@contrail/cli 3.8.0-alpha.a026035 → 3.8.0-alpha.c55a61b

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 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.8.0-alpha.a026035 linux-x64 node-v24.22.2
20
+ @contrail/cli/3.8.0-alpha.c55a61b linux-x64 node-v24.22.3
21
21
  $ contrail --help [COMMAND]
22
22
  USAGE
23
23
  $ contrail COMMAND
@@ -45,6 +45,9 @@ 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 premajor`](#contrail-app-version-premajor)
49
+ * [`contrail app version preminor`](#contrail-app-version-preminor)
50
+ * [`contrail app version prepatch`](#contrail-app-version-prepatch)
48
51
  * [`contrail app version prerelease`](#contrail-app-version-prerelease)
49
52
  * [`contrail autocomplete [SHELL]`](#contrail-autocomplete-shell)
50
53
  * [`contrail config create`](#contrail-config-create)
@@ -398,6 +401,69 @@ EXAMPLES
398
401
  $ contrail app version patch
399
402
  ```
400
403
 
404
+ ## `contrail app version premajor`
405
+
406
+ Start an alpha pre-release of the next major app version (1.2.3 to 2.0.0-alpha.0).
407
+
408
+ ```
409
+ USAGE
410
+ $ contrail app version premajor [-l error|warn|info|debug] [-e true|false]
411
+
412
+ FLAGS
413
+ -e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
414
+ <options: true|false>
415
+ -l, --logLevel=<option> The Log Level
416
+ <options: error|warn|info|debug>
417
+
418
+ DESCRIPTION
419
+ Start an alpha pre-release of the next major app version (1.2.3 to 2.0.0-alpha.0).
420
+
421
+ EXAMPLES
422
+ $ contrail app version premajor
423
+ ```
424
+
425
+ ## `contrail app version preminor`
426
+
427
+ Start an alpha pre-release of the next minor app version (1.2.3 to 1.3.0-alpha.0).
428
+
429
+ ```
430
+ USAGE
431
+ $ contrail app version preminor [-l error|warn|info|debug] [-e true|false]
432
+
433
+ FLAGS
434
+ -e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
435
+ <options: true|false>
436
+ -l, --logLevel=<option> The Log Level
437
+ <options: error|warn|info|debug>
438
+
439
+ DESCRIPTION
440
+ Start an alpha pre-release of the next minor app version (1.2.3 to 1.3.0-alpha.0).
441
+
442
+ EXAMPLES
443
+ $ contrail app version preminor
444
+ ```
445
+
446
+ ## `contrail app version prepatch`
447
+
448
+ Start an alpha pre-release of the next patch app version (1.2.3 to 1.2.4-alpha.0).
449
+
450
+ ```
451
+ USAGE
452
+ $ contrail app version prepatch [-l error|warn|info|debug] [-e true|false]
453
+
454
+ FLAGS
455
+ -e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
456
+ <options: true|false>
457
+ -l, --logLevel=<option> The Log Level
458
+ <options: error|warn|info|debug>
459
+
460
+ DESCRIPTION
461
+ Start an alpha pre-release of the next patch app version (1.2.3 to 1.2.4-alpha.0).
462
+
463
+ EXAMPLES
464
+ $ contrail app version prepatch
465
+ ```
466
+
401
467
  ## `contrail app version prerelease`
402
468
 
403
469
  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).
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from '../../../basecommand';
2
+ export default class AppPremajorVersionUpgrade 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 AppPremajorVersionUpgrade extends basecommand_1.BaseCommand {
10
+ skipConfirmEnv = true;
11
+ static description = 'Start an alpha pre-release of the next major app version (1.2.3 to 2.0.0-alpha.0).';
12
+ static examples = [
13
+ `$ contrail app version premajor
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-major Version for ${appDeclaration.version}`);
23
+ const version = (0, upgrade_version_1.upgradeVersion)(appDeclaration.version, 'premajor');
24
+ (0, update_app_config_1.updateAppConfig)({ ...appDeclaration, version });
25
+ logger_1.default.info(`Pre-major Version Upgraded to ${version}`);
26
+ }
27
+ catch (e) {
28
+ logger_1.default.error(`Application Pre-major Version Upgrade Failed: ${e}`);
29
+ }
30
+ }
31
+ }
32
+ exports.default = AppPremajorVersionUpgrade;
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from '../../../basecommand';
2
+ export default class AppPreminorVersionUpgrade 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 AppPreminorVersionUpgrade extends basecommand_1.BaseCommand {
10
+ skipConfirmEnv = true;
11
+ static description = 'Start an alpha pre-release of the next minor app version (1.2.3 to 1.3.0-alpha.0).';
12
+ static examples = [
13
+ `$ contrail app version preminor
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-minor Version for ${appDeclaration.version}`);
23
+ const version = (0, upgrade_version_1.upgradeVersion)(appDeclaration.version, 'preminor');
24
+ (0, update_app_config_1.updateAppConfig)({ ...appDeclaration, version });
25
+ logger_1.default.info(`Pre-minor Version Upgraded to ${version}`);
26
+ }
27
+ catch (e) {
28
+ logger_1.default.error(`Application Pre-minor Version Upgrade Failed: ${e}`);
29
+ }
30
+ }
31
+ }
32
+ exports.default = AppPreminorVersionUpgrade;
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from '../../../basecommand';
2
+ export default class AppPrepatchVersionUpgrade 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 AppPrepatchVersionUpgrade extends basecommand_1.BaseCommand {
10
+ skipConfirmEnv = true;
11
+ static description = 'Start an alpha pre-release of the next patch app version (1.2.3 to 1.2.4-alpha.0).';
12
+ static examples = [
13
+ `$ contrail app version prepatch
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-patch Version for ${appDeclaration.version}`);
23
+ const version = (0, upgrade_version_1.upgradeVersion)(appDeclaration.version, 'prepatch');
24
+ (0, update_app_config_1.updateAppConfig)({ ...appDeclaration, version });
25
+ logger_1.default.info(`Pre-patch Version Upgraded to ${version}`);
26
+ }
27
+ catch (e) {
28
+ logger_1.default.error(`Application Pre-patch Version Upgrade Failed: ${e}`);
29
+ }
30
+ }
31
+ }
32
+ exports.default = AppPrepatchVersionUpgrade;
@@ -11,6 +11,7 @@ export declare const ERROR_MESSAGES: {
11
11
  invalidOrgSlug: string;
12
12
  emptyPermissionsArray: string;
13
13
  invalidVisibility: string;
14
+ invalidGithubRepositoryUrl: string;
14
15
  deprecatedHiddenField: string;
15
16
  ignoredAccessGrants: string;
16
17
  invalidPermission: (permission: string) => string;
@@ -19,4 +20,5 @@ export declare const ERROR_MESSAGES: {
19
20
  export declare function validateAppConfig(appConfig: AppDeclaration): void;
20
21
  export declare function appVersionValidator(appDeclaration: AppDeclaration): AppConfigValidationError;
21
22
  export declare function visibilityValidator(appDeclaration: AppDeclaration): AppConfigValidationError;
23
+ export declare function githubRepositoryUrlValidator(appDeclaration: AppDeclaration): AppConfigValidationError;
22
24
  export declare function validateAccessGrants(appDeclaration: AppDeclaration): AppConfigValidationError;
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateAccessGrants = exports.visibilityValidator = exports.appVersionValidator = exports.validateAppConfig = exports.ERROR_MESSAGES = void 0;
3
+ exports.validateAccessGrants = exports.githubRepositoryUrlValidator = exports.visibilityValidator = exports.appVersionValidator = exports.validateAppConfig = exports.ERROR_MESSAGES = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const semver_1 = tslib_1.__importDefault(require("semver"));
6
6
  const interfaces_1 = require("../../interfaces");
7
7
  const logger_1 = tslib_1.__importDefault(require("../../logger"));
8
- const VALIDATORS = [appVersionValidator, visibilityValidator, validateAccessGrants];
8
+ const VALIDATORS = [
9
+ appVersionValidator,
10
+ visibilityValidator,
11
+ validateAccessGrants,
12
+ githubRepositoryUrlValidator,
13
+ ];
14
+ const GITHUB_REPOSITORY_URL = /^https:\/\/github\.com\/[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/;
9
15
  exports.ERROR_MESSAGES = {
10
16
  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
17
  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.',
@@ -14,6 +20,7 @@ exports.ERROR_MESSAGES = {
14
20
  invalidOrgSlug: 'Invalid or missing orgSlug in one of the accessGrants objects.',
15
21
  emptyPermissionsArray: 'Permissions must be a non-empty array in one of the accessGrants objects.',
16
22
  invalidVisibility: 'Invalid visibility. Visibility must be "public" or "private".',
23
+ invalidGithubRepositoryUrl: 'Invalid githubRepositoryUrl. Use a GitHub repository like "https://github.com/owner/name", or remove the field.',
17
24
  deprecatedHiddenField: 'The "hidden" field is deprecated.',
18
25
  ignoredAccessGrants: 'App is set to public. accessGrants will be ignored.',
19
26
  invalidPermission: (permission) => `Invalid permission found in one of the accessGrants objects: ${permission}.`,
@@ -31,7 +38,7 @@ function validateAppConfig(appConfig) {
31
38
  logger_1.default.warn(warnings);
32
39
  }
33
40
  if (errors.length) {
34
- throw new Error(`Invalid app config: \n ${errors.map((x) => x.error).join('\n')}`);
41
+ throw new Error(`Invalid app config: \n ${errors.join('\n')}`);
35
42
  }
36
43
  }
37
44
  exports.validateAppConfig = validateAppConfig;
@@ -64,6 +71,16 @@ function visibilityValidator(appDeclaration) {
64
71
  return { errors, warnings };
65
72
  }
66
73
  exports.visibilityValidator = visibilityValidator;
74
+ function githubRepositoryUrlValidator(appDeclaration) {
75
+ const isDeclared = 'githubRepositoryUrl' in appDeclaration;
76
+ const isValid = typeof appDeclaration.githubRepositoryUrl === 'string' &&
77
+ GITHUB_REPOSITORY_URL.test(appDeclaration.githubRepositoryUrl);
78
+ return {
79
+ errors: isDeclared && !isValid ? [exports.ERROR_MESSAGES.invalidGithubRepositoryUrl] : [],
80
+ warnings: [],
81
+ };
82
+ }
83
+ exports.githubRepositoryUrlValidator = githubRepositoryUrlValidator;
67
84
  function validateAccessGrants(appDeclaration) {
68
85
  const errors = [];
69
86
  const warnings = [];
@@ -337,3 +337,39 @@ describe('validateAccessGrants', () => {
337
337
  expect(validationResult).toEqual(expectedError);
338
338
  });
339
339
  });
340
+ describe('githubRepositoryUrlValidator', () => {
341
+ it('should not return an error if githubRepositoryUrl is not declared', () => {
342
+ expect((0, app_config_validators_1.githubRepositoryUrlValidator)({})).toEqual(validResult);
343
+ });
344
+ it('should not return an error if githubRepositoryUrl is a GitHub repository URL', () => {
345
+ const appDeclaration = {
346
+ githubRepositoryUrl: 'https://github.com/acme/vibeiq-apps',
347
+ };
348
+ expect((0, app_config_validators_1.githubRepositoryUrlValidator)(appDeclaration)).toEqual(validResult);
349
+ });
350
+ it.each([
351
+ 'http://github.com/acme/vibeiq-apps',
352
+ 'https://gitlab.com/acme/vibeiq-apps',
353
+ 'https://github.com/acme',
354
+ 'https://github.com/acme/vibeiq-apps/',
355
+ 'git@github.com:acme/vibeiq-apps.git',
356
+ '',
357
+ null,
358
+ ])('should return an error if githubRepositoryUrl is %p', (githubRepositoryUrl) => {
359
+ const appDeclaration = { githubRepositoryUrl };
360
+ expect((0, app_config_validators_1.githubRepositoryUrlValidator)(appDeclaration)).toEqual({
361
+ errors: [app_config_validators_1.ERROR_MESSAGES.invalidGithubRepositoryUrl],
362
+ warnings: [],
363
+ });
364
+ });
365
+ });
366
+ describe('validateAppConfig', () => {
367
+ it('should name each problem in the error it throws', () => {
368
+ const appDeclaration = {
369
+ version: '1.0.0',
370
+ visibility: 'private',
371
+ githubRepositoryUrl: 'https://github.com/acme',
372
+ };
373
+ expect(() => (0, app_config_validators_1.validateAppConfig)(appDeclaration)).toThrow(app_config_validators_1.ERROR_MESSAGES.invalidGithubRepositoryUrl);
374
+ });
375
+ });
@@ -78,6 +78,7 @@ class AppDeployer {
78
78
  description: appDeclaration.appDescription,
79
79
  publisher: appDeclaration.publisher,
80
80
  thumbnail: appDeclaration.thumbnail,
81
+ githubRepositoryUrl: appDeclaration.githubRepositoryUrl,
81
82
  eventWorkflowTriggerKeyMapping: appDeclaration.eventWorkflowTriggerKeyMapping,
82
83
  keywords: appDeclaration.keywords,
83
84
  configProperties,
@@ -129,6 +130,7 @@ class AppDeployer {
129
130
  description: appDeclaration.appDescription,
130
131
  publisher: appDeclaration.publisher,
131
132
  thumbnail: appDeclaration.thumbnail,
133
+ githubRepositoryUrl: appDeclaration.githubRepositoryUrl,
132
134
  eventWorkflowTriggerKeyMapping: appDeclaration.eventWorkflowTriggerKeyMapping,
133
135
  keywords: appDeclaration.keywords,
134
136
  configProperties,
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const apps_1 = require("../../api/apps");
4
+ const app_deployer_1 = require("./app-deployer");
5
+ const createSpy = jest.fn();
6
+ const updateSpy = jest.fn();
7
+ const getSpy = jest.fn();
8
+ jest.mock('@contrail/sdk', () => ({
9
+ Entities: jest.fn().mockImplementation(() => ({
10
+ create: (...args) => createSpy(...args),
11
+ update: (...args) => updateSpy(...args),
12
+ get: (...args) => getSpy(...args),
13
+ })),
14
+ }));
15
+ jest.mock('../../api/apps');
16
+ jest.mock('../../logger');
17
+ jest.mock('fs');
18
+ jest.mock('child_process');
19
+ jest.mock('zip-a-folder');
20
+ jest.mock('axios');
21
+ jest.mock('./metadata-extractor');
22
+ jest.mock('./actions-deployer');
23
+ jest.mock('./extensions-deployer');
24
+ jest.mock('../workflow-template-definitions/workflow-template-definition-deployer');
25
+ const GITHUB_REPOSITORY_URL = 'https://github.com/acme/vibeiq-apps';
26
+ const existingApp = { id: 'app-1', identifier: '@acme/board-tools' };
27
+ const appDeclaration = {
28
+ appIdentifier: '@acme/board-tools',
29
+ appName: 'Board Tools',
30
+ visibility: 'private',
31
+ publisher: 'Acme',
32
+ version: '1.4.0',
33
+ };
34
+ const sentBody = (spy, entityName) => {
35
+ const call = spy.mock.calls.find(([options]) => options.entityName === entityName);
36
+ return call && JSON.parse(JSON.stringify(call[0].object));
37
+ };
38
+ describe('AppDeployer githubRepositoryUrl', () => {
39
+ beforeEach(() => {
40
+ jest.clearAllMocks();
41
+ getSpy.mockResolvedValue([existingApp]);
42
+ createSpy.mockImplementation(async ({ object }) => ({ id: 'created-1', ...object }));
43
+ updateSpy.mockImplementation(async ({ id, object }) => ({ id, ...object }));
44
+ });
45
+ describe('first publish', () => {
46
+ beforeEach(() => apps_1.getAvailableApps.mockResolvedValue([]));
47
+ it('should create the app with the declared repository', async () => {
48
+ await new app_deployer_1.AppDeployer().deploy({
49
+ ...appDeclaration,
50
+ githubRepositoryUrl: GITHUB_REPOSITORY_URL,
51
+ });
52
+ expect(sentBody(createSpy, 'app').githubRepositoryUrl).toBe(GITHUB_REPOSITORY_URL);
53
+ });
54
+ it('should create the app without a repository when none is declared', async () => {
55
+ await new app_deployer_1.AppDeployer().deploy(appDeclaration);
56
+ expect(sentBody(createSpy, 'app')).not.toHaveProperty('githubRepositoryUrl');
57
+ });
58
+ it('should create the app with the declared repository when the first version is a pre-release', async () => {
59
+ await new app_deployer_1.AppDeployer().deploy({
60
+ ...appDeclaration,
61
+ version: '1.4.0-alpha.1',
62
+ githubRepositoryUrl: GITHUB_REPOSITORY_URL,
63
+ });
64
+ expect(sentBody(createSpy, 'app').githubRepositoryUrl).toBe(GITHUB_REPOSITORY_URL);
65
+ });
66
+ });
67
+ describe('publish of an existing app', () => {
68
+ beforeEach(() => apps_1.getAvailableApps.mockResolvedValue([existingApp]));
69
+ it('should update the app with the declared repository on a stable publish', async () => {
70
+ await new app_deployer_1.AppDeployer().deploy({
71
+ ...appDeclaration,
72
+ githubRepositoryUrl: GITHUB_REPOSITORY_URL,
73
+ });
74
+ expect(sentBody(updateSpy, 'app').githubRepositoryUrl).toBe(GITHUB_REPOSITORY_URL);
75
+ });
76
+ it('should leave the repository out of a stable publish when none is declared', async () => {
77
+ await new app_deployer_1.AppDeployer().deploy(appDeclaration);
78
+ expect(sentBody(updateSpy, 'app')).not.toHaveProperty('githubRepositoryUrl');
79
+ });
80
+ it('should not update the app or send the repository on a pre-release publish', async () => {
81
+ await new app_deployer_1.AppDeployer().deploy({
82
+ ...appDeclaration,
83
+ version: '1.4.1-alpha.0',
84
+ githubRepositoryUrl: GITHUB_REPOSITORY_URL,
85
+ });
86
+ expect(sentBody(updateSpy, 'app')).toBeUndefined();
87
+ expect(sentBody(createSpy, 'app-version')).not.toHaveProperty('githubRepositoryUrl');
88
+ });
89
+ });
90
+ });
@@ -3,9 +3,13 @@ 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', 'prerelease').
6
+ * @param {semver.ReleaseType} type - The type of release ('major', 'minor', 'patch', 'premajor',
7
+ * 'preminor', 'prepatch', 'prerelease').
7
8
  * 'prerelease' starts an alpha (1.2.3 becomes 1.2.4-alpha.0) or bumps the existing pre-release tag
8
9
  * (1.2.4-alpha.0 becomes 1.2.4-alpha.1).
10
+ * 'premajor', 'preminor' and 'prepatch' always start the first alpha of the next major, minor or
11
+ * patch version (1.2.3 becomes 2.0.0-alpha.0, 1.3.0-alpha.0 or 1.2.4-alpha.0). The results match
12
+ * `npm version <type> --preid=alpha`.
9
13
  * @returns {string} The upgraded semantic version.
10
14
  * @throws {Error} If the provided currentVersion is not a valid semantic version.
11
15
  *
@@ -7,9 +7,13 @@ 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', 'prerelease').
10
+ * @param {semver.ReleaseType} type - The type of release ('major', 'minor', 'patch', 'premajor',
11
+ * 'preminor', 'prepatch', 'prerelease').
11
12
  * 'prerelease' starts an alpha (1.2.3 becomes 1.2.4-alpha.0) or bumps the existing pre-release tag
12
13
  * (1.2.4-alpha.0 becomes 1.2.4-alpha.1).
14
+ * 'premajor', 'preminor' and 'prepatch' always start the first alpha of the next major, minor or
15
+ * patch version (1.2.3 becomes 2.0.0-alpha.0, 1.3.0-alpha.0 or 1.2.4-alpha.0). The results match
16
+ * `npm version <type> --preid=alpha`.
13
17
  * @returns {string} The upgraded semantic version.
14
18
  * @throws {Error} If the provided currentVersion is not a valid semantic version.
15
19
  *
@@ -27,7 +31,7 @@ function upgradeVersion(currentVersion, type) {
27
31
  if (!semver_1.default.valid(paddedVersion)) {
28
32
  throw new Error('Invalid version string');
29
33
  }
30
- return semver_1.default.inc(paddedVersion, type, semver_1.default.prerelease(paddedVersion) ? undefined : 'alpha');
34
+ return semver_1.default.inc(paddedVersion, type, type === 'prerelease' && semver_1.default.prerelease(paddedVersion) ? undefined : 'alpha');
31
35
  }
32
36
  catch (e) {
33
37
  throw new Error(`ERROR PARSING YAML: ${e}`);
@@ -34,6 +34,17 @@ describe('upgradeVersion', () => {
34
34
  it('should keep the existing pre-release tag when it is not alpha', () => {
35
35
  expect((0, upgrade_version_1.upgradeVersion)('1.4.0-beta.1', 'prerelease')).toBe('1.4.0-beta.2');
36
36
  });
37
+ it.each([
38
+ ['premajor', '1.2.3', '2.0.0-alpha.0'],
39
+ ['preminor', '1.2.3', '1.3.0-alpha.0'],
40
+ ['prepatch', '1.2.3', '1.2.4-alpha.0'],
41
+ ['premajor', '1.2.4-alpha.1', '2.0.0-alpha.0'],
42
+ ['preminor', '1.2.4-alpha.1', '1.3.0-alpha.0'],
43
+ ['prepatch', '1.2.4-alpha.1', '1.2.5-alpha.0'],
44
+ ['premajor', '2.0.0-beta.1', '3.0.0-alpha.0'],
45
+ ])('should apply %s to %s the way npm version does', (type, current, expected) => {
46
+ expect((0, upgrade_version_1.upgradeVersion)(current, type)).toBe(expected);
47
+ });
37
48
  it('should pad a short version before upgrading it', () => {
38
49
  expect((0, upgrade_version_1.upgradeVersion)('1.2', 'patch')).toBe('1.2.1');
39
50
  });
@@ -13,6 +13,7 @@ export interface AppDeclaration {
13
13
  version: string;
14
14
  eventWorkflowTriggerKeyMapping: string;
15
15
  thumbnail?: string;
16
+ githubRepositoryUrl?: string;
16
17
  keywords?: Array<string>;
17
18
  actions?: {
18
19
  [key: string]: AppActionDeclaration;
@@ -147,10 +148,12 @@ export interface App {
147
148
  description?: string;
148
149
  publisher: string;
149
150
  thumbnail: string;
151
+ githubRepositoryUrl?: string;
150
152
  eventWorkflowTriggerKeyMapping: string;
151
153
  configProperties?: ConfigProperty[];
152
154
  triggerKeyDefinitions?: TriggerKeyDefinition[];
153
155
  latestAppVersionId?: string;
156
+ nodeRuntime?: NodeRuntime;
154
157
  }
155
158
  export interface AppOrg {
156
159
  id: string;
@@ -10,6 +10,8 @@ visibility: private # This should be private unless you want to develop an app f
10
10
  # permissions:
11
11
  # - install
12
12
  publisher: 'APP_PUBLISHER_STUB' # Your company name, used for public apps
13
+ # The GitHub repository that holds this app's source.
14
+ # githubRepositoryUrl: 'https://github.com/OWNER/NAME'
13
15
  version: '1.0.0'
14
16
 
15
17
  # Properties you can configure when you install the app.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.8.0-alpha.a026035",
2
+ "version": "3.8.0-alpha.c55a61b",
3
3
  "commands": {
4
4
  "login": {
5
5
  "id": "login",
@@ -4009,6 +4009,132 @@
4009
4009
  },
4010
4010
  "args": {}
4011
4011
  },
4012
+ "app:version:premajor": {
4013
+ "id": "app:version:premajor",
4014
+ "description": "Start an alpha pre-release of the next major app version (1.2.3 to 2.0.0-alpha.0).",
4015
+ "strict": true,
4016
+ "pluginName": "@contrail/cli",
4017
+ "pluginAlias": "@contrail/cli",
4018
+ "pluginType": "core",
4019
+ "aliases": [],
4020
+ "examples": [
4021
+ "$ contrail app version premajor\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
+ },
4054
+ "app:version:preminor": {
4055
+ "id": "app:version:preminor",
4056
+ "description": "Start an alpha pre-release of the next minor app version (1.2.3 to 1.3.0-alpha.0).",
4057
+ "strict": true,
4058
+ "pluginName": "@contrail/cli",
4059
+ "pluginAlias": "@contrail/cli",
4060
+ "pluginType": "core",
4061
+ "aliases": [],
4062
+ "examples": [
4063
+ "$ contrail app version preminor\n"
4064
+ ],
4065
+ "flags": {
4066
+ "logLevel": {
4067
+ "name": "logLevel",
4068
+ "type": "option",
4069
+ "char": "l",
4070
+ "description": "The Log Level",
4071
+ "required": false,
4072
+ "multiple": false,
4073
+ "options": [
4074
+ "error",
4075
+ "warn",
4076
+ "info",
4077
+ "debug"
4078
+ ]
4079
+ },
4080
+ "alwaysConfirmEnv": {
4081
+ "name": "alwaysConfirmEnv",
4082
+ "type": "option",
4083
+ "char": "e",
4084
+ "description": "The Environment variables",
4085
+ "required": false,
4086
+ "multiple": false,
4087
+ "options": [
4088
+ "true",
4089
+ "false"
4090
+ ],
4091
+ "default": "true"
4092
+ }
4093
+ },
4094
+ "args": {}
4095
+ },
4096
+ "app:version:prepatch": {
4097
+ "id": "app:version:prepatch",
4098
+ "description": "Start an alpha pre-release of the next patch app version (1.2.3 to 1.2.4-alpha.0).",
4099
+ "strict": true,
4100
+ "pluginName": "@contrail/cli",
4101
+ "pluginAlias": "@contrail/cli",
4102
+ "pluginType": "core",
4103
+ "aliases": [],
4104
+ "examples": [
4105
+ "$ contrail app version prepatch\n"
4106
+ ],
4107
+ "flags": {
4108
+ "logLevel": {
4109
+ "name": "logLevel",
4110
+ "type": "option",
4111
+ "char": "l",
4112
+ "description": "The Log Level",
4113
+ "required": false,
4114
+ "multiple": false,
4115
+ "options": [
4116
+ "error",
4117
+ "warn",
4118
+ "info",
4119
+ "debug"
4120
+ ]
4121
+ },
4122
+ "alwaysConfirmEnv": {
4123
+ "name": "alwaysConfirmEnv",
4124
+ "type": "option",
4125
+ "char": "e",
4126
+ "description": "The Environment variables",
4127
+ "required": false,
4128
+ "multiple": false,
4129
+ "options": [
4130
+ "true",
4131
+ "false"
4132
+ ],
4133
+ "default": "true"
4134
+ }
4135
+ },
4136
+ "args": {}
4137
+ },
4012
4138
  "app:version:prerelease": {
4013
4139
  "id": "app:version:prerelease",
4014
4140
  "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).",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/cli",
3
- "version": "3.8.0-alpha.a026035",
3
+ "version": "3.8.0-alpha.c55a61b",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",