@fastly/compute-js-static-publish 2.2.1 → 2.2.2
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/README.md +5 -5
- package/build/init-app.js +8 -8
- package/package.json +1 -1
- package/src/init-app.ts +8 -8
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Assuming the root of your output directory is `./public`,
|
|
|
11
11
|
### 1. Run `compute-js-static-publish`
|
|
12
12
|
|
|
13
13
|
```shell
|
|
14
|
-
npx @fastly/compute-js-static-publish --public-dir=./public
|
|
14
|
+
npx @fastly/compute-js-static-publish@latest --public-dir=./public
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
>This will generate a Compute@Edge application at `./compute-js`. It will add a default `./src/index.js` file that serves the static files from your project.
|
|
@@ -91,21 +91,21 @@ These arguments are used to populate the `fastly.toml` and `package.json` files
|
|
|
91
91
|
|
|
92
92
|
You may still override any of these options individually.
|
|
93
93
|
|
|
94
|
-
*1 - For Next.js, consider using `@fastly/next-compute-js`, a
|
|
94
|
+
*1 - For Next.js, consider using `@fastly/next-compute-js`, a Next.js server implementation that allows you to run
|
|
95
95
|
your Next.js application on Compute@Edge.
|
|
96
96
|
|
|
97
97
|
## Troubleshooting
|
|
98
98
|
|
|
99
99
|
If you're using Fastly CLI 4.0.0 or newer, and your project was scaffolded using a version
|
|
100
|
-
of this tool older than 2.1.0, then you'll need to add the following to the
|
|
100
|
+
of this tool older than 2.1.0, then you'll need to either re-scaffold your project, or add the following to the
|
|
101
101
|
`fastly.toml` file that is in your `compute-js` directory.
|
|
102
102
|
|
|
103
103
|
```toml
|
|
104
104
|
[scripts]
|
|
105
|
-
build = "npx @fastly/compute-js-static-publish --build-static &&
|
|
105
|
+
build = "npx @fastly/compute-js-static-publish --build-static && npx webpack && npx js-compute-runtime ./bin/index.js ./bin/main.wasm"
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
If Fastly CLI has already added `build = "
|
|
108
|
+
If Fastly CLI has already added `build = "npx webpack && npx js-compute-runtime ./bin/index.js ./bin/main.wasm"`, then replace it with the above.
|
|
109
109
|
|
|
110
110
|
## Issues
|
|
111
111
|
|
package/build/init-app.js
CHANGED
|
@@ -143,14 +143,14 @@ export function initApp(commandLineValues) {
|
|
|
143
143
|
console.log('');
|
|
144
144
|
console.log('Public Dir :', PUBLIC_DIR);
|
|
145
145
|
console.log('Static Dir :', BUILD_STATIC_DIR !== null && BUILD_STATIC_DIR !== void 0 ? BUILD_STATIC_DIR : '(None)');
|
|
146
|
-
console.log('SPA :', spaRel
|
|
147
|
-
console.log('404 Page :', notFoundRel
|
|
148
|
-
console.log('Auto-Index :', autoIndex
|
|
149
|
-
console.log('Auto-Ext :', autoExt
|
|
146
|
+
console.log('SPA :', spaRel !== null && spaRel !== void 0 ? spaRel : '(None)');
|
|
147
|
+
console.log('404 Page :', notFoundRel !== null && notFoundRel !== void 0 ? notFoundRel : '(None)');
|
|
148
|
+
console.log('Auto-Index :', autoIndex !== null && autoIndex !== void 0 ? autoIndex : '(None)');
|
|
149
|
+
console.log('Auto-Ext :', autoExt !== null && autoExt !== void 0 ? autoExt : '(None)');
|
|
150
150
|
console.log('name :', name);
|
|
151
151
|
console.log('author :', author);
|
|
152
152
|
console.log('description :', description);
|
|
153
|
-
console.log('Service ID :', fastlyServiceId);
|
|
153
|
+
console.log('Service ID :', fastlyServiceId !== null && fastlyServiceId !== void 0 ? fastlyServiceId : '(None)');
|
|
154
154
|
console.log('');
|
|
155
155
|
console.log("Initializing Compute@Edge Application in " + computeJsDir + "...");
|
|
156
156
|
fs.mkdirSync(computeJsDir);
|
|
@@ -204,10 +204,10 @@ description = "${description}"
|
|
|
204
204
|
language = "javascript"
|
|
205
205
|
manifest_version = 2
|
|
206
206
|
name = "${name}"
|
|
207
|
-
service_id = "${fastlyServiceId}"
|
|
208
|
-
|
|
207
|
+
${fastlyServiceId != null ? `service_id = "${fastlyServiceId}"
|
|
208
|
+
` : ''}
|
|
209
209
|
[scripts]
|
|
210
|
-
build = "npx @fastly/compute-js-static-publish --build-static &&
|
|
210
|
+
build = "npx @fastly/compute-js-static-publish --build-static && npx webpack && npx js-compute-runtime ./bin/index.js ./bin/main.wasm"
|
|
211
211
|
`;
|
|
212
212
|
const fastlyTomlPath = path.resolve(computeJsDir, 'fastly.toml');
|
|
213
213
|
fs.writeFileSync(fastlyTomlPath, fastlyTomlContent, "utf-8");
|
package/package.json
CHANGED
package/src/init-app.ts
CHANGED
|
@@ -175,14 +175,14 @@ export function initApp(commandLineValues: CommandLineOptions) {
|
|
|
175
175
|
console.log('');
|
|
176
176
|
console.log('Public Dir :', PUBLIC_DIR);
|
|
177
177
|
console.log('Static Dir :', BUILD_STATIC_DIR ?? '(None)');
|
|
178
|
-
console.log('SPA :', spaRel
|
|
179
|
-
console.log('404 Page :', notFoundRel
|
|
180
|
-
console.log('Auto-Index :', autoIndex
|
|
181
|
-
console.log('Auto-Ext :', autoExt
|
|
178
|
+
console.log('SPA :', spaRel ?? '(None)');
|
|
179
|
+
console.log('404 Page :', notFoundRel ?? '(None)');
|
|
180
|
+
console.log('Auto-Index :', autoIndex ?? '(None)')
|
|
181
|
+
console.log('Auto-Ext :', autoExt ?? '(None)')
|
|
182
182
|
console.log('name :', name);
|
|
183
183
|
console.log('author :', author);
|
|
184
184
|
console.log('description :', description);
|
|
185
|
-
console.log('Service ID :', fastlyServiceId);
|
|
185
|
+
console.log('Service ID :', fastlyServiceId ?? '(None)');
|
|
186
186
|
console.log('');
|
|
187
187
|
|
|
188
188
|
console.log("Initializing Compute@Edge Application in " + computeJsDir + "...");
|
|
@@ -243,10 +243,10 @@ description = "${description}"
|
|
|
243
243
|
language = "javascript"
|
|
244
244
|
manifest_version = 2
|
|
245
245
|
name = "${name}"
|
|
246
|
-
service_id = "${fastlyServiceId}"
|
|
247
|
-
|
|
246
|
+
${fastlyServiceId != null ? `service_id = "${fastlyServiceId}"
|
|
247
|
+
` : ''}
|
|
248
248
|
[scripts]
|
|
249
|
-
build = "npx @fastly/compute-js-static-publish --build-static &&
|
|
249
|
+
build = "npx @fastly/compute-js-static-publish --build-static && npx webpack && npx js-compute-runtime ./bin/index.js ./bin/main.wasm"
|
|
250
250
|
`;
|
|
251
251
|
|
|
252
252
|
const fastlyTomlPath = path.resolve(computeJsDir, 'fastly.toml');
|