@corva/create-app 0.0.0-9a3cf8e → 0.0.0-ae3a727
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/lib/constants/manifest.js +2 -2
- package/lib/flows/lib/api.js +3 -3
- package/lib/flows/release.js +1 -2
- package/lib/flows/steps/release/get-config.js +2 -2
- package/lib/flows/steps/release/prepare-data.js +5 -14
- package/lib/flows/steps/release/upload-zip-to-corva.js +2 -6
- package/lib/flows/steps/zip-file-list-resolve.js +26 -45
- package/lib/helpers/resolve-app-runtime.js +3 -3
- package/lib/helpers/utils.js +7 -1
- package/lib/main.js +0 -2
- package/package.json +1 -1
- package/template_extensions/corva/.release-please-manifest.json +3 -0
- package/template_extensions/corva/release-please-config.json +10 -0
- package/lib/commands/build-release.js +0 -60
- package/lib/flows/build-release.js +0 -31
- package/lib/flows/steps/build.js +0 -25
- package/lib/flows/steps/resolve-built-files-for-zip.js +0 -35
|
@@ -20,7 +20,7 @@ export const defaultManifest = {
|
|
|
20
20
|
summary: 'More information about this app goes here',
|
|
21
21
|
category: '',
|
|
22
22
|
website: 'https://www.oandgexample.com/my-app/',
|
|
23
|
-
segments: ['drilling', 'completion'],
|
|
23
|
+
segments: ['drilling', 'completion', 'intervention'],
|
|
24
24
|
},
|
|
25
25
|
settings: {
|
|
26
26
|
entrypoint: {
|
|
@@ -206,7 +206,7 @@ export const manifestOptions = (projectName = 'Corva Dev Center App') => [
|
|
|
206
206
|
type: 'rawlist',
|
|
207
207
|
name: 'segments',
|
|
208
208
|
message: 'Choose segments',
|
|
209
|
-
choices: ['drilling', 'completion'],
|
|
209
|
+
choices: ['drilling', 'completion', 'intervention'],
|
|
210
210
|
required: true,
|
|
211
211
|
},
|
|
212
212
|
{
|
package/lib/flows/lib/api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import debugFn from 'debug';
|
|
2
2
|
import got from 'got';
|
|
3
3
|
import { StepError } from './step-error.js';
|
|
4
|
-
import {
|
|
4
|
+
import { OVERRIDE_CACHE_BEHAVIOR, DELETE_CACHE_BEHAVIOR } from './../../constants/cache.js';
|
|
5
5
|
|
|
6
6
|
const debug = debugFn('cca:api');
|
|
7
7
|
|
|
@@ -15,8 +15,8 @@ export class Api {
|
|
|
15
15
|
*/
|
|
16
16
|
#api;
|
|
17
17
|
|
|
18
|
-
constructor(envName, apiKey, authToken = null
|
|
19
|
-
const prefixUrl =
|
|
18
|
+
constructor(envName, apiKey, authToken = null) {
|
|
19
|
+
const prefixUrl = `https://api${envName === 'production' ? '' : `.${envName}`}.corva.ai`;
|
|
20
20
|
|
|
21
21
|
this.#api = got.extend({
|
|
22
22
|
prefixUrl,
|
package/lib/flows/release.js
CHANGED
|
@@ -16,8 +16,7 @@ export const RELEASE_FLOW = {
|
|
|
16
16
|
SETUP_API_CLIENT_STEP,
|
|
17
17
|
RELEASE_PREPARE_DATA_STEP,
|
|
18
18
|
ZIP_SIMPLE_FLOW,
|
|
19
|
-
|
|
20
|
-
UPLOAD_ZIP_TO_CORVA_STEP(),
|
|
19
|
+
UPLOAD_ZIP_TO_CORVA_STEP,
|
|
21
20
|
WAIT_FOR_BUILD_FINISH_STEP,
|
|
22
21
|
REMOVE_FAILED_UPLOAD_STEP,
|
|
23
22
|
PUBLISH_PACKAGE_STEP,
|
|
@@ -18,7 +18,7 @@ async function getVarsFromDotEnv({ dirName }) {
|
|
|
18
18
|
|
|
19
19
|
export const SETUP_API_CLIENT_STEP = {
|
|
20
20
|
message: RELEASE.getAuthToken,
|
|
21
|
-
fn: async ({ dirName,
|
|
21
|
+
fn: async ({ dirName, options: { apiKey, env } }) => {
|
|
22
22
|
const parsedEnv = await getVarsFromDotEnv({ dirName });
|
|
23
23
|
|
|
24
24
|
const CORVA_API_ENV = env || parsedEnv.CORVA_API_ENV || process.env.CORVA_API_ENV || 'production';
|
|
@@ -29,7 +29,7 @@ export const SETUP_API_CLIENT_STEP = {
|
|
|
29
29
|
throw new StepError(RELEASE.getAuthTokenError);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const api = new Api(CORVA_API_ENV, API_KEY, AUTH_TOKEN
|
|
32
|
+
const api = new Api(CORVA_API_ENV, API_KEY, AUTH_TOKEN);
|
|
33
33
|
const notification = new Notification(CORVA_API_ENV);
|
|
34
34
|
|
|
35
35
|
return {
|
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
|
|
3
1
|
export const RELEASE_PREPARE_DATA_STEP = {
|
|
4
2
|
message: 'Preparing data...',
|
|
5
3
|
async fn({ api, manifest, options }) {
|
|
6
4
|
const appKey = options.appKey || manifest.manifest.application.key;
|
|
5
|
+
const app = await api.getAppByKey(appKey);
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
appId: app.id,
|
|
13
|
-
appKey,
|
|
14
|
-
};
|
|
15
|
-
} catch (e) {
|
|
16
|
-
console.log(chalk.bold.red(`\n${e.message}`));
|
|
17
|
-
|
|
18
|
-
throw e;
|
|
19
|
-
}
|
|
7
|
+
return {
|
|
8
|
+
appId: app.id,
|
|
9
|
+
appKey,
|
|
10
|
+
};
|
|
20
11
|
},
|
|
21
12
|
};
|
|
@@ -89,7 +89,7 @@ function getGitConfigUsername() {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
export const UPLOAD_ZIP_TO_CORVA_STEP =
|
|
92
|
+
export const UPLOAD_ZIP_TO_CORVA_STEP = {
|
|
93
93
|
message: RELEASE.uploadApp,
|
|
94
94
|
/**
|
|
95
95
|
*
|
|
@@ -102,10 +102,6 @@ export const UPLOAD_ZIP_TO_CORVA_STEP = (uploadPackagesParams) => ({
|
|
|
102
102
|
|
|
103
103
|
form.append('package', createReadStream(resolve(dirName, zipFileName)), 'package.zip');
|
|
104
104
|
|
|
105
|
-
if (uploadPackagesParams?.prebuilt) {
|
|
106
|
-
form.append('prebuilt', 'true');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
105
|
let githubUsername = getGithubUsernameActor();
|
|
110
106
|
|
|
111
107
|
if (!githubUsername) {
|
|
@@ -137,4 +133,4 @@ export const UPLOAD_ZIP_TO_CORVA_STEP = (uploadPackagesParams) => ({
|
|
|
137
133
|
throw error;
|
|
138
134
|
}
|
|
139
135
|
},
|
|
140
|
-
}
|
|
136
|
+
};
|
|
@@ -9,10 +9,11 @@ import { getIncreasedVersion } from '../../helpers/cli-version.js';
|
|
|
9
9
|
import { generateRandomString } from '../../helpers/utils.js';
|
|
10
10
|
import { loadJson } from '../lib/json.js';
|
|
11
11
|
import { StepError } from '../lib/step-error.js';
|
|
12
|
-
import debugFn from 'debug';
|
|
13
12
|
|
|
14
13
|
const glob = promisify(Glob);
|
|
15
14
|
|
|
15
|
+
import debugFn from 'debug';
|
|
16
|
+
|
|
16
17
|
const debug = debugFn('cca:flow:zip:resolve');
|
|
17
18
|
|
|
18
19
|
const uniqueValues = (array) => Array.from(new Set(array));
|
|
@@ -39,7 +40,7 @@ export const FILE_LIST_RESOLVE_STEP = {
|
|
|
39
40
|
},
|
|
40
41
|
};
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
const transformPatternsIntoFileNames = async (dirName, patterns, ignoredFiles = []) => {
|
|
43
44
|
const filesFromPatterns = [];
|
|
44
45
|
|
|
45
46
|
for (const pattern of patterns) {
|
|
@@ -67,7 +68,14 @@ export const transformPatternsIntoFileNames = async (dirName, patterns, ignoredF
|
|
|
67
68
|
return filesFromPatterns;
|
|
68
69
|
};
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* @param {string[]} itemsToZip
|
|
74
|
+
* @param {object} param1
|
|
75
|
+
* @param {import('../lib/manifest').Manifest} param1.manifest
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
const resolveDataToZipUiApp = async (itemsToZip = [], { options, pkg, dirName, manifest, appKey }) => {
|
|
71
79
|
const version = await getIncreasedVersion(pkg.version, options);
|
|
72
80
|
const randomSuffix = generateRandomString(); // Random suffix is needed to not cause a conflict when we call 2 parallel commands at the same time.
|
|
73
81
|
const zipFileName = `${manifest.unix_name}-${version}-${randomSuffix}.zip`;
|
|
@@ -101,6 +109,21 @@ export const prepareUiAppFilesForZip = async (itemsToZip, { options, pkg, dirNam
|
|
|
101
109
|
|
|
102
110
|
const itemsToRemove = [tmpPackageForSourceName];
|
|
103
111
|
|
|
112
|
+
itemsToZip.push(
|
|
113
|
+
'manifest.json',
|
|
114
|
+
'config-overrides.js',
|
|
115
|
+
'tsconfig.json',
|
|
116
|
+
'.npmrc',
|
|
117
|
+
'.nvmrc',
|
|
118
|
+
'yarn.lock',
|
|
119
|
+
{
|
|
120
|
+
path: resolve(dirName, tmpPackageForSourceName),
|
|
121
|
+
name: 'package.json',
|
|
122
|
+
},
|
|
123
|
+
...(await transformPatternsIntoFileNames(dirName, ['src/**/*'], options.ignoredFiles)),
|
|
124
|
+
...(await transformPatternsIntoFileNames(dirName, ['config/**/*'], options.ignoredFiles)),
|
|
125
|
+
);
|
|
126
|
+
|
|
104
127
|
if (options.appKey) {
|
|
105
128
|
/**
|
|
106
129
|
* Both manifest.json appKey in zip and the provided
|
|
@@ -121,50 +144,8 @@ export const prepareUiAppFilesForZip = async (itemsToZip, { options, pkg, dirNam
|
|
|
121
144
|
path: resolve(dirName, tmpManifestForSourceName),
|
|
122
145
|
name: 'manifest.json',
|
|
123
146
|
});
|
|
124
|
-
} else {
|
|
125
|
-
itemsToZip.push('manifest.json');
|
|
126
147
|
}
|
|
127
148
|
|
|
128
|
-
return {
|
|
129
|
-
zipFileName,
|
|
130
|
-
itemsToZip: [
|
|
131
|
-
...itemsToZip,
|
|
132
|
-
{
|
|
133
|
-
path: resolve(dirName, tmpPackageForSourceName),
|
|
134
|
-
name: 'package.json',
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
itemsToSave,
|
|
138
|
-
itemsToRemove,
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
*
|
|
144
|
-
* @param {string[]} itemsToZipBase
|
|
145
|
-
* @param {object} param1
|
|
146
|
-
* @param {import('../lib/manifest').Manifest} param1.manifest
|
|
147
|
-
* @returns
|
|
148
|
-
*/
|
|
149
|
-
const resolveDataToZipUiApp = async (itemsToZipBase = [], { options, pkg, dirName, manifest, appKey }) => {
|
|
150
|
-
const { zipFileName, itemsToZip, itemsToSave, itemsToRemove } = await prepareUiAppFilesForZip(itemsToZipBase, {
|
|
151
|
-
options,
|
|
152
|
-
pkg,
|
|
153
|
-
dirName,
|
|
154
|
-
manifest,
|
|
155
|
-
appKey,
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
itemsToZip.push(
|
|
159
|
-
'config-overrides.js',
|
|
160
|
-
'tsconfig.json',
|
|
161
|
-
'.npmrc',
|
|
162
|
-
'.nvmrc',
|
|
163
|
-
'yarn.lock',
|
|
164
|
-
...(await transformPatternsIntoFileNames(dirName, ['src/**/*'], options.ignoredFiles)),
|
|
165
|
-
...(await transformPatternsIntoFileNames(dirName, ['config/**/*'], options.ignoredFiles)),
|
|
166
|
-
);
|
|
167
|
-
|
|
168
149
|
return {
|
|
169
150
|
zipFileName,
|
|
170
151
|
itemsToZip,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import debugFn from 'debug';
|
|
2
2
|
import { APP_TYPES } from '../constants/cli.js';
|
|
3
|
-
|
|
4
|
-
const debug = debugFn('cca:resolve-app-runtime');
|
|
5
|
-
|
|
6
3
|
import spawn from 'cross-spawn';
|
|
7
4
|
import { promises as fs } from 'fs';
|
|
8
5
|
import os from 'os';
|
|
9
6
|
import semver from 'semver';
|
|
10
7
|
|
|
8
|
+
const debug = debugFn('cca:resolve-app-runtime');
|
|
9
|
+
|
|
11
10
|
/**
|
|
12
11
|
*
|
|
13
12
|
* @param {string} command
|
|
@@ -69,6 +68,7 @@ const semverVersionsMapping = {
|
|
|
69
68
|
'3.9': '3.9.16',
|
|
70
69
|
'3.10': '3.10.9',
|
|
71
70
|
'3.11': '3.11.1',
|
|
71
|
+
'3.13': '3.13.7',
|
|
72
72
|
},
|
|
73
73
|
};
|
|
74
74
|
|
package/lib/helpers/utils.js
CHANGED
|
@@ -8,7 +8,13 @@ export const addUiAppFile = (templateFolder, root, runtime, manifest, opts) => {
|
|
|
8
8
|
logger.log(chalk.green('adding app file'));
|
|
9
9
|
|
|
10
10
|
const fileExtension = runtime.language === 'typescript' ? 'tsx' : 'js';
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
const segment =
|
|
13
|
+
{
|
|
14
|
+
drilling: 'drilling',
|
|
15
|
+
completion: 'completion',
|
|
16
|
+
intervention: 'drilling', // same as drilling for now
|
|
17
|
+
}[opts.segments] || 'drilling';
|
|
12
18
|
const appFilePath = join(templateFolder, 'src', `App.${segment}.${fileExtension}`);
|
|
13
19
|
|
|
14
20
|
copyFileSync(appFilePath, join(root, 'src', `App.${fileExtension}`));
|
package/lib/main.js
CHANGED
|
@@ -14,7 +14,6 @@ import { createCommand } from './commands/create.js';
|
|
|
14
14
|
import { ERROR_ICON } from './constants/messages.js';
|
|
15
15
|
import { StepError } from './flows/lib/step-error.js';
|
|
16
16
|
import debugFn from 'debug';
|
|
17
|
-
import { buildReleasePaasCommand } from './commands/build-release.js';
|
|
18
17
|
|
|
19
18
|
const debug = debugFn('cca:main');
|
|
20
19
|
|
|
@@ -48,7 +47,6 @@ export async function run() {
|
|
|
48
47
|
.addCommand(createCommand, { isDefault: true })
|
|
49
48
|
.addCommand(zipCommand)
|
|
50
49
|
.addCommand(releaseCommand)
|
|
51
|
-
.addCommand(buildReleasePaasCommand)
|
|
52
50
|
.addCommand(rerunCommand)
|
|
53
51
|
.addCommand(attachCommand)
|
|
54
52
|
.showHelpAfterError()
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@corva/create-app","version":"0.0.0-
|
|
1
|
+
{"name":"@corva/create-app","version":"0.0.0-ae3a727","private":false,"description":"Create an app to use it in CORVA.AI","keywords":["react"],"bugs":{"url":"https://github.com/facebook/create-react-app/issues"},"repository":{"type":"git","url":"https://github.com/corva-ai/create-corva-app","directory":"@corva/create-app"},"license":"MIT","type":"module","bin":{"create-corva-app":"./bin/create-corva-app.cjs"},"files":["bin/**/*.cjs","bin/**/*.js","lib/**/*.js","templates","template_extensions","common"],"scripts":{"build":"echo \"build is not configured for package \\\"×\\\", skipping.\"","get-changelog":"conventional-changelog -r 2 -p angular","lint":"eslint . --resolve-plugins-relative-to $(pwd) --max-warnings 0","lint:fix":"eslint . --fix","release":"git add -A && standard-version -a","release-rc":"npm run release -- --prerelease","run:local-ui-ts-completion":"node ./bin/create-corva-app.cjs ../test-app-ui-ts-completions --appName 'TestAppUiTsCompletions' --segments 'completion' --category 'analytics' --appKey 'corva.testappuitscompletions.ui' --appType 'ui' --runtime 'ui' -t --extensions corva","run:local-ui-ts-drilling":"node ./bin/create-corva-app.cjs ../test-app-ui-ts-drilling --appName 'TestAppUiTsDrilling' --segments 'drilling' --category 'analytics' --appKey 'corva.testappuitsdrilling.ui' --appType 'ui' --runtime 'ui' -t --extensions corva","run:local-ui-ts-intervention":"node ./bin/create-corva-app.cjs ../test-app-ui-ts-intervention --appName 'TestAppUiTsIntervention' --segments 'intervention' --category 'analytics' --appKey 'corva.testappuitsintervention.ui' --appType 'ui' --runtime 'ui' -t --extensions corva","test":"NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest"},"lint-staged":{"*.js":"npm run lint:fix"},"dependencies":{"archiver":"^5.3.0","chalk":"^4.1.0","commander":"^9.1.0","cross-spawn":"^7.0.3","debug":"^4.3.4","dotenv":"^16.0.0","figlet":"^1.5.0","form-data":"^4.0.0","fs-extra":"^9.0.1","glob":"^8.0.1","got":"^12.5.1","inquirer":"^8.2.3","is-glob":"^4.0.3","lodash":"^4.17.21","npm-api":"^1.0.0","semver":"^7.3.2","terminal-link":"^3.0.0"},"devDependencies":{"@babel/core":"^7.11.0","@babel/eslint-parser":"^7.19.1","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-syntax-import-assertions":"^7.20.0","@babel/preset-react":"^7.18.6","@commitlint/cli":"^17.3.0","@commitlint/config-conventional":"^17.3.0","@corva/eslint-config-browser":"^0.1.7","@corva/eslint-config-node":"^5.1.1","@corva/node-sdk":"^8.0.1","@types/cross-spawn":"^6.0.2","@types/jest":"^29.5.4","@typescript-eslint/eslint-plugin":"^5.42.1","@typescript-eslint/parser":"^5.42.1","conventional-changelog-cli":"^2.1.0","eslint":"^8.2.0","eslint-config-google":"^0.14.0","eslint-config-prettier":"^8.5.0","eslint-plugin-import":"^2.26.0","eslint-plugin-jest":"^27.1.5","eslint-plugin-jsx-a11y":"^6.7.1","eslint-plugin-prettier":"^4.2.1","eslint-plugin-react":"^7.32.0","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-require-sort":"^1.3.0","husky":"^8.0.2","jest":"^29.6.4","prettier":"^2.0.0","prettier-plugin-packagejson":"^2.3.0","standard-version":"^9.0.0","typescript":"^4.8.4","zx":"^7.2.3"},"packageManager":"yarn@1.22.19+sha512.ff4579ab459bb25aa7c0ff75b62acebe576f6084b36aa842971cf250a5d8c6cd3bc9420b22ce63c7f93a0857bc6ef29291db39c3e7a23aab5adfd5a4dd6c5d71","engines":{"node":">=18"},"standard-version":{"skip":{"tag":true}}}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Command, Option } from 'commander';
|
|
2
|
-
import { bumpVersionOption } from '../options/bump-version.js';
|
|
3
|
-
import { silentOption } from '../options/silent.js';
|
|
4
|
-
import { envOption } from '../options/env.js';
|
|
5
|
-
import { apiKeyOption } from '../options/api-key.js';
|
|
6
|
-
import { appKeyOption } from '../options/app-key.js';
|
|
7
|
-
import { originalCwdOption } from '../options/original-cwd.js';
|
|
8
|
-
import { ensureBumpVersion } from '../helpers/cli-version.js';
|
|
9
|
-
import { runFlow } from '../flow.js';
|
|
10
|
-
import { getRealWorkingDir } from '../helpers/commands.js';
|
|
11
|
-
import chalk from 'chalk';
|
|
12
|
-
import { ERROR_ICON } from '../constants/messages.js';
|
|
13
|
-
import { BUILD_RELEASE_PAAS_FLOW } from '../flows/build-release.js';
|
|
14
|
-
|
|
15
|
-
export const buildReleasePaasCommand = new Command('build-release')
|
|
16
|
-
.description("Build & release app to environments that don't have a packager")
|
|
17
|
-
.argument('<project-directory>', 'Project directory to work with')
|
|
18
|
-
.argument(
|
|
19
|
-
'[environment-api-url]',
|
|
20
|
-
'(Optional) API URL for environment to upload to. You have to have the correct auth token for the given environment',
|
|
21
|
-
)
|
|
22
|
-
.addOption(bumpVersionOption)
|
|
23
|
-
.addOption(silentOption)
|
|
24
|
-
.addOption(envOption)
|
|
25
|
-
.addOption(apiKeyOption)
|
|
26
|
-
.addOption(appKeyOption)
|
|
27
|
-
.addOption(originalCwdOption)
|
|
28
|
-
.addOption(new Option('--notes [string]', 'Add custom notes to published app'))
|
|
29
|
-
.addOption(new Option('--label [string]', 'Put a label on the release').choices(['DEV', 'BETA', 'PROD']))
|
|
30
|
-
.addOption(new Option('--remove-on-fail [boolean]', 'Remove release if it fails during deployment').default(false))
|
|
31
|
-
.addOption(
|
|
32
|
-
new Option('--remove-on-success [boolean]', 'App package (.zip) will not be deleted after upload').default(true),
|
|
33
|
-
)
|
|
34
|
-
.addOption(
|
|
35
|
-
new Option(
|
|
36
|
-
'--remove-existing [boolean]',
|
|
37
|
-
'If package version is already taken - remove the previously published package and upload a new one',
|
|
38
|
-
).default(false),
|
|
39
|
-
)
|
|
40
|
-
.addOption(new Option('--author [string]', 'Author name for the audit'))
|
|
41
|
-
.action(async (dirName, envApiUrl, options) => {
|
|
42
|
-
// if author is present in CLI, save it to process.env
|
|
43
|
-
if (options.author) {
|
|
44
|
-
process.env.githubUsername = options.author;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
options.bumpVersion = await ensureBumpVersion(options.bumpVersion);
|
|
48
|
-
|
|
49
|
-
await runFlow(BUILD_RELEASE_PAAS_FLOW, {
|
|
50
|
-
dirName: getRealWorkingDir(dirName, options),
|
|
51
|
-
patterns: [],
|
|
52
|
-
envApiUrl,
|
|
53
|
-
options,
|
|
54
|
-
});
|
|
55
|
-
})
|
|
56
|
-
.showHelpAfterError()
|
|
57
|
-
.showSuggestionAfterError(true)
|
|
58
|
-
.configureOutput({
|
|
59
|
-
outputError: (str, write) => write(chalk.red(`${ERROR_ICON} ${str}`)),
|
|
60
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { PREPARE_FLOW } from './prepare.js';
|
|
2
|
-
import { SETUP_API_CLIENT_STEP } from './steps/release/get-config.js';
|
|
3
|
-
import { RELEASE_PREPARE_DATA_STEP } from './steps/release/prepare-data.js';
|
|
4
|
-
import { PREPARE_FILES_BEFORE_ZIP_STEP } from './steps/zip-prepare.js';
|
|
5
|
-
import { CREATE_ARCHIVE_STEP } from './steps/zip-create-archive.js';
|
|
6
|
-
import { CLEANUP_STEP } from './steps/zip-cleanup.js';
|
|
7
|
-
import { UPLOAD_ZIP_TO_CORVA_STEP } from './steps/release/upload-zip-to-corva.js';
|
|
8
|
-
import { PUBLISH_PACKAGE_STEP } from './steps/release/publish.js';
|
|
9
|
-
import { ADD_LABEL_STEP } from './steps/release/add-label.js';
|
|
10
|
-
import { ADD_NOTES_STEP } from './steps/release/add-notes.js';
|
|
11
|
-
import { BUILD_STEP } from './steps/build.js';
|
|
12
|
-
import { RESOLVE_BUILT_FILES_FOR_ZIP_STEP } from './steps/resolve-built-files-for-zip.js';
|
|
13
|
-
|
|
14
|
-
export const BUILD_RELEASE_PAAS_FLOW = {
|
|
15
|
-
name: 'build-release-paas',
|
|
16
|
-
steps: [
|
|
17
|
-
PREPARE_FLOW,
|
|
18
|
-
SETUP_API_CLIENT_STEP,
|
|
19
|
-
RELEASE_PREPARE_DATA_STEP,
|
|
20
|
-
BUILD_STEP,
|
|
21
|
-
RESOLVE_BUILT_FILES_FOR_ZIP_STEP,
|
|
22
|
-
PREPARE_FILES_BEFORE_ZIP_STEP,
|
|
23
|
-
CREATE_ARCHIVE_STEP,
|
|
24
|
-
CLEANUP_STEP,
|
|
25
|
-
// eslint-disable-next-line new-cap
|
|
26
|
-
UPLOAD_ZIP_TO_CORVA_STEP({ prebuilt: true }),
|
|
27
|
-
PUBLISH_PACKAGE_STEP,
|
|
28
|
-
ADD_LABEL_STEP,
|
|
29
|
-
ADD_NOTES_STEP,
|
|
30
|
-
],
|
|
31
|
-
};
|
package/lib/flows/steps/build.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { StepError } from '../lib/step-error.js';
|
|
2
|
-
import util from 'util';
|
|
3
|
-
import ChildProcess from 'child_process';
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
|
|
6
|
-
const exec = util.promisify(ChildProcess.exec);
|
|
7
|
-
|
|
8
|
-
export const BUILD_STEP = {
|
|
9
|
-
message: 'Building...',
|
|
10
|
-
fn: async ({ dirName }) => {
|
|
11
|
-
const currentCWD = process.cwd();
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
process.chdir(dirName);
|
|
15
|
-
|
|
16
|
-
const command = fs.existsSync('./yarn.lock') ? 'yarn' : 'npm';
|
|
17
|
-
|
|
18
|
-
await exec(`${command} webpack --config=./config-overrides.js --mode production`);
|
|
19
|
-
} catch (e) {
|
|
20
|
-
throw new StepError(`Application build failed! ${e.stderr || e.message || 'Unknown error'}`);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
process.chdir(currentCWD);
|
|
24
|
-
},
|
|
25
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { prepareUiAppFilesForZip, transformPatternsIntoFileNames } from './zip-file-list-resolve.js';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { StepError } from '../lib/step-error.js';
|
|
4
|
-
|
|
5
|
-
export const RESOLVE_BUILT_FILES_FOR_ZIP_STEP = {
|
|
6
|
-
message: 'Resolving files list...',
|
|
7
|
-
fn: async (context) => {
|
|
8
|
-
const { manifest, dirName } = context;
|
|
9
|
-
const files = [];
|
|
10
|
-
|
|
11
|
-
if (manifest.isUi()) {
|
|
12
|
-
const data = await prepareUiAppFilesForZip(files, context);
|
|
13
|
-
|
|
14
|
-
const regex = new RegExp(`^dist${path.sep}`);
|
|
15
|
-
|
|
16
|
-
// Manifest is already accounted for (with possible changes) in prepareUiAppFilesForZip
|
|
17
|
-
const builtFiles = (await transformPatternsIntoFileNames(dirName, ['dist/**/*'], ['dist/manifest.json'])).map(
|
|
18
|
-
(filename) => ({
|
|
19
|
-
// Source file path
|
|
20
|
-
path: path.resolve(dirName, filename),
|
|
21
|
-
// Target file path
|
|
22
|
-
name: filename.replace(regex, ''),
|
|
23
|
-
}),
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
data.itemsToZip.push('yarn.lock', ...builtFiles);
|
|
27
|
-
|
|
28
|
-
return data;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
throw new StepError(
|
|
32
|
-
`Unsupported runtime: ${manifest.runtime}. Currently, this command supports the following app types: "ui"`,
|
|
33
|
-
);
|
|
34
|
-
},
|
|
35
|
-
};
|