@_linked/cli 1.18.0 → 1.19.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/CHANGELOG.md +87 -0
- package/README.md +119 -0
- package/lib/esm/app-release/app-assets-store.d.ts +23 -0
- package/lib/esm/app-release/app-assets-store.d.ts.map +1 -0
- package/lib/esm/app-release/app-assets-store.js +33 -0
- package/lib/esm/app-release/app-assets-store.js.map +1 -0
- package/lib/esm/app-release/create-release-manifest.d.ts +114 -0
- package/lib/esm/app-release/create-release-manifest.d.ts.map +1 -0
- package/lib/esm/app-release/create-release-manifest.js +238 -0
- package/lib/esm/app-release/create-release-manifest.js.map +1 -0
- package/lib/esm/app-release/paths.d.ts +5 -0
- package/lib/esm/app-release/paths.d.ts.map +1 -0
- package/lib/esm/app-release/paths.js +44 -0
- package/lib/esm/app-release/paths.js.map +1 -0
- package/lib/esm/app-release/publisher.d.ts +25 -0
- package/lib/esm/app-release/publisher.d.ts.map +1 -0
- package/lib/esm/app-release/publisher.js +238 -0
- package/lib/esm/app-release/publisher.js.map +1 -0
- package/lib/esm/app-release/resolve-build-target.d.ts +19 -0
- package/lib/esm/app-release/resolve-build-target.d.ts.map +1 -0
- package/lib/esm/app-release/resolve-build-target.js +30 -0
- package/lib/esm/app-release/resolve-build-target.js.map +1 -0
- package/lib/esm/app-release/static-assets.d.ts +13 -0
- package/lib/esm/app-release/static-assets.d.ts.map +1 -0
- package/lib/esm/app-release/static-assets.js +55 -0
- package/lib/esm/app-release/static-assets.js.map +1 -0
- package/lib/esm/app-release/types.d.ts +71 -0
- package/lib/esm/app-release/types.d.ts.map +1 -0
- package/lib/esm/app-release/types.js +2 -0
- package/lib/esm/app-release/types.js.map +1 -0
- package/lib/esm/cli.js +78 -16
- package/lib/esm/cli.js.map +1 -1
- package/lib/esm/commands/build-app.d.ts +55 -0
- package/lib/esm/commands/build-app.d.ts.map +1 -0
- package/lib/esm/commands/build-app.js +178 -0
- package/lib/esm/commands/build-app.js.map +1 -0
- package/lib/esm/commands/publish-app.d.ts +18 -0
- package/lib/esm/commands/publish-app.d.ts.map +1 -0
- package/lib/esm/commands/publish-app.js +124 -0
- package/lib/esm/commands/publish-app.js.map +1 -0
- package/lib/esm/commands/serve-app.d.ts +14 -0
- package/lib/esm/commands/serve-app.d.ts.map +1 -0
- package/lib/esm/commands/serve-app.js +49 -0
- package/lib/esm/commands/serve-app.js.map +1 -0
- package/lib/esm/index.d.ts +11 -0
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +9 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/lifecycle.d.ts +1 -1
- package/lib/esm/lifecycle.d.ts.map +1 -1
- package/lib/esm/lifecycle.js +17 -8
- package/lib/esm/lifecycle.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-release-manifest.js","sourceRoot":"","sources":["../../../src/app-release/create-release-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,2BAA2B,EAAC,MAAM,oBAAoB,CAAC;AA0C/D,MAAM,UAAU,GAA2B;IACzC,MAAM,EAAE,yBAAyB;IACjC,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,0BAA0B;IACnC,MAAM,EAAE,cAAc;IACtB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,gCAAgC;IACvC,OAAO,EAAE,iCAAiC;IAC1C,MAAM,EAAE,iCAAiC;IACzC,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,eAAe;IACvB,OAAO,EAAE,Y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AAW,EAAE;QACpD,gBAAgB,EAAE,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC;QAC/C,WAAW,EAAE;YACX,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,EAAE;YAClC,aAAa;YACb,OAAO,EACL,MAAA,OAAO,CAAC,OAAO,mCACf,CAAC,OAAO,CAAC,SAAS;gBAChB,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,EAAE,aAAa,CAAC;gBAClD,CAAC,CAAC,EAAE,CAAC;SACV;QACD,KAAK;KACN,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,QAAkC,EAC1B,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AAEtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,OAAe,EACf,QAAkC,EAC1B,EAAE;IACV,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;IAC5D,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjE,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const normalizeReleasePath: (value: string, label?: string) => string;
|
|
2
|
+
export declare const joinObjectKey: (...segments: string[]) => string;
|
|
3
|
+
export declare const resolveExistingPathWithinRoot: (appRoot: string, relativePath: string) => string;
|
|
4
|
+
export declare const joinStaticAssetUrl: (publicBaseUrl: string, assetPath: string) => string;
|
|
5
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/app-release/paths.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,EACb,QAAO,MAAuB,KAC7B,MAiBF,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,GAAG,UAAU,MAAM,EAAE,KAAG,MAMrD,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,cAAc,MAAM,KACnB,MAeF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,eAAe,MAAM,EACrB,WAAW,MAAM,KAChB,MASF,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
const WINDOWS_ABSOLUTE_PATH = /^[a-zA-Z]:[\\/]/;
|
|
4
|
+
export const normalizeReleasePath = (value, label = 'release path') => {
|
|
5
|
+
const slashPath = value.replace(/\\/g, '/').trim();
|
|
6
|
+
if (!slashPath || slashPath === '.') {
|
|
7
|
+
throw new Error(`${label} must not be empty`);
|
|
8
|
+
}
|
|
9
|
+
if (path.posix.isAbsolute(slashPath) || WINDOWS_ABSOLUTE_PATH.test(value)) {
|
|
10
|
+
throw new Error(`${label} must be relative: ${value}`);
|
|
11
|
+
}
|
|
12
|
+
const normalized = path.posix.normalize(slashPath).replace(/^\.\//, '');
|
|
13
|
+
if (normalized === '..' || normalized.startsWith('../')) {
|
|
14
|
+
throw new Error(`${label} must stay inside the application root: ${value}`);
|
|
15
|
+
}
|
|
16
|
+
return normalized;
|
|
17
|
+
};
|
|
18
|
+
export const joinObjectKey = (...segments) => {
|
|
19
|
+
if (segments.length === 0) {
|
|
20
|
+
throw new Error('object key must not be empty');
|
|
21
|
+
}
|
|
22
|
+
return normalizeReleasePath(segments.join('/'), 'object key');
|
|
23
|
+
};
|
|
24
|
+
export const resolveExistingPathWithinRoot = (appRoot, relativePath) => {
|
|
25
|
+
const normalized = normalizeReleasePath(relativePath, 'source path');
|
|
26
|
+
const rootRealPath = fs.realpathSync(appRoot);
|
|
27
|
+
const candidateRealPath = fs.realpathSync(path.resolve(rootRealPath, normalized));
|
|
28
|
+
const relativeToRoot = path.relative(rootRealPath, candidateRealPath);
|
|
29
|
+
if (relativeToRoot === '..' ||
|
|
30
|
+
relativeToRoot.startsWith(`..${path.sep}`) ||
|
|
31
|
+
path.isAbsolute(relativeToRoot)) {
|
|
32
|
+
throw new Error(`source path escapes the application root: ${relativePath}`);
|
|
33
|
+
}
|
|
34
|
+
return candidateRealPath;
|
|
35
|
+
};
|
|
36
|
+
export const joinStaticAssetUrl = (publicBaseUrl, assetPath) => {
|
|
37
|
+
const normalizedAssetPath = normalizeReleasePath(assetPath, 'asset path');
|
|
38
|
+
const normalizedBaseUrl = publicBaseUrl.trim().replace(/\/+$/, '');
|
|
39
|
+
if (!normalizedBaseUrl) {
|
|
40
|
+
throw new Error('public base URL must not be empty');
|
|
41
|
+
}
|
|
42
|
+
return `${normalizedBaseUrl}/${normalizedAssetPath}`;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../src/app-release/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,KAAa,EACb,QAAgB,cAAc,EACtB,EAAE;IACV,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAEnD,IAAI,CAAC,SAAS,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,oBAAoB,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1E,MAAM,IAAI,KAAK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AC/B,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,6CAA6C,YAAY,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,aAAqB,EACrB,SAAiB,EACT,EAAE;IACV,MAAM,mBAAmB,GAAG,oBAAoB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAC1E,MAAM,iBAAiB,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAEnE,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,GAAG,iBAAiB,IAAI,mBAAmB,EAAE,CAAC;AACvD,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { IFileStore } from '@_linked/core/interfaces/IFileStore';
|
|
2
|
+
import type { LinkedAppReleaseManifest, PublishPlan, PublishResult } from './types.js';
|
|
3
|
+
export interface PlanReleasePublishOptions {
|
|
4
|
+
appRoot: string;
|
|
5
|
+
manifestPath?: string;
|
|
6
|
+
store: IFileStore;
|
|
7
|
+
}
|
|
8
|
+
export interface LoadedReleaseManifest {
|
|
9
|
+
absolutePath: string;
|
|
10
|
+
manifest: LinkedAppReleaseManifest;
|
|
11
|
+
}
|
|
12
|
+
export interface PublishReleaseOptions extends PlanReleasePublishOptions {
|
|
13
|
+
yes?: boolean;
|
|
14
|
+
onProgress?: (progress: PublishProgress) => void;
|
|
15
|
+
onWarning?: (message: string) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface PublishProgress {
|
|
18
|
+
completed: number;
|
|
19
|
+
total: number;
|
|
20
|
+
objectKey: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const loadReleaseManifest: (appRoot: string, manifestPath?: string) => LoadedReleaseManifest;
|
|
23
|
+
export declare const planReleasePublish: (options: PlanReleasePublishOptions) => PublishPlan;
|
|
24
|
+
export declare const publishRelease: (options: PublishReleaseOptions) => Promise<PublishResult>;
|
|
25
|
+
//# sourceMappingURL=publisher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publisher.d.ts","sourceRoot":"","sources":["../../../src/app-release/publisher.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qCAAqC,CAAC;AASpE,OAAO,KAAK,EAEV,wBAAwB,EACxB,WAAW,EACX,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,wBAAwB,CAAC;CACpC;AAED,MAAM,WAAW,qBAAsB,SAAQ,yBAAyB;IACtE,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;IACjD,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAkCD,eAAO,MAAM,mBAAmB,GAC9B,SAAS,MAAM,EACf,qBAAmC,KAClC,qBA6BF,CAAC;AA2CF,eAAO,MAAM,kBAAkB,GAC7B,SAAS,yBAAyB,KACjC,WAsBF,CAAC;AAkCF,eAAO,MAAM,cAAc,GACzB,SAAS,qBAAqB,KAC7B,OAAO,CAAC,aAAa,CAgJvB,CAAC"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import crypto from 'crypto';
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
import { normalizeAccessURL } from './app-assets-store.js';
|
|
13
|
+
import { MANIFEST_CONTENT_TYPE, MANIFEST_SOURCE_PATH, ENTRY_CACHE_CONTROL, releaseObjectKey, } from './create-release-manifest.js';
|
|
14
|
+
import { normalizeReleasePath, resolveExistingPathWithinRoot } from './paths.js';
|
|
15
|
+
/**
|
|
16
|
+
* Every object of a release must land under that release's own prefix.
|
|
17
|
+
*
|
|
18
|
+
* The manifest is a plain file on disk: a hand-edited or foreign one can name
|
|
19
|
+
* any `objectKey` it likes, and nothing else catches it — the `accessURL` check
|
|
20
|
+
* only proves the store is the right store, and the stored-location check only
|
|
21
|
+
* proves the store kept the key it was handed. So the key is not merely checked
|
|
22
|
+
* for shape, it is recomputed: it has to be exactly what this release prefix and
|
|
23
|
+
* this source path produce, or a release could overwrite a *different* release.
|
|
24
|
+
*/
|
|
25
|
+
const validateObjectKey = (releasePrefix, file) => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
const sourcePath = normalizeReleasePath(String((_a = file.sourcePath) !== null && _a !== void 0 ? _a : ''), 'source path');
|
|
28
|
+
const objectKey = normalizeReleasePath(String((_b = file.objectKey) !== null && _b !== void 0 ? _b : ''), 'object key');
|
|
29
|
+
const expected = releaseObjectKey(releasePrefix, sourcePath);
|
|
30
|
+
if (objectKey !== expected) {
|
|
31
|
+
throw new Error(`Release manifest object key is not under the release prefix: ` +
|
|
32
|
+
`"${file.objectKey}" (expected "${expected}"). Rebuild the release; ` +
|
|
33
|
+
'a manifest may only upload to its own prefix.');
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
export const loadReleaseManifest = (appRoot, manifestPath = MANIFEST_SOURCE_PATH) => {
|
|
37
|
+
var _a;
|
|
38
|
+
const absolutePath = resolveExistingPathWithinRoot(appRoot, manifestPath);
|
|
39
|
+
const manifest = JSON.parse(fs.readFileSync(absolutePath, 'utf8'));
|
|
40
|
+
if (manifest.schemaVersion !== 1) {
|
|
41
|
+
throw new Error(`Unsupported release manifest schema: ${manifest.schemaVersion}`);
|
|
42
|
+
}
|
|
43
|
+
if (manifest.target !== 'web' || manifest.publishable !== true) {
|
|
44
|
+
throw new Error('Only publishable web release manifests may be uploaded');
|
|
45
|
+
}
|
|
46
|
+
if (!Array.isArray(manifest.files) || manifest.files.length === 0) {
|
|
47
|
+
throw new Error('Release manifest contains no files');
|
|
48
|
+
}
|
|
49
|
+
if (!((_a = manifest.destination) === null || _a === void 0 ? void 0 : _a.releasePrefix)) {
|
|
50
|
+
throw new Error('Release manifest has no release prefix');
|
|
51
|
+
}
|
|
52
|
+
const releasePrefix = normalizeReleasePath(manifest.destination.releasePrefix, 'release prefix');
|
|
53
|
+
for (const file of manifest.files) {
|
|
54
|
+
validateObjectKey(releasePrefix, file);
|
|
55
|
+
}
|
|
56
|
+
return { absolutePath, manifest };
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The manifest records the `accessURL` of the store it was built for. If the
|
|
60
|
+
* configured store now writes somewhere else, the release is not the one that
|
|
61
|
+
* was built and publishing stops. Trailing slashes are not significant.
|
|
62
|
+
*/
|
|
63
|
+
const validateDestination = (manifest, store) => {
|
|
64
|
+
const expected = normalizeAccessURL(manifest.destination.accessURL);
|
|
65
|
+
const actual = normalizeAccessURL(store.accessURL);
|
|
66
|
+
if (expected !== actual) {
|
|
67
|
+
throw new Error(`Release destination does not match the manifest (manifest was built for ${expected || '(empty)'}, the configured appAssets store writes to ${actual || '(empty)'})`);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const hashBuffer = (content) => crypto.createHash('sha256').update(content).digest('hex');
|
|
71
|
+
/**
|
|
72
|
+
* Re-hash the file on disk before uploading. This needs no support from the
|
|
73
|
+
* store and is what actually guarantees the bytes match the manifest.
|
|
74
|
+
*/
|
|
75
|
+
const validateLocalFile = (appRoot, file) => {
|
|
76
|
+
// `resolveExistingPathWithinRoot` resolves symlinks, so a source path that
|
|
77
|
+
// points out of the app root through one is refused here too.
|
|
78
|
+
const absolutePath = resolveExistingPathWithinRoot(appRoot, file.sourcePath);
|
|
79
|
+
const content = fs.readFileSync(absolutePath);
|
|
80
|
+
if (content.byteLength !== file.size || hashBuffer(content) !== file.sha256) {
|
|
81
|
+
throw new Error(`Release artifact changed after build: ${file.sourcePath}`);
|
|
82
|
+
}
|
|
83
|
+
return absolutePath;
|
|
84
|
+
};
|
|
85
|
+
export const planReleasePublish = (options) => {
|
|
86
|
+
const { absolutePath, manifest } = loadReleaseManifest(options.appRoot, options.manifestPath);
|
|
87
|
+
validateDestination(manifest, options.store);
|
|
88
|
+
for (const file of manifest.files) {
|
|
89
|
+
validateLocalFile(options.appRoot, file);
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
releaseId: manifest.releaseId,
|
|
93
|
+
manifestPath: absolutePath,
|
|
94
|
+
manifestObjectKey: releaseObjectKey(manifest.destination.releasePrefix, MANIFEST_SOURCE_PATH),
|
|
95
|
+
destination: manifest.destination,
|
|
96
|
+
files: manifest.files,
|
|
97
|
+
totalBytes: manifest.files.reduce((total, file) => total + file.size, 0),
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Verify one uploaded object against the hash in the manifest.
|
|
102
|
+
*
|
|
103
|
+
* `statFile` is optional on `IFileStore`, and a store that has it may still
|
|
104
|
+
* report no `sha256` (S3 only returns one when the object carries a checksum).
|
|
105
|
+
* Neither case is a failure: verification is skipped, the key is reported back
|
|
106
|
+
* as unverified, and the caller warns once. An `etag` is deliberately not used
|
|
107
|
+
* as a substitute — it is not a content hash.
|
|
108
|
+
*/
|
|
109
|
+
const verifyUpload = (store, objectKey, expected) => __awaiter(void 0, void 0, void 0, function* () {
|
|
110
|
+
if (typeof store.statFile !== 'function')
|
|
111
|
+
return 'unsupported';
|
|
112
|
+
const stat = yield store.statFile(objectKey);
|
|
113
|
+
if (!stat) {
|
|
114
|
+
throw new Error(`Uploaded artifact is missing from the store: ${objectKey}`);
|
|
115
|
+
}
|
|
116
|
+
if (stat.size !== expected.size) {
|
|
117
|
+
throw new Error(`Uploaded artifact size does not match the manifest: ${objectKey}`);
|
|
118
|
+
}
|
|
119
|
+
if (!stat.sha256)
|
|
120
|
+
return 'no-hash';
|
|
121
|
+
if (stat.sha256 !== expected.sha256) {
|
|
122
|
+
throw new Error(`Uploaded artifact verification failed: ${objectKey}`);
|
|
123
|
+
}
|
|
124
|
+
return 'verified';
|
|
125
|
+
});
|
|
126
|
+
export const publishRelease = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
127
|
+
var _a, _b;
|
|
128
|
+
const plan = planReleasePublish(options);
|
|
129
|
+
if (!options.yes) {
|
|
130
|
+
return {
|
|
131
|
+
releaseId: plan.releaseId,
|
|
132
|
+
uploadedFiles: 0,
|
|
133
|
+
uploadedBytes: 0,
|
|
134
|
+
dryRun: true,
|
|
135
|
+
unverified: [],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const unverified = [];
|
|
139
|
+
let warnedAboutVerification = false;
|
|
140
|
+
const noteUnverified = (objectKey, reason) => {
|
|
141
|
+
var _a;
|
|
142
|
+
unverified.push(objectKey);
|
|
143
|
+
if (warnedAboutVerification)
|
|
144
|
+
return;
|
|
145
|
+
warnedAboutVerification = true;
|
|
146
|
+
(_a = options.onWarning) === null || _a === void 0 ? void 0 : _a.call(options, `Cannot verify uploads against a store hash (${reason}). Files are still ` +
|
|
147
|
+
'checked against the manifest before upload; the remote copy is not re-checked.');
|
|
148
|
+
};
|
|
149
|
+
const upload = (objectKey, content, contentType, cacheControl, sha256) => __awaiter(void 0, void 0, void 0, function* () {
|
|
150
|
+
// `preventDuplicates: false` is explicit: a release key must be exactly the
|
|
151
|
+
// key in the manifest. `LocalFileStore` otherwise appends a random suffix,
|
|
152
|
+
// which would both break the URL and make verification meaningless.
|
|
153
|
+
const storedURL = yield options.store.saveFile(objectKey, content, {
|
|
154
|
+
mimeType: contentType,
|
|
155
|
+
cacheControl,
|
|
156
|
+
preventDuplicates: false,
|
|
157
|
+
});
|
|
158
|
+
// A release key has to survive the round trip verbatim, or the published
|
|
159
|
+
// URLs in the bundle point at nothing. Some stores sanitise or suffix the
|
|
160
|
+
// path they are given; say so plainly instead of failing later with a
|
|
161
|
+
// confusing "missing from the store".
|
|
162
|
+
if (typeof storedURL === 'string' && !storedURL.endsWith(objectKey)) {
|
|
163
|
+
throw new Error(`The file store did not store the release object under its own key. ` +
|
|
164
|
+
`Expected a location ending in "${objectKey}", got "${storedURL}". ` +
|
|
165
|
+
'A release store must keep object keys verbatim.');
|
|
166
|
+
}
|
|
167
|
+
const outcome = yield verifyUpload(options.store, objectKey, {
|
|
168
|
+
size: content.byteLength,
|
|
169
|
+
sha256,
|
|
170
|
+
});
|
|
171
|
+
if (outcome === 'unsupported') {
|
|
172
|
+
noteUnverified(objectKey, 'this store does not implement statFile');
|
|
173
|
+
}
|
|
174
|
+
else if (outcome === 'no-hash') {
|
|
175
|
+
noteUnverified(objectKey, 'the store reports no sha256 for stored objects');
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
const totalUploads = plan.files.length + 1;
|
|
179
|
+
let completedUploads = 0;
|
|
180
|
+
/**
|
|
181
|
+
* A failure halfway through leaves a partial prefix behind, so the message
|
|
182
|
+
* has to say which object failed, where it was going and how much is already
|
|
183
|
+
* there — and that a re-run finishes the job, since keys are deterministic
|
|
184
|
+
* and every object is overwritten with identical bytes.
|
|
185
|
+
*/
|
|
186
|
+
const describeFailure = (error, what, objectKey) => {
|
|
187
|
+
const cause = error instanceof Error ? error : new Error(String(error));
|
|
188
|
+
const failure = new Error(`Release upload failed while uploading ${what} to "${objectKey}" ` +
|
|
189
|
+
`(store ${options.store.accessURL || '(no accessURL)'}): ${cause.message}. ` +
|
|
190
|
+
`${completedUploads} of ${totalUploads} objects were already uploaded under ` +
|
|
191
|
+
`"${plan.destination.releasePrefix}"; the release manifest was not uploaded, so the ` +
|
|
192
|
+
'release is incomplete. Re-running publish-app resumes it — object keys are ' +
|
|
193
|
+
'deterministic and already-uploaded objects are rewritten with identical bytes.');
|
|
194
|
+
failure.cause = cause;
|
|
195
|
+
failure.stack = cause.stack
|
|
196
|
+
? `${failure.message}\nCaused by: ${cause.stack}`
|
|
197
|
+
: failure.stack;
|
|
198
|
+
return failure;
|
|
199
|
+
};
|
|
200
|
+
for (const file of plan.files) {
|
|
201
|
+
const absolutePath = resolveExistingPathWithinRoot(options.appRoot, file.sourcePath);
|
|
202
|
+
try {
|
|
203
|
+
yield upload(file.objectKey, fs.readFileSync(absolutePath), file.contentType, file.cacheControl, file.sha256);
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
throw describeFailure(error, file.sourcePath, file.objectKey);
|
|
207
|
+
}
|
|
208
|
+
completedUploads += 1;
|
|
209
|
+
(_a = options.onProgress) === null || _a === void 0 ? void 0 : _a.call(options, {
|
|
210
|
+
completed: completedUploads,
|
|
211
|
+
total: totalUploads,
|
|
212
|
+
objectKey: file.objectKey,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
// The manifest goes last: its presence under the release prefix is what marks
|
|
216
|
+
// the release as complete.
|
|
217
|
+
const manifestBody = fs.readFileSync(plan.manifestPath);
|
|
218
|
+
try {
|
|
219
|
+
yield upload(plan.manifestObjectKey, manifestBody, MANIFEST_CONTENT_TYPE, ENTRY_CACHE_CONTROL, hashBuffer(manifestBody));
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
throw describeFailure(error, 'the release manifest', plan.manifestObjectKey);
|
|
223
|
+
}
|
|
224
|
+
completedUploads += 1;
|
|
225
|
+
(_b = options.onProgress) === null || _b === void 0 ? void 0 : _b.call(options, {
|
|
226
|
+
completed: completedUploads,
|
|
227
|
+
total: totalUploads,
|
|
228
|
+
objectKey: plan.manifestObjectKey,
|
|
229
|
+
});
|
|
230
|
+
return {
|
|
231
|
+
releaseId: plan.releaseId,
|
|
232
|
+
uploadedFiles: totalUploads,
|
|
233
|
+
uploadedBytes: plan.totalBytes + manifestBody.byteLength,
|
|
234
|
+
dryRun: false,
|
|
235
|
+
unverified,
|
|
236
|
+
};
|
|
237
|
+
});
|
|
238
|
+
//# sourceMappingURL=publisher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publisher.js","sourceRoot":"","sources":["../../../src/app-release/publisher.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAC,oBAAoB,EAAE,6BAA6B,EAAC,MAAM,YAAY,CAAC;AA+B/E;;;;;;;;;GASG;AACH,MAAM,iBAAiB,GAAG,CACxB,aAAqB,EACrB,IAA0B,EACpB,EAAE;;IACR,MAAM,UAAU,GAAG,oBAAoB,CACrC,MAAM,CAAC,MAAA,IAAI,CAAC,UAAU,mCAAI,EAAE,CAAC,EAC7B,aAAa,CACd,CAAC;IACF,MAAM,SAAS,GAAG,oBAAoB,CACpC,MAAM,CAAC,MAAA,IAAI,CAAC,SAAS,mCAAI,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IACxD,IAAI,CAAC;QACH,MAAM,MAAM,CACV,IAAI,CAAC,iBAAiB,EACtB,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,CAAC,YAAY,CAAC,CACzB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,eAAe,CAAC,KAAK,EAAE,sBAAsB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC/E,CAAC;IACD,gBAAgB,IAAI,CAAC,CAAC;IACtB,MAAA,OAAO,CAAC,UAAU,wDAAG;QACnB,SAAS,EAAE,gBAAgB;QAC3B,KAAK,EAAE,YAAY;QACnB,SAAS,EAAE,IAAI,CAAC,iBAAiB;KAClC,CAAC,CAAC;IAEH,OAAO;QACL,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,aAAa,EAAE,YAAY;QAC3B,aAAa,EAAE,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU;QACxD,MAAM,EAAE,KAAK;QACb,UAAU;KACX,CAAC;AACJ,CAAC,CAAA,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AppBuildTarget } from './types.js';
|
|
2
|
+
export interface ResolveBuildTargetOptions {
|
|
3
|
+
target?: AppBuildTarget;
|
|
4
|
+
appEnv?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the app build target.
|
|
8
|
+
*
|
|
9
|
+
* `APP_ENV` selects the Capacitor target only when it literally says
|
|
10
|
+
* `capacitor`. It used to be read as a boolean — any non-empty value meant
|
|
11
|
+
* "native" — which quietly hijacked the far more common `APP_ENV=production`
|
|
12
|
+
* into a near-empty, non-publishable manifest, and then made `--target web`
|
|
13
|
+
* fail outright. Nothing else in this monorepo reads `APP_ENV`, so there is no
|
|
14
|
+
* boolean contract left to preserve; an unrelated value is ignored and the
|
|
15
|
+
* build defaults to web, exactly as it does with `APP_ENV` unset. Pass
|
|
16
|
+
* `--target` to be explicit.
|
|
17
|
+
*/
|
|
18
|
+
export declare const resolveBuildTarget: ({ target, appEnv, }?: ResolveBuildTargetOptions) => AppBuildTarget;
|
|
19
|
+
//# sourceMappingURL=resolve-build-target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-build-target.d.ts","sourceRoot":"","sources":["../../../src/app-release/resolve-build-target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAKD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,GAAI,sBAGhC,yBAA8B,KAAG,cAsBnC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** The only `APP_ENV` value that selects a native build. */
|
|
2
|
+
const CAPACITOR_APP_ENV = 'capacitor';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the app build target.
|
|
5
|
+
*
|
|
6
|
+
* `APP_ENV` selects the Capacitor target only when it literally says
|
|
7
|
+
* `capacitor`. It used to be read as a boolean — any non-empty value meant
|
|
8
|
+
* "native" — which quietly hijacked the far more common `APP_ENV=production`
|
|
9
|
+
* into a near-empty, non-publishable manifest, and then made `--target web`
|
|
10
|
+
* fail outright. Nothing else in this monorepo reads `APP_ENV`, so there is no
|
|
11
|
+
* boolean contract left to preserve; an unrelated value is ignored and the
|
|
12
|
+
* build defaults to web, exactly as it does with `APP_ENV` unset. Pass
|
|
13
|
+
* `--target` to be explicit.
|
|
14
|
+
*/
|
|
15
|
+
export const resolveBuildTarget = ({ target, appEnv = process.env.APP_ENV, } = {}) => {
|
|
16
|
+
if (target !== undefined && target !== 'web' && target !== 'capacitor') {
|
|
17
|
+
throw new Error(`Unknown app build target "${String(target)}". Expected "web" or "capacitor".`);
|
|
18
|
+
}
|
|
19
|
+
const isCapacitorEnvironment = (appEnv || '').trim().toLowerCase() === CAPACITOR_APP_ENV;
|
|
20
|
+
// An explicit web target cannot silently override an explicit
|
|
21
|
+
// `APP_ENV=capacitor`, because that would make a native build publishable.
|
|
22
|
+
if (target === 'web' && isCapacitorEnvironment) {
|
|
23
|
+
throw new Error('Cannot build target "web" while APP_ENV=capacitor. Unset APP_ENV or use --target capacitor.');
|
|
24
|
+
}
|
|
25
|
+
if (target) {
|
|
26
|
+
return target;
|
|
27
|
+
}
|
|
28
|
+
return isCapacitorEnvironment ? 'capacitor' : 'web';
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=resolve-build-target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-build-target.js","sourceRoot":"","sources":["../../../src/app-release/resolve-build-target.ts"],"names":[],"mappings":"AAOA,4DAA4D;AAC5D,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,MAAM,EACN,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,MACC,EAAE,EAAkB,EAAE;IACnD,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;QACvE,MAAM,IAAI,KAAK,CACb,6BAA6B,MAAM,CAAC,MAAM,CAAC,mCAAmC,CAC/E,CAAC;IACJ,CAAC;IACD,MAAM,sBAAsB,GAC1B,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,iBAAiB,CAAC;IAE5D,8DAA8D;IAC9D,2EAA2E;IAC3E,IAAI,MAAM,KAAK,KAAK,IAAI,sBAAsB,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CACb,6FAA6F,CAC9F,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,sBAAsB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC;AACtD,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const PUBLIC_ROOT = "public";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve `publish.staticAssets` globs to files under the app's `public/`.
|
|
4
|
+
*
|
|
5
|
+
* Both the pattern and every match are checked. Checking only the pattern is
|
|
6
|
+
* not enough: brace expansion escapes it, and `public/{,../}secret/**` expands
|
|
7
|
+
* to `public/../secret/**`, which glob returns as plain `secret/…` paths — a
|
|
8
|
+
* prefix test on the pattern sees `public/` and lets them through. So each
|
|
9
|
+
* match is resolved (following symlinks) and has to land inside `public/`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const resolveDeclaredStaticAssets: (appRoot: string, patterns?: string[]) => string[];
|
|
12
|
+
export declare const relativePublicAssetPath: (publicRoot: string, absoluteOrRelativePath: string) => string;
|
|
13
|
+
//# sourceMappingURL=static-assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static-assets.d.ts","sourceRoot":"","sources":["../../../src/app-release/static-assets.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,WAAW,WAAW,CAAC;AAEpC;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,GACtC,SAAS,MAAM,EACf,WAAU,MAAM,EAAO,KACtB,MAAM,EA6CR,CAAC;AAKF,eAAO,MAAM,uBAAuB,GAClC,YAAY,MAAM,EAClB,wBAAwB,MAAM,KAC7B,MAKF,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { globSync } from 'glob';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { normalizeReleasePath, resolveExistingPathWithinRoot, } from './paths.js';
|
|
5
|
+
export const PUBLIC_ROOT = 'public';
|
|
6
|
+
/**
|
|
7
|
+
* Resolve `publish.staticAssets` globs to files under the app's `public/`.
|
|
8
|
+
*
|
|
9
|
+
* Both the pattern and every match are checked. Checking only the pattern is
|
|
10
|
+
* not enough: brace expansion escapes it, and `public/{,../}secret/**` expands
|
|
11
|
+
* to `public/../secret/**`, which glob returns as plain `secret/…` paths — a
|
|
12
|
+
* prefix test on the pattern sees `public/` and lets them through. So each
|
|
13
|
+
* match is resolved (following symlinks) and has to land inside `public/`.
|
|
14
|
+
*/
|
|
15
|
+
export const resolveDeclaredStaticAssets = (appRoot, patterns = []) => {
|
|
16
|
+
const matches = new Set();
|
|
17
|
+
if (patterns.length === 0)
|
|
18
|
+
return [];
|
|
19
|
+
const publicPath = path.join(appRoot, PUBLIC_ROOT);
|
|
20
|
+
if (!fs.existsSync(publicPath)) {
|
|
21
|
+
throw new Error(`static assets are declared but ${PUBLIC_ROOT}/ does not exist in ${appRoot}`);
|
|
22
|
+
}
|
|
23
|
+
const publicRealPath = fs.realpathSync(publicPath);
|
|
24
|
+
for (const pattern of patterns) {
|
|
25
|
+
const normalizedPattern = normalizeReleasePath(pattern, 'static asset pattern');
|
|
26
|
+
if (!isUnderPublicRoot(normalizedPattern)) {
|
|
27
|
+
throw new Error(`static asset pattern must stay inside public/: ${pattern}`);
|
|
28
|
+
}
|
|
29
|
+
for (const match of globSync(normalizedPattern, {
|
|
30
|
+
cwd: appRoot,
|
|
31
|
+
nodir: true,
|
|
32
|
+
dot: false,
|
|
33
|
+
follow: false,
|
|
34
|
+
})) {
|
|
35
|
+
const normalizedMatch = normalizeReleasePath(match, 'static asset path');
|
|
36
|
+
const absoluteMatch = resolveExistingPathWithinRoot(appRoot, normalizedMatch);
|
|
37
|
+
const relativeToPublic = path.relative(publicRealPath, absoluteMatch);
|
|
38
|
+
if (!isUnderPublicRoot(normalizedMatch) ||
|
|
39
|
+
relativeToPublic.startsWith('..') ||
|
|
40
|
+
path.isAbsolute(relativeToPublic)) {
|
|
41
|
+
throw new Error(`static asset "${match}" (from pattern ${pattern}) resolves outside public/`);
|
|
42
|
+
}
|
|
43
|
+
matches.add(normalizedMatch);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return [...matches].sort((a, b) => a.localeCompare(b));
|
|
47
|
+
};
|
|
48
|
+
const isUnderPublicRoot = (normalizedPath) => normalizedPath.startsWith(`${PUBLIC_ROOT}/`);
|
|
49
|
+
export const relativePublicAssetPath = (publicRoot, absoluteOrRelativePath) => {
|
|
50
|
+
const relativePath = path.isAbsolute(absoluteOrRelativePath)
|
|
51
|
+
? path.relative(publicRoot, absoluteOrRelativePath)
|
|
52
|
+
: absoluteOrRelativePath;
|
|
53
|
+
return normalizeReleasePath(relativePath, 'public asset path');
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=static-assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static-assets.js","sourceRoot":"","sources":["../../../src/app-release/static-assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAC,QAAQ,EAAC,MAAM,MAAM,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEpC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,OAAe,EACf,WAAqB,EAAE,EACb,EAAE;IACZ,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACrC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACnD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,kCAAkC,WAAW,uBAAuB,OAAO,EAAE,CAC9E,CAAC;IACJ,CAA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AW,EAAE,CAC5D,cAAc,CAAC,UAAU,CAAC,GAAG,WAAW,GAAG,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,UAAkB,EAClB,sBAA8B,EACtB,EAAE;IACV,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC;QAC1D,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,sBAAsB,CAAC;QACnD,CAAC,CAAC,sBAAsB,CAAC;IAC3B,OAAO,oBAAoB,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAC;AACjE,CAAC,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export type AppBuildTarget = 'web' | 'capacitor';
|
|
2
|
+
export interface BuildAppOptions {
|
|
3
|
+
environments: string[];
|
|
4
|
+
target?: AppBuildTarget;
|
|
5
|
+
}
|
|
6
|
+
export interface AppPublishConfig {
|
|
7
|
+
/** Extra files under `public/` to ship besides the Vite bundle output. */
|
|
8
|
+
staticAssets?: string[];
|
|
9
|
+
/**
|
|
10
|
+
* Base key every release is nested under. The release prefix becomes
|
|
11
|
+
* `<releasePrefix>/<releaseId>`. Defaults to `releases`.
|
|
12
|
+
*/
|
|
13
|
+
releasePrefix?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Where a release was built for. `accessURL` is the base URL of the file store
|
|
17
|
+
* that produced the manifest (see `IFileStore.accessURL`); publishing refuses
|
|
18
|
+
* to run against a store whose `accessURL` no longer matches, so a staging
|
|
19
|
+
* build can never be pushed to production by swapping config.
|
|
20
|
+
*/
|
|
21
|
+
export interface LinkedAppReleaseDestination {
|
|
22
|
+
accessURL: string;
|
|
23
|
+
/** Key prefix every object of this release lives under. */
|
|
24
|
+
releasePrefix: string;
|
|
25
|
+
/**
|
|
26
|
+
* Public URL the release's client bundle is served from — `accessURL`,
|
|
27
|
+
* the release prefix and the Vite output directory joined. The build passes
|
|
28
|
+
* it to Vite as `base`, so the bundle's own asset URLs resolve under the
|
|
29
|
+
* release prefix with no server rewrite. Empty for a Capacitor build.
|
|
30
|
+
*/
|
|
31
|
+
baseURL: string;
|
|
32
|
+
}
|
|
33
|
+
export interface LinkedAppReleaseFile {
|
|
34
|
+
/** Path relative to the app root, used to read the file back at publish time. */
|
|
35
|
+
sourcePath: string;
|
|
36
|
+
/** Key in the file store, always under the release prefix. */
|
|
37
|
+
objectKey: string;
|
|
38
|
+
sha256: string;
|
|
39
|
+
size: number;
|
|
40
|
+
contentType: string;
|
|
41
|
+
cacheControl: string;
|
|
42
|
+
}
|
|
43
|
+
export interface LinkedAppReleaseManifest {
|
|
44
|
+
schemaVersion: 1;
|
|
45
|
+
appName: string;
|
|
46
|
+
appVersion: string;
|
|
47
|
+
releaseId: string;
|
|
48
|
+
target: AppBuildTarget;
|
|
49
|
+
publishable: boolean;
|
|
50
|
+
builtAt: string;
|
|
51
|
+
environmentNames: string[];
|
|
52
|
+
destination: LinkedAppReleaseDestination;
|
|
53
|
+
files: LinkedAppReleaseFile[];
|
|
54
|
+
}
|
|
55
|
+
export interface PublishPlan {
|
|
56
|
+
releaseId: string;
|
|
57
|
+
manifestPath: string;
|
|
58
|
+
manifestObjectKey: string;
|
|
59
|
+
destination: LinkedAppReleaseDestination;
|
|
60
|
+
files: LinkedAppReleaseFile[];
|
|
61
|
+
totalBytes: number;
|
|
62
|
+
}
|
|
63
|
+
export interface PublishResult {
|
|
64
|
+
releaseId: string;
|
|
65
|
+
uploadedFiles: number;
|
|
66
|
+
uploadedBytes: number;
|
|
67
|
+
dryRun: boolean;
|
|
68
|
+
/** Object keys whose upload could not be verified against a store hash. */
|
|
69
|
+
unverified: string[];
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/app-release/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,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