@shoplifter/cli 0.1.5 → 0.1.6
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/dist/index.js +3 -2
- package/dist/publication.d.ts +1 -1
- package/dist/publication.js +5 -3
- package/dist/release-manifest.json +4 -4
- package/dist/runtime.js +4 -2
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
import { program, command, requiredArg, optionalArg, description, version } from 'commander-ts';
|
|
14
|
+
import { program, command, commandOption, requiredArg, optionalArg, description, version } from 'commander-ts';
|
|
15
15
|
import { spawn } from 'node:child_process';
|
|
16
16
|
import { readFileSync } from 'node:fs';
|
|
17
17
|
import { initialize, editProject, scaffold } from './author.js';
|
|
@@ -70,7 +70,7 @@ let Shoplifter = class Shoplifter {
|
|
|
70
70
|
throw new Error(`Astro exited with status ${code}`);
|
|
71
71
|
}
|
|
72
72
|
async publication(action, channel, revision, language) {
|
|
73
|
-
await reportFailure(() => publication(action, channel, revision, language));
|
|
73
|
+
await reportFailure(() => publication(action, channel, revision, language, Boolean(this.reset)));
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
__decorate([
|
|
@@ -198,6 +198,7 @@ __decorate([
|
|
|
198
198
|
], Shoplifter.prototype, "dev", null);
|
|
199
199
|
__decorate([
|
|
200
200
|
command(),
|
|
201
|
+
commandOption('--reset', 'Reset the channel preview link and revoke existing preview browsers'),
|
|
201
202
|
__param(0, requiredArg('action')),
|
|
202
203
|
__param(1, requiredArg('channel')),
|
|
203
204
|
__param(2, optionalArg('revision')),
|
package/dist/publication.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export declare function previewUpload(directory?: string): Promise<{
|
|
|
5
5
|
}[];
|
|
6
6
|
totalBytes: number;
|
|
7
7
|
}>;
|
|
8
|
-
export declare function publication(action: string, channel: string, revision?: string, languageCode?: string): Promise<void>;
|
|
8
|
+
export declare function publication(action: string, channel: string, revision?: string, languageCode?: string, reset?: boolean): Promise<void>;
|
package/dist/publication.js
CHANGED
|
@@ -8,9 +8,11 @@ export async function previewUpload(directory = process.cwd()) {
|
|
|
8
8
|
console.log(JSON.stringify(preview, null, 2));
|
|
9
9
|
return preview;
|
|
10
10
|
}
|
|
11
|
-
export async function publication(action, channel, revision, languageCode) {
|
|
11
|
+
export async function publication(action, channel, revision, languageCode, reset = false) {
|
|
12
12
|
if (!['upload', 'stage', 'preview', 'preview-link', 'build', 'publish', 'status', 'logs', 'retry', 'retry-deployment', 'activate', 'rollback'].includes(action))
|
|
13
13
|
throw new Error('Unknown publication operation');
|
|
14
|
+
if (reset && action !== 'preview-link')
|
|
15
|
+
throw new Error('--reset is only supported for preview-link');
|
|
14
16
|
const base = apiOrigin(), session = await credentials(false);
|
|
15
17
|
const channelCode = session ? await sessionChannel(session.token) : channel;
|
|
16
18
|
if (session && channel !== channelCode && channel !== session.channelId)
|
|
@@ -25,11 +27,11 @@ export async function publication(action, channel, revision, languageCode) {
|
|
|
25
27
|
await uploadSource(base, session, channelCode);
|
|
26
28
|
return;
|
|
27
29
|
}
|
|
28
|
-
if (['stage', 'preview', '
|
|
30
|
+
if (['stage', 'preview', 'build', 'retry', 'retry-deployment', 'activate', 'rollback'].includes(action) && !revision)
|
|
29
31
|
throw new Error('Revision ID is required');
|
|
30
32
|
if (action === 'preview-link' && !session)
|
|
31
33
|
throw new Error('Protected preview access requires shoplifter login');
|
|
32
|
-
const operation = action === 'preview' ? 'preview-candidate' : action === 'build' ? 'build-candidate' : action === 'preview-link' ? 'preview-access' : action;
|
|
34
|
+
const operation = action === 'preview' ? 'preview-candidate' : action === 'build' ? 'build-candidate' : action === 'preview-link' ? reset ? 'preview-reset' : 'preview-access' : action;
|
|
33
35
|
const response = await fetch(new URL(session ? '/shoplifter-cli/operation' : '/shoplifter-development/' + operation, base), {
|
|
34
36
|
method: 'POST',
|
|
35
37
|
headers: { 'content-type': 'application/json', ...(session ? { authorization: 'Bearer ' + session.token } : {}) },
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
"path": "index.js",
|
|
38
|
-
"sha256": "
|
|
38
|
+
"sha256": "33d0b5c231f837683ff4397e2f428e46d1c510697d457d76ee2c803e15306c7b"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
"path": "publication.d.ts",
|
|
42
|
-
"sha256": "
|
|
42
|
+
"sha256": "ba1a8c1662a2006954d47431aa80079827c2e2cf3ecf613472df35ed63e5e580"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
"path": "publication.js",
|
|
46
|
-
"sha256": "
|
|
46
|
+
"sha256": "b68508530ae29ddac9dc039df6d9b9402c5df047d15138a91d691a96ddad97fa"
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
"path": "runtime.d.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
"path": "runtime.js",
|
|
54
|
-
"sha256": "
|
|
54
|
+
"sha256": "c5ba204f6e98599e7dd376c9358e75e23ca266ff4c0c25762eea6af3cd10ca54"
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
"path": "upload-archive.d.ts",
|
package/dist/runtime.js
CHANGED
|
@@ -34,10 +34,12 @@ export async function downloadRuntime(origin) {
|
|
|
34
34
|
return runtime;
|
|
35
35
|
}
|
|
36
36
|
// CLI-only patches do not require new platform runtime releases.
|
|
37
|
-
const
|
|
38
|
-
|
|
37
|
+
const metadata = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8'));
|
|
38
|
+
const versions = { sdk: metadata.shoplifterRuntimeVersion, contract: metadata.shoplifterContractVersion ?? metadata.shoplifterRuntimeVersion };
|
|
39
|
+
if (Object.values(versions).some(version => !/^\d+\.\d+\.\d+$/.test(version ?? '')))
|
|
39
40
|
throw new Error('Invalid platform runtime version');
|
|
40
41
|
const archive = async (kind) => {
|
|
42
|
+
const version = versions[kind];
|
|
41
43
|
const name = '@shoplifter/presentation-' + kind;
|
|
42
44
|
const metadata = JSON.parse((await bytes(await get(`https://registry.npmjs.org/${encodeURIComponent(name)}/${version}`), 512 * 1024)).toString());
|
|
43
45
|
if (metadata.name !== name || metadata.version !== version || !/^sha512-[A-Za-z0-9+/]{86}==$/.test(metadata.dist?.integrity ?? ''))
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shoplifter/cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"shoplifterRuntimeVersion": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"shoplifterRuntimeVersion": "0.1.3",
|
|
5
|
+
"shoplifterContractVersion": "0.1.2",
|
|
5
6
|
"private": false,
|
|
6
7
|
"license": "Apache-2.0",
|
|
7
8
|
"description": "Author, validate and publish independent Shoplifter Astro presentations",
|