@contrail/cli 2.0.15 → 2.0.17
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 +3 -2
- package/dist/auth/login.d.ts +1 -0
- package/dist/auth/login.js +10 -6
- package/dist/commands/app/create.js +59 -1
- package/dist/commands/app/install.js +3 -0
- package/dist/commands/app/publish.d.ts +1 -0
- package/dist/commands/app/publish.js +2 -1
- package/dist/commands/app/uninstall.js +3 -0
- package/dist/commands/app/upgrade.js +1 -1
- package/dist/helpers/app/app-deployer.d.ts +4 -1
- package/dist/helpers/app/app-deployer.js +97 -3
- package/dist/helpers/app/setup-template.d.ts +7 -1
- package/dist/helpers/app/setup-template.js +9 -1
- package/dist/interfaces.d.ts +11 -0
- package/dist/interfaces.js +6 -1
- package/dist/templates/typescript/app.yml +4 -4
- package/oclif.manifest.json +9 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ $ npm install -g @contrail/cli
|
|
|
15
15
|
$ contrail COMMAND
|
|
16
16
|
running command...
|
|
17
17
|
$ contrail (--version)
|
|
18
|
-
@contrail/cli/2.0.
|
|
18
|
+
@contrail/cli/2.0.17 darwin-arm64 node-v18.13.0
|
|
19
19
|
$ contrail --help [COMMAND]
|
|
20
20
|
USAGE
|
|
21
21
|
$ contrail COMMAND
|
|
@@ -159,9 +159,10 @@ Publish the app
|
|
|
159
159
|
|
|
160
160
|
```
|
|
161
161
|
USAGE
|
|
162
|
-
$ contrail app publish [-u]
|
|
162
|
+
$ contrail app publish [-u] [-d]
|
|
163
163
|
|
|
164
164
|
FLAGS
|
|
165
|
+
-d, --debug Debug the app deployment step and do not remove the intermediate build artifacts.
|
|
165
166
|
-u, --upgrade In addition to deploying, upgrade the installed version of the app in this org to the latest one.
|
|
166
167
|
|
|
167
168
|
DESCRIPTION
|
package/dist/auth/login.d.ts
CHANGED
package/dist/auth/login.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.authUser = void 0;
|
|
3
|
+
exports.getCurrentUser = exports.authUser = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const AmazonCognitoIdentity = require('amazon-cognito-identity-js');
|
|
6
6
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
@@ -12,13 +12,13 @@ const CONFIGURATION = {
|
|
|
12
12
|
clientId: process.env.CONTRAIL_COGNITO_CLIENT_ID || '7knkt34gfacbgd0ghnuspefdfg',
|
|
13
13
|
};
|
|
14
14
|
async function authUser() {
|
|
15
|
-
console.debug('authorizing user');
|
|
15
|
+
console.debug('authorizing user...');
|
|
16
16
|
const config = await (0, config_1.getConfig)();
|
|
17
17
|
if (config &&
|
|
18
18
|
config.apiUserToken &&
|
|
19
19
|
config.apiGateway &&
|
|
20
20
|
config.orgSlug) {
|
|
21
|
-
console.debug('populating auth config from fs config');
|
|
21
|
+
console.debug('populating auth config from fs config...');
|
|
22
22
|
auth_1.Auth.config = {
|
|
23
23
|
apiUserToken: config.apiUserToken,
|
|
24
24
|
apiGateway: config.apiGateway,
|
|
@@ -124,15 +124,19 @@ async function setAuthContext(user, params) {
|
|
|
124
124
|
(0, sdk_1.setConfig)(auth_1.Auth.config);
|
|
125
125
|
return refreshCurrentUserOrg();
|
|
126
126
|
}
|
|
127
|
-
async function
|
|
128
|
-
|
|
129
|
-
const currentUser = await sdk_1.Request.request('/users/current', {
|
|
127
|
+
async function getCurrentUser() {
|
|
128
|
+
return await sdk_1.Request.request('/users/current', {
|
|
130
129
|
method: 'GET',
|
|
131
130
|
headers: {
|
|
132
131
|
Accept: 'application/json',
|
|
133
132
|
'Content-Type': 'application/json',
|
|
134
133
|
},
|
|
135
134
|
});
|
|
135
|
+
}
|
|
136
|
+
exports.getCurrentUser = getCurrentUser;
|
|
137
|
+
async function refreshCurrentUserOrg() {
|
|
138
|
+
console.debug('refreshing current user org...');
|
|
139
|
+
const currentUser = await getCurrentUser();
|
|
136
140
|
if (!currentUser) {
|
|
137
141
|
throw Error('Could not get current user');
|
|
138
142
|
}
|
|
@@ -1,10 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
const core_1 = require("@oclif/core");
|
|
4
5
|
const setup_template_1 = require("../../helpers/app/setup-template");
|
|
6
|
+
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
7
|
+
const login_1 = require("../../auth/login");
|
|
8
|
+
const sdk_1 = require("@contrail/sdk");
|
|
9
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
5
10
|
class CreateApp extends core_1.Command {
|
|
6
11
|
async run() {
|
|
7
|
-
await (0,
|
|
12
|
+
await (0, login_1.authUser)();
|
|
13
|
+
const currentUser = await (0, login_1.getCurrentUser)();
|
|
14
|
+
const defaultAppName = `Hello World by ${currentUser.email}`;
|
|
15
|
+
const defaultAppIdentifier = `${currentUser.email}/hello-world`;
|
|
16
|
+
const defaultAppDescription = `Hello world app by ${currentUser.email}`;
|
|
17
|
+
const defaultAppPublisher = `${currentUser.email}`;
|
|
18
|
+
const answers = await inquirer_1.default.prompt([{
|
|
19
|
+
type: 'input',
|
|
20
|
+
name: 'appName',
|
|
21
|
+
message: 'What is the Name of your app?',
|
|
22
|
+
default: defaultAppName,
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'input',
|
|
27
|
+
name: 'appIdentifier',
|
|
28
|
+
message: 'App Identifier (must be unique):',
|
|
29
|
+
default: defaultAppIdentifier,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: 'input',
|
|
34
|
+
name: 'appDescription',
|
|
35
|
+
message: 'App description:',
|
|
36
|
+
default: defaultAppDescription,
|
|
37
|
+
required: true
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: 'input',
|
|
41
|
+
name: 'appPublisher',
|
|
42
|
+
message: 'App Publisher:',
|
|
43
|
+
default: defaultAppPublisher,
|
|
44
|
+
required: true
|
|
45
|
+
}]);
|
|
46
|
+
const newApp = {
|
|
47
|
+
identifier: answers.appIdentifier,
|
|
48
|
+
name: answers.appName,
|
|
49
|
+
publisher: answers.appPublisher,
|
|
50
|
+
public: false,
|
|
51
|
+
hidden: false,
|
|
52
|
+
description: answers.appDescription
|
|
53
|
+
};
|
|
54
|
+
try {
|
|
55
|
+
await new sdk_1.Entities().create({ entityName: 'app', object: newApp });
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
console.error(`%s Failed to create new app: ${answers.appIdentifier}`, chalk_1.default.red.bold('APP'));
|
|
59
|
+
this.exit(1);
|
|
60
|
+
}
|
|
61
|
+
await (0, setup_template_1.setUpTemplate)({
|
|
62
|
+
appName: answers.appName,
|
|
63
|
+
appIdentifier: answers.appIdentifier,
|
|
64
|
+
appDescription: answers.appDescription
|
|
65
|
+
});
|
|
8
66
|
}
|
|
9
67
|
}
|
|
10
68
|
exports.default = CreateApp;
|
|
@@ -77,6 +77,9 @@ class InstallApp extends core_1.Command {
|
|
|
77
77
|
console.log('%s Not installing associated app workflows', chalk_1.default.yellow.bold('APP INSTALLATION'));
|
|
78
78
|
flags.installWorkflowTemplates = false;
|
|
79
79
|
}
|
|
80
|
+
else {
|
|
81
|
+
flags.installWorkflowTemplates = true;
|
|
82
|
+
}
|
|
80
83
|
}
|
|
81
84
|
if (flags.installWorkflowTemplates) {
|
|
82
85
|
const workflowTemplateDefinitions = await (0, apps_1.getWorkflowTemplateDefinitionsForApp)({ appId: app.id });
|
|
@@ -22,7 +22,7 @@ class PublishApp extends core_1.Command {
|
|
|
22
22
|
console.log(`%s Deploying Application. ${appDeclaration.appIdentifier}`, chalk_1.default.blue.bold('START'));
|
|
23
23
|
try {
|
|
24
24
|
await (0, login_1.authUser)();
|
|
25
|
-
const app = await new app_deployer_1.AppDeployer().deploy(appDeclaration);
|
|
25
|
+
const app = await new app_deployer_1.AppDeployer(flags.debug).deploy(appDeclaration);
|
|
26
26
|
if (flags.upgrade) {
|
|
27
27
|
const installedApps = await (0, apps_1.getInstalledApps)();
|
|
28
28
|
const installedAppOrg = installedApps.find(x => x.appId === app.id);
|
|
@@ -51,4 +51,5 @@ PublishApp.examples = [
|
|
|
51
51
|
PublishApp.strict = true;
|
|
52
52
|
PublishApp.flags = {
|
|
53
53
|
upgrade: core_1.Flags.boolean({ char: 'u', description: 'In addition to deploying, upgrade the installed version of the app in this org to the latest one.', required: false }),
|
|
54
|
+
debug: core_1.Flags.boolean({ char: 'd', description: 'Debug the app deployment step and do not remove the intermediate build artifacts.', required: false }),
|
|
54
55
|
};
|
|
@@ -22,6 +22,9 @@ class UninstallApp extends core_1.Command {
|
|
|
22
22
|
flags.appIdentifier = answers.appIdentifier;
|
|
23
23
|
}
|
|
24
24
|
const appToDelete = installedApps.find(x => x.app.identifier === flags.appIdentifier);
|
|
25
|
+
if (!appToDelete) {
|
|
26
|
+
throw new Error(`App ${flags.appIdentifier} not found`);
|
|
27
|
+
}
|
|
25
28
|
this.log('%s Uninstalling app', chalk_1.default.green.bold('APP UNINSTALLATION'));
|
|
26
29
|
await (0, apps_1.deleteAppOrg)(appToDelete.id);
|
|
27
30
|
// eslint-disable-next-line no-constant-condition
|
|
@@ -40,7 +40,7 @@ class UpgradeApp extends core_1.Command {
|
|
|
40
40
|
message: 'Which app version would you like to upgrade to?',
|
|
41
41
|
choices: versions.map(x => {
|
|
42
42
|
const number = x.versionNumber.toString().padStart(4, '0');
|
|
43
|
-
const name = x.id === appOrgToUpgrade.appVersionId ? `${number} (${x.createdOn}) (current)` : `${number} (${x.createdOn})`;
|
|
43
|
+
const name = x.id === appOrgToUpgrade.appVersionId ? `${number} (${x.createdOn}) (${x.appRuntime}) (current)` : `${number} (${x.createdOn}) (${x.appRuntime})`;
|
|
44
44
|
return {
|
|
45
45
|
value: x.id, name
|
|
46
46
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { App, AppDeclaration } from '../../interfaces';
|
|
1
|
+
import { App, AppCodePackage, AppDeclaration } from '../../interfaces';
|
|
2
2
|
export declare class AppDeployer {
|
|
3
|
+
private debug;
|
|
4
|
+
constructor(debug?: boolean);
|
|
3
5
|
deploy(appDeclaration: AppDeclaration): Promise<App>;
|
|
4
6
|
getExistingApp(appDeclaration: AppDeclaration): Promise<App>;
|
|
5
7
|
private createNewApp;
|
|
6
8
|
updateExistingApp(appDeclaration: AppDeclaration, existingApp: any): Promise<any>;
|
|
7
9
|
remove(appDeclaration: AppDeclaration): Promise<void>;
|
|
8
10
|
}
|
|
11
|
+
export declare function createNodePackage(appIdentifier: string, debug: boolean): Promise<AppCodePackage>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AppDeployer = void 0;
|
|
3
|
+
exports.createNodePackage = exports.AppDeployer = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const sdk_1 = require("@contrail/sdk");
|
|
6
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
@@ -9,7 +9,15 @@ const actions_deployer_1 = require("./actions-deployer");
|
|
|
9
9
|
const app_template_parsers_1 = require("./app-template-parsers");
|
|
10
10
|
const workflow_template_definition_deployer_1 = require("../workflow-template-definitions/workflow-template-definition-deployer");
|
|
11
11
|
const apps_1 = require("../../api/apps");
|
|
12
|
+
const zip_a_folder_1 = require("zip-a-folder");
|
|
13
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
14
|
+
const child_process = require('child_process');
|
|
15
|
+
const fs = require('fs');
|
|
12
16
|
class AppDeployer {
|
|
17
|
+
constructor(debug = false) {
|
|
18
|
+
this.debug = debug;
|
|
19
|
+
//pass
|
|
20
|
+
}
|
|
13
21
|
async deploy(appDeclaration) {
|
|
14
22
|
let app = await this.getExistingApp(appDeclaration);
|
|
15
23
|
if (!app) {
|
|
@@ -30,6 +38,7 @@ class AppDeployer {
|
|
|
30
38
|
return apps.find(app => app.identifier === appDeclaration.appIdentifier);
|
|
31
39
|
}
|
|
32
40
|
async createNewApp(appDeclaration) {
|
|
41
|
+
var _a;
|
|
33
42
|
let configProperties;
|
|
34
43
|
if (appDeclaration === null || appDeclaration === void 0 ? void 0 : appDeclaration.appConfiguration) {
|
|
35
44
|
configProperties = app_template_parsers_1.ConfigPropertiesParser.getConfigProperties(appDeclaration.appConfiguration);
|
|
@@ -38,6 +47,13 @@ class AppDeployer {
|
|
|
38
47
|
if (appDeclaration === null || appDeclaration === void 0 ? void 0 : appDeclaration.triggers) {
|
|
39
48
|
triggerKeyDefinitions = app_template_parsers_1.TriggerKeyDefinitionParser.buildTriggersArray(appDeclaration);
|
|
40
49
|
}
|
|
50
|
+
// does appDeclaration have dockerImageRef
|
|
51
|
+
const isDocker = Object.hasOwnProperty.call(appDeclaration, 'dockerImageRef');
|
|
52
|
+
let appCodePackageId;
|
|
53
|
+
if (!isDocker) { // this is the expected default behavior
|
|
54
|
+
const appCodePackage = await createNodePackage(appDeclaration.appIdentifier, this.debug);
|
|
55
|
+
appCodePackageId = appCodePackage.id;
|
|
56
|
+
}
|
|
41
57
|
const newApp = {
|
|
42
58
|
identifier: appDeclaration.appIdentifier,
|
|
43
59
|
name: appDeclaration.appName,
|
|
@@ -50,13 +66,15 @@ class AppDeployer {
|
|
|
50
66
|
keywords: appDeclaration.keywords,
|
|
51
67
|
configProperties,
|
|
52
68
|
triggerKeyDefinitions,
|
|
53
|
-
dockerImageRef: appDeclaration.dockerImageRef,
|
|
69
|
+
dockerImageRef: (_a = appDeclaration.dockerImageRef) !== null && _a !== void 0 ? _a : null,
|
|
70
|
+
appCodePackageId: appCodePackageId !== null && appCodePackageId !== void 0 ? appCodePackageId : null,
|
|
54
71
|
};
|
|
55
72
|
const app = await new sdk_1.Entities().create({ entityName: 'app', object: newApp });
|
|
56
73
|
console.log(`%s Created new app: ${app.name}`, chalk_1.default.yellow.bold('APP'));
|
|
57
74
|
return app;
|
|
58
75
|
}
|
|
59
76
|
async updateExistingApp(appDeclaration, existingApp) {
|
|
77
|
+
var _a;
|
|
60
78
|
let configProperties;
|
|
61
79
|
if (appDeclaration === null || appDeclaration === void 0 ? void 0 : appDeclaration.appConfiguration) {
|
|
62
80
|
configProperties = app_template_parsers_1.ConfigPropertiesParser.getConfigProperties(appDeclaration.appConfiguration);
|
|
@@ -65,6 +83,13 @@ class AppDeployer {
|
|
|
65
83
|
if (appDeclaration === null || appDeclaration === void 0 ? void 0 : appDeclaration.triggers) {
|
|
66
84
|
triggerKeyDefinitions = app_template_parsers_1.TriggerKeyDefinitionParser.buildTriggersArray(appDeclaration);
|
|
67
85
|
}
|
|
86
|
+
// does appDeclaration have dockerImageRef
|
|
87
|
+
const isDocker = Object.hasOwnProperty.call(appDeclaration, 'dockerImageRef');
|
|
88
|
+
let appCodePackageId;
|
|
89
|
+
if (!isDocker) { // this is the expected default behavior
|
|
90
|
+
const appCodePackage = await createNodePackage(appDeclaration.appIdentifier, this.debug);
|
|
91
|
+
appCodePackageId = appCodePackage.id;
|
|
92
|
+
}
|
|
68
93
|
const updates = {
|
|
69
94
|
name: appDeclaration.appName,
|
|
70
95
|
public: appDeclaration.visibility === 'public',
|
|
@@ -76,7 +101,8 @@ class AppDeployer {
|
|
|
76
101
|
keywords: appDeclaration.keywords,
|
|
77
102
|
configProperties,
|
|
78
103
|
triggerKeyDefinitions,
|
|
79
|
-
dockerImageRef: appDeclaration.dockerImageRef,
|
|
104
|
+
dockerImageRef: (_a = appDeclaration.dockerImageRef) !== null && _a !== void 0 ? _a : null,
|
|
105
|
+
appCodePackageId: appCodePackageId !== null && appCodePackageId !== void 0 ? appCodePackageId : null,
|
|
80
106
|
};
|
|
81
107
|
const app = await new sdk_1.Entities().update({ entityName: 'app', id: existingApp.id, object: updates });
|
|
82
108
|
console.log(`%s Updated app: ${app.name}`, chalk_1.default.yellow.bold('APP'));
|
|
@@ -99,3 +125,71 @@ class AppDeployer {
|
|
|
99
125
|
}
|
|
100
126
|
}
|
|
101
127
|
exports.AppDeployer = AppDeployer;
|
|
128
|
+
async function createNodePackage(appIdentifier, debug) {
|
|
129
|
+
// zip src code and package.json and package-lock.json files into a zip file
|
|
130
|
+
// and upload as a code package.
|
|
131
|
+
const entitiesClient = new sdk_1.Entities();
|
|
132
|
+
try {
|
|
133
|
+
// clear and make temp directory
|
|
134
|
+
fs.rmSync('tmp/', { recursive: true, force: true });
|
|
135
|
+
fs.cpSync('package.json', 'tmp/package.json');
|
|
136
|
+
fs.cpSync('app.yml', 'tmp/app.yml');
|
|
137
|
+
//copy package-lock.json if it exists
|
|
138
|
+
if (fs.existsSync('package-lock.json')) {
|
|
139
|
+
fs.cpSync('package-lock.json', 'tmp/package-lock.json');
|
|
140
|
+
}
|
|
141
|
+
fs.mkdirSync('tmp/node_modules', { recursive: true });
|
|
142
|
+
console.log('Installing production dependencies started...');
|
|
143
|
+
child_process.execSync('npm install --omit=dev --prefix tmp/');
|
|
144
|
+
console.log('Installing production dependencies done.');
|
|
145
|
+
console.log('Building package...');
|
|
146
|
+
child_process.execSync('npx tsc --outDir tmp/dist');
|
|
147
|
+
console.log('Building package done.');
|
|
148
|
+
console.log('Zipping package...');
|
|
149
|
+
await (0, zip_a_folder_1.zip)('tmp/', 'tmp.zip');
|
|
150
|
+
console.log('Zipping package done.');
|
|
151
|
+
console.log('Uploading package to S3...');
|
|
152
|
+
let apps = await entitiesClient.get({ entityName: 'app', criteria: { hidden: true } });
|
|
153
|
+
apps = apps.concat(await entitiesClient.get({ entityName: 'app', criteria: { private: true } }));
|
|
154
|
+
const thisApp = apps.find(x => x.identifier === appIdentifier);
|
|
155
|
+
if (!thisApp) {
|
|
156
|
+
throw new Error('App not found');
|
|
157
|
+
}
|
|
158
|
+
const appCodePackage = await entitiesClient.create({ entityName: 'app-code-package', object: { appId: thisApp.id } });
|
|
159
|
+
// upload an s3 object using a signed url with an https put request
|
|
160
|
+
const readStream = fs.readFileSync('tmp.zip');
|
|
161
|
+
const postBody = Buffer.from(readStream);
|
|
162
|
+
// await axios.put(uploadUrlObject.signedUrl, postBody.toString());
|
|
163
|
+
await axios_1.default.request({
|
|
164
|
+
method: 'PUT',
|
|
165
|
+
url: appCodePackage.uploadURL,
|
|
166
|
+
data: postBody,
|
|
167
|
+
headers: {
|
|
168
|
+
// explicitly do not include content type because that breaks S3
|
|
169
|
+
'content-type': '',
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
// update app with the most recent code package
|
|
173
|
+
await entitiesClient.update({ entityName: 'app', id: thisApp.id, object: { appCodePackageId: appCodePackage.id } });
|
|
174
|
+
return appCodePackage;
|
|
175
|
+
}
|
|
176
|
+
catch (e) {
|
|
177
|
+
console.error('%s Failed to create app package.', chalk_1.default.red.bold('APP'));
|
|
178
|
+
throw e;
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
if (!debug) {
|
|
182
|
+
cleanUp();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
exports.createNodePackage = createNodePackage;
|
|
187
|
+
function cleanUp() {
|
|
188
|
+
console.log('cleaning up');
|
|
189
|
+
if (fs.existsSync('tmp')) {
|
|
190
|
+
fs.rmSync('tmp', { recursive: true, force: true });
|
|
191
|
+
}
|
|
192
|
+
if (fs.existsSync('tmp.zip')) {
|
|
193
|
+
fs.rmSync('tmp.zip');
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -7,6 +7,7 @@ const path_1 = tslib_1.__importDefault(require("path"));
|
|
|
7
7
|
const util_1 = require("util");
|
|
8
8
|
const Listr = require('listr');
|
|
9
9
|
const pkg_install_1 = require("pkg-install");
|
|
10
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
10
11
|
const copy = (0, util_1.promisify)(ncp_1.default);
|
|
11
12
|
const TARGET_DIR = process.cwd();
|
|
12
13
|
function copyTemplate(templateDir) {
|
|
@@ -14,7 +15,7 @@ function copyTemplate(templateDir) {
|
|
|
14
15
|
clobber: false,
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
|
-
async function setUpTemplate() {
|
|
18
|
+
async function setUpTemplate(appInput) {
|
|
18
19
|
const templateDir = path_1.default.resolve(path_1.default.join(__dirname, '../../templates/typescript'));
|
|
19
20
|
try {
|
|
20
21
|
const tasks = new Listr([
|
|
@@ -30,6 +31,13 @@ async function setUpTemplate() {
|
|
|
30
31
|
},
|
|
31
32
|
]);
|
|
32
33
|
await tasks.run();
|
|
34
|
+
// replace properties in yml file with appName
|
|
35
|
+
const appYmlFileLoc = path_1.default.join(TARGET_DIR, 'app.yml');
|
|
36
|
+
const appYml = fs_1.default.readFileSync(appYmlFileLoc, 'utf8');
|
|
37
|
+
const newAppYml = appYml.replace(/APP_IDENTIFIER_STUB/g, appInput.appIdentifier)
|
|
38
|
+
.replace(/APP_NAME_STUB/g, appInput.appName)
|
|
39
|
+
.replace(/APP_DESCRIPTION_STUB/g, appInput.appDescription);
|
|
40
|
+
fs_1.default.writeFileSync(appYmlFileLoc, newAppYml);
|
|
33
41
|
}
|
|
34
42
|
catch (e) {
|
|
35
43
|
throw new Error(`Error copying template: ${e}`);
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -108,6 +108,7 @@ export interface App {
|
|
|
108
108
|
configProperties?: ConfigProperty[];
|
|
109
109
|
triggerKeyDefinitions?: TriggerKeyDefinition[];
|
|
110
110
|
latestAppVersionId?: string;
|
|
111
|
+
appRuntime?: AppRuntime;
|
|
111
112
|
}
|
|
112
113
|
export interface AppOrg {
|
|
113
114
|
id: string;
|
|
@@ -126,6 +127,11 @@ export interface AppOrg {
|
|
|
126
127
|
apiKey?: AppApiKey;
|
|
127
128
|
appConfig?: any;
|
|
128
129
|
}
|
|
130
|
+
export interface AppCodePackage {
|
|
131
|
+
id: string;
|
|
132
|
+
appId: string;
|
|
133
|
+
uploadURL: string;
|
|
134
|
+
}
|
|
129
135
|
export declare enum AppOrgStatus {
|
|
130
136
|
INSTALLING = "INSTALLING",
|
|
131
137
|
FAILED_INSTALLING = "FAILED_INSTALLING",
|
|
@@ -141,6 +147,10 @@ export declare enum AppVersionStatus {
|
|
|
141
147
|
FAILED_ARCHIVING = "FAILED_ARCHIVING",
|
|
142
148
|
ARCHIVED = "ARCHIVED"
|
|
143
149
|
}
|
|
150
|
+
export declare enum AppRuntime {
|
|
151
|
+
DOCKER = "DOCKER",
|
|
152
|
+
NODE = "NODE"
|
|
153
|
+
}
|
|
144
154
|
export declare class AppVersion {
|
|
145
155
|
id: string;
|
|
146
156
|
createdOn?: Date;
|
|
@@ -159,6 +169,7 @@ export declare class AppVersion {
|
|
|
159
169
|
configProperties?: ConfigProperty[];
|
|
160
170
|
triggerKeyDefinitions?: TriggerKeyDefinition[];
|
|
161
171
|
dockerImageRef?: string;
|
|
172
|
+
appRuntime?: AppRuntime;
|
|
162
173
|
}
|
|
163
174
|
export declare class AppApiKey {
|
|
164
175
|
id: string;
|
package/dist/interfaces.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AssortmentConfigurationRelationships = exports.AssortmentConfigurationSlim = exports.FolderSlim = exports.ProjectConfigurationTemplate = exports.ProjectConfiguration = exports.Folder = exports.AssortmentConfiguration = exports.AssortmentType = exports.CommonConfiguration = exports.TriggerKeyDefinition = exports.ConfigProperty = exports.AppApiKey = exports.AppVersion = exports.AppVersionStatus = exports.AppOrgStatus = void 0;
|
|
3
|
+
exports.AssortmentConfigurationRelationships = exports.AssortmentConfigurationSlim = exports.FolderSlim = exports.ProjectConfigurationTemplate = exports.ProjectConfiguration = exports.Folder = exports.AssortmentConfiguration = exports.AssortmentType = exports.CommonConfiguration = exports.TriggerKeyDefinition = exports.ConfigProperty = exports.AppApiKey = exports.AppVersion = exports.AppRuntime = exports.AppVersionStatus = exports.AppOrgStatus = void 0;
|
|
4
4
|
var AppOrgStatus;
|
|
5
5
|
(function (AppOrgStatus) {
|
|
6
6
|
AppOrgStatus["INSTALLING"] = "INSTALLING";
|
|
@@ -18,6 +18,11 @@ var AppVersionStatus;
|
|
|
18
18
|
AppVersionStatus["FAILED_ARCHIVING"] = "FAILED_ARCHIVING";
|
|
19
19
|
AppVersionStatus["ARCHIVED"] = "ARCHIVED";
|
|
20
20
|
})(AppVersionStatus = exports.AppVersionStatus || (exports.AppVersionStatus = {}));
|
|
21
|
+
var AppRuntime;
|
|
22
|
+
(function (AppRuntime) {
|
|
23
|
+
AppRuntime["DOCKER"] = "DOCKER";
|
|
24
|
+
AppRuntime["NODE"] = "NODE";
|
|
25
|
+
})(AppRuntime = exports.AppRuntime || (exports.AppRuntime = {}));
|
|
21
26
|
class AppVersion {
|
|
22
27
|
}
|
|
23
28
|
exports.AppVersion = AppVersion;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
appIdentifier: "
|
|
2
|
-
appName: "
|
|
3
|
-
appDescription: "
|
|
1
|
+
appIdentifier: "APP_IDENTIFIER_STUB" # Change to be your company root domain and the name of the app
|
|
2
|
+
appName: "APP_NAME_STUB" # Give your app a name
|
|
3
|
+
appDescription: "APP_DESCRIPTION_STUB" # Give your app a description
|
|
4
4
|
visibility: private # This should be private unless you want to develop an app for all VibeIQ customers to use
|
|
5
5
|
hidden: false # can be used with a public app to prevent it from showing on the marketplace, but still installable by other orgs
|
|
6
6
|
publisher: "Your company name" # Your company name, used for public apps
|
|
7
7
|
version: 1.0
|
|
8
|
-
dockerImageRef: CHANGE_ME # For VibeIQ Deployment... for use by VibeIQ employees only
|
|
8
|
+
# dockerImageRef: CHANGE_ME # Deprecated. For VibeIQ Deployment... for use by VibeIQ employees only
|
|
9
9
|
|
|
10
10
|
# Properties you can configure when you install the app.
|
|
11
11
|
# These property values will be available to all of your actions when they run
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.0.
|
|
2
|
+
"version": "2.0.17",
|
|
3
3
|
"commands": {
|
|
4
4
|
"app:create": {
|
|
5
5
|
"id": "app:create",
|
|
@@ -109,6 +109,14 @@
|
|
|
109
109
|
"description": "In addition to deploying, upgrade the installed version of the app in this org to the latest one.",
|
|
110
110
|
"required": false,
|
|
111
111
|
"allowNo": false
|
|
112
|
+
},
|
|
113
|
+
"debug": {
|
|
114
|
+
"name": "debug",
|
|
115
|
+
"type": "boolean",
|
|
116
|
+
"char": "d",
|
|
117
|
+
"description": "Debug the app deployment step and do not remove the intermediate build artifacts.",
|
|
118
|
+
"required": false,
|
|
119
|
+
"allowNo": false
|
|
112
120
|
}
|
|
113
121
|
},
|
|
114
122
|
"args": {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
4
|
"description": "VibeIQ's Contrail Platform CLI.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"contrail-cli": "./bin/run",
|
|
@@ -45,13 +45,15 @@
|
|
|
45
45
|
"listr": "^0.14.3",
|
|
46
46
|
"lodash": "^4.17.21",
|
|
47
47
|
"ncp": "^2.0.0",
|
|
48
|
-
"pkg-install": "^1.0.0"
|
|
48
|
+
"pkg-install": "^1.0.0",
|
|
49
|
+
"zip-a-folder": "^1.1.5"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@oclif/test": "^2.3.8",
|
|
52
53
|
"@types/chai": "^4",
|
|
53
54
|
"@types/jest": "^29.5.0",
|
|
54
55
|
"@types/node": "^16.18.14",
|
|
56
|
+
"axios": "^1.3.5",
|
|
55
57
|
"chai": "^4",
|
|
56
58
|
"eslint": "^8.35.0",
|
|
57
59
|
"eslint-config-oclif": "^4",
|