@fastly/compute-js-static-publish 2.0.0-alpha.2 → 2.1.0

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 CHANGED
@@ -85,12 +85,28 @@ These arguments are used to populate the `fastly.toml` and `package.json` files
85
85
  | `cra-eject` | `./build` | `./build/static` | For apps written using Create React App, but which have since been ejected via `npm run eject`. Does not check for `react-scripts`. |
86
86
  | `vite` | `./dist` | (None) | For apps written using [Vite](https://vitejs.dev). |
87
87
  | `sveltekit` | `./dist` | (None) | For apps written using [SvelteKit](https://kit.svelte.dev). |
88
- | `next` | `./out` | (None) | For apps written using [Next.js](https://nextjs.org), using `npm run export`. |
88
+ | `next` | `./out` | (None) | For apps written using [Next.js](https://nextjs.org), using `npm run export`. *1 |
89
89
  | `gatsby` | `./public` | (None) | For apps written using [Gatsby](https://www.gatsbyjs.com). |
90
90
  | `docusaurus` | `./build` | (None) | For apps written using [Docusaurus](https://docusaurus.io) |
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 Node.js server implementation that allows you to run
95
+ your Next.js application on Compute@Edge.
96
+
97
+ ## Troubleshooting
98
+
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
101
+ `fastly.toml` file that is in your `compute-js` directory.
102
+
103
+ ```toml
104
+ [scripts]
105
+ build = "npx @fastly/compute-js-static-publish --build-static && $(npm bin)/webpack && $(npm bin)/js-compute-runtime ./bin/index.js ./bin/main.wasm"
106
+ ```
107
+
108
+ If Fastly CLI has already added `build = "$(npm bin)/webpack && $(npm bin)/js-compute-runtime ./bin/index.js ./bin/main.wasm"`, then replace it with the above.
109
+
94
110
  ## Issues
95
111
 
96
112
  If you encounter any non-security-related bug or unexpected behavior, please [file an issue][bug].
package/build/init-app.js CHANGED
@@ -173,22 +173,20 @@ export function initApp(commandLineValues) {
173
173
  "author": ${JSON.stringify(author)},
174
174
  "devDependencies": {
175
175
  "@fastly/expressly": "^1.0.0-alpha.7",
176
- "@fastly/js-compute": "^0.3.0",
176
+ "@fastly/js-compute": "^0.5.3",
177
177
  "buffer": "^6.0.3",
178
178
  "core-js": "^3.19.1",
179
179
  "webpack": "^5.64.0",
180
180
  "webpack-cli": "^4.9.1"
181
181
  },
182
182
  "engines": {
183
- "node": "^16"
183
+ "node": ">=16.0.0"
184
184
  },
185
185
  "license": "MIT",
186
186
  "private": true,
187
187
  "main": "src/index.js",
188
188
  "scripts": {
189
- "build": "js-compute-runtime bin/index.js bin/main.wasm",
190
- "deploy": "npm run build && fastly compute deploy",
191
- "prebuild": "npx @fastly/compute-js-static-publish --build-static && webpack"
189
+ "deploy": "fastly compute deploy"
192
190
  },
193
191
  "version": "0.2.1"
194
192
  }
@@ -207,6 +205,9 @@ language = "javascript"
207
205
  manifest_version = 2
208
206
  name = "${name}"
209
207
  service_id = "${fastlyServiceId}"
208
+
209
+ [scripts]
210
+ build = "npx @fastly/compute-js-static-publish --build-static && $(npm bin)/webpack && $(npm bin)/js-compute-runtime ./bin/index.js ./bin/main.wasm"
210
211
  `;
211
212
  const fastlyTomlPath = path.resolve(computeJsDir, 'fastly.toml');
212
213
  fs.writeFileSync(fastlyTomlPath, fastlyTomlContent, "utf-8");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fastly/compute-js-static-publish",
3
3
  "type": "module",
4
- "version": "2.0.0-alpha.2",
4
+ "version": "2.1.0",
5
5
  "description": "Static Publisher for Compute@Edge JavaScript",
6
6
  "main": "./build/index.js",
7
7
  "scripts": {
package/src/init-app.ts CHANGED
@@ -209,22 +209,20 @@ export function initApp(commandLineValues: CommandLineOptions) {
209
209
  "author": ${JSON.stringify(author)},
210
210
  "devDependencies": {
211
211
  "@fastly/expressly": "^1.0.0-alpha.7",
212
- "@fastly/js-compute": "^0.3.0",
212
+ "@fastly/js-compute": "^0.5.3",
213
213
  "buffer": "^6.0.3",
214
214
  "core-js": "^3.19.1",
215
215
  "webpack": "^5.64.0",
216
216
  "webpack-cli": "^4.9.1"
217
217
  },
218
218
  "engines": {
219
- "node": "^16"
219
+ "node": ">=16.0.0"
220
220
  },
221
221
  "license": "MIT",
222
222
  "private": true,
223
223
  "main": "src/index.js",
224
224
  "scripts": {
225
- "build": "js-compute-runtime bin/index.js bin/main.wasm",
226
- "deploy": "npm run build && fastly compute deploy",
227
- "prebuild": "npx @fastly/compute-js-static-publish --build-static && webpack"
225
+ "deploy": "fastly compute deploy"
228
226
  },
229
227
  "version": "0.2.1"
230
228
  }
@@ -246,6 +244,9 @@ language = "javascript"
246
244
  manifest_version = 2
247
245
  name = "${name}"
248
246
  service_id = "${fastlyServiceId}"
247
+
248
+ [scripts]
249
+ build = "npx @fastly/compute-js-static-publish --build-static && $(npm bin)/webpack && $(npm bin)/js-compute-runtime ./bin/index.js ./bin/main.wasm"
249
250
  `;
250
251
 
251
252
  const fastlyTomlPath = path.resolve(computeJsDir, 'fastly.toml');