@fastly/compute-js-static-publish 8.0.0-beta.14 → 8.0.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli/cli/commands/manage/clean.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/clean.js +2 -3
- package/build/cli/cli/commands/manage/collections/delete.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/delete.js +2 -3
- package/build/cli/cli/commands/manage/collections/index.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/index.js +2 -3
- package/build/cli/cli/commands/manage/collections/list.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/list.js +2 -3
- package/build/cli/cli/commands/manage/collections/promote.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/promote.js +2 -3
- package/build/cli/cli/commands/manage/collections/update-expiration.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/update-expiration.js +2 -3
- package/build/cli/cli/commands/manage/index.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/index.js +2 -3
- package/build/cli/cli/commands/manage/publish-content.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/publish-content.js +10 -3
- package/build/cli/cli/storage/s3-storage-provider.d.ts.map +1 -1
- package/build/cli/cli/storage/s3-storage-provider.js +9 -6
- package/build/cli/cli/storage/storage-provider.d.ts +1 -0
- package/build/cli/cli/storage/storage-provider.d.ts.map +1 -1
- package/build/cli/cli/util/api-token.d.ts.map +1 -1
- package/build/cli/cli/util/api-token.js +0 -28
- package/build/cli/cli/util/service-id.d.ts +10 -0
- package/build/cli/cli/util/service-id.d.ts.map +1 -0
- package/build/cli/cli/util/service-id.js +26 -0
- package/package.json +1 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/clean.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/clean.ts"],"names":[],"mappings":"AAmDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA0NhD"}
|
|
@@ -29,9 +29,8 @@ KV Store Options:
|
|
|
29
29
|
with the local development environment.
|
|
30
30
|
|
|
31
31
|
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
32
|
-
If not set, the tool
|
|
33
|
-
|
|
34
|
-
2. The default profile in the Fastly CLI
|
|
32
|
+
If not set, the tool uses the FASTLY_API_TOKEN
|
|
33
|
+
environment variable.
|
|
35
34
|
|
|
36
35
|
S3 Storage Options (BETA):
|
|
37
36
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/delete.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/delete.ts"],"names":[],"mappings":"AAiDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAuIhD"}
|
|
@@ -28,9 +28,8 @@ KV Store Options:
|
|
|
28
28
|
with the local development environment.
|
|
29
29
|
|
|
30
30
|
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
31
|
-
If not set, the tool
|
|
32
|
-
|
|
33
|
-
2. The default profile in the Fastly CLI
|
|
31
|
+
If not set, the tool uses the FASTLY_API_TOKEN
|
|
32
|
+
environment variable.
|
|
34
33
|
|
|
35
34
|
S3 Storage Options (BETA):
|
|
36
35
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/index.ts"],"names":[],"mappings":"AAmDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA0BhD"}
|
|
@@ -29,9 +29,8 @@ KV Store Options:
|
|
|
29
29
|
with the local development environment.
|
|
30
30
|
|
|
31
31
|
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
32
|
-
If not set, the tool
|
|
33
|
-
|
|
34
|
-
2. The default profile in the Fastly CLI
|
|
32
|
+
If not set, the tool uses the FASTLY_API_TOKEN
|
|
33
|
+
environment variable.
|
|
35
34
|
|
|
36
35
|
S3 Storage Options (BETA):
|
|
37
36
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/list.ts"],"names":[],"mappings":"AA4CA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAmIhD"}
|
|
@@ -23,9 +23,8 @@ KV Store Options:
|
|
|
23
23
|
with the local development environment.
|
|
24
24
|
|
|
25
25
|
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
26
|
-
If not set, the tool
|
|
27
|
-
|
|
28
|
-
2. The default profile in the Fastly CLI
|
|
26
|
+
If not set, the tool uses the FASTLY_API_TOKEN
|
|
27
|
+
environment variable.
|
|
29
28
|
|
|
30
29
|
S3 Storage Options (BETA):
|
|
31
30
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promote.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/promote.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"promote.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/promote.ts"],"names":[],"mappings":"AAkEA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAuLhD"}
|
|
@@ -45,9 +45,8 @@ KV Store Options:
|
|
|
45
45
|
with the local development environment.
|
|
46
46
|
|
|
47
47
|
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
48
|
-
If not set, the tool
|
|
49
|
-
|
|
50
|
-
2. The default profile in the Fastly CLI
|
|
48
|
+
If not set, the tool uses the FASTLY_API_TOKEN
|
|
49
|
+
environment variable.
|
|
51
50
|
|
|
52
51
|
S3 Storage Options (BETA):
|
|
53
52
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-expiration.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/update-expiration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-expiration.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/update-expiration.ts"],"names":[],"mappings":"AA8DA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA0JhD"}
|
|
@@ -41,9 +41,8 @@ KV Store Options:
|
|
|
41
41
|
with the local development environment.
|
|
42
42
|
|
|
43
43
|
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
44
|
-
If not set, the tool
|
|
45
|
-
|
|
46
|
-
2. The default profile in the Fastly CLI
|
|
44
|
+
If not set, the tool uses the FASTLY_API_TOKEN
|
|
45
|
+
environment variable.
|
|
47
46
|
|
|
48
47
|
S3 Storage Options (BETA):
|
|
49
48
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/index.ts"],"names":[],"mappings":"AA0DA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAyBhD"}
|
|
@@ -31,9 +31,8 @@ KV Store Options:
|
|
|
31
31
|
with the local development environment.
|
|
32
32
|
|
|
33
33
|
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
34
|
-
If not set, the tool
|
|
35
|
-
|
|
36
|
-
2. The default profile in the Fastly CLI
|
|
34
|
+
If not set, the tool uses the FASTLY_API_TOKEN
|
|
35
|
+
environment variable.
|
|
37
36
|
|
|
38
37
|
S3 Storage Options (BETA):
|
|
39
38
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"AAoHA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAoiBhD"}
|
|
@@ -44,9 +44,14 @@ Optional:
|
|
|
44
44
|
Default: rootDir from publish-content.config.js
|
|
45
45
|
|
|
46
46
|
--fastly-api-token=<token> Fastly API token for KV Store or cache access.
|
|
47
|
+
If not set, the tool uses the FASTLY_API_TOKEN
|
|
48
|
+
environment variable.
|
|
49
|
+
|
|
50
|
+
--fastly-service-id=<id> Fastly Service ID to purge after publishing (S3 storage).
|
|
47
51
|
If not set, the tool will check:
|
|
48
|
-
1.
|
|
49
|
-
2.
|
|
52
|
+
1. service_id in fastly.toml
|
|
53
|
+
2. FASTLY_SERVICE_ID environment variable
|
|
54
|
+
If none is found, the purge is skipped.
|
|
50
55
|
|
|
51
56
|
--overwrite-existing Always overwrite existing entries in storage, even if unchanged.
|
|
52
57
|
|
|
@@ -105,6 +110,7 @@ export async function action(actionArgs) {
|
|
|
105
110
|
{ name: 'expires-never', type: Boolean },
|
|
106
111
|
{ name: 'local', type: Boolean },
|
|
107
112
|
{ name: 'fastly-api-token', type: String, },
|
|
113
|
+
{ name: 'fastly-service-id', type: String, },
|
|
108
114
|
{ name: 'kv-overwrite', type: Boolean },
|
|
109
115
|
{ name: 's3-access-key-id', type: String, },
|
|
110
116
|
{ name: 's3-secret-access-key', type: String, },
|
|
@@ -120,7 +126,7 @@ export async function action(actionArgs) {
|
|
|
120
126
|
help();
|
|
121
127
|
return;
|
|
122
128
|
}
|
|
123
|
-
const { verbose, config: configFilePathValue, ['collection-name']: collectionNameValue, ['root-dir']: rootDir, ['overwrite-existing']: _overwriteExisting, ['brotli-quality']: brotliQualityValue, ['expires-in']: expiresIn, ['expires-at']: expiresAt, ['expires-never']: expiresNever, local: localMode, ['fastly-api-token']: fastlyApiToken, ['kv-overwrite']: _kvOverwrite, ['s3-access-key-id']: s3AccessKeyId, ['s3-secret-access-key']: s3SecretAccessKey, ['s3-upload-concurrency']: s3UploadConcurrencyValue, } = parsed.commandLineOptions;
|
|
129
|
+
const { verbose, config: configFilePathValue, ['collection-name']: collectionNameValue, ['root-dir']: rootDir, ['overwrite-existing']: _overwriteExisting, ['brotli-quality']: brotliQualityValue, ['expires-in']: expiresIn, ['expires-at']: expiresAt, ['expires-never']: expiresNever, local: localMode, ['fastly-api-token']: fastlyApiToken, ['fastly-service-id']: fastlyServiceId, ['kv-overwrite']: _kvOverwrite, ['s3-access-key-id']: s3AccessKeyId, ['s3-secret-access-key']: s3SecretAccessKey, ['s3-upload-concurrency']: s3UploadConcurrencyValue, } = parsed.commandLineOptions;
|
|
124
130
|
let s3UploadConcurrency;
|
|
125
131
|
if (s3UploadConcurrencyValue !== undefined) {
|
|
126
132
|
if (typeof s3UploadConcurrencyValue !== 'string' || !/^\d+$/.test(s3UploadConcurrencyValue) ||
|
|
@@ -213,6 +219,7 @@ export async function action(actionArgs) {
|
|
|
213
219
|
computeAppDir,
|
|
214
220
|
localMode,
|
|
215
221
|
fastlyApiToken,
|
|
222
|
+
fastlyServiceId,
|
|
216
223
|
s3AccessKeyId,
|
|
217
224
|
s3SecretAccessKey,
|
|
218
225
|
s3UploadConcurrency,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/s3-storage-provider.ts"],"names":[],"mappings":"AASA,OAAO,EAUL,QAAQ,EAIT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AASxB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAE3B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAuB/B,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAKnF,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"s3-storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/s3-storage-provider.ts"],"names":[],"mappings":"AASA,OAAO,EAUL,QAAQ,EAIT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AASxB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAE3B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAuB/B,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAKnF,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD,eAAO,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,EACX,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC;IAaV,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW9C,UAAU,CAAC,KAAK,EAAE,oBAAoB,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IA+BvF,oBAAoB,CAAC,OAAO,SAAS;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,EACxD,OAAO,EAAE,OAAO,EAAE,EAClB,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EAC/D,aAAa,GAAE,MAAW,EAC1B,YAAY,GAAE,OAAe,GAC5B,OAAO,CAAC,IAAI,CAAC;IAmBhB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAInC,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CA4B7D"}
|
|
@@ -14,7 +14,7 @@ import { loadS3Credentials, } from '../util/s3-credentials.js';
|
|
|
14
14
|
import { concurrentParallel, makeRetryable, } from '../util/retryable.js';
|
|
15
15
|
import { rootRelative, } from '../util/files.js';
|
|
16
16
|
import { loadApiToken, } from '../util/api-token.js';
|
|
17
|
-
import {
|
|
17
|
+
import { loadServiceId, } from '../util/service-id.js';
|
|
18
18
|
import { purgeSurrogateKey, } from '../util/purge.js';
|
|
19
19
|
// The number of objects to upload at the same time. S3 accepts many parallel
|
|
20
20
|
// requests, and each request mostly waits for the network. In a test with small
|
|
@@ -40,14 +40,17 @@ export const buildStoreProvider = async (config, context) => {
|
|
|
40
40
|
throw new Error("❌ S3 Credentials not provided.\nProvide an access key ID and secret access key that have write access to the S3 or compatible storage.\nRefer to the README file and --help for additional information.");
|
|
41
41
|
}
|
|
42
42
|
console.log(`✔️ S3 Credentials: ${s3CredentialsResult.s3AccessKeyId.slice(0, 4)}${'*'.repeat(s3CredentialsResult.s3AccessKeyId.length - 4)} from '${s3CredentialsResult.source}'`);
|
|
43
|
-
const
|
|
44
|
-
|
|
43
|
+
const serviceIdResult = loadServiceId({
|
|
44
|
+
commandLine: context.fastlyServiceId,
|
|
45
|
+
fastlyTomlPath: path.resolve(context.computeAppDir, 'fastly.toml'),
|
|
46
|
+
});
|
|
47
|
+
const serviceId = serviceIdResult?.serviceId;
|
|
45
48
|
let apiToken = undefined;
|
|
46
|
-
if (
|
|
47
|
-
console.log(`- Service ID not found
|
|
49
|
+
if (serviceIdResult == null) {
|
|
50
|
+
console.log(`- Service ID not found (--fastly-service-id, fastly.toml, or FASTLY_SERVICE_ID). Will skip purge step after publish.`);
|
|
48
51
|
}
|
|
49
52
|
else {
|
|
50
|
-
console.log(`✔️ Service ID from
|
|
53
|
+
console.log(`✔️ Service ID from ${serviceIdResult.source}: ${serviceIdResult.serviceId}`);
|
|
51
54
|
const apiTokenResult = loadApiToken({ commandLine: context.fastlyApiToken });
|
|
52
55
|
if (apiTokenResult == null) {
|
|
53
56
|
throw new Error("❌ Fastly API Token not provided.\nSet the FASTLY_API_TOKEN environment variable to an API token that has write access to the KV Store.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/storage-provider.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,eAAe,EACrB,MAAM,0CAA0C,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,gBAAgB,CAA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AAE,CAAC;IACzD,GAAG,CAAC,KAAK,EAAE,yBAAyB;CAGrC;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AACF,MAAM,MAAM,sBAAsB,GAChC,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,6BAA6B,KAAK,CAAC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,GAAG,eAAe,GAAG,IAAI,CAAC,CAAC;AAQlI,wBAAsB,yBAAyB,CAAC,eAAe,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAQ1H;AAGD,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,sBAAsB,QAE7E;AAED,wBAAsB,sCAAsC,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,6BAA6B,4BAS3H"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-token.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/api-token.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-token.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/api-token.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,GAAG,CAAC;CAClB,CAAC;AAEF,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,kBAAkB,GAAG,IAAI,CAyB7E;AAaD,qBAAa,UAAW,SAAQ,KAAK;gBACvB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAK3C,MAAM,EAAE,MAAM,CAAC;CAChB;AAWD,wBAAsB,aAAa,CACjC,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,eAAe,GAAG,IAAI,EACpC,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,QAAQ,CAAC,CAqCnB"}
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* Copyright Fastly, Inc.
|
|
3
3
|
* Licensed under the MIT license. See LICENSE file for details.
|
|
4
4
|
*/
|
|
5
|
-
import { spawnSync } from 'node:child_process';
|
|
6
|
-
import cli from '@fastly/cli';
|
|
7
5
|
import { makeRetryable } from './retryable.js';
|
|
8
6
|
export function loadApiToken(params) {
|
|
9
7
|
let apiToken = null;
|
|
@@ -20,32 +18,6 @@ export function loadApiToken(params) {
|
|
|
20
18
|
source = 'env';
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
|
-
// Try fastly cli
|
|
24
|
-
if (apiToken == null) {
|
|
25
|
-
try {
|
|
26
|
-
const { stdout, error, status } = spawnSync(cli, ['profile', 'token', '--quiet'], {
|
|
27
|
-
encoding: 'utf-8',
|
|
28
|
-
});
|
|
29
|
-
if (status != null && status !== 0) {
|
|
30
|
-
console.warn(`⚠️ Warning: 'fastly profile token' returned a non-zero status code.`);
|
|
31
|
-
apiToken = null;
|
|
32
|
-
}
|
|
33
|
-
else if (error) {
|
|
34
|
-
console.warn(`⚠️ Warning: 'fastly profile token' returned an error:`);
|
|
35
|
-
console.warn(String(error));
|
|
36
|
-
apiToken = null;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
apiToken = stdout.trim();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
catch {
|
|
43
|
-
apiToken = null;
|
|
44
|
-
}
|
|
45
|
-
if (apiToken != null) {
|
|
46
|
-
source = 'fastly-profile-token';
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
21
|
if (apiToken == null) {
|
|
50
22
|
return null;
|
|
51
23
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type LoadServiceIdResult = {
|
|
2
|
+
serviceId: string;
|
|
3
|
+
source: string;
|
|
4
|
+
};
|
|
5
|
+
export type LoadServiceIdParams = {
|
|
6
|
+
commandLine: unknown;
|
|
7
|
+
fastlyTomlPath: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function loadServiceId(params: LoadServiceIdParams): LoadServiceIdResult | null;
|
|
10
|
+
//# sourceMappingURL=service-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-id.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/service-id.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAMF,wBAAgB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,IAAI,CAmBrF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Fastly, Inc.
|
|
3
|
+
* Licensed under the MIT license. See LICENSE file for details.
|
|
4
|
+
*/
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import { readServiceId } from './fastly-toml.js';
|
|
7
|
+
// Finds the Fastly Service ID to purge after publishing. Checks, in order:
|
|
8
|
+
// 1. The command line (--fastly-service-id)
|
|
9
|
+
// 2. service_id in fastly.toml
|
|
10
|
+
// 3. The FASTLY_SERVICE_ID environment variable
|
|
11
|
+
export function loadServiceId(params) {
|
|
12
|
+
if (typeof params.commandLine === 'string' && params.commandLine.trim() !== '') {
|
|
13
|
+
return { serviceId: params.commandLine.trim(), source: 'commandline' };
|
|
14
|
+
}
|
|
15
|
+
if (fs.existsSync(params.fastlyTomlPath)) {
|
|
16
|
+
const serviceId = readServiceId(params.fastlyTomlPath);
|
|
17
|
+
if (serviceId != null) {
|
|
18
|
+
return { serviceId, source: 'fastly.toml' };
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const envServiceId = process.env.FASTLY_SERVICE_ID?.trim();
|
|
22
|
+
if (envServiceId) {
|
|
23
|
+
return { serviceId: envServiceId, source: 'env' };
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastly/compute-js-static-publish",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.0.0-beta.
|
|
4
|
+
"version": "8.0.0-beta.15",
|
|
5
5
|
"description": "Static Publisher for Fastly Compute JavaScript",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"homepage": "https://github.com/fastly/compute-js-static-publish#readme",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@aws-sdk/client-s3": "3.888.0",
|
|
44
|
-
"@fastly/cli": "^16.0.0",
|
|
45
44
|
"command-line-args": "^5.2.1",
|
|
46
45
|
"glob-to-regexp": "^0.4.1",
|
|
47
46
|
"toml": "^3.0.0"
|