@contrail/cli 3.7.0-alpha.67dab99 → 3.7.0-alpha.91c1ee9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -3
- package/dist/commands/app/publish.js +1 -1
- package/dist/commands/app/version/prerelease.d.ts +11 -0
- package/dist/commands/app/version/prerelease.js +32 -0
- package/dist/helpers/app/app-config-validators.js +2 -2
- package/dist/helpers/app/app-config-validators.spec.js +1 -1
- package/dist/helpers/app/app-deployer.js +2 -6
- package/dist/helpers/app/upgrade-version.d.ts +3 -1
- package/dist/helpers/app/upgrade-version.js +7 -8
- package/dist/helpers/app/upgrade-version.spec.js +13 -1
- package/oclif.manifest.json +44 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
|
|
|
17
17
|
$ contrail COMMAND
|
|
18
18
|
running command...
|
|
19
19
|
$ contrail (--version)
|
|
20
|
-
@contrail/cli/3.7.0-alpha.
|
|
20
|
+
@contrail/cli/3.7.0-alpha.91c1ee9 linux-x64 node-v24.22.3
|
|
21
21
|
$ contrail --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ contrail COMMAND
|
|
@@ -45,6 +45,7 @@ To get instructions on how to set up autocomplete for your shell, run `contrail
|
|
|
45
45
|
* [`contrail app version major`](#contrail-app-version-major)
|
|
46
46
|
* [`contrail app version minor`](#contrail-app-version-minor)
|
|
47
47
|
* [`contrail app version patch`](#contrail-app-version-patch)
|
|
48
|
+
* [`contrail app version prerelease`](#contrail-app-version-prerelease)
|
|
48
49
|
* [`contrail autocomplete [SHELL]`](#contrail-autocomplete-shell)
|
|
49
50
|
* [`contrail config create`](#contrail-config-create)
|
|
50
51
|
* [`contrail config describe [NAME]`](#contrail-config-describe-name)
|
|
@@ -264,7 +265,7 @@ EXAMPLES
|
|
|
264
265
|
|
|
265
266
|
## `contrail app publish`
|
|
266
267
|
|
|
267
|
-
Publish the app to the marketplace. This visibility of your app depends on the app.yml configuration ("visibility" property). A
|
|
268
|
+
Publish the app to the marketplace. This visibility of your app depends on the app.yml configuration ("visibility" property). A pre-release version (e.g. "1.4.0-alpha.1") is published without becoming the latest version of the app.
|
|
268
269
|
|
|
269
270
|
```
|
|
270
271
|
USAGE
|
|
@@ -282,7 +283,7 @@ FLAGS
|
|
|
282
283
|
|
|
283
284
|
DESCRIPTION
|
|
284
285
|
Publish the app to the marketplace. This visibility of your app depends on the app.yml configuration ("visibility"
|
|
285
|
-
property). A
|
|
286
|
+
property). A pre-release version (e.g. "1.4.0-alpha.1") is published without becoming the latest version of the app.
|
|
286
287
|
|
|
287
288
|
EXAMPLES
|
|
288
289
|
$ contrail app publish
|
|
@@ -397,6 +398,28 @@ EXAMPLES
|
|
|
397
398
|
$ contrail app version patch
|
|
398
399
|
```
|
|
399
400
|
|
|
401
|
+
## `contrail app version prerelease`
|
|
402
|
+
|
|
403
|
+
Upgrade the Pre-release app version. A stable version becomes the first alpha of the next patch (1.2.3 to 1.2.4-alpha.0). A pre-release version gets its number bumped (1.2.4-alpha.0 to 1.2.4-alpha.1).
|
|
404
|
+
|
|
405
|
+
```
|
|
406
|
+
USAGE
|
|
407
|
+
$ contrail app version prerelease [-l error|warn|info|debug] [-e true|false]
|
|
408
|
+
|
|
409
|
+
FLAGS
|
|
410
|
+
-e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
|
|
411
|
+
<options: true|false>
|
|
412
|
+
-l, --logLevel=<option> The Log Level
|
|
413
|
+
<options: error|warn|info|debug>
|
|
414
|
+
|
|
415
|
+
DESCRIPTION
|
|
416
|
+
Upgrade the Pre-release app version. A stable version becomes the first alpha of the next patch (1.2.3 to
|
|
417
|
+
1.2.4-alpha.0). A pre-release version gets its number bumped (1.2.4-alpha.0 to 1.2.4-alpha.1).
|
|
418
|
+
|
|
419
|
+
EXAMPLES
|
|
420
|
+
$ contrail app version prerelease
|
|
421
|
+
```
|
|
422
|
+
|
|
400
423
|
## `contrail autocomplete [SHELL]`
|
|
401
424
|
|
|
402
425
|
display autocomplete installation instructions
|
|
@@ -11,7 +11,7 @@ const upgrade_1 = require("./upgrade");
|
|
|
11
11
|
const basecommand_1 = require("../../basecommand");
|
|
12
12
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
13
13
|
class PublishApp extends basecommand_1.BaseCommand {
|
|
14
|
-
static description = 'Publish the app to the marketplace. This visibility of your app depends on the app.yml configuration ("visibility" property). A
|
|
14
|
+
static description = 'Publish the app to the marketplace. This visibility of your app depends on the app.yml configuration ("visibility" property). A pre-release version (e.g. "1.4.0-alpha.1") is published without becoming the latest version of the app.';
|
|
15
15
|
static examples = [
|
|
16
16
|
`$ contrail app publish
|
|
17
17
|
`,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../basecommand';
|
|
2
|
+
export default class AppPrereleaseVersionUpgrade extends BaseCommand {
|
|
3
|
+
skipConfirmEnv: boolean;
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: {
|
|
7
|
+
alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const load_app_config_1 = require("../../../helpers/app/load-app-config");
|
|
5
|
+
const basecommand_1 = require("../../../basecommand");
|
|
6
|
+
const logger_1 = tslib_1.__importDefault(require("../../../logger"));
|
|
7
|
+
const update_app_config_1 = require("../../../helpers/app/update-app-config");
|
|
8
|
+
const upgrade_version_1 = require("../../../helpers/app/upgrade-version");
|
|
9
|
+
class AppPrereleaseVersionUpgrade extends basecommand_1.BaseCommand {
|
|
10
|
+
skipConfirmEnv = true;
|
|
11
|
+
static description = 'Upgrade the Pre-release app version. A stable version becomes the first alpha of the next patch (1.2.3 to 1.2.4-alpha.0). A pre-release version gets its number bumped (1.2.4-alpha.0 to 1.2.4-alpha.1).';
|
|
12
|
+
static examples = [
|
|
13
|
+
`$ contrail app version prerelease
|
|
14
|
+
`,
|
|
15
|
+
];
|
|
16
|
+
static flags = {
|
|
17
|
+
...basecommand_1.BaseCommand.baseFlags,
|
|
18
|
+
};
|
|
19
|
+
async run() {
|
|
20
|
+
try {
|
|
21
|
+
const appDeclaration = (0, load_app_config_1.loadAppConfig)({ skipValidation: true });
|
|
22
|
+
logger_1.default.info(`Upgrading Pre-release Version for ${appDeclaration.version}`);
|
|
23
|
+
const version = (0, upgrade_version_1.upgradeVersion)(appDeclaration.version, 'prerelease');
|
|
24
|
+
(0, update_app_config_1.updateAppConfig)({ ...appDeclaration, version });
|
|
25
|
+
logger_1.default.info(`Pre-release Version Upgraded to ${version}`);
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
logger_1.default.error(`Application Pre-release Version Upgrade Failed: ${e}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.default = AppPrereleaseVersionUpgrade;
|
|
@@ -7,9 +7,9 @@ const interfaces_1 = require("../../interfaces");
|
|
|
7
7
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
8
8
|
const VALIDATORS = [appVersionValidator, visibilityValidator, validateAccessGrants];
|
|
9
9
|
exports.ERROR_MESSAGES = {
|
|
10
|
-
missingVersionField: 'Missing "version" field". Semantic App Version looks like "1.0.0". Use "contrail app version [patch|minor|major]" to update the app version.',
|
|
10
|
+
missingVersionField: 'Missing "version" field". Semantic App Version looks like "1.0.0". Use "contrail app version [patch|minor|major|prerelease]" to update the app version.',
|
|
11
11
|
invalidVersionField: '"version" field is not a string. Expecting a version like "1.0.0". Manually update the "version" field to be a string in the app.yml file.',
|
|
12
|
-
invalidAppVersion: 'Invalid app version. Semantic App Version looks like "1.0.0", or "1.0.0-alpha.1" for a
|
|
12
|
+
invalidAppVersion: 'Invalid app version. Semantic App Version looks like "1.0.0", or "1.0.0-alpha.1" for a pre-release. Use "contrail app version [patch|minor|major|prerelease]" to update the app version.',
|
|
13
13
|
accessGrantsArray: 'accessGrants must be an array.',
|
|
14
14
|
invalidOrgSlug: 'Invalid or missing orgSlug in one of the accessGrants objects.',
|
|
15
15
|
emptyPermissionsArray: 'Permissions must be a non-empty array in one of the accessGrants objects.',
|
|
@@ -33,7 +33,7 @@ describe('appVersionValidator', () => {
|
|
|
33
33
|
const validationResult = (0, app_config_validators_1.appVersionValidator)(appDeclaration);
|
|
34
34
|
expect(validationResult).toEqual(validResult);
|
|
35
35
|
});
|
|
36
|
-
it('should not return an error if app version is a
|
|
36
|
+
it('should not return an error if app version is a pre-release', () => {
|
|
37
37
|
const appDeclaration = {
|
|
38
38
|
version: '1.4.0-alpha.1',
|
|
39
39
|
};
|
|
@@ -31,7 +31,7 @@ class AppDeployer {
|
|
|
31
31
|
app = await this.createNewApp(appDeclaration);
|
|
32
32
|
}
|
|
33
33
|
else if (semver_1.default.prerelease(appDeclaration.version)) {
|
|
34
|
-
logger_1.default.info(`${chalk_1.default.yellow.bold('APP')} Publishing
|
|
34
|
+
logger_1.default.info(`${chalk_1.default.yellow.bold('APP')} Publishing pre-release version.`);
|
|
35
35
|
app = await this.publishPrereleaseVersion(appDeclaration, app);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
@@ -151,8 +151,6 @@ class AppDeployer {
|
|
|
151
151
|
logger_1.default.info(`${chalk_1.default.yellow.bold('APP')} Updated app: ${app.name}`);
|
|
152
152
|
return app;
|
|
153
153
|
}
|
|
154
|
-
// A prerelease is published as a version of its own. The app record and its latest version stay as they are,
|
|
155
|
-
// so orgs on a stable version are not offered the prerelease as an update.
|
|
156
154
|
async publishPrereleaseVersion(appDeclaration, existingApp) {
|
|
157
155
|
const appCodePackage = await createNodePackage(appDeclaration.appIdentifier, this.debug, this.dryRun);
|
|
158
156
|
if (this.dryRun) {
|
|
@@ -179,9 +177,7 @@ class AppDeployer {
|
|
|
179
177
|
nodeRuntime: appDeclaration.nodeRuntime ?? existingApp.nodeRuntime,
|
|
180
178
|
},
|
|
181
179
|
});
|
|
182
|
-
logger_1.default.info(`${chalk_1.default.yellow.bold('APP')} Published
|
|
183
|
-
// The actions, extensions and workflow templates deployed next attach to latestAppVersionId,
|
|
184
|
-
// so it carries the version just published.
|
|
180
|
+
logger_1.default.info(`${chalk_1.default.yellow.bold('APP')} Published pre-release version: ${appVersion.semver}`);
|
|
185
181
|
return { ...existingApp, latestAppVersionId: appVersion.id };
|
|
186
182
|
}
|
|
187
183
|
async remove(appDeclaration) {
|
|
@@ -3,7 +3,9 @@ import semver from 'semver';
|
|
|
3
3
|
* Upgrades a semantic version based on a specified release type.
|
|
4
4
|
*
|
|
5
5
|
* @param {string} currentVersion - The current semantic version string.
|
|
6
|
-
* @param {semver.ReleaseType} type - The type of release ('major', 'minor', 'patch').
|
|
6
|
+
* @param {semver.ReleaseType} type - The type of release ('major', 'minor', 'patch', 'prerelease').
|
|
7
|
+
* 'prerelease' starts an alpha (1.2.3 becomes 1.2.4-alpha.0) or bumps the existing pre-release tag
|
|
8
|
+
* (1.2.4-alpha.0 becomes 1.2.4-alpha.1).
|
|
7
9
|
* @returns {string} The upgraded semantic version.
|
|
8
10
|
* @throws {Error} If the provided currentVersion is not a valid semantic version.
|
|
9
11
|
*
|
|
@@ -7,7 +7,9 @@ const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
|
7
7
|
* Upgrades a semantic version based on a specified release type.
|
|
8
8
|
*
|
|
9
9
|
* @param {string} currentVersion - The current semantic version string.
|
|
10
|
-
* @param {semver.ReleaseType} type - The type of release ('major', 'minor', 'patch').
|
|
10
|
+
* @param {semver.ReleaseType} type - The type of release ('major', 'minor', 'patch', 'prerelease').
|
|
11
|
+
* 'prerelease' starts an alpha (1.2.3 becomes 1.2.4-alpha.0) or bumps the existing pre-release tag
|
|
12
|
+
* (1.2.4-alpha.0 becomes 1.2.4-alpha.1).
|
|
11
13
|
* @returns {string} The upgraded semantic version.
|
|
12
14
|
* @throws {Error} If the provided currentVersion is not a valid semantic version.
|
|
13
15
|
*
|
|
@@ -19,16 +21,13 @@ const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
|
19
21
|
*/
|
|
20
22
|
function upgradeVersion(currentVersion, type) {
|
|
21
23
|
try {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
.split('.')
|
|
25
|
-
.concat(new Array(3).fill(0).map(String))
|
|
26
|
-
.slice(0, 3)
|
|
27
|
-
.join('.');
|
|
24
|
+
const version = currentVersion.toString();
|
|
25
|
+
const paddedVersion = semver_1.default.valid(version) ??
|
|
26
|
+
version.split('.').concat(new Array(3).fill(0).map(String)).slice(0, 3).join('.');
|
|
28
27
|
if (!semver_1.default.valid(paddedVersion)) {
|
|
29
28
|
throw new Error('Invalid version string');
|
|
30
29
|
}
|
|
31
|
-
return semver_1.default.inc(paddedVersion, type);
|
|
30
|
+
return semver_1.default.inc(paddedVersion, type, semver_1.default.prerelease(paddedVersion) ? undefined : 'alpha');
|
|
32
31
|
}
|
|
33
32
|
catch (e) {
|
|
34
33
|
throw new Error(`ERROR PARSING YAML: ${e}`);
|
|
@@ -25,7 +25,19 @@ describe('upgradeVersion', () => {
|
|
|
25
25
|
const expectedVersion = semver_1.default.inc(currentVersion, releaseType);
|
|
26
26
|
expect(upgradedVersion).toBe(expectedVersion);
|
|
27
27
|
});
|
|
28
|
-
it('should
|
|
28
|
+
it('should start an alpha pre-release of the next patch from a stable version', () => {
|
|
29
|
+
expect((0, upgrade_version_1.upgradeVersion)('1.3.0', 'prerelease')).toBe('1.3.1-alpha.0');
|
|
30
|
+
});
|
|
31
|
+
it('should bump the number of an existing pre-release', () => {
|
|
32
|
+
expect((0, upgrade_version_1.upgradeVersion)('1.4.0-alpha.1', 'prerelease')).toBe('1.4.0-alpha.2');
|
|
33
|
+
});
|
|
34
|
+
it('should keep the existing pre-release tag when it is not alpha', () => {
|
|
35
|
+
expect((0, upgrade_version_1.upgradeVersion)('1.4.0-beta.1', 'prerelease')).toBe('1.4.0-beta.2');
|
|
36
|
+
});
|
|
37
|
+
it('should pad a short version before upgrading it', () => {
|
|
38
|
+
expect((0, upgrade_version_1.upgradeVersion)('1.2', 'patch')).toBe('1.2.1');
|
|
39
|
+
});
|
|
40
|
+
it('should upgrade a pre-release to its stable version', () => {
|
|
29
41
|
expect((0, upgrade_version_1.upgradeVersion)('1.4.0-alpha.1', 'patch')).toBe('1.4.0');
|
|
30
42
|
});
|
|
31
43
|
it('should throw an error for an invalid semantic version input', () => {
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.7.0-alpha.
|
|
2
|
+
"version": "3.7.0-alpha.91c1ee9",
|
|
3
3
|
"commands": {
|
|
4
4
|
"login": {
|
|
5
5
|
"id": "login",
|
|
@@ -286,7 +286,7 @@
|
|
|
286
286
|
},
|
|
287
287
|
"app:publish": {
|
|
288
288
|
"id": "app:publish",
|
|
289
|
-
"description": "Publish the app to the marketplace. This visibility of your app depends on the app.yml configuration (\"visibility\" property). A
|
|
289
|
+
"description": "Publish the app to the marketplace. This visibility of your app depends on the app.yml configuration (\"visibility\" property). A pre-release version (e.g. \"1.4.0-alpha.1\") is published without becoming the latest version of the app.",
|
|
290
290
|
"strict": true,
|
|
291
291
|
"pluginName": "@contrail/cli",
|
|
292
292
|
"pluginAlias": "@contrail/cli",
|
|
@@ -4009,6 +4009,48 @@
|
|
|
4009
4009
|
},
|
|
4010
4010
|
"args": {}
|
|
4011
4011
|
},
|
|
4012
|
+
"app:version:prerelease": {
|
|
4013
|
+
"id": "app:version:prerelease",
|
|
4014
|
+
"description": "Upgrade the Pre-release app version. A stable version becomes the first alpha of the next patch (1.2.3 to 1.2.4-alpha.0). A pre-release version gets its number bumped (1.2.4-alpha.0 to 1.2.4-alpha.1).",
|
|
4015
|
+
"strict": true,
|
|
4016
|
+
"pluginName": "@contrail/cli",
|
|
4017
|
+
"pluginAlias": "@contrail/cli",
|
|
4018
|
+
"pluginType": "core",
|
|
4019
|
+
"aliases": [],
|
|
4020
|
+
"examples": [
|
|
4021
|
+
"$ contrail app version prerelease\n"
|
|
4022
|
+
],
|
|
4023
|
+
"flags": {
|
|
4024
|
+
"logLevel": {
|
|
4025
|
+
"name": "logLevel",
|
|
4026
|
+
"type": "option",
|
|
4027
|
+
"char": "l",
|
|
4028
|
+
"description": "The Log Level",
|
|
4029
|
+
"required": false,
|
|
4030
|
+
"multiple": false,
|
|
4031
|
+
"options": [
|
|
4032
|
+
"error",
|
|
4033
|
+
"warn",
|
|
4034
|
+
"info",
|
|
4035
|
+
"debug"
|
|
4036
|
+
]
|
|
4037
|
+
},
|
|
4038
|
+
"alwaysConfirmEnv": {
|
|
4039
|
+
"name": "alwaysConfirmEnv",
|
|
4040
|
+
"type": "option",
|
|
4041
|
+
"char": "e",
|
|
4042
|
+
"description": "The Environment variables",
|
|
4043
|
+
"required": false,
|
|
4044
|
+
"multiple": false,
|
|
4045
|
+
"options": [
|
|
4046
|
+
"true",
|
|
4047
|
+
"false"
|
|
4048
|
+
],
|
|
4049
|
+
"default": "true"
|
|
4050
|
+
}
|
|
4051
|
+
},
|
|
4052
|
+
"args": {}
|
|
4053
|
+
},
|
|
4012
4054
|
"app:extension:deployment:list": {
|
|
4013
4055
|
"id": "app:extension:deployment:list",
|
|
4014
4056
|
"description": "List extension deployments",
|