@fastly/compute-js-static-publish 8.1.0-beta.1 → 8.1.0-beta.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/DOCUMENTATION.md +26 -26
- package/README.md +11 -1
- package/README.short.md +11 -1
- package/build/cli/cli/commands/manage/clean.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/clean.js +2 -1
- package/build/cli/cli/commands/manage/collections/delete.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/delete.js +3 -2
- package/build/cli/cli/commands/manage/collections/index.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/index.js +4 -3
- package/build/cli/cli/commands/manage/collections/list.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/list.js +2 -1
- package/build/cli/cli/commands/manage/collections/promote.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/promote.js +2 -1
- 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 -1
- package/build/cli/cli/commands/manage/deploy.js +2 -2
- package/build/cli/cli/commands/manage/dev.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/dev.js +2 -1
- package/build/cli/cli/commands/manage/eject.js +2 -2
- package/build/cli/cli/commands/manage/index.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/index.js +6 -5
- package/build/cli/cli/commands/manage/publish-content.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/publish-content.js +5 -4
- package/build/cli/cli/commands/manage/status.js +2 -2
- package/build/cli/cli/commands/manage/template/index.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/template/index.js +2 -1
- package/build/cli/cli/commands/manage/template/init.js +3 -3
- package/build/cli/cli/commands/manage/upgrade.js +2 -2
- package/build/cli/cli/commands/scaffold/index.js +3 -3
- package/build/cli/cli/hono/build.d.ts.map +1 -1
- package/build/cli/cli/hono/build.js +2 -1
- package/build/cli/cli/managed/command-helpers.js +2 -2
- package/build/cli/cli/util/package.d.ts +3 -0
- package/build/cli/cli/util/package.d.ts.map +1 -1
- package/build/cli/cli/util/package.js +11 -0
- package/package.json +1 -1
package/DOCUMENTATION.md
CHANGED
|
@@ -257,8 +257,8 @@ Paths in the project file are relative to it. The name of the file marks the mod
|
|
|
257
257
|
To run the app on your computer:
|
|
258
258
|
|
|
259
259
|
```sh
|
|
260
|
-
npx @fastly/compute-js-static-publish publish-content --local
|
|
261
|
-
npx @fastly/compute-js-static-publish dev
|
|
260
|
+
npx @fastly/compute-js-static-publish@beta publish-content --local
|
|
261
|
+
npx @fastly/compute-js-static-publish@beta dev
|
|
262
262
|
```
|
|
263
263
|
|
|
264
264
|
`dev` generates the app in `.static-publish/app/`, installs its dependencies with `npm ci` if they changed, and runs `fastly compute serve` in it. Options after `--` go to `fastly compute serve`, for example `dev -- --addr=127.0.0.1:8080`. With `dev -- --watch`, a change in the app builds and restarts it, and the watch script of the template (`scripts/template_watch.js`, see [Template hooks](#-template-hooks)), if it has one, runs next to `fastly compute serve`. The app serves the content of the local KV Store, `kvstore.json` in the working directory.
|
|
@@ -297,7 +297,7 @@ npm install --save-dev @fastly/compute-js-static-publish
|
|
|
297
297
|
To deploy the app:
|
|
298
298
|
|
|
299
299
|
```sh
|
|
300
|
-
npx @fastly/compute-js-static-publish deploy
|
|
300
|
+
npx @fastly/compute-js-static-publish@beta deploy
|
|
301
301
|
```
|
|
302
302
|
|
|
303
303
|
`deploy` generates the app, installs it if necessary, and runs `fastly compute build` and `fastly compute deploy`, only if the app changed. It needs a Fastly API token (`FASTLY_API_TOKEN` or `--fastly-api-token`).
|
|
@@ -550,7 +550,7 @@ Collections are a powerful feature that allow you to publish and manage multiple
|
|
|
550
550
|
Collections are published using a `--collection-name`, and can be reused, updated, or deleted independently. For example, you can create a staging version of your site using:
|
|
551
551
|
|
|
552
552
|
```sh
|
|
553
|
-
npx @fastly/compute-js-static-publish publish-content \
|
|
553
|
+
npx @fastly/compute-js-static-publish@beta publish-content \
|
|
554
554
|
--collection-name=staging \
|
|
555
555
|
--expires-in=7d \
|
|
556
556
|
--config=./publish-content.config.js
|
|
@@ -733,7 +733,7 @@ jobs:
|
|
|
733
733
|
with:
|
|
734
734
|
node-version: 24
|
|
735
735
|
- run: npm ci
|
|
736
|
-
- run: npx @fastly/compute-js-static-publish publish-content --collection-name=pr-${{ github.event.number }} --expires-in=7d
|
|
736
|
+
- run: npx @fastly/compute-js-static-publish@beta publish-content --collection-name=pr-${{ github.event.number }} --expires-in=7d
|
|
737
737
|
|
|
738
738
|
remove:
|
|
739
739
|
if: github.event.action == 'closed'
|
|
@@ -750,8 +750,8 @@ jobs:
|
|
|
750
750
|
with:
|
|
751
751
|
node-version: 24
|
|
752
752
|
- run: npm ci
|
|
753
|
-
- run: npx @fastly/compute-js-static-publish collections delete --collection-name=pr-${{ github.event.number }}
|
|
754
|
-
- run: npx @fastly/compute-js-static-publish clean --delete-expired-collections
|
|
753
|
+
- run: npx @fastly/compute-js-static-publish@beta collections delete --collection-name=pr-${{ github.event.number }}
|
|
754
|
+
- run: npx @fastly/compute-js-static-publish@beta clean --delete-expired-collections
|
|
755
755
|
```
|
|
756
756
|
|
|
757
757
|
For a pull request that never published, `collections delete` finds no collection and deletes nothing.
|
|
@@ -795,7 +795,7 @@ collectionSelector.fromConfigStore('my-config-store', 'collection-key');
|
|
|
795
795
|
If you're happy with a preview or staging collection and want to make it live, use the `collections promote` command:
|
|
796
796
|
|
|
797
797
|
```sh
|
|
798
|
-
npx @fastly/compute-js-static-publish collections promote \
|
|
798
|
+
npx @fastly/compute-js-static-publish@beta collections promote \
|
|
799
799
|
--collection-name=staging
|
|
800
800
|
--to=live
|
|
801
801
|
```
|
|
@@ -805,7 +805,7 @@ This copies all content and server settings from the `staging` collection to `li
|
|
|
805
805
|
You can also specify a new expiration:
|
|
806
806
|
|
|
807
807
|
```sh
|
|
808
|
-
npx @fastly/compute-js-static-publish collections promote \
|
|
808
|
+
npx @fastly/compute-js-static-publish@beta collections promote \
|
|
809
809
|
--collection-name=preview-42 \
|
|
810
810
|
--to=staging \
|
|
811
811
|
--expires-in=7d
|
|
@@ -975,7 +975,7 @@ npm run fastly:clean
|
|
|
975
975
|
|
|
976
976
|
These scripts run against the local and Fastly KV Stores respectively, and run the following command:
|
|
977
977
|
```
|
|
978
|
-
npx @fastly/compute-js-static-publish clean --delete-expired-collections
|
|
978
|
+
npx @fastly/compute-js-static-publish@beta clean --delete-expired-collections
|
|
979
979
|
```
|
|
980
980
|
|
|
981
981
|
This removes:
|
|
@@ -992,7 +992,7 @@ This removes:
|
|
|
992
992
|
Preview what will be deleted without making changes:
|
|
993
993
|
|
|
994
994
|
```sh
|
|
995
|
-
npx @fastly/compute-js-static-publish clean --dry-run
|
|
995
|
+
npx @fastly/compute-js-static-publish@beta clean --dry-run
|
|
996
996
|
```
|
|
997
997
|
|
|
998
998
|
> ⚠️ Cleanup never deletes the default collection and never deletes content that’s still in use.
|
|
@@ -1180,7 +1180,7 @@ To add your own middleware and routes to the `hono` template, put modules in the
|
|
|
1180
1180
|
`scaffold --template hono` makes the folder next to the project file (managed) or next to `compute-js/` (ejected). To make it later, or to update it, run:
|
|
1181
1181
|
|
|
1182
1182
|
```sh
|
|
1183
|
-
npx @fastly/compute-js-static-publish template init
|
|
1183
|
+
npx @fastly/compute-js-static-publish@beta template init
|
|
1184
1184
|
```
|
|
1185
1185
|
|
|
1186
1186
|
```
|
|
@@ -1265,10 +1265,10 @@ templateOptions: {
|
|
|
1265
1265
|
|
|
1266
1266
|
**Watch:** `dev -- --watch` (managed) and `npm run dev:watch` (ejected) also watch the extensions folder, also if it does not exist yet. A change in the folder bundles the modules again, and then the Fastly CLI builds and restarts the app. If a module has an error, the watcher shows it and the app keeps the last modules that built.
|
|
1267
1267
|
|
|
1268
|
-
**Examples** in [`examples/hono/`](https://github.com/fastly/compute-js-static-publish/tree/
|
|
1268
|
+
**Examples** in [`examples/hono/`](https://github.com/fastly/compute-js-static-publish/tree/beta/8.1/examples/hono) show complete extensions. They are not part of the npm package, and you cannot scaffold an app with them: for a new project, copy the `hono-extensions/` folder of an example into your project, and set it up as the README of the example shows. The README also shows how to add an example to a project that exists.
|
|
1269
1269
|
|
|
1270
|
-
- [`grip`](https://github.com/fastly/compute-js-static-publish/tree/
|
|
1271
|
-
- [`oauth`](https://github.com/fastly/compute-js-static-publish/tree/
|
|
1270
|
+
- [`grip`](https://github.com/fastly/compute-js-static-publish/tree/beta/8.1/examples/hono/grip): realtime streams and Server-Sent Events with Fastly Fanout, and a publish endpoint with a shared key. One module with two phases: the `middleware` phase hands off only `/events/*` to Fanout, and the `beforeFiles` phase has the endpoints.
|
|
1271
|
+
- [`oauth`](https://github.com/fastly/compute-js-static-publish/tree/beta/8.1/examples/hono/oauth): a login with GitHub or Google in front of some paths of the site (`protect`), with a signed session cookie.
|
|
1272
1272
|
|
|
1273
1273
|
Each example takes its secrets from a Secret Store. For `dev`, `managed.fastlyToml` adds a local Secret Store that reads environment variables.
|
|
1274
1274
|
|
|
@@ -1423,7 +1423,7 @@ These rules are for tools that run the CLI with no person present, for example a
|
|
|
1423
1423
|
**`--json`:** `publish-content`, `collections list`, `collections delete`, `collections promote`, `status`, `deploy` (in a managed project), and `--version` can write their result as one JSON object to stdout, at the end. All log lines then go to stderr, so that they still show in the CI log. With another command, `--json` is an error (`json-not-supported`).
|
|
1424
1424
|
|
|
1425
1425
|
```sh
|
|
1426
|
-
npx @fastly/compute-js-static-publish publish-content \
|
|
1426
|
+
npx @fastly/compute-js-static-publish@beta publish-content \
|
|
1427
1427
|
--project-dir=./compute-js --collection-name=pr-42 --json > result.json
|
|
1428
1428
|
```
|
|
1429
1429
|
|
|
@@ -1643,14 +1643,14 @@ Once you're in the scaffolded Compute app directory (with `static-publish.rc.js`
|
|
|
1643
1643
|
To run a subcommand from another directory, for example the root of your repo in CI, give the app directory with `--project-dir`:
|
|
1644
1644
|
|
|
1645
1645
|
```sh
|
|
1646
|
-
npx @fastly/compute-js-static-publish publish-content \
|
|
1646
|
+
npx @fastly/compute-js-static-publish@beta publish-content \
|
|
1647
1647
|
--project-dir=./compute-js \
|
|
1648
1648
|
--collection-name=staging
|
|
1649
1649
|
```
|
|
1650
1650
|
|
|
1651
1651
|
With `--project-dir`, all relative paths are relative to that directory: the paths in `static-publish.rc.js` and `publish-content.config.js`, and also the paths in the other options (for example `--config` and `--root-dir`). The directory must have a `static-publish.rc.js` (an app) or a `static-publish.project.js` (a [managed project](#managed-projects)). To scaffold an app in another directory, use `--output`.
|
|
1652
1652
|
|
|
1653
|
-
To print the version of this package, run `npx @fastly/compute-js-static-publish --version`. It works in any directory.
|
|
1653
|
+
To print the version of this package, run `npx @fastly/compute-js-static-publish@beta --version`. It works in any directory.
|
|
1654
1654
|
|
|
1655
1655
|
With `--non-interactive`, or when the `CI` environment variable is set, the CLI never asks for input: missing input is an error. `deploy` then also runs the Fastly CLI with `--non-interactive`. The output never shows the values of `--fastly-api-token`, `--s3-secret-access-key`, `FASTLY_API_TOKEN`, and `S3_SECRET_ACCESS_KEY`.
|
|
1656
1656
|
|
|
@@ -1659,7 +1659,7 @@ For `--json`, the exit codes, and the error codes, see [Using the CLI in CI](#-u
|
|
|
1659
1659
|
#### `publish-content`
|
|
1660
1660
|
|
|
1661
1661
|
```sh
|
|
1662
|
-
npx @fastly/compute-js-static-publish publish-content \
|
|
1662
|
+
npx @fastly/compute-js-static-publish@beta publish-content \
|
|
1663
1663
|
[--root-dir=./public] \
|
|
1664
1664
|
[--collection-name=preview-42] \
|
|
1665
1665
|
[--config=./publish-content.config.js] \
|
|
@@ -1717,7 +1717,7 @@ After this process is complete, the PublisherServer object in the Compute applic
|
|
|
1717
1717
|
#### `clean`
|
|
1718
1718
|
|
|
1719
1719
|
```sh
|
|
1720
|
-
npx @fastly/compute-js-static-publish clean \
|
|
1720
|
+
npx @fastly/compute-js-static-publish@beta clean \
|
|
1721
1721
|
[--delete-expired-collections] \
|
|
1722
1722
|
[--dry-run]
|
|
1723
1723
|
```
|
|
@@ -1743,7 +1743,7 @@ This can include expired collection indexes and orphaned content assets.
|
|
|
1743
1743
|
#### `collections list`
|
|
1744
1744
|
|
|
1745
1745
|
```sh
|
|
1746
|
-
npx @fastly/compute-js-static-publish collections list
|
|
1746
|
+
npx @fastly/compute-js-static-publish@beta collections list
|
|
1747
1747
|
```
|
|
1748
1748
|
Lists all collections currently published in storage.
|
|
1749
1749
|
|
|
@@ -1762,7 +1762,7 @@ Lists all collections currently published in storage.
|
|
|
1762
1762
|
#### `collections promote`
|
|
1763
1763
|
|
|
1764
1764
|
```sh
|
|
1765
|
-
npx @fastly/compute-js-static-publish collections promote \
|
|
1765
|
+
npx @fastly/compute-js-static-publish@beta collections promote \
|
|
1766
1766
|
--collection-name=preview-42 \
|
|
1767
1767
|
--to=live \
|
|
1768
1768
|
[--expires-in=7d | --expires-at=2025-06-01T00:00Z | --expires-never]
|
|
@@ -1802,7 +1802,7 @@ If a Service ID is found, the command then purges the surrogate key `<publishId>
|
|
|
1802
1802
|
#### `collections update-expiration`
|
|
1803
1803
|
|
|
1804
1804
|
```sh
|
|
1805
|
-
npx @fastly/compute-js-static-publish collections update-expiration \
|
|
1805
|
+
npx @fastly/compute-js-static-publish@beta collections update-expiration \
|
|
1806
1806
|
--collection-name=preview-42 \
|
|
1807
1807
|
--expires-in=3d | --expires-at=2025-06-01T00:00Z | --expires-never
|
|
1808
1808
|
```
|
|
@@ -1832,13 +1832,13 @@ Sets or updates the expiration time of an existing collection.
|
|
|
1832
1832
|
#### `collections delete`
|
|
1833
1833
|
|
|
1834
1834
|
```sh
|
|
1835
|
-
npx @fastly/compute-js-static-publish collections delete \
|
|
1835
|
+
npx @fastly/compute-js-static-publish@beta collections delete \
|
|
1836
1836
|
--collection-name=preview-42
|
|
1837
1837
|
```
|
|
1838
1838
|
|
|
1839
1839
|
Deletes a collection index from storage. The content files will remain as they may still be referenced by other collection indexes.
|
|
1840
1840
|
|
|
1841
|
-
Use the `npx @fastly/compute-js-static-publish clean` command afterward to remove content files that are no longer referenced by any collection.
|
|
1841
|
+
Use the `npx @fastly/compute-js-static-publish@beta clean` command afterward to remove content files that are no longer referenced by any collection.
|
|
1842
1842
|
|
|
1843
1843
|
If a Service ID is found, the command then purges the surrogate key `<publishId>-<collectionName>`, so that the service stops serving cached responses of the deleted collection. This uses the same options as [`publish-content`](#publish-content).
|
|
1844
1844
|
|
|
@@ -1959,7 +1959,7 @@ async function handleRequest(event) {
|
|
|
1959
1959
|
|
|
1960
1960
|
## 📚 Next Steps
|
|
1961
1961
|
|
|
1962
|
-
- View CLI command help: `npx @fastly/compute-js-static-publish --help`
|
|
1962
|
+
- View CLI command help: `npx @fastly/compute-js-static-publish@beta --help`
|
|
1963
1963
|
- Use in CI to automate branch previews
|
|
1964
1964
|
- Visit [https://developer.fastly.com](https://developer.fastly.com) for Compute platform docs
|
|
1965
1965
|
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ npx @fastly/compute-js-static-publish@beta --root-dir=./public --storage-mode=s3
|
|
|
29
29
|
|
|
30
30
|
If the storage needs a custom endpoint, as Fastly Object Storage does, add `--s3-endpoint=<endpoint>` (for example, `--s3-endpoint=https://us-east-1.object.fastlystorage.app`).
|
|
31
31
|
|
|
32
|
-
For more details, see the [S3-compatible storage](https://github.com/fastly/compute-js-static-publish/blob/
|
|
32
|
+
For more details, see the [S3-compatible storage](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-using-s3-compatible-storage-beta) section in the full documentation.
|
|
33
33
|
|
|
34
34
|
### 🔧 Local Preview
|
|
35
35
|
|
|
@@ -69,6 +69,16 @@ npm run fastly:publish # upload your static files
|
|
|
69
69
|
|
|
70
70
|
If the app uses S3-compatible storage, your files are already in the bucket after `npm run s3:publish`. Run `npm run fastly:deploy` to deploy the app, and use `npm run s3:publish` to upload updates. After the deploy, `fastly.toml` has the service ID, so `s3:publish` also purges the service's cache. For this purge, set `FASTLY_API_TOKEN` too. Without it, `s3:publish` stops with an error before it uploads files.
|
|
71
71
|
|
|
72
|
+
## New in 8.1
|
|
73
|
+
|
|
74
|
+
- **Managed projects:** keep only `static-publish.project.js` in your repo. The CLI generates the app, and `dev`, `deploy`, `status`, `upgrade`, and `eject` work with it. ([Managed and ejected apps](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#managed-and-ejected-apps))
|
|
75
|
+
- **Previews:** serve another collection for a request, selected by host, path, query, cookie, or header. ([Previews](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-previews-collection-selection))
|
|
76
|
+
- **Hidden files:** publish files that the server does not serve for a request, for your own code to read. ([Hidden files](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#hidden-files))
|
|
77
|
+
- **Hono:** the `hono` template, with your own middleware and routes in `hono-extensions/`, and examples for GRIP streaming and OAuth login. For your own Hono app, `@fastly/compute-js-static-publish/hono` replaces `@fastly/hono-compute-js-static-publish`. ([Using Hono](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-using-hono))
|
|
78
|
+
- **CI:** `--json` output, exit codes, error codes, `--project-dir`, and `--non-interactive`. ([Using the CLI in CI](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-using-the-cli-in-ci))
|
|
79
|
+
|
|
80
|
+
Before you upgrade, read [CHANGELOG.md](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/CHANGELOG.md): collection names now must be DNS labels (lowercase letters, digits, and `-`), and a usage or config error now exits with `2`.
|
|
81
|
+
|
|
72
82
|
## Features
|
|
73
83
|
|
|
74
84
|
- Named collections for previews, staging, production
|
package/README.short.md
CHANGED
|
@@ -29,7 +29,7 @@ npx @fastly/compute-js-static-publish@beta --root-dir=./public --storage-mode=s3
|
|
|
29
29
|
|
|
30
30
|
If the storage needs a custom endpoint, as Fastly Object Storage does, add `--s3-endpoint=<endpoint>` (for example, `--s3-endpoint=https://us-east-1.object.fastlystorage.app`).
|
|
31
31
|
|
|
32
|
-
For more details, see the [S3-compatible storage](https://github.com/fastly/compute-js-static-publish/blob/
|
|
32
|
+
For more details, see the [S3-compatible storage](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-using-s3-compatible-storage-beta) section in the full documentation.
|
|
33
33
|
|
|
34
34
|
### 🔧 Local Preview
|
|
35
35
|
|
|
@@ -69,6 +69,16 @@ npm run fastly:publish # upload your static files
|
|
|
69
69
|
|
|
70
70
|
If the app uses S3-compatible storage, your files are already in the bucket after `npm run s3:publish`. Run `npm run fastly:deploy` to deploy the app, and use `npm run s3:publish` to upload updates. After the deploy, `fastly.toml` has the service ID, so `s3:publish` also purges the service's cache. For this purge, set `FASTLY_API_TOKEN` too. Without it, `s3:publish` stops with an error before it uploads files.
|
|
71
71
|
|
|
72
|
+
## New in 8.1
|
|
73
|
+
|
|
74
|
+
- **Managed projects:** keep only `static-publish.project.js` in your repo. The CLI generates the app, and `dev`, `deploy`, `status`, `upgrade`, and `eject` work with it. ([Managed and ejected apps](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#managed-and-ejected-apps))
|
|
75
|
+
- **Previews:** serve another collection for a request, selected by host, path, query, cookie, or header. ([Previews](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-previews-collection-selection))
|
|
76
|
+
- **Hidden files:** publish files that the server does not serve for a request, for your own code to read. ([Hidden files](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#hidden-files))
|
|
77
|
+
- **Hono:** the `hono` template, with your own middleware and routes in `hono-extensions/`, and examples for GRIP streaming and OAuth login. For your own Hono app, `@fastly/compute-js-static-publish/hono` replaces `@fastly/hono-compute-js-static-publish`. ([Using Hono](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-using-hono))
|
|
78
|
+
- **CI:** `--json` output, exit codes, error codes, `--project-dir`, and `--non-interactive`. ([Using the CLI in CI](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-using-the-cli-in-ci))
|
|
79
|
+
|
|
80
|
+
Before you upgrade, read [CHANGELOG.md](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/CHANGELOG.md): collection names now must be DNS labels (lowercase letters, digits, and `-`), and a usage or config error now exits with `2`.
|
|
81
|
+
|
|
72
82
|
## Features
|
|
73
83
|
|
|
74
84
|
- Named collections for previews, staging, production
|
|
@@ -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":"AAgEA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA0NhD"}
|
|
@@ -8,11 +8,12 @@ import { parseCommandLine } from '../../util/args.js';
|
|
|
8
8
|
import { errorCodeOf, recordFailure } from '../../util/output.js';
|
|
9
9
|
import { LoadConfigError, configFileName, getComputeAppDir, loadStaticPublisherRcFile, } from '../../util/config.js';
|
|
10
10
|
import { loadStorageProviderFromStaticPublishRc } from '../../storage/storage-provider.js';
|
|
11
|
+
import { cliCommand } from '../../util/package.js';
|
|
11
12
|
function help() {
|
|
12
13
|
console.log(`\
|
|
13
14
|
|
|
14
15
|
Usage:
|
|
15
|
-
|
|
16
|
+
${cliCommand()} clean [options]
|
|
16
17
|
|
|
17
18
|
Description:
|
|
18
19
|
Cleans up expired or unreferenced items in storage.
|
|
@@ -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":"AAwEA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAiLhD"}
|
|
@@ -7,17 +7,18 @@ import { errorCodeOf, fail, recordFailure, setJsonResult } from '../../../util/o
|
|
|
7
7
|
import { LoadConfigError, configFileName, getComputeAppDir, loadStaticPublisherRcFile, } from '../../../util/config.js';
|
|
8
8
|
import { loadStorageProviderFromStaticPublishRc } from '../../../storage/storage-provider.js';
|
|
9
9
|
import { loadPurgeTarget, purgeCollection } from '../../../util/purge.js';
|
|
10
|
+
import { cliCommand } from '../../../util/package.js';
|
|
10
11
|
function help() {
|
|
11
12
|
console.log(`\
|
|
12
13
|
|
|
13
14
|
Usage:
|
|
14
|
-
|
|
15
|
+
${cliCommand()} collections delete --collection-name=<name> [options]
|
|
15
16
|
|
|
16
17
|
Description:
|
|
17
18
|
Deletes a collection index from storage. The content files will remain as they may still
|
|
18
19
|
be referenced by other collection indexes.
|
|
19
20
|
|
|
20
|
-
Use the '
|
|
21
|
+
Use the '${cliCommand()} clean' command afterward to remove content
|
|
21
22
|
files that are no longer referenced by any collection.
|
|
22
23
|
|
|
23
24
|
If a Service ID is found, the tool then purges the cached responses of the collection
|
|
@@ -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":"AAsDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA8BhD"}
|
|
@@ -8,11 +8,12 @@ import * as deleteCommand from './delete.js';
|
|
|
8
8
|
import * as listCommand from './list.js';
|
|
9
9
|
import * as promoteCommand from './promote.js';
|
|
10
10
|
import * as updateExpirationCommand from './update-expiration.js';
|
|
11
|
+
import { cliCommand } from '../../../util/package.js';
|
|
11
12
|
function help() {
|
|
12
13
|
console.log(`\
|
|
13
14
|
|
|
14
15
|
Usage:
|
|
15
|
-
|
|
16
|
+
${cliCommand()} collections <sub-command> [options]
|
|
16
17
|
|
|
17
18
|
Description:
|
|
18
19
|
Manage named collections within a Compute application built with @fastly/compute-js-static-publish.
|
|
@@ -44,8 +45,8 @@ Global Options:
|
|
|
44
45
|
-h, --help Show this help message and exit.
|
|
45
46
|
|
|
46
47
|
Examples:
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
${cliCommand()} collections list
|
|
49
|
+
${cliCommand()} collections delete --collection-name=preview-42
|
|
49
50
|
`);
|
|
50
51
|
}
|
|
51
52
|
export async function action(actionArgs) {
|
|
@@ -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":"AAqDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAoLhD"}
|
|
@@ -9,11 +9,12 @@ import { parseCommandLine } from '../../../util/args.js';
|
|
|
9
9
|
import { errorCodeOf, recordFailure, setJsonResult } from '../../../util/output.js';
|
|
10
10
|
import { LoadConfigError, configFileName, getComputeAppDir, loadStaticPublisherRcFile, } from '../../../util/config.js';
|
|
11
11
|
import { loadStorageProviderFromStaticPublishRc } from '../../../storage/storage-provider.js';
|
|
12
|
+
import { cliCommand } from '../../../util/package.js';
|
|
12
13
|
function help() {
|
|
13
14
|
console.log(`\
|
|
14
15
|
|
|
15
16
|
Usage:
|
|
16
|
-
|
|
17
|
+
${cliCommand()} collections list [options]
|
|
17
18
|
|
|
18
19
|
Description:
|
|
19
20
|
Lists all collections currently published in the KV Store.
|
|
@@ -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":"AA0FA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA0NhD"}
|
|
@@ -11,12 +11,13 @@ import { parseCommandLine } from '../../../util/args.js';
|
|
|
11
11
|
import { errorCodeOf, fail, recordFailure, setJsonResult } from '../../../util/output.js';
|
|
12
12
|
import { checkCollectionNameForWrite } from '../../../util/collection-name.js';
|
|
13
13
|
import { loadStorageProviderFromStaticPublishRc } from '../../../storage/storage-provider.js';
|
|
14
|
+
import { cliCommand } from '../../../util/package.js';
|
|
14
15
|
import { loadPurgeTarget, purgeCollection } from '../../../util/purge.js';
|
|
15
16
|
function help() {
|
|
16
17
|
console.log(`\
|
|
17
18
|
|
|
18
19
|
Usage:
|
|
19
|
-
|
|
20
|
+
${cliCommand()} collections promote
|
|
20
21
|
--collection-name=<name> \\
|
|
21
22
|
--to=name> \\
|
|
22
23
|
[options]
|
|
@@ -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":"AAsEA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAwJhD"}
|
|
@@ -10,11 +10,12 @@ import { LoadConfigError, configFileName, getComputeAppDir, loadStaticPublisherR
|
|
|
10
10
|
import { parseCommandLine } from '../../../util/args.js';
|
|
11
11
|
import { errorCodeOf, fail, recordFailure } from '../../../util/output.js';
|
|
12
12
|
import { loadStorageProviderFromStaticPublishRc } from '../../../storage/storage-provider.js';
|
|
13
|
+
import { cliCommand } from '../../../util/package.js';
|
|
13
14
|
function help() {
|
|
14
15
|
console.log(`\
|
|
15
16
|
|
|
16
17
|
Usage:
|
|
17
|
-
|
|
18
|
+
${cliCommand()} collections update-expiration \\
|
|
18
19
|
--collection-name=<name> \\
|
|
19
20
|
[options]
|
|
20
21
|
|
|
@@ -14,7 +14,7 @@ import { loadApiToken } from '../../util/api-token.js';
|
|
|
14
14
|
import { parseCommandLine } from '../../util/args.js';
|
|
15
15
|
import { detectProjectMode } from '../../util/config.js';
|
|
16
16
|
import { readServiceId } from '../../util/fastly-toml.js';
|
|
17
|
-
import { getOwnPackageDir, getOwnVersion } from '../../util/package.js';
|
|
17
|
+
import { cliCommand, getOwnPackageDir, getOwnVersion } from '../../util/package.js';
|
|
18
18
|
import { fail, isJsonMode, isNonInteractive, recordFailure, setJsonResult } from '../../util/output.js';
|
|
19
19
|
import { loadServiceId } from '../../util/service-id.js';
|
|
20
20
|
import { isS3StorageConfigRc } from '../../../models/config/static-publish-rc.js';
|
|
@@ -23,7 +23,7 @@ function help() {
|
|
|
23
23
|
console.log(`\
|
|
24
24
|
|
|
25
25
|
Usage:
|
|
26
|
-
|
|
26
|
+
${cliCommand()} deploy [options]
|
|
27
27
|
|
|
28
28
|
Description:
|
|
29
29
|
Deploys the app of a managed project, only if it changed: generates the app,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/dev.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/dev.ts"],"names":[],"mappings":"AAgDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAwChD"}
|
|
@@ -9,11 +9,12 @@ import { fail, recordFailure } from '../../util/output.js';
|
|
|
9
9
|
import { checkVersionForCommand, loadManagedProject, showTemplateFolderHint } from '../../managed/command-helpers.js';
|
|
10
10
|
import { PROJECT_FILE_NAME } from '../../../models/config/static-publish-project.js';
|
|
11
11
|
import { serveApp } from '../run-dev-watch.js';
|
|
12
|
+
import { cliCommand } from '../../util/package.js';
|
|
12
13
|
function help() {
|
|
13
14
|
console.log(`\
|
|
14
15
|
|
|
15
16
|
Usage:
|
|
16
|
-
|
|
17
|
+
${cliCommand()} dev [-- <options of fastly compute serve>]
|
|
17
18
|
|
|
18
19
|
Description:
|
|
19
20
|
Runs the app of a managed project on your computer. Generates the app in
|
|
@@ -14,7 +14,7 @@ import { parseCommandLine } from '../../util/args.js';
|
|
|
14
14
|
import { detectProjectMode } from '../../util/config.js';
|
|
15
15
|
import { rootRelative } from '../../util/files.js';
|
|
16
16
|
import { fail, recordFailure } from '../../util/output.js';
|
|
17
|
-
import { getOwnVersion } from '../../util/package.js';
|
|
17
|
+
import { cliCommand, getOwnVersion } from '../../util/package.js';
|
|
18
18
|
import { MANAGED_APP_DIR, PROJECT_FILE_NAME, RC_FILE_NAME } from '../../../models/config/static-publish-project.js';
|
|
19
19
|
// An environment variable for the tests of this package only. The tests run a
|
|
20
20
|
// version that is not on npm, so they give here the spec of this package for
|
|
@@ -24,7 +24,7 @@ function help() {
|
|
|
24
24
|
console.log(`\
|
|
25
25
|
|
|
26
26
|
Usage:
|
|
27
|
-
|
|
27
|
+
${cliCommand()} eject [options]
|
|
28
28
|
|
|
29
29
|
Description:
|
|
30
30
|
Converts a managed project into an ejected app, which you own and change:
|
|
@@ -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":"AAsFA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAmChD"}
|
|
@@ -13,11 +13,12 @@ import * as templateCommands from './template/index.js';
|
|
|
13
13
|
import * as upgradeCommand from './upgrade.js';
|
|
14
14
|
import * as publishContentCommand from './publish-content.js';
|
|
15
15
|
import * as collectionsCommands from './collections/index.js';
|
|
16
|
+
import { cliCommand } from '../../util/package.js';
|
|
16
17
|
function help() {
|
|
17
18
|
console.log(`\
|
|
18
19
|
|
|
19
20
|
Usage:
|
|
20
|
-
|
|
21
|
+
${cliCommand()} <command> [options]
|
|
21
22
|
|
|
22
23
|
Description:
|
|
23
24
|
Manage and publish static content to Fastly Compute using KV Store-backed collections.
|
|
@@ -74,10 +75,10 @@ Automatic Project Initialization:
|
|
|
74
75
|
Compute application for you, including Fastly configuration, default routes, and publishing setup.
|
|
75
76
|
|
|
76
77
|
Examples:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
${cliCommand()} publish-content --collection-name=live
|
|
79
|
+
${cliCommand()} collections list
|
|
80
|
+
${cliCommand()} clean --dry-run
|
|
81
|
+
${cliCommand()} publish-content --project-dir=./compute-js
|
|
81
82
|
`);
|
|
82
83
|
}
|
|
83
84
|
export async function action(actionArgs) {
|
|
@@ -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":"AAiJA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAqmBhD"}
|
|
@@ -21,6 +21,7 @@ import { concurrentMap } from '../../util/retryable.js';
|
|
|
21
21
|
import { ProgressLog } from '../../util/progress.js';
|
|
22
22
|
import { loadPurgeTarget, purgeCollection } from '../../util/purge.js';
|
|
23
23
|
import { getStorageKeysByHexPrefix, isVariantInStorage, loadStorageProviderFromStaticPublishRc, StorageProviderBatch, } from '../../storage/storage-provider.js';
|
|
24
|
+
import { cliCommand } from '../../util/package.js';
|
|
24
25
|
// Storage key format:
|
|
25
26
|
// <publishId>_index_<preview_id>.json
|
|
26
27
|
// <publishId>_settings_<preview_id>.json
|
|
@@ -29,7 +30,7 @@ function help() {
|
|
|
29
30
|
console.log(`\
|
|
30
31
|
|
|
31
32
|
Usage:
|
|
32
|
-
|
|
33
|
+
${cliCommand()} publish-content [--collection-name=<name>] [options]
|
|
33
34
|
|
|
34
35
|
Description:
|
|
35
36
|
Publishes static files from your local root directory into a named collection,
|
|
@@ -106,9 +107,9 @@ Global Options:
|
|
|
106
107
|
-h, --help Show this help message and exit.
|
|
107
108
|
|
|
108
109
|
Examples:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
${cliCommand()} publish-content --collection-name=preview-456
|
|
111
|
+
${cliCommand()} publish-content --expires-in=7d --kv-overwrite
|
|
112
|
+
${cliCommand()} publish-content --expires-never --local
|
|
112
113
|
|
|
113
114
|
`);
|
|
114
115
|
}
|
|
@@ -12,7 +12,7 @@ import { loadApiToken } from '../../util/api-token.js';
|
|
|
12
12
|
import { parseCommandLine } from '../../util/args.js';
|
|
13
13
|
import { recordFailure, setJsonResult } from '../../util/output.js';
|
|
14
14
|
import { detectProjectMode } from '../../util/config.js';
|
|
15
|
-
import { getOwnVersion } from '../../util/package.js';
|
|
15
|
+
import { cliCommand, getOwnVersion } from '../../util/package.js';
|
|
16
16
|
import { loadServiceId } from '../../util/service-id.js';
|
|
17
17
|
import { previewUrlTemplates } from '../../../models/config/collection-selection.js';
|
|
18
18
|
import { MANAGED_APP_DIR } from '../../../models/config/static-publish-project.js';
|
|
@@ -22,7 +22,7 @@ function help() {
|
|
|
22
22
|
console.log(`\
|
|
23
23
|
|
|
24
24
|
Usage:
|
|
25
|
-
|
|
25
|
+
${cliCommand()} status [options]
|
|
26
26
|
|
|
27
27
|
Description:
|
|
28
28
|
Shows the state of the app. In a managed project: the fingerprint of the app
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/template/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/template/index.ts"],"names":[],"mappings":"AA4BA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAuBhD"}
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
import { getCommandAndArgs } from '../../../util/args.js';
|
|
6
6
|
import { recordFailure } from '../../../util/output.js';
|
|
7
7
|
import * as initCommand from './init.js';
|
|
8
|
+
import { cliCommand } from '../../../util/package.js';
|
|
8
9
|
function help() {
|
|
9
10
|
console.log(`\
|
|
10
11
|
|
|
11
12
|
Usage:
|
|
12
|
-
|
|
13
|
+
${cliCommand()} template <sub-command> [options]
|
|
13
14
|
|
|
14
15
|
Description:
|
|
15
16
|
Commands for the template of the app.
|
|
@@ -14,12 +14,12 @@ import { parseCommandLine } from '../../../util/args.js';
|
|
|
14
14
|
import { LoadConfigError, detectProjectMode, loadStaticPublisherRcFile } from '../../../util/config.js';
|
|
15
15
|
import { rootRelative } from '../../../util/files.js';
|
|
16
16
|
import { fail, isNonInteractive, recordFailure } from '../../../util/output.js';
|
|
17
|
-
import { getOwnVersion } from '../../../util/package.js';
|
|
17
|
+
import { cliCommand, getOwnVersion } from '../../../util/package.js';
|
|
18
18
|
function help() {
|
|
19
19
|
console.log(`\
|
|
20
20
|
|
|
21
21
|
Usage:
|
|
22
|
-
|
|
22
|
+
${cliCommand()} template init [options]
|
|
23
23
|
|
|
24
24
|
Description:
|
|
25
25
|
Makes or updates the folder of the app's template: for the hono template,
|
|
@@ -62,7 +62,7 @@ export async function runTemplateInit(params) {
|
|
|
62
62
|
const plan = planTemplateInit(templateName, folderDir, provided, { reset });
|
|
63
63
|
if (check) {
|
|
64
64
|
if (plan.outOfDate.length > 0) {
|
|
65
|
-
fail('template-init-needed', `${folderName} is out of date. Run:
|
|
65
|
+
fail('template-init-needed', `${folderName} is out of date. Run: ${cliCommand()} template init`);
|
|
66
66
|
for (const reason of plan.outOfDate) {
|
|
67
67
|
console.error(` * ${reason}`);
|
|
68
68
|
}
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
import { loadManagedProject, writeProjectVersion } from '../../managed/command-helpers.js';
|
|
6
6
|
import { checkProjectVersion } from '../../managed/version-check.js';
|
|
7
7
|
import { parseCommandLine } from '../../util/args.js';
|
|
8
|
-
import { getOwnVersion } from '../../util/package.js';
|
|
8
|
+
import { cliCommand, getOwnVersion } from '../../util/package.js';
|
|
9
9
|
import { PROJECT_FILE_NAME } from '../../../models/config/static-publish-project.js';
|
|
10
10
|
import { fail, recordFailure } from '../../util/output.js';
|
|
11
11
|
function help() {
|
|
12
12
|
console.log(`\
|
|
13
13
|
|
|
14
14
|
Usage:
|
|
15
|
-
|
|
15
|
+
${cliCommand()} upgrade
|
|
16
16
|
|
|
17
17
|
Description:
|
|
18
18
|
Moves a managed project to the version of @fastly/compute-js-static-publish
|
|
@@ -12,7 +12,7 @@ import * as fs from 'node:fs';
|
|
|
12
12
|
import { parseCommandLine } from '../../util/args.js';
|
|
13
13
|
import { fail, recordFailure } from '../../util/output.js';
|
|
14
14
|
import { rootRelative } from '../../util/files.js';
|
|
15
|
-
import { findComputeJsStaticPublisherVersion, getOwnVersion } from '../../util/package.js';
|
|
15
|
+
import { cliCommand, findComputeJsStaticPublisherVersion, getOwnVersion } from '../../util/package.js';
|
|
16
16
|
import { runTemplateInit } from '../manage/template/init.js';
|
|
17
17
|
import { templateHasInit } from '../../managed/template-init.js';
|
|
18
18
|
import { findHostnameForAwsS3RegionAndBucket } from '../../util/s3.js';
|
|
@@ -28,7 +28,7 @@ function help() {
|
|
|
28
28
|
console.log(`\
|
|
29
29
|
|
|
30
30
|
Usage:
|
|
31
|
-
|
|
31
|
+
${cliCommand({ latest: true })} [options]
|
|
32
32
|
|
|
33
33
|
Description:
|
|
34
34
|
Scaffold a new Compute app configured for static publishing.
|
|
@@ -910,6 +910,6 @@ Commit ${PROJECT_FILE_NAME}. Do not commit .static-publish/.
|
|
|
910
910
|
|
|
911
911
|
To publish your content from this directory:
|
|
912
912
|
|
|
913
|
-
|
|
913
|
+
${cliCommand()} publish-content --local
|
|
914
914
|
`);
|
|
915
915
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/cli/hono/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/cli/hono/build.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,wBAAwB,qCAAqC,CAAC;AAI3E,eAAO,MAAM,2BAA2B,sBAAsB,CAAC;AAK/D,MAAM,MAAM,mBAAmB,GAAG;IAGhC,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAMF,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAsBrF;AAUD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAIhE;AAED,KAAK,EAAE,GAAG;IACR,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE;YAAE,aAAa,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IAC9C,eAAe,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE;YAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAAE,CAAA;KAAE,CAAC;CACvE,CAAC;AASF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,MAAM,CAEhE;AA4BD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAE5E;AA0CD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,CA8BrF;AAKD,KAAK,OAAO,GAAG;IAAE,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC;QAAE,WAAW,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC;AAE1F,MAAM,MAAM,2BAA2B,GAAG;IAExC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAQF,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,OAAO,CAAC,CAuCjG;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAYF,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAuF9G"}
|
|
@@ -11,6 +11,7 @@ import fs from 'node:fs';
|
|
|
11
11
|
import path from 'node:path';
|
|
12
12
|
import { pathToFileURL } from 'node:url';
|
|
13
13
|
import { compareVersions } from '../managed/version-check.js';
|
|
14
|
+
import { cliCommand } from '../util/package.js';
|
|
14
15
|
// The file that the build writes into the app, and that src/index.ts imports.
|
|
15
16
|
export const HONO_EXTENSIONS_MANIFEST = 'src/hono-extensions.generated.js';
|
|
16
17
|
// The extensions folder when build.hono.extensionsDir is not set, relative to
|
|
@@ -155,7 +156,7 @@ export function checkProvidedVersions(appDir, extensionsDir) {
|
|
|
155
156
|
const version = readJson(installed).version;
|
|
156
157
|
if (satisfiesRange(version, range) === false) {
|
|
157
158
|
warnings.push(`hono-extensions/package.json expects ${name} ${range}, but the app provides ${version}. ` +
|
|
158
|
-
`The build uses the app's ${name}. Run:
|
|
159
|
+
`The build uses the app's ${name}. Run: ${cliCommand()} template init`);
|
|
159
160
|
}
|
|
160
161
|
}
|
|
161
162
|
return warnings;
|
|
@@ -6,7 +6,7 @@ import fs from 'node:fs';
|
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
import { PROJECT_FILE_NAME } from '../../models/config/static-publish-project.js';
|
|
8
8
|
import { LoadConfigError, detectProjectMode, loadProjectFile } from '../util/config.js';
|
|
9
|
-
import { getOwnVersion } from '../util/package.js';
|
|
9
|
+
import { cliCommand, getOwnVersion } from '../util/package.js';
|
|
10
10
|
import { DEFAULT_APP_TEMPLATE_NAME } from '../commands/scaffold/app-template.js';
|
|
11
11
|
import { DEFAULT_HONO_EXTENSIONS_DIR } from '../hono/build.js';
|
|
12
12
|
import { writeBackStaticPublishVersion } from './project-edit.js';
|
|
@@ -43,7 +43,7 @@ export function showTemplateFolderHint(project) {
|
|
|
43
43
|
}
|
|
44
44
|
const extensionsDir = project.rc.build?.hono?.extensionsDir ?? DEFAULT_HONO_EXTENSIONS_DIR;
|
|
45
45
|
if (!fs.existsSync(path.resolve(extensionsDir))) {
|
|
46
|
-
console.log(`💡 No ${extensionsDir} folder. To add your own Hono middleware and routes, run:
|
|
46
|
+
console.log(`💡 No ${extensionsDir} folder. To add your own Hono middleware and routes, run: ${cliCommand()} template init`);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
// Check managed.staticPublishVersion against the running CLI. With
|
|
@@ -8,5 +8,8 @@ export type PackageJson = {
|
|
|
8
8
|
export declare function getOwnPackageDir(): string;
|
|
9
9
|
export declare function readOwnPackageJson(): Record<string, any>;
|
|
10
10
|
export declare function getOwnVersion(): string;
|
|
11
|
+
export declare function cliCommand(options?: {
|
|
12
|
+
latest?: boolean;
|
|
13
|
+
}, version?: string): string;
|
|
11
14
|
export declare function findComputeJsStaticPublisherVersion(packageJson: PackageJson | null): string;
|
|
12
15
|
//# sourceMappingURL=package.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/package.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C,CAAC;AAGF,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAGD,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAExD;AAGD,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,UA8ClF"}
|
|
1
|
+
{"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/package.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C,CAAC;AAGF,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAGD,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAExD;AAGD,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAQD,wBAAgB,UAAU,CAAC,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,EAAE,OAAO,GAAE,MAAwB,GAAG,MAAM,CAIxG;AAED,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,UA8ClF"}
|
|
@@ -16,6 +16,17 @@ export function readOwnPackageJson() {
|
|
|
16
16
|
export function getOwnVersion() {
|
|
17
17
|
return readOwnPackageJson().version;
|
|
18
18
|
}
|
|
19
|
+
// The npx command of this package, for the messages of the CLI. The version of
|
|
20
|
+
// a prerelease (for example 8.1.0-beta.1) gives the dist-tag of the prerelease
|
|
21
|
+
// (@beta), because npx without a dist-tag runs the latest stable version, which
|
|
22
|
+
// does not have the features of the prerelease. A stable version gives no
|
|
23
|
+
// dist-tag, or @latest with { latest: true } (the command that makes a new
|
|
24
|
+
// app).
|
|
25
|
+
export function cliCommand(options = {}, version = getOwnVersion()) {
|
|
26
|
+
const prerelease = /^\d+\.\d+\.\d+-([a-z][a-z0-9-]*)/.exec(version)?.[1];
|
|
27
|
+
const distTag = prerelease ?? (options.latest ? 'latest' : undefined);
|
|
28
|
+
return `npx @fastly/compute-js-static-publish${distTag != null ? `@${distTag}` : ''}`;
|
|
29
|
+
}
|
|
19
30
|
export function findComputeJsStaticPublisherVersion(packageJson) {
|
|
20
31
|
// Get the current compute js static publisher version.
|
|
21
32
|
let computeJsStaticPublisherVersion = null;
|
package/package.json
CHANGED