@ankhorage/deploy 0.9.0 → 0.10.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 +6 -0
- package/README.md +1 -1
- package/dist/cli/DeployCliEnvironment.d.ts +13 -0
- package/dist/cli/DeployCliEnvironment.d.ts.map +1 -0
- package/dist/cli/DeployCliEnvironment.js +13 -0
- package/dist/cli/DeployCliEnvironment.js.map +1 -0
- package/dist/cli/DeployCliInput.d.ts +6 -0
- package/dist/cli/DeployCliInput.d.ts.map +1 -0
- package/dist/cli/DeployCliInput.js +2 -0
- package/dist/cli/DeployCliInput.js.map +1 -0
- package/dist/cli/DeployCliOptions.d.ts +14 -0
- package/dist/cli/DeployCliOptions.d.ts.map +1 -0
- package/dist/cli/DeployCliOptions.js +2 -0
- package/dist/cli/DeployCliOptions.js.map +1 -0
- package/dist/cli/DeployCliRuntime.d.ts +9 -0
- package/dist/cli/DeployCliRuntime.d.ts.map +1 -0
- package/dist/cli/DeployCliRuntime.js +2 -0
- package/dist/cli/DeployCliRuntime.js.map +1 -0
- package/dist/cli/createDeployCliAccess.d.ts +4 -0
- package/dist/cli/createDeployCliAccess.d.ts.map +1 -0
- package/dist/cli/createDeployCliAccess.js +65 -0
- package/dist/cli/createDeployCliAccess.js.map +1 -0
- package/dist/cli/createDeployCliProvider.d.ts +4 -0
- package/dist/cli/createDeployCliProvider.d.ts.map +1 -0
- package/dist/cli/createDeployCliProvider.js +35 -0
- package/dist/cli/createDeployCliProvider.js.map +1 -0
- package/dist/cli/defaultDeployCliRuntime.d.ts +3 -0
- package/dist/cli/defaultDeployCliRuntime.d.ts.map +1 -0
- package/dist/cli/defaultDeployCliRuntime.js +11 -0
- package/dist/cli/defaultDeployCliRuntime.js.map +1 -0
- package/dist/cli/handleDeployCliCommand.d.ts +5 -0
- package/dist/cli/handleDeployCliCommand.d.ts.map +1 -0
- package/dist/cli/handleDeployCliCommand.js +62 -0
- package/dist/cli/handleDeployCliCommand.js.map +1 -0
- package/dist/cli/handleDeployCliPlan.d.ts +5 -0
- package/dist/cli/handleDeployCliPlan.d.ts.map +1 -0
- package/dist/cli/handleDeployCliPlan.js +22 -0
- package/dist/cli/handleDeployCliPlan.js.map +1 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +6 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/inspectDeployCliRelease.d.ts +16 -0
- package/dist/cli/inspectDeployCliRelease.d.ts.map +1 -0
- package/dist/cli/inspectDeployCliRelease.js +17 -0
- package/dist/cli/inspectDeployCliRelease.js.map +1 -0
- package/dist/cli/mapDeployCliPlan.d.ts +5 -0
- package/dist/cli/mapDeployCliPlan.d.ts.map +1 -0
- package/dist/cli/mapDeployCliPlan.js +29 -0
- package/dist/cli/mapDeployCliPlan.js.map +1 -0
- package/dist/cli/parseDeployCliOptions.d.ts +11 -0
- package/dist/cli/parseDeployCliOptions.d.ts.map +1 -0
- package/dist/cli/parseDeployCliOptions.js +93 -0
- package/dist/cli/parseDeployCliOptions.js.map +1 -0
- package/dist/cli/renderDeployCliExecution.d.ts +3 -0
- package/dist/cli/renderDeployCliExecution.d.ts.map +1 -0
- package/dist/cli/renderDeployCliExecution.js +22 -0
- package/dist/cli/renderDeployCliExecution.js.map +1 -0
- package/dist/cli/renderDeployCliFailure.d.ts +3 -0
- package/dist/cli/renderDeployCliFailure.d.ts.map +1 -0
- package/dist/cli/renderDeployCliFailure.js +6 -0
- package/dist/cli/renderDeployCliFailure.js.map +1 -0
- package/dist/cli/renderDeployCliPlan.d.ts +4 -0
- package/dist/cli/renderDeployCliPlan.d.ts.map +1 -0
- package/dist/cli/renderDeployCliPlan.js +50 -0
- package/dist/cli/renderDeployCliPlan.js.map +1 -0
- package/package.json +15 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @ankhorage/deploy
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b10e259: Add the first-class `@ankhorage/deploy/cli` provider for category-root `ankh deploy` and `ankh plan deploy`, with dry-run planning, explicit runtime release context, host-owned confirmation, transient ENV credential mapping and offline safety coverage.
|
|
8
|
+
|
|
3
9
|
## 0.9.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# @ankhorage/deploy
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Declarative deployment engine for Expo apps across web, iOS, and Android.
|
|
9
9
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transient environment inputs understood by `ankh deploy`.
|
|
3
|
+
*
|
|
4
|
+
* Google Play expects the complete service-account JSON string.
|
|
5
|
+
* App Store Connect expects JSON containing keyId, issuerId and privateKey.
|
|
6
|
+
* EAS expects the raw Expo access token.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEPLOY_CLI_ENVIRONMENT: {
|
|
9
|
+
readonly googlePlayServiceAccountJson: "ANKH_DEPLOY_GOOGLE_PLAY_SERVICE_ACCOUNT_JSON";
|
|
10
|
+
readonly appStoreConnectApiKeyJson: "ANKH_DEPLOY_APP_STORE_CONNECT_API_KEY_JSON";
|
|
11
|
+
readonly easToken: "ANKH_DEPLOY_EAS_TOKEN";
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=DeployCliEnvironment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeployCliEnvironment.d.ts","sourceRoot":"","sources":["../../src/cli/DeployCliEnvironment.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transient environment inputs understood by `ankh deploy`.
|
|
3
|
+
*
|
|
4
|
+
* Google Play expects the complete service-account JSON string.
|
|
5
|
+
* App Store Connect expects JSON containing keyId, issuerId and privateKey.
|
|
6
|
+
* EAS expects the raw Expo access token.
|
|
7
|
+
*/
|
|
8
|
+
export const DEPLOY_CLI_ENVIRONMENT = {
|
|
9
|
+
googlePlayServiceAccountJson: 'ANKH_DEPLOY_GOOGLE_PLAY_SERVICE_ACCOUNT_JSON',
|
|
10
|
+
appStoreConnectApiKeyJson: 'ANKH_DEPLOY_APP_STORE_CONNECT_API_KEY_JSON',
|
|
11
|
+
easToken: 'ANKH_DEPLOY_EAS_TOKEN',
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=DeployCliEnvironment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeployCliEnvironment.js","sourceRoot":"","sources":["../../src/cli/DeployCliEnvironment.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,4BAA4B,EAAE,8CAA8C;IAC5E,yBAAyB,EAAE,4CAA4C;IACvE,QAAQ,EAAE,uBAAuB;CACzB,CAAC","sourcesContent":["/**\n * Transient environment inputs understood by `ankh deploy`.\n *\n * Google Play expects the complete service-account JSON string.\n * App Store Connect expects JSON containing keyId, issuerId and privateKey.\n * EAS expects the raw Expo access token.\n */\nexport const DEPLOY_CLI_ENVIRONMENT = {\n googlePlayServiceAccountJson: 'ANKH_DEPLOY_GOOGLE_PLAY_SERVICE_ACCOUNT_JSON',\n appStoreConnectApiKeyJson: 'ANKH_DEPLOY_APP_STORE_CONNECT_API_KEY_JSON',\n easToken: 'ANKH_DEPLOY_EAS_TOKEN',\n} as const;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeployCliInput.d.ts","sourceRoot":"","sources":["../../src/cli/DeployCliInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;CACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeployCliInput.js","sourceRoot":"","sources":["../../src/cli/DeployCliInput.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnkhCommandContext } from '@ankhorage/ankh';\n\nexport interface DeployCliInput {\n readonly argv: readonly string[];\n readonly context: AnkhCommandContext;\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AndroidDeploymentTrack } from '../index.js';
|
|
2
|
+
export interface DeployCliOptions {
|
|
3
|
+
readonly projectRoot: string;
|
|
4
|
+
readonly dryRun: boolean;
|
|
5
|
+
readonly yes: boolean;
|
|
6
|
+
readonly format: 'human' | 'json';
|
|
7
|
+
readonly executionId?: string;
|
|
8
|
+
readonly androidTrack?: AndroidDeploymentTrack;
|
|
9
|
+
readonly androidBuildProfile?: string;
|
|
10
|
+
readonly iosBuildProfile?: string;
|
|
11
|
+
readonly webAlias?: string;
|
|
12
|
+
readonly webEnvironment?: string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=DeployCliOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeployCliOptions.d.ts","sourceRoot":"","sources":["../../src/cli/DeployCliOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,sBAAsB,CAAC;IAC/C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeployCliOptions.js","sourceRoot":"","sources":["../../src/cli/DeployCliOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { AndroidDeploymentTrack } from '../index.js';\n\nexport interface DeployCliOptions {\n readonly projectRoot: string;\n readonly dryRun: boolean;\n readonly yes: boolean;\n readonly format: 'human' | 'json';\n readonly executionId?: string;\n readonly androidTrack?: AndroidDeploymentTrack;\n readonly androidBuildProfile?: string;\n readonly iosBuildProfile?: string;\n readonly webAlias?: string;\n readonly webEnvironment?: string;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReleasePlan } from '../index.js';
|
|
2
|
+
import type { ExecuteProjectReleaseOptions, InspectProjectReleaseOptions, ProjectReleaseExecutionResult, ProjectReleaseInspection, ProjectReleaseInspectionResult } from '../project/index.js';
|
|
3
|
+
export interface DeployCliRuntime {
|
|
4
|
+
inspectProjectRelease(options: InspectProjectReleaseOptions): Promise<ProjectReleaseInspectionResult>;
|
|
5
|
+
createProjectReleasePlan(inspection: ProjectReleaseInspection): ReleasePlan;
|
|
6
|
+
executeProjectRelease(options: ExecuteProjectReleaseOptions): Promise<ProjectReleaseExecutionResult>;
|
|
7
|
+
createExecutionId(): string;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=DeployCliRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeployCliRuntime.d.ts","sourceRoot":"","sources":["../../src/cli/DeployCliRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EACV,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,wBAAwB,EACxB,8BAA8B,EAC/B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,gBAAgB;IAC/B,qBAAqB,CACnB,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAC3C,wBAAwB,CAAC,UAAU,EAAE,wBAAwB,GAAG,WAAW,CAAC;IAC5E,qBAAqB,CACnB,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAC1C,iBAAiB,IAAI,MAAM,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeployCliRuntime.js","sourceRoot":"","sources":["../../src/cli/DeployCliRuntime.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReleasePlan } from '../index.js';\nimport type {\n ExecuteProjectReleaseOptions,\n InspectProjectReleaseOptions,\n ProjectReleaseExecutionResult,\n ProjectReleaseInspection,\n ProjectReleaseInspectionResult,\n} from '../project/index.js';\n\nexport interface DeployCliRuntime {\n inspectProjectRelease(\n options: InspectProjectReleaseOptions,\n ): Promise<ProjectReleaseInspectionResult>;\n createProjectReleasePlan(inspection: ProjectReleaseInspection): ReleasePlan;\n executeProjectRelease(\n options: ExecuteProjectReleaseOptions,\n ): Promise<ProjectReleaseExecutionResult>;\n createExecutionId(): string;\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProjectReleaseAccess } from '../project/index.js';
|
|
2
|
+
import type { DeployCliOptions } from './DeployCliOptions.js';
|
|
3
|
+
export declare function createDeployCliAccess(options: DeployCliOptions, env: Readonly<Record<string, string | undefined>>): ProjectReleaseAccess;
|
|
4
|
+
//# sourceMappingURL=createDeployCliAccess.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDeployCliAccess.d.ts","sourceRoot":"","sources":["../../src/cli/createDeployCliAccess.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,gBAAgB,EACzB,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAChD,oBAAoB,CA6BtB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { DEPLOY_CLI_ENVIRONMENT } from './DeployCliEnvironment.js';
|
|
2
|
+
export function createDeployCliAccess(options, env) {
|
|
3
|
+
const credentials = [];
|
|
4
|
+
const secrets = new Map();
|
|
5
|
+
addSecret(credentials, secrets, env, {
|
|
6
|
+
envName: DEPLOY_CLI_ENVIRONMENT.googlePlayServiceAccountJson,
|
|
7
|
+
id: 'env:google-play-service-account',
|
|
8
|
+
provider: 'google-play',
|
|
9
|
+
kind: 'service-account',
|
|
10
|
+
});
|
|
11
|
+
addSecret(credentials, secrets, env, {
|
|
12
|
+
envName: DEPLOY_CLI_ENVIRONMENT.appStoreConnectApiKeyJson,
|
|
13
|
+
id: 'env:app-store-connect-api-key',
|
|
14
|
+
provider: 'app-store-connect',
|
|
15
|
+
kind: 'api-key',
|
|
16
|
+
});
|
|
17
|
+
addSecret(credentials, secrets, env, {
|
|
18
|
+
envName: DEPLOY_CLI_ENVIRONMENT.easToken,
|
|
19
|
+
id: 'env:eas-token',
|
|
20
|
+
provider: 'eas',
|
|
21
|
+
kind: 'expo-token',
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
credentials,
|
|
25
|
+
resolveSecret: (reference) => Promise.resolve(secrets.get(reference.id) ?? null),
|
|
26
|
+
...androidAccess(options),
|
|
27
|
+
...iosAccess(options),
|
|
28
|
+
...webAccess(options),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function addSecret(credentials, secrets, env, input) {
|
|
32
|
+
const value = env[input.envName]?.trim();
|
|
33
|
+
if (value === undefined || value.length === 0)
|
|
34
|
+
return;
|
|
35
|
+
credentials.push({ id: input.id, provider: input.provider, kind: input.kind });
|
|
36
|
+
secrets.set(input.id, value);
|
|
37
|
+
}
|
|
38
|
+
function androidAccess(options) {
|
|
39
|
+
if (options.androidTrack === undefined)
|
|
40
|
+
return {};
|
|
41
|
+
return {
|
|
42
|
+
android: {
|
|
43
|
+
track: options.androidTrack,
|
|
44
|
+
...(options.androidBuildProfile === undefined
|
|
45
|
+
? {}
|
|
46
|
+
: { buildProfile: options.androidBuildProfile }),
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function iosAccess(options) {
|
|
51
|
+
return options.iosBuildProfile === undefined
|
|
52
|
+
? {}
|
|
53
|
+
: { ios: { buildProfile: options.iosBuildProfile } };
|
|
54
|
+
}
|
|
55
|
+
function webAccess(options) {
|
|
56
|
+
if (options.webAlias === undefined && options.webEnvironment === undefined)
|
|
57
|
+
return {};
|
|
58
|
+
return {
|
|
59
|
+
web: {
|
|
60
|
+
...(options.webAlias === undefined ? {} : { alias: options.webAlias }),
|
|
61
|
+
...(options.webEnvironment === undefined ? {} : { environment: options.webEnvironment }),
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=createDeployCliAccess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDeployCliAccess.js","sourceRoot":"","sources":["../../src/cli/createDeployCliAccess.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,MAAM,UAAU,qBAAqB,CACnC,OAAyB,EACzB,GAAiD;IAEjD,MAAM,WAAW,GAAoC,EAAE,CAAC;I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K,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,aAAa,CAAC,OAAyB;IAC9C,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAClD,OAAO;QACL,OAAO,EAAE;YACP,KAAK,EAAE,OAAO,CAAC,YAAY;YAC3B,GAAG,CAAC,OAAO,CAAC,mBAAmB,KAAK,SAAS;gBAC3C,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,mBAAmB,EAAE,CAAC;SACnD;KACF,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,OAAyB;IAC1C,OAAO,OAAO,CAAC,eAAe,KAAK,SAAS;QAC1C,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;AACzD,CAAC;AAED,SAAS,SAAS,CAAC,OAAyB;IAC1C,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACtF,OAAO;QACL,GAAG,EAAE;YACH,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;YACtE,GAAG,CAAC,OAAO,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC;SACzF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { DeploymentCredentialReference } from '../index.js';\nimport type { ProjectReleaseAccess } from '../project/index.js';\nimport { DEPLOY_CLI_ENVIRONMENT } from './DeployCliEnvironment.js';\nimport type { DeployCliOptions } from './DeployCliOptions.js';\n\nexport function createDeployCliAccess(\n options: DeployCliOptions,\n env: Readonly<Record<string, string | undefined>>,\n): ProjectReleaseAccess {\n const credentials: DeploymentCredentialReference[] = [];\n const secrets = new Map<string, string>();\n addSecret(credentials, secrets, env, {\n envName: DEPLOY_CLI_ENVIRONMENT.googlePlayServiceAccountJson,\n id: 'env:google-play-service-account',\n provider: 'google-play',\n kind: 'service-account',\n });\n addSecret(credentials, secrets, env, {\n envName: DEPLOY_CLI_ENVIRONMENT.appStoreConnectApiKeyJson,\n id: 'env:app-store-connect-api-key',\n provider: 'app-store-connect',\n kind: 'api-key',\n });\n addSecret(credentials, secrets, env, {\n envName: DEPLOY_CLI_ENVIRONMENT.easToken,\n id: 'env:eas-token',\n provider: 'eas',\n kind: 'expo-token',\n });\n\n return {\n credentials,\n resolveSecret: (reference) => Promise.resolve(secrets.get(reference.id) ?? null),\n ...androidAccess(options),\n ...iosAccess(options),\n ...webAccess(options),\n };\n}\n\ninterface SecretInput {\n readonly envName: string;\n readonly id: string;\n readonly provider: string;\n readonly kind: string;\n}\n\nfunction addSecret(\n credentials: DeploymentCredentialReference[],\n secrets: Map<string, string>,\n env: Readonly<Record<string, string | undefined>>,\n input: SecretInput,\n): void {\n const value = env[input.envName]?.trim();\n if (value === undefined || value.length === 0) return;\n credentials.push({ id: input.id, provider: input.provider, kind: input.kind });\n secrets.set(input.id, value);\n}\n\nfunction androidAccess(options: DeployCliOptions): Pick<ProjectReleaseAccess, 'android'> {\n if (options.androidTrack === undefined) return {};\n return {\n android: {\n track: options.androidTrack,\n ...(options.androidBuildProfile === undefined\n ? {}\n : { buildProfile: options.androidBuildProfile }),\n },\n };\n}\n\nfunction iosAccess(options: DeployCliOptions): Pick<ProjectReleaseAccess, 'ios'> {\n return options.iosBuildProfile === undefined\n ? {}\n : { ios: { buildProfile: options.iosBuildProfile } };\n}\n\nfunction webAccess(options: DeployCliOptions): Pick<ProjectReleaseAccess, 'web'> {\n if (options.webAlias === undefined && options.webEnvironment === undefined) return {};\n return {\n web: {\n ...(options.webAlias === undefined ? {} : { alias: options.webAlias }),\n ...(options.webEnvironment === undefined ? {} : { environment: options.webEnvironment }),\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AnkhRuntimeCommandProvider } from '@ankhorage/ankh';
|
|
2
|
+
import type { DeployCliRuntime } from './DeployCliRuntime.js';
|
|
3
|
+
export declare function createDeployCliProvider(runtime: DeployCliRuntime): AnkhRuntimeCommandProvider;
|
|
4
|
+
//# sourceMappingURL=createDeployCliProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDeployCliProvider.d.ts","sourceRoot":"","sources":["../../src/cli/createDeployCliProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAGlE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI9D,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,gBAAgB,GAAG,0BAA0B,CAiC7F"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import packageJson from '../../package.json';
|
|
2
|
+
import { handleDeployCliCommand } from './handleDeployCliCommand.js';
|
|
3
|
+
import { handleDeployCliPlan } from './handleDeployCliPlan.js';
|
|
4
|
+
export function createDeployCliProvider(runtime) {
|
|
5
|
+
const command = {
|
|
6
|
+
path: [],
|
|
7
|
+
capability: 'deploy.execute',
|
|
8
|
+
summary: 'Inspect, plan and execute the authored project release',
|
|
9
|
+
examples: [
|
|
10
|
+
'ankh deploy',
|
|
11
|
+
'ankh deploy --dry-run',
|
|
12
|
+
'ankh deploy --yes --android-track production',
|
|
13
|
+
],
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
id: packageJson.name,
|
|
17
|
+
category: 'deploy',
|
|
18
|
+
version: packageJson.version,
|
|
19
|
+
capabilities: ['deploy.inspect', 'deploy.plan', 'deploy.execute'],
|
|
20
|
+
commands: [command],
|
|
21
|
+
handlers: [
|
|
22
|
+
{
|
|
23
|
+
path: [],
|
|
24
|
+
handler: (request) => handleDeployCliCommand({ argv: request.argv, context: request.context }, runtime),
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
planningHandlers: [
|
|
28
|
+
{
|
|
29
|
+
path: [],
|
|
30
|
+
handler: (request) => handleDeployCliPlan({ argv: request.argv, context: request.context }, runtime),
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=createDeployCliProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDeployCliProvider.js","sourceRoot":"","sources":["../../src/cli/createDeployCliProvider.ts"],"names":[],"mappings":"AAEA,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,UAAU,uBAAuB,CAAC,OAAyB;IAC/D,MAAM,OAAO,GAAG;QACd,IAAI,EAAE,EAAE;QACR,UAAU,EAAE,gBAAgB;QAC5B,OAAO,EAAE,wDAAwD;QACjE,QAAQ,EAAE;YACR,aAAa;YACb,uBAAuB;YACvB,8CAA8C;SAC/C;KACO,CAAC;IAEX,OAAO;QACL,EAAE,EAAE,WAAW,CAAC,IAAI;QACpB,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,YAAY,EAAE,CAAC,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,CAAC;QACjE,QAAQ,EAAE,CAAC,OAAO,CAAC;QACnB,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,EAAE;gBACR,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CACnB,sBAAsB,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC;aACpF;SACF;QACD,gBAAgB,EAAE;YAChB;gBACE,IAAI,EAAE,EAAE;gBACR,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CACnB,mBAAmB,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC;aACjF;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { AnkhRuntimeCommandProvider } from '@ankhorage/ankh';\n\nimport packageJson from '../../package.json';\nimport type { DeployCliRuntime } from './DeployCliRuntime.js';\nimport { handleDeployCliCommand } from './handleDeployCliCommand.js';\nimport { handleDeployCliPlan } from './handleDeployCliPlan.js';\n\nexport function createDeployCliProvider(runtime: DeployCliRuntime): AnkhRuntimeCommandProvider {\n const command = {\n path: [],\n capability: 'deploy.execute',\n summary: 'Inspect, plan and execute the authored project release',\n examples: [\n 'ankh deploy',\n 'ankh deploy --dry-run',\n 'ankh deploy --yes --android-track production',\n ],\n } as const;\n\n return {\n id: packageJson.name,\n category: 'deploy',\n version: packageJson.version,\n capabilities: ['deploy.inspect', 'deploy.plan', 'deploy.execute'],\n commands: [command],\n handlers: [\n {\n path: [],\n handler: (request) =>\n handleDeployCliCommand({ argv: request.argv, context: request.context }, runtime),\n },\n ],\n planningHandlers: [\n {\n path: [],\n handler: (request) =>\n handleDeployCliPlan({ argv: request.argv, context: request.context }, runtime),\n },\n ],\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultDeployCliRuntime.d.ts","sourceRoot":"","sources":["../../src/cli/defaultDeployCliRuntime.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,eAAO,MAAM,uBAAuB,EAAE,gBAOrC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { createProjectReleasePlan, executeProjectRelease, inspectProjectRelease, } from '../project/index.js';
|
|
3
|
+
export const defaultDeployCliRuntime = {
|
|
4
|
+
inspectProjectRelease,
|
|
5
|
+
createProjectReleasePlan,
|
|
6
|
+
executeProjectRelease,
|
|
7
|
+
createExecutionId() {
|
|
8
|
+
return `release-${randomUUID()}`;
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=defaultDeployCliRuntime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultDeployCliRuntime.js","sourceRoot":"","sources":["../../src/cli/defaultDeployCliRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,CAAC,MAAM,uBAAuB,GAAqB;IACvD,qBAAqB;IACrB,wBAAwB;IACxB,qBAAqB;IACrB,iBAAiB;QACf,OAAO,WAAW,UAAU,EAAE,EAAE,CAAC;IACnC,CAAC;CACF,CAAC","sourcesContent":["import { randomUUID } from 'node:crypto';\n\nimport {\n createProjectReleasePlan,\n executeProjectRelease,\n inspectProjectRelease,\n} from '../project/index.js';\nimport type { DeployCliRuntime } from './DeployCliRuntime.js';\n\nexport const defaultDeployCliRuntime: DeployCliRuntime = {\n inspectProjectRelease,\n createProjectReleasePlan,\n executeProjectRelease,\n createExecutionId() {\n return `release-${randomUUID()}`;\n },\n};\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AnkhCliRunResult } from '@ankhorage/ankh';
|
|
2
|
+
import type { DeployCliInput } from './DeployCliInput.js';
|
|
3
|
+
import type { DeployCliRuntime } from './DeployCliRuntime.js';
|
|
4
|
+
export declare function handleDeployCliCommand(input: DeployCliInput, runtime: DeployCliRuntime): Promise<AnkhCliRunResult>;
|
|
5
|
+
//# sourceMappingURL=handleDeployCliCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleDeployCliCommand.d.ts","sourceRoot":"","sources":["../../src/cli/handleDeployCliCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAA0B,MAAM,iBAAiB,CAAC;AAGhF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAO9D,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,gBAAgB,CAAC,CAoC3B"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { inspectDeployCliRelease } from './inspectDeployCliRelease.js';
|
|
2
|
+
import { parseDeployCliOptions } from './parseDeployCliOptions.js';
|
|
3
|
+
import { renderDeployCliExecution } from './renderDeployCliExecution.js';
|
|
4
|
+
import { renderDeployCliFailure } from './renderDeployCliFailure.js';
|
|
5
|
+
import { renderDeployCliPlan } from './renderDeployCliPlan.js';
|
|
6
|
+
export async function handleDeployCliCommand(input, runtime) {
|
|
7
|
+
const parsed = parseDeployCliOptions(input.argv, input.context.cwd);
|
|
8
|
+
if (!parsed.ok)
|
|
9
|
+
return fail(input, `Deploy CLI: ${parsed.message}\n`);
|
|
10
|
+
const inspected = await inspectDeployCliRelease(parsed.options, input.context.env, runtime);
|
|
11
|
+
if (!inspected.ok)
|
|
12
|
+
return fail(input, renderDeployCliFailure(inspected.failure));
|
|
13
|
+
input.context.writeStdout(renderDeployCliPlan(inspected.inspection, inspected.plan, parsed.options.format));
|
|
14
|
+
const early = earlyResult(parsed.options, inspected.plan);
|
|
15
|
+
if (early !== null)
|
|
16
|
+
return early;
|
|
17
|
+
const confirmation = await confirmMutation(input, parsed.options, inspected.plan);
|
|
18
|
+
if (confirmation === 'declined') {
|
|
19
|
+
input.context.writeStderr('Deployment cancelled; no mutation was performed.\n');
|
|
20
|
+
return { exitCode: 0 };
|
|
21
|
+
}
|
|
22
|
+
if (confirmation !== 'confirmed') {
|
|
23
|
+
return fail(input, 'Deployment requires confirmation. Use --yes for explicit non-interactive approval or --dry-run to inspect only.\n');
|
|
24
|
+
}
|
|
25
|
+
const executionId = parsed.options.executionId ?? runtime.createExecutionId();
|
|
26
|
+
const executed = await runtime.executeProjectRelease({
|
|
27
|
+
...inspected.access,
|
|
28
|
+
inspection: inspected.inspection,
|
|
29
|
+
plan: inspected.plan,
|
|
30
|
+
executionId,
|
|
31
|
+
});
|
|
32
|
+
if (!executed.ok)
|
|
33
|
+
return fail(input, renderDeployCliFailure(executed.failure));
|
|
34
|
+
input.context.writeStdout(renderDeployCliExecution(executed.execution, executionId, parsed.options.format));
|
|
35
|
+
return { exitCode: executed.execution.result.status === 'completed' ? 0 : 1 };
|
|
36
|
+
}
|
|
37
|
+
function earlyResult(options, plan) {
|
|
38
|
+
if (options.dryRun)
|
|
39
|
+
return { exitCode: plan.status === 'blocked' ? 1 : 0 };
|
|
40
|
+
if (plan.status === 'no-change')
|
|
41
|
+
return { exitCode: 0 };
|
|
42
|
+
if (plan.status === 'blocked')
|
|
43
|
+
return { exitCode: 1 };
|
|
44
|
+
if (plan.steps.length === 0)
|
|
45
|
+
return { exitCode: plan.status === 'waiting' ? 1 : 0 };
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
async function confirmMutation(input, options, plan) {
|
|
49
|
+
if (options.yes)
|
|
50
|
+
return 'confirmed';
|
|
51
|
+
const { interaction } = input.context;
|
|
52
|
+
if (interaction === undefined)
|
|
53
|
+
return 'unavailable';
|
|
54
|
+
const irreversible = plan.steps.filter((step) => step.irreversible).length;
|
|
55
|
+
const detail = irreversible === 0 ? '' : ` (${irreversible} irreversible)`;
|
|
56
|
+
return interaction.confirm(`Execute ${plan.steps.length} release step(s)${detail}?`);
|
|
57
|
+
}
|
|
58
|
+
function fail(input, message) {
|
|
59
|
+
input.context.writeStderr(message);
|
|
60
|
+
return { exitCode: 1 };
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=handleDeployCliCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleDeployCliCommand.js","sourceRoot":"","sources":["../../src/cli/handleDeployCliCommand.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,KAAqB,EACrB,OAAyB;IAEzB,MAAM,MAAM,GAAG,qBAAqB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpE,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC,KAAK,EAAE,eAAe,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC;IACtE,MAAM,SAAS,GAAG,MAAM,uBAAuB,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5F,IAAI,CAAC,SAAS,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC,KAAK,EAAE,sBAAsB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAEjF,KAAK,CAAC,OAAO,CAAC,WAAW,CACvB,mBAAmB,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,OA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,IAAI,CAAC,KAAqB,EAAE,OAAe;IAClD,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;AACzB,CAAC","sourcesContent":["import type { AnkhCliRunResult, AnkhConfirmationResult } from '@ankhorage/ankh';\n\nimport type { ReleasePlan } from '../index.js';\nimport type { DeployCliInput } from './DeployCliInput.js';\nimport type { DeployCliOptions } from './DeployCliOptions.js';\nimport type { DeployCliRuntime } from './DeployCliRuntime.js';\nimport { inspectDeployCliRelease } from './inspectDeployCliRelease.js';\nimport { parseDeployCliOptions } from './parseDeployCliOptions.js';\nimport { renderDeployCliExecution } from './renderDeployCliExecution.js';\nimport { renderDeployCliFailure } from './renderDeployCliFailure.js';\nimport { renderDeployCliPlan } from './renderDeployCliPlan.js';\n\nexport async function handleDeployCliCommand(\n input: DeployCliInput,\n runtime: DeployCliRuntime,\n): Promise<AnkhCliRunResult> {\n const parsed = parseDeployCliOptions(input.argv, input.context.cwd);\n if (!parsed.ok) return fail(input, `Deploy CLI: ${parsed.message}\\n`);\n const inspected = await inspectDeployCliRelease(parsed.options, input.context.env, runtime);\n if (!inspected.ok) return fail(input, renderDeployCliFailure(inspected.failure));\n\n input.context.writeStdout(\n renderDeployCliPlan(inspected.inspection, inspected.plan, parsed.options.format),\n );\n const early = earlyResult(parsed.options, inspected.plan);\n if (early !== null) return early;\n\n const confirmation = await confirmMutation(input, parsed.options, inspected.plan);\n if (confirmation === 'declined') {\n input.context.writeStderr('Deployment cancelled; no mutation was performed.\\n');\n return { exitCode: 0 };\n }\n if (confirmation !== 'confirmed') {\n return fail(\n input,\n 'Deployment requires confirmation. Use --yes for explicit non-interactive approval or --dry-run to inspect only.\\n',\n );\n }\n\n const executionId = parsed.options.executionId ?? runtime.createExecutionId();\n const executed = await runtime.executeProjectRelease({\n ...inspected.access,\n inspection: inspected.inspection,\n plan: inspected.plan,\n executionId,\n });\n if (!executed.ok) return fail(input, renderDeployCliFailure(executed.failure));\n input.context.writeStdout(\n renderDeployCliExecution(executed.execution, executionId, parsed.options.format),\n );\n return { exitCode: executed.execution.result.status === 'completed' ? 0 : 1 };\n}\n\nfunction earlyResult(options: DeployCliOptions, plan: ReleasePlan): AnkhCliRunResult | null {\n if (options.dryRun) return { exitCode: plan.status === 'blocked' ? 1 : 0 };\n if (plan.status === 'no-change') return { exitCode: 0 };\n if (plan.status === 'blocked') return { exitCode: 1 };\n if (plan.steps.length === 0) return { exitCode: plan.status === 'waiting' ? 1 : 0 };\n return null;\n}\n\nasync function confirmMutation(\n input: DeployCliInput,\n options: DeployCliOptions,\n plan: ReleasePlan,\n): Promise<AnkhConfirmationResult> {\n if (options.yes) return 'confirmed';\n const { interaction } = input.context;\n if (interaction === undefined) return 'unavailable';\n const irreversible = plan.steps.filter((step) => step.irreversible).length;\n const detail = irreversible === 0 ? '' : ` (${irreversible} irreversible)`;\n return interaction.confirm(`Execute ${plan.steps.length} release step(s)${detail}?`);\n}\n\nfunction fail(input: DeployCliInput, message: string): AnkhCliRunResult {\n input.context.writeStderr(message);\n return { exitCode: 1 };\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AnkhCommandPlan } from '@ankhorage/ankh';
|
|
2
|
+
import type { DeployCliInput } from './DeployCliInput.js';
|
|
3
|
+
import type { DeployCliRuntime } from './DeployCliRuntime.js';
|
|
4
|
+
export declare function handleDeployCliPlan(input: DeployCliInput, runtime: DeployCliRuntime): Promise<AnkhCommandPlan>;
|
|
5
|
+
//# sourceMappingURL=handleDeployCliPlan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleDeployCliPlan.d.ts","sourceRoot":"","sources":["../../src/cli/handleDeployCliPlan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAK9D,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,CAM1B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { inspectDeployCliRelease } from './inspectDeployCliRelease.js';
|
|
2
|
+
import { mapDeployCliPlan } from './mapDeployCliPlan.js';
|
|
3
|
+
import { parseDeployCliOptions } from './parseDeployCliOptions.js';
|
|
4
|
+
export async function handleDeployCliPlan(input, runtime) {
|
|
5
|
+
const parsed = parseDeployCliOptions(input.argv, input.context.cwd);
|
|
6
|
+
if (!parsed.ok)
|
|
7
|
+
return failedPlan('DEPLOY_CLI_INVALID_ARGUMENT', parsed.message);
|
|
8
|
+
const result = await inspectDeployCliRelease(parsed.options, input.context.env, runtime);
|
|
9
|
+
if (!result.ok)
|
|
10
|
+
return failedPlan(result.failure.code, result.failure.message);
|
|
11
|
+
return mapDeployCliPlan(result.inspection, result.plan);
|
|
12
|
+
}
|
|
13
|
+
function failedPlan(code, message) {
|
|
14
|
+
return {
|
|
15
|
+
kind: 'ankh-command-plan',
|
|
16
|
+
version: 1,
|
|
17
|
+
title: 'Deploy release',
|
|
18
|
+
steps: [],
|
|
19
|
+
diagnostics: [{ code, message, severity: 'error' }],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=handleDeployCliPlan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleDeployCliPlan.js","sourceRoot":"","sources":["../../src/cli/handleDeployCliPlan.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,KAAqB,EACrB,OAAyB;IAEzB,MAAM,MAAM,GAAG,qBAAqB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpE,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,UAAU,CAAC,6BAA6B,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACjF,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACzF,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/E,OAAO,gBAAgB,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,OAAe;IAC/C,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,gBAAgB;QACvB,KAAK,EAAE,EAAE;QACT,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;KACpD,CAAC;AACJ,CAAC","sourcesContent":["import type { AnkhCommandPlan } from '@ankhorage/ankh';\n\nimport type { DeployCliInput } from './DeployCliInput.js';\nimport type { DeployCliRuntime } from './DeployCliRuntime.js';\nimport { inspectDeployCliRelease } from './inspectDeployCliRelease.js';\nimport { mapDeployCliPlan } from './mapDeployCliPlan.js';\nimport { parseDeployCliOptions } from './parseDeployCliOptions.js';\n\nexport async function handleDeployCliPlan(\n input: DeployCliInput,\n runtime: DeployCliRuntime,\n): Promise<AnkhCommandPlan> {\n const parsed = parseDeployCliOptions(input.argv, input.context.cwd);\n if (!parsed.ok) return failedPlan('DEPLOY_CLI_INVALID_ARGUMENT', parsed.message);\n const result = await inspectDeployCliRelease(parsed.options, input.context.env, runtime);\n if (!result.ok) return failedPlan(result.failure.code, result.failure.message);\n return mapDeployCliPlan(result.inspection, result.plan);\n}\n\nfunction failedPlan(code: string, message: string): AnkhCommandPlan {\n return {\n kind: 'ankh-command-plan',\n version: 1,\n title: 'Deploy release',\n steps: [],\n diagnostics: [{ code, message, severity: 'error' }],\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,QAAA,MAAM,QAAQ,sDAAmD,CAAC;AAElE,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createDeployCliProvider } from './createDeployCliProvider.js';
|
|
2
|
+
import { defaultDeployCliRuntime } from './defaultDeployCliRuntime.js';
|
|
3
|
+
export { DEPLOY_CLI_ENVIRONMENT } from './DeployCliEnvironment.js';
|
|
4
|
+
const provider = createDeployCliProvider(defaultDeployCliRuntime);
|
|
5
|
+
export default provider;
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,MAAM,QAAQ,GAAG,uBAAuB,CAAC,uBAAuB,CAAC,CAAC;AAElE,eAAe,QAAQ,CAAC","sourcesContent":["import { createDeployCliProvider } from './createDeployCliProvider.js';\nimport { defaultDeployCliRuntime } from './defaultDeployCliRuntime.js';\n\nexport { DEPLOY_CLI_ENVIRONMENT } from './DeployCliEnvironment.js';\n\nconst provider = createDeployCliProvider(defaultDeployCliRuntime);\n\nexport default provider;\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DeploymentFailure, ReleasePlan } from '../index.js';
|
|
2
|
+
import type { ProjectReleaseAccess, ProjectReleaseInspection } from '../project/index.js';
|
|
3
|
+
import type { DeployCliOptions } from './DeployCliOptions.js';
|
|
4
|
+
import type { DeployCliRuntime } from './DeployCliRuntime.js';
|
|
5
|
+
type InspectionResult = {
|
|
6
|
+
readonly ok: true;
|
|
7
|
+
readonly access: ProjectReleaseAccess;
|
|
8
|
+
readonly inspection: ProjectReleaseInspection;
|
|
9
|
+
readonly plan: ReleasePlan;
|
|
10
|
+
} | {
|
|
11
|
+
readonly ok: false;
|
|
12
|
+
readonly failure: DeploymentFailure;
|
|
13
|
+
};
|
|
14
|
+
export declare function inspectDeployCliRelease(options: DeployCliOptions, env: Readonly<Record<string, string | undefined>>, runtime: DeployCliRuntime): Promise<InspectionResult>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=inspectDeployCliRelease.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspectDeployCliRelease.d.ts","sourceRoot":"","sources":["../../src/cli/inspectDeployCliRelease.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,KAAK,gBAAgB,GACjB;IACE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,wBAAwB,CAAC;IAC9C,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B,GACD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAEhE,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,gBAAgB,EACzB,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACjD,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,gBAAgB,CAAC,CAa3B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createDeployCliAccess } from './createDeployCliAccess.js';
|
|
2
|
+
export async function inspectDeployCliRelease(options, env, runtime) {
|
|
3
|
+
const access = createDeployCliAccess(options, env);
|
|
4
|
+
const result = await runtime.inspectProjectRelease({
|
|
5
|
+
projectRoot: options.projectRoot,
|
|
6
|
+
...access,
|
|
7
|
+
});
|
|
8
|
+
if (!result.ok)
|
|
9
|
+
return result;
|
|
10
|
+
return {
|
|
11
|
+
ok: true,
|
|
12
|
+
access,
|
|
13
|
+
inspection: result.inspection,
|
|
14
|
+
plan: runtime.createProjectReleasePlan(result.inspection),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=inspectDeployCliRelease.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspectDeployCliRelease.js","sourceRoot":"","sources":["../../src/cli/inspectDeployCliRelease.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAanE,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,OAAyB,EACzB,GAAiD,EACjD,OAAyB;IAEzB,MAAM,MAAM,GAAG,qBAAqB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,qBAAqB,CAAC;QACjD,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,GAAG,MAAM;KACV,CAAC,CAAC;IACH,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,MAAM,CAAC;IAC9B,OAAO;QACL,EAAE,EAAE,IAAI;QACR,MAAM;QACN,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,IAAI,EAAE,OAAO,CAAC,wBAAwB,CAAC,MAAM,CAAC,UAAU,CAAC;KAC1D,CAAC;AACJ,CAAC","sourcesContent":["import type { DeploymentFailure, ReleasePlan } from '../index.js';\nimport type { ProjectReleaseAccess, ProjectReleaseInspection } from '../project/index.js';\nimport { createDeployCliAccess } from './createDeployCliAccess.js';\nimport type { DeployCliOptions } from './DeployCliOptions.js';\nimport type { DeployCliRuntime } from './DeployCliRuntime.js';\n\ntype InspectionResult =\n | {\n readonly ok: true;\n readonly access: ProjectReleaseAccess;\n readonly inspection: ProjectReleaseInspection;\n readonly plan: ReleasePlan;\n }\n | { readonly ok: false; readonly failure: DeploymentFailure };\n\nexport async function inspectDeployCliRelease(\n options: DeployCliOptions,\n env: Readonly<Record<string, string | undefined>>,\n runtime: DeployCliRuntime,\n): Promise<InspectionResult> {\n const access = createDeployCliAccess(options, env);\n const result = await runtime.inspectProjectRelease({\n projectRoot: options.projectRoot,\n ...access,\n });\n if (!result.ok) return result;\n return {\n ok: true,\n access,\n inspection: result.inspection,\n plan: runtime.createProjectReleasePlan(result.inspection),\n };\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AnkhCommandPlan } from '@ankhorage/ankh';
|
|
2
|
+
import type { ReleasePlan } from '../index.js';
|
|
3
|
+
import type { ProjectReleaseInspection } from '../project/index.js';
|
|
4
|
+
export declare function mapDeployCliPlan(inspection: ProjectReleaseInspection, plan: ReleasePlan): AnkhCommandPlan;
|
|
5
|
+
//# sourceMappingURL=mapDeployCliPlan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapDeployCliPlan.d.ts","sourceRoot":"","sources":["../../src/cli/mapDeployCliPlan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEpE,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,wBAAwB,EACpC,IAAI,EAAE,WAAW,GAChB,eAAe,CA2BjB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function mapDeployCliPlan(inspection, plan) {
|
|
2
|
+
return {
|
|
3
|
+
kind: 'ankh-command-plan',
|
|
4
|
+
version: 1,
|
|
5
|
+
title: `Deploy release ${inspection.desired.version}`,
|
|
6
|
+
steps: plan.steps.map((step) => ({
|
|
7
|
+
capability: 'deploy.execute',
|
|
8
|
+
dependsOn: step.dependsOn,
|
|
9
|
+
destructive: step.irreversible,
|
|
10
|
+
id: step.id,
|
|
11
|
+
label: `[${step.target}] ${step.operation}`,
|
|
12
|
+
providerId: '@ankhorage/deploy',
|
|
13
|
+
status: plan.status === 'blocked' ? 'blocked' : 'planned',
|
|
14
|
+
})),
|
|
15
|
+
diagnostics: [
|
|
16
|
+
...plan.diagnostics.map((diagnostic) => ({
|
|
17
|
+
code: diagnostic.code,
|
|
18
|
+
message: diagnostic.message,
|
|
19
|
+
severity: diagnostic.severity,
|
|
20
|
+
})),
|
|
21
|
+
...inspection.actions.map((action) => ({
|
|
22
|
+
code: action.code,
|
|
23
|
+
message: action.message,
|
|
24
|
+
severity: 'warning',
|
|
25
|
+
})),
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=mapDeployCliPlan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapDeployCliPlan.js","sourceRoot":"","sources":["../../src/cli/mapDeployCliPlan.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,gBAAgB,CAC9B,UAAoC,EACpC,IAAiB;IAEjB,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,kBAAkB,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE;QACrD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC/B,UAAU,EAAE,gBAAgB;YAC5B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,YAAY;YAC9B,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,KAAK,EAAE,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,SAAS,EAAE;YAC3C,UAAU,EAAE,mBAAmB;YAC/B,MAAM,EAAE,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;SAC1D,CAAC,CAAC;QACH,WAAW,EAAE;YACX,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;gBACvC,IAAI,EAAE,UAAU,CAAC,IAAI;gBACrB,OAAO,EAAE,UAAU,CAAC,OAAO;gBAC3B,QAAQ,EAAE,UAAU,CAAC,QAAQ;aAC9B,CAAC,CAAC;YACH,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBACrC,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,QAAQ,EAAE,SAAkB;aAC7B,CAAC,CAAC;SACJ;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { AnkhCommandPlan } from '@ankhorage/ankh';\n\nimport type { ReleasePlan } from '../index.js';\nimport type { ProjectReleaseInspection } from '../project/index.js';\n\nexport function mapDeployCliPlan(\n inspection: ProjectReleaseInspection,\n plan: ReleasePlan,\n): AnkhCommandPlan {\n return {\n kind: 'ankh-command-plan',\n version: 1,\n title: `Deploy release ${inspection.desired.version}`,\n steps: plan.steps.map((step) => ({\n capability: 'deploy.execute',\n dependsOn: step.dependsOn,\n destructive: step.irreversible,\n id: step.id,\n label: `[${step.target}] ${step.operation}`,\n providerId: '@ankhorage/deploy',\n status: plan.status === 'blocked' ? 'blocked' : 'planned',\n })),\n diagnostics: [\n ...plan.diagnostics.map((diagnostic) => ({\n code: diagnostic.code,\n message: diagnostic.message,\n severity: diagnostic.severity,\n })),\n ...inspection.actions.map((action) => ({\n code: action.code,\n message: action.message,\n severity: 'warning' as const,\n })),\n ],\n };\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DeployCliOptions } from './DeployCliOptions.js';
|
|
2
|
+
type ParseResult = {
|
|
3
|
+
readonly ok: true;
|
|
4
|
+
readonly options: DeployCliOptions;
|
|
5
|
+
} | {
|
|
6
|
+
readonly ok: false;
|
|
7
|
+
readonly message: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function parseDeployCliOptions(argv: readonly string[], cwd: string): ParseResult;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=parseDeployCliOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseDeployCliOptions.d.ts","sourceRoot":"","sources":["../../src/cli/parseDeployCliOptions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAa9D,KAAK,WAAW,GACZ;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE,GACzD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAerD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAgCvF"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { ANDROID_DEPLOYMENT_TRACKS, } from '../domain/AndroidDeploymentIntent.js';
|
|
3
|
+
const BOOLEAN_FLAGS = new Set(['--dry-run', '--yes', '--json']);
|
|
4
|
+
const VALUE_FLAGS = new Set([
|
|
5
|
+
'--project-root',
|
|
6
|
+
'--execution-id',
|
|
7
|
+
'--android-track',
|
|
8
|
+
'--android-build-profile',
|
|
9
|
+
'--ios-build-profile',
|
|
10
|
+
'--web-alias',
|
|
11
|
+
'--web-environment',
|
|
12
|
+
]);
|
|
13
|
+
export function parseDeployCliOptions(argv, cwd) {
|
|
14
|
+
const draft = {
|
|
15
|
+
projectRoot: path.resolve(cwd),
|
|
16
|
+
dryRun: false,
|
|
17
|
+
yes: false,
|
|
18
|
+
format: 'human',
|
|
19
|
+
};
|
|
20
|
+
const seen = new Set();
|
|
21
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
22
|
+
const token = argv.at(index);
|
|
23
|
+
if (token === undefined)
|
|
24
|
+
continue;
|
|
25
|
+
const duplicate = markSeen(seen, token);
|
|
26
|
+
if (duplicate !== null)
|
|
27
|
+
return failure(duplicate);
|
|
28
|
+
if (BOOLEAN_FLAGS.has(token)) {
|
|
29
|
+
applyBooleanFlag(draft, token);
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (!VALUE_FLAGS.has(token))
|
|
33
|
+
return failure(`Unknown deploy option: ${token}`);
|
|
34
|
+
const value = argv.at(index + 1);
|
|
35
|
+
if (value === undefined || value.startsWith('--')) {
|
|
36
|
+
return failure(`Deploy option ${token} requires a value.`);
|
|
37
|
+
}
|
|
38
|
+
const error = applyValueFlag(draft, token, value, cwd);
|
|
39
|
+
if (error !== null)
|
|
40
|
+
return failure(error);
|
|
41
|
+
index += 1;
|
|
42
|
+
}
|
|
43
|
+
if (draft.androidBuildProfile !== undefined && draft.androidTrack === undefined) {
|
|
44
|
+
return failure('--android-build-profile requires --android-track.');
|
|
45
|
+
}
|
|
46
|
+
return { ok: true, options: draft };
|
|
47
|
+
}
|
|
48
|
+
function markSeen(seen, token) {
|
|
49
|
+
if (!token.startsWith('--'))
|
|
50
|
+
return null;
|
|
51
|
+
if (seen.has(token))
|
|
52
|
+
return `Deploy option ${token} may only be provided once.`;
|
|
53
|
+
seen.add(token);
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
function applyBooleanFlag(draft, flag) {
|
|
57
|
+
if (flag === '--dry-run')
|
|
58
|
+
draft.dryRun = true;
|
|
59
|
+
if (flag === '--yes')
|
|
60
|
+
draft.yes = true;
|
|
61
|
+
if (flag === '--json')
|
|
62
|
+
draft.format = 'json';
|
|
63
|
+
}
|
|
64
|
+
function applyValueFlag(draft, flag, value, cwd) {
|
|
65
|
+
if (flag === '--project-root')
|
|
66
|
+
draft.projectRoot = path.resolve(cwd, value);
|
|
67
|
+
if (flag === '--execution-id')
|
|
68
|
+
draft.executionId = value;
|
|
69
|
+
if (flag === '--android-track') {
|
|
70
|
+
if (!isAndroidDeploymentTrack(value))
|
|
71
|
+
return invalidAndroidTrack(value);
|
|
72
|
+
draft.androidTrack = value;
|
|
73
|
+
}
|
|
74
|
+
if (flag === '--android-build-profile')
|
|
75
|
+
draft.androidBuildProfile = value;
|
|
76
|
+
if (flag === '--ios-build-profile')
|
|
77
|
+
draft.iosBuildProfile = value;
|
|
78
|
+
if (flag === '--web-alias')
|
|
79
|
+
draft.webAlias = value;
|
|
80
|
+
if (flag === '--web-environment')
|
|
81
|
+
draft.webEnvironment = value;
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
function isAndroidDeploymentTrack(value) {
|
|
85
|
+
return ANDROID_DEPLOYMENT_TRACKS.some((track) => track === value);
|
|
86
|
+
}
|
|
87
|
+
function invalidAndroidTrack(value) {
|
|
88
|
+
return `Invalid Android track: ${value}. Expected one of: ${ANDROID_DEPLOYMENT_TRACKS.join(', ')}.`;
|
|
89
|
+
}
|
|
90
|
+
function failure(message) {
|
|
91
|
+
return { ok: false, message };
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=parseDeployCliOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseDeployCliOptions.js","sourceRoot":"","sources":["../../src/cli/parseDeployCliOptions.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACL,yBAAyB,GAE1B,MAAM,sCAAsC,CAAC;AAG9C,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAChE,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,yBAAyB;IACzB,qBAAqB;IACrB,aAAa;IACb,mBAAmB;CACpB,CAAC,CAAC;AAmBH,MAAM,UAAU,qBAAqB,CAAC,IAAuB,EAAE,GAAW;IACxE,MAAM,KAAK,GAAiB;QAC1B,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;QAC9B,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,KAAK;QACV,MAAM,EAAE,OAAO;KAChB,CAAC;IACF,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACxC,IAAI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pE,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAa;IACxC,OAAO,0BAA0B,KAAK,sBAAsB,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AACtG,CAAC;AAED,SAAS,OAAO,CAAC,OAAe;IAC9B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC","sourcesContent":["import path from 'node:path';\n\nimport {\n ANDROID_DEPLOYMENT_TRACKS,\n type AndroidDeploymentTrack,\n} from '../domain/AndroidDeploymentIntent.js';\nimport type { DeployCliOptions } from './DeployCliOptions.js';\n\nconst BOOLEAN_FLAGS = new Set(['--dry-run', '--yes', '--json']);\nconst VALUE_FLAGS = new Set([\n '--project-root',\n '--execution-id',\n '--android-track',\n '--android-build-profile',\n '--ios-build-profile',\n '--web-alias',\n '--web-environment',\n]);\n\ntype ParseResult =\n | { readonly ok: true; readonly options: DeployCliOptions }\n | { readonly ok: false; readonly message: string };\n\ninterface DraftOptions {\n projectRoot: string;\n dryRun: boolean;\n yes: boolean;\n format: 'human' | 'json';\n executionId?: string;\n androidTrack?: AndroidDeploymentTrack;\n androidBuildProfile?: string;\n iosBuildProfile?: string;\n webAlias?: string;\n webEnvironment?: string;\n}\n\nexport function parseDeployCliOptions(argv: readonly string[], cwd: string): ParseResult {\n const draft: DraftOptions = {\n projectRoot: path.resolve(cwd),\n dryRun: false,\n yes: false,\n format: 'human',\n };\n const seen = new Set<string>();\n\n for (let index = 0; index < argv.length; index += 1) {\n const token = argv.at(index);\n if (token === undefined) continue;\n const duplicate = markSeen(seen, token);\n if (duplicate !== null) return failure(duplicate);\n if (BOOLEAN_FLAGS.has(token)) {\n applyBooleanFlag(draft, token);\n continue;\n }\n if (!VALUE_FLAGS.has(token)) return failure(`Unknown deploy option: ${token}`);\n const value = argv.at(index + 1);\n if (value === undefined || value.startsWith('--')) {\n return failure(`Deploy option ${token} requires a value.`);\n }\n const error = applyValueFlag(draft, token, value, cwd);\n if (error !== null) return failure(error);\n index += 1;\n }\n\n if (draft.androidBuildProfile !== undefined && draft.androidTrack === undefined) {\n return failure('--android-build-profile requires --android-track.');\n }\n return { ok: true, options: draft };\n}\n\nfunction markSeen(seen: Set<string>, token: string): string | null {\n if (!token.startsWith('--')) return null;\n if (seen.has(token)) return `Deploy option ${token} may only be provided once.`;\n seen.add(token);\n return null;\n}\n\nfunction applyBooleanFlag(draft: DraftOptions, flag: string): void {\n if (flag === '--dry-run') draft.dryRun = true;\n if (flag === '--yes') draft.yes = true;\n if (flag === '--json') draft.format = 'json';\n}\n\nfunction applyValueFlag(\n draft: DraftOptions,\n flag: string,\n value: string,\n cwd: string,\n): string | null {\n if (flag === '--project-root') draft.projectRoot = path.resolve(cwd, value);\n if (flag === '--execution-id') draft.executionId = value;\n if (flag === '--android-track') {\n if (!isAndroidDeploymentTrack(value)) return invalidAndroidTrack(value);\n draft.androidTrack = value;\n }\n if (flag === '--android-build-profile') draft.androidBuildProfile = value;\n if (flag === '--ios-build-profile') draft.iosBuildProfile = value;\n if (flag === '--web-alias') draft.webAlias = value;\n if (flag === '--web-environment') draft.webEnvironment = value;\n return null;\n}\n\nfunction isAndroidDeploymentTrack(value: string): value is AndroidDeploymentTrack {\n return ANDROID_DEPLOYMENT_TRACKS.some((track) => track === value);\n}\n\nfunction invalidAndroidTrack(value: string): string {\n return `Invalid Android track: ${value}. Expected one of: ${ANDROID_DEPLOYMENT_TRACKS.join(', ')}.`;\n}\n\nfunction failure(message: string): { readonly ok: false; readonly message: string } {\n return { ok: false, message };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderDeployCliExecution.d.ts","sourceRoot":"","sources":["../../src/cli/renderDeployCliExecution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,uBAAuB,EAClC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,GAAG,MAAM,GACvB,MAAM,CAqBR"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function renderDeployCliExecution(execution, executionId, format) {
|
|
2
|
+
if (format === 'json') {
|
|
3
|
+
return `${JSON.stringify({ kind: 'deploy-release-execution', executionId, execution })}\n`;
|
|
4
|
+
}
|
|
5
|
+
const lines = [
|
|
6
|
+
`Execution: ${executionId}`,
|
|
7
|
+
`Result: ${execution.result.status}`,
|
|
8
|
+
`Current revision: ${execution.result.currentRevision}`,
|
|
9
|
+
`History recorded: ${execution.historyRecorded ? 'yes' : 'no'}`,
|
|
10
|
+
];
|
|
11
|
+
if (execution.result.code !== undefined)
|
|
12
|
+
lines.push(`Code: ${execution.result.code}`);
|
|
13
|
+
if (execution.result.executedStepIds.length > 0) {
|
|
14
|
+
lines.push(`Executed steps: ${execution.result.executedStepIds.join(', ')}`);
|
|
15
|
+
}
|
|
16
|
+
if (execution.historyFailure !== undefined) {
|
|
17
|
+
lines.push(`History failure: ${execution.historyFailure.code}: ${execution.historyFailure.message}`);
|
|
18
|
+
}
|
|
19
|
+
lines.push('');
|
|
20
|
+
return lines.join('\n');
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=renderDeployCliExecution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderDeployCliExecution.js","sourceRoot":"","sources":["../../src/cli/renderDeployCliExecution.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,wBAAwB,CACtC,SAAkC,EAClC,WAAmB,EACnB,MAAwB;IAExB,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC;IAC7F,CAAC;IACD,MAAM,KAAK,GAAG;QACZ,cAAc,WAAW,EAAE;QAC3B,WAAW,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE;QACpC,qBAAqB,SAAS,CAAC,MAAM,CAAC,eAAe,EAAE;QACvD,qBAAqB,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE;KAChE,CAAC;IACF,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACtF,IAAI,SAAS,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChD,KAAK,CAAC,IAAI,CAAC,mBAAmB,SAAS,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/E,CAAC;IACD,IAAI,SAAS,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;QAC3C,KAAK,CAAC,IAAI,CACR,oBAAoB,SAAS,CAAC,cAAc,CAAC,IAAI,KAAK,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,CACzF,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["import type { ProjectReleaseExecution } from '../project/index.js';\n\nexport function renderDeployCliExecution(\n execution: ProjectReleaseExecution,\n executionId: string,\n format: 'human' | 'json',\n): string {\n if (format === 'json') {\n return `${JSON.stringify({ kind: 'deploy-release-execution', executionId, execution })}\\n`;\n }\n const lines = [\n `Execution: ${executionId}`,\n `Result: ${execution.result.status}`,\n `Current revision: ${execution.result.currentRevision}`,\n `History recorded: ${execution.historyRecorded ? 'yes' : 'no'}`,\n ];\n if (execution.result.code !== undefined) lines.push(`Code: ${execution.result.code}`);\n if (execution.result.executedStepIds.length > 0) {\n lines.push(`Executed steps: ${execution.result.executedStepIds.join(', ')}`);\n }\n if (execution.historyFailure !== undefined) {\n lines.push(\n `History failure: ${execution.historyFailure.code}: ${execution.historyFailure.message}`,\n );\n }\n lines.push('');\n return lines.join('\\n');\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderDeployCliFailure.d.ts","sourceRoot":"","sources":["../../src/cli/renderDeployCliFailure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAMzE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function renderDeployCliFailure(failure) {
|
|
2
|
+
const scope = [failure.target, failure.provider].filter((value) => value !== undefined);
|
|
3
|
+
const suffix = scope.length === 0 ? '' : ` (${scope.join(' | ')})`;
|
|
4
|
+
return `Deploy failed: ${failure.code}: ${failure.message}${suffix}\n`;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=renderDeployCliFailure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderDeployCliFailure.js","sourceRoot":"","sources":["../../src/cli/renderDeployCliFailure.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,sBAAsB,CAAC,OAA0B;IAC/D,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CACrD,CAAC,KAAK,EAAmB,EAAE,CAAC,KAAK,KAAK,SAAS,CAChD,CAAC;IACF,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;IACnE,OAAO,kBAAkB,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC;AACzE,CAAC","sourcesContent":["import type { DeploymentFailure } from '../index.js';\n\nexport function renderDeployCliFailure(failure: DeploymentFailure): string {\n const scope = [failure.target, failure.provider].filter(\n (value): value is string => value !== undefined,\n );\n const suffix = scope.length === 0 ? '' : ` (${scope.join(' | ')})`;\n return `Deploy failed: ${failure.code}: ${failure.message}${suffix}\\n`;\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ReleasePlan } from '../index.js';
|
|
2
|
+
import type { ProjectReleaseInspection } from '../project/index.js';
|
|
3
|
+
export declare function renderDeployCliPlan(inspection: ProjectReleaseInspection, plan: ReleasePlan, format: 'human' | 'json'): string;
|
|
4
|
+
//# sourceMappingURL=renderDeployCliPlan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderDeployCliPlan.d.ts","sourceRoot":"","sources":["../../src/cli/renderDeployCliPlan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEpE,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,wBAAwB,EACpC,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,OAAO,GAAG,MAAM,GACvB,MAAM,CAUR"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export function renderDeployCliPlan(inspection, plan, format) {
|
|
2
|
+
if (format === 'json') {
|
|
3
|
+
return `${JSON.stringify({
|
|
4
|
+
kind: 'deploy-release-plan',
|
|
5
|
+
desired: inspection.desired,
|
|
6
|
+
plan,
|
|
7
|
+
actions: inspection.actions,
|
|
8
|
+
})}\n`;
|
|
9
|
+
}
|
|
10
|
+
return renderHuman(inspection, plan);
|
|
11
|
+
}
|
|
12
|
+
function renderHuman(inspection, plan) {
|
|
13
|
+
const lines = [
|
|
14
|
+
`Release: ${inspection.desired.version}`,
|
|
15
|
+
`Targets: ${inspection.desired.targets.join(', ')}`,
|
|
16
|
+
`Revision: ${inspection.desired.revision}`,
|
|
17
|
+
`Plan status: ${plan.status}`,
|
|
18
|
+
'',
|
|
19
|
+
'Steps:',
|
|
20
|
+
];
|
|
21
|
+
if (plan.steps.length === 0)
|
|
22
|
+
lines.push(' - none');
|
|
23
|
+
plan.steps.forEach((step, index) => lines.push(...renderStep(step, index)));
|
|
24
|
+
lines.push('', 'Diagnostics:');
|
|
25
|
+
if (plan.diagnostics.length === 0)
|
|
26
|
+
lines.push(' - none');
|
|
27
|
+
for (const diagnostic of plan.diagnostics) {
|
|
28
|
+
const target = diagnostic.target === undefined ? '' : ` [${diagnostic.target}]`;
|
|
29
|
+
lines.push(` [${diagnostic.severity}]${target} ${diagnostic.code}: ${diagnostic.message}`);
|
|
30
|
+
}
|
|
31
|
+
lines.push('', 'Required actions:');
|
|
32
|
+
if (inspection.actions.length === 0)
|
|
33
|
+
lines.push(' - none');
|
|
34
|
+
for (const action of inspection.actions) {
|
|
35
|
+
const target = action.target === undefined ? '' : ` [${action.target}]`;
|
|
36
|
+
lines.push(` ${action.type}${target} ${action.code}: ${action.message}`);
|
|
37
|
+
}
|
|
38
|
+
lines.push('');
|
|
39
|
+
return lines.join('\n');
|
|
40
|
+
}
|
|
41
|
+
function renderStep(step, index) {
|
|
42
|
+
return [
|
|
43
|
+
` ${index + 1}. [${step.target}] ${step.operation}`,
|
|
44
|
+
` id: ${step.id}`,
|
|
45
|
+
` dependsOn: ${step.dependsOn.length === 0 ? 'none' : step.dependsOn.join(', ')}`,
|
|
46
|
+
` irreversible: ${step.irreversible ? 'yes' : 'no'}`,
|
|
47
|
+
` retry: ${step.retry}`,
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=renderDeployCliPlan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderDeployCliPlan.js","sourceRoot":"","sources":["../../src/cli/renderDeployCliPlan.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,mBAAmB,CACjC,UAAoC,EACpC,IAAiB,EACjB,M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;KAC5B,CAAC;AACJ,CAAC","sourcesContent":["import type { ReleasePlan, ReleasePlanStep } from '../index.js';\nimport type { ProjectReleaseInspection } from '../project/index.js';\n\nexport function renderDeployCliPlan(\n inspection: ProjectReleaseInspection,\n plan: ReleasePlan,\n format: 'human' | 'json',\n): string {\n if (format === 'json') {\n return `${JSON.stringify({\n kind: 'deploy-release-plan',\n desired: inspection.desired,\n plan,\n actions: inspection.actions,\n })}\\n`;\n }\n return renderHuman(inspection, plan);\n}\n\nfunction renderHuman(inspection: ProjectReleaseInspection, plan: ReleasePlan): string {\n const lines = [\n `Release: ${inspection.desired.version}`,\n `Targets: ${inspection.desired.targets.join(', ')}`,\n `Revision: ${inspection.desired.revision}`,\n `Plan status: ${plan.status}`,\n '',\n 'Steps:',\n ];\n if (plan.steps.length === 0) lines.push(' - none');\n plan.steps.forEach((step, index) => lines.push(...renderStep(step, index)));\n lines.push('', 'Diagnostics:');\n if (plan.diagnostics.length === 0) lines.push(' - none');\n for (const diagnostic of plan.diagnostics) {\n const target = diagnostic.target === undefined ? '' : ` [${diagnostic.target}]`;\n lines.push(` [${diagnostic.severity}]${target} ${diagnostic.code}: ${diagnostic.message}`);\n }\n lines.push('', 'Required actions:');\n if (inspection.actions.length === 0) lines.push(' - none');\n for (const action of inspection.actions) {\n const target = action.target === undefined ? '' : ` [${action.target}]`;\n lines.push(` ${action.type}${target} ${action.code}: ${action.message}`);\n }\n lines.push('');\n return lines.join('\\n');\n}\n\nfunction renderStep(step: ReleasePlanStep, index: number): string[] {\n return [\n ` ${index + 1}. [${step.target}] ${step.operation}`,\n ` id: ${step.id}`,\n ` dependsOn: ${step.dependsOn.length === 0 ? 'none' : step.dependsOn.join(', ')}`,\n ` irreversible: ${step.irreversible ? 'yes' : 'no'}`,\n ` retry: ${step.retry}`,\n ];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/deploy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Declarative deployment engine for Expo apps across web, iOS, and Android — build, provision, publish, and manage releases from one configuration.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -42,7 +42,12 @@
|
|
|
42
42
|
"import": "./dist/project/index.js",
|
|
43
43
|
"default": "./dist/project/index.js"
|
|
44
44
|
},
|
|
45
|
-
"./package.json": "./package.json"
|
|
45
|
+
"./package.json": "./package.json",
|
|
46
|
+
"./cli": {
|
|
47
|
+
"types": "./dist/cli/index.d.ts",
|
|
48
|
+
"import": "./dist/cli/index.js",
|
|
49
|
+
"default": "./dist/cli/index.js"
|
|
50
|
+
}
|
|
46
51
|
},
|
|
47
52
|
"files": [
|
|
48
53
|
"dist",
|
|
@@ -52,8 +57,12 @@
|
|
|
52
57
|
],
|
|
53
58
|
"ankh": {
|
|
54
59
|
"category": "deploy",
|
|
55
|
-
"provider":
|
|
56
|
-
"capabilities": [
|
|
60
|
+
"provider": "./dist/cli/index.js",
|
|
61
|
+
"capabilities": [
|
|
62
|
+
"deploy.inspect",
|
|
63
|
+
"deploy.plan",
|
|
64
|
+
"deploy.execute"
|
|
65
|
+
]
|
|
57
66
|
},
|
|
58
67
|
"scripts": {
|
|
59
68
|
"build": "rm -rf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo && bun x tsc -p tsconfig.build.json",
|
|
@@ -71,10 +80,11 @@
|
|
|
71
80
|
"prepack": "bun run build"
|
|
72
81
|
},
|
|
73
82
|
"dependencies": {
|
|
74
|
-
"@ankhorage/contracts": "^7.
|
|
83
|
+
"@ankhorage/contracts": "^7.9.0",
|
|
75
84
|
"google-auth-library": "^10.9.1"
|
|
76
85
|
},
|
|
77
86
|
"devDependencies": {
|
|
87
|
+
"@ankhorage/ankh": "^0.8.0",
|
|
78
88
|
"@ankhorage/devtools": "^1.4.1",
|
|
79
89
|
"@ankhorage/paradox": "^0.1.21",
|
|
80
90
|
"@changesets/cli": "^2.31.0",
|