@fastly/compute-js-static-publish 8.0.0-beta.20 → 8.0.0-beta.21
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.
|
@@ -50,8 +50,8 @@ Optional:
|
|
|
50
50
|
|
|
51
51
|
--fastly-service-id=<id> Fastly Service ID to purge after publishing (not with --local).
|
|
52
52
|
If not set, the tool will check:
|
|
53
|
-
1.
|
|
54
|
-
2.
|
|
53
|
+
1. FASTLY_SERVICE_ID environment variable
|
|
54
|
+
2. service_id in fastly.toml
|
|
55
55
|
If none is found, the purge is skipped.
|
|
56
56
|
|
|
57
57
|
--purge-environment=<env> Environment to purge: production, staging, or a
|
|
@@ -43,7 +43,7 @@ export function loadPurgeTarget(params) {
|
|
|
43
43
|
fastlyTomlPath: path.resolve(params.computeAppDir, 'fastly.toml'),
|
|
44
44
|
});
|
|
45
45
|
if (serviceIdResult == null) {
|
|
46
|
-
console.log(`- Service ID not found (--fastly-service-id,
|
|
46
|
+
console.log(`- Service ID not found (--fastly-service-id, FASTLY_SERVICE_ID, or fastly.toml). Will skip purge step after publish.`);
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
49
|
console.log(`✔️ Service ID from ${serviceIdResult.source}: ${serviceIdResult.serviceId}`);
|
|
@@ -1 +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;
|
|
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;AAOF,wBAAgB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,IAAI,CAmBrF"}
|
|
@@ -6,21 +6,22 @@ import fs from 'node:fs';
|
|
|
6
6
|
import { readServiceId } from './fastly-toml.js';
|
|
7
7
|
// Finds the Fastly Service ID to purge after publishing. Checks, in order:
|
|
8
8
|
// 1. The command line (--fastly-service-id)
|
|
9
|
-
// 2.
|
|
10
|
-
// 3.
|
|
9
|
+
// 2. The FASTLY_SERVICE_ID environment variable
|
|
10
|
+
// 3. service_id in fastly.toml
|
|
11
|
+
// This is the same order as the Fastly CLI's --service-id.
|
|
11
12
|
export function loadServiceId(params) {
|
|
12
13
|
if (typeof params.commandLine === 'string' && params.commandLine.trim() !== '') {
|
|
13
14
|
return { serviceId: params.commandLine.trim(), source: 'commandline' };
|
|
14
15
|
}
|
|
16
|
+
const envServiceId = process.env.FASTLY_SERVICE_ID?.trim();
|
|
17
|
+
if (envServiceId) {
|
|
18
|
+
return { serviceId: envServiceId, source: 'env' };
|
|
19
|
+
}
|
|
15
20
|
if (fs.existsSync(params.fastlyTomlPath)) {
|
|
16
21
|
const serviceId = readServiceId(params.fastlyTomlPath);
|
|
17
22
|
if (serviceId != null) {
|
|
18
23
|
return { serviceId, source: 'fastly.toml' };
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
|
-
const envServiceId = process.env.FASTLY_SERVICE_ID?.trim();
|
|
22
|
-
if (envServiceId) {
|
|
23
|
-
return { serviceId: envServiceId, source: 'env' };
|
|
24
|
-
}
|
|
25
26
|
return null;
|
|
26
27
|
}
|
package/package.json
CHANGED