@corva/create-app 0.40.0-0 → 0.41.0-1
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 +19 -17
- package/bin/cca.js +5 -0
- package/bin/create-corva-app.cjs +14 -0
- package/lib/bump-version.option.js +17 -8
- package/lib/constants/cli.js +5 -11
- package/lib/constants/manifest.js +15 -22
- package/lib/constants/messages.js +4 -10
- package/lib/constants/package.js +6 -8
- package/lib/flow.js +16 -13
- package/lib/flows/lib/api.js +153 -84
- package/lib/flows/lib/create-zip-archive.js +7 -7
- package/lib/flows/lib/json.js +8 -8
- package/lib/flows/lib/manifest.js +5 -7
- package/lib/flows/lib/step-error.js +1 -3
- package/lib/flows/prepare.js +2 -4
- package/lib/flows/release.js +18 -10
- package/lib/flows/rerun.js +5 -7
- package/lib/flows/steps/prepare-load-app-files.js +3 -7
- package/lib/flows/steps/release/add-label.js +11 -0
- package/lib/flows/steps/release/add-notes.js +10 -0
- package/lib/flows/steps/release/get-config.js +37 -0
- package/lib/flows/steps/release/prepare-data.js +10 -0
- package/lib/flows/steps/release/publish.js +9 -0
- package/lib/flows/steps/release/remove-failed-upload.js +20 -0
- package/lib/flows/steps/release/upload-zip-to-corva.js +25 -0
- package/lib/flows/steps/release/wait-for-build.js +29 -0
- package/lib/flows/steps/rerun-create-task.js +22 -15
- package/lib/flows/steps/rerun-prepare-data.js +150 -127
- package/lib/flows/steps/rerun.js +3 -7
- package/lib/flows/steps/zip-cleanup.js +6 -6
- package/lib/flows/steps/zip-create-archive.js +5 -5
- package/lib/flows/steps/zip-file-list-resolve.js +34 -29
- package/lib/flows/steps/zip-prepare.js +7 -8
- package/lib/flows/steps/zip.js +5 -9
- package/lib/flows/zip-simple.js +2 -4
- package/lib/flows/zip.js +3 -5
- package/lib/helpers/logger.js +35 -0
- package/lib/helpers/manifest.js +6 -10
- package/lib/helpers/resolve-app-runtime.js +47 -45
- package/lib/helpers/utils.js +4 -9
- package/lib/helpers/versioning.js +8 -13
- package/lib/{index.js → main.js} +118 -116
- package/lib/scripts/utils/version.js +12 -13
- package/package.json +5 -3
- package/bin/create-corva-app.js +0 -5
- package/lib/app.js +0 -9
- package/lib/flows/steps/release-get-app-key.js +0 -16
- package/lib/flows/steps/release-get-config.js +0 -37
- package/lib/flows/steps/release-upload-zip-to-corva.js +0 -25
package/lib/flows/zip.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { PREPARE_FLOW } from './prepare.js';
|
|
2
|
+
import { ZIP_STEPS } from './steps/zip.js';
|
|
3
3
|
|
|
4
|
-
const ZIP_FLOW = {
|
|
4
|
+
export const ZIP_FLOW = {
|
|
5
5
|
name: 'zip',
|
|
6
6
|
steps: [PREPARE_FLOW, ...ZIP_STEPS],
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
module.exports = { ZIP_FLOW };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export class Logger {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.isSilent = process.argv.includes('--silent');
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
write(str) {
|
|
7
|
+
if (this.isSilent) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (str === undefined) {
|
|
12
|
+
process.stdout.write();
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
process.stdout.write(str);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
log(str) {
|
|
21
|
+
if (this.isSilent) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (str === undefined) {
|
|
26
|
+
console.log();
|
|
27
|
+
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
console.log(str);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const logger = new Logger();
|
package/lib/helpers/manifest.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { APP_RUNTIMES, APP_TYPES, TEMPLATE_TYPES } from '../constants/cli.js';
|
|
2
|
+
import * as manifestConstants from '../constants/manifest.js';
|
|
3
3
|
|
|
4
|
-
function fillManifest(answers) {
|
|
4
|
+
export function fillManifest(answers) {
|
|
5
5
|
const runtime = answers.runtime || APP_RUNTIMES.UI;
|
|
6
6
|
|
|
7
7
|
const defaultManifestProperties = _defaultManifestProperties({
|
|
@@ -66,16 +66,12 @@ function defaultAppSettings({ type, schedulerType, cronString, depthMilestone })
|
|
|
66
66
|
if (schedulerType === manifestConstants.SCHEDULER_TYPE_DEPTH.value) {
|
|
67
67
|
return {
|
|
68
68
|
scheduler_type: schedulerType,
|
|
69
|
-
depth_milestone: depthMilestone || 1
|
|
70
|
-
}
|
|
69
|
+
depth_milestone: depthMilestone || 1,
|
|
70
|
+
};
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
return {
|
|
74
74
|
scheduler_type: schedulerType,
|
|
75
75
|
cron_string: cronString || '*/5 * * * *',
|
|
76
|
-
}
|
|
76
|
+
};
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
module.exports = {
|
|
80
|
-
fillManifest,
|
|
81
|
-
};
|
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { spawn } = require("child_process");
|
|
4
|
-
const { promises: fs } = require("fs");
|
|
5
|
-
const semver = require("semver");
|
|
6
|
-
const os = require("os");
|
|
1
|
+
import { APP_TYPES } from '../constants/cli.js';
|
|
2
|
+
import Debug from 'debug';
|
|
7
3
|
|
|
8
|
-
const
|
|
9
|
-
|
|
4
|
+
const debug = Debug('cca:resolve-app-runtime');
|
|
5
|
+
import { spawn } from 'child_process';
|
|
6
|
+
import { promises as fs } from 'fs';
|
|
7
|
+
import semver from 'semver';
|
|
8
|
+
import os from 'os';
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
const checkCliVersion = async (command, version, stdErr = false) =>
|
|
11
|
+
new Promise((resolve, reject) => {
|
|
12
|
+
const child = spawn(command, ['--version']);
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
data = buffer;
|
|
15
|
-
});
|
|
14
|
+
let data;
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
child.stderr.once('data', (buffer) => {
|
|
17
|
+
data = buffer;
|
|
18
|
+
});
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
debug(data.toString());
|
|
20
|
+
child.stdout.once('data', (buffer) => {
|
|
21
|
+
data = buffer;
|
|
22
|
+
});
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
child.once('close', (code) => {
|
|
25
|
+
if (code !== 0) {
|
|
26
|
+
debug(`Command ${command} exited with code ${code}`);
|
|
27
|
+
debug(data.toString());
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
return reject(false);
|
|
30
|
+
}
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
debug(`%s version output: %s`, command, data.toString());
|
|
33
|
+
|
|
34
|
+
resolve(semver.satisfies(semver.coerce(data.toString('utf-8')), version));
|
|
35
|
+
});
|
|
36
|
+
});
|
|
34
37
|
|
|
35
|
-
const checkNodeVersion = version => async () => {
|
|
38
|
+
const checkNodeVersion = (version) => async () => {
|
|
36
39
|
try {
|
|
37
40
|
await fs.access(`${os.homedir()}/.nvm/nvm.sh`);
|
|
38
41
|
|
|
@@ -43,41 +46,40 @@ const checkNodeVersion = version => async () => {
|
|
|
43
46
|
debug(e);
|
|
44
47
|
debug('nvm is not installed, checking node version');
|
|
45
48
|
|
|
46
|
-
return checkCliVersion(
|
|
49
|
+
return checkCliVersion('node', version);
|
|
47
50
|
}
|
|
48
|
-
}
|
|
51
|
+
};
|
|
49
52
|
|
|
50
|
-
const resolveAppRuntime = (opts) => {
|
|
53
|
+
export const resolveAppRuntime = (opts) => {
|
|
51
54
|
if (opts.appType === APP_TYPES.UI) {
|
|
52
|
-
const version =
|
|
55
|
+
const version = '16';
|
|
53
56
|
|
|
54
57
|
return {
|
|
55
|
-
language: opts.useTypescript ?
|
|
58
|
+
language: opts.useTypescript ? 'typescript' : 'javascript',
|
|
56
59
|
isRuntimeAvailable: checkNodeVersion(version),
|
|
57
60
|
packageManager: opts.packageManager,
|
|
58
|
-
version
|
|
59
|
-
}
|
|
61
|
+
version,
|
|
62
|
+
};
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
if (opts.runtime.startsWith(
|
|
65
|
+
if (opts.runtime.startsWith('node')) {
|
|
63
66
|
const version = /nodejs(\d{2})\.x/.exec(opts.runtime)[1];
|
|
64
67
|
|
|
65
68
|
return {
|
|
66
|
-
language: opts.useTypescript ?
|
|
69
|
+
language: opts.useTypescript ? 'typescript' : 'javascript',
|
|
67
70
|
isRuntimeAvailable: checkNodeVersion(version),
|
|
68
71
|
packageManager: opts.packageManager,
|
|
69
|
-
version
|
|
70
|
-
}
|
|
72
|
+
version,
|
|
73
|
+
};
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
const version = /python(\d\.\d)/.exec(opts.runtime)[1]
|
|
76
|
+
const version = /python(\d\.\d)/.exec(opts.runtime)[1];
|
|
74
77
|
|
|
75
78
|
return {
|
|
76
|
-
language:
|
|
77
|
-
isRuntimeAvailable: async () =>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
language: 'python',
|
|
80
|
+
isRuntimeAvailable: async () =>
|
|
81
|
+
(await checkCliVersion('python3', version)) || (await checkCliVersion('python', version)),
|
|
82
|
+
packageManager: 'pip',
|
|
83
|
+
version,
|
|
84
|
+
};
|
|
81
85
|
};
|
|
82
|
-
|
|
83
|
-
module.exports = { resolveAppRuntime };
|
package/lib/helpers/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
3
|
|
|
4
|
-
function copyFileSync(source, target) {
|
|
4
|
+
export function copyFileSync(source, target) {
|
|
5
5
|
let targetFile = target;
|
|
6
6
|
//if target is a directory a new file with the same name will be created
|
|
7
7
|
if (fs.existsSync(target)) {
|
|
@@ -13,7 +13,7 @@ function copyFileSync(source, target) {
|
|
|
13
13
|
fs.writeFileSync(targetFile, fs.readFileSync(source));
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
function copyFolderRecursiveSync(sourceFolder, targetFolder) {
|
|
16
|
+
export function copyFolderRecursiveSync(sourceFolder, targetFolder) {
|
|
17
17
|
//check if folder needs to be created or integrated
|
|
18
18
|
if (!fs.existsSync(targetFolder)) {
|
|
19
19
|
fs.mkdirSync(targetFolder);
|
|
@@ -38,8 +38,3 @@ function copyFolderRecursiveSync(sourceFolder, targetFolder) {
|
|
|
38
38
|
copyFileSync(curSource, targetFolder);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
module.exports = {
|
|
43
|
-
copyFileSync,
|
|
44
|
-
copyFolderRecursiveSync,
|
|
45
|
-
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import { logger } from './logger.js';
|
|
2
3
|
|
|
3
|
-
function isInGitRepository(appPath) {
|
|
4
|
+
export function isInGitRepository(appPath) {
|
|
4
5
|
try {
|
|
5
6
|
execSync('git rev-parse --is-inside-work-tree', {
|
|
6
7
|
stdio: 'ignore',
|
|
@@ -12,7 +13,7 @@ function isInGitRepository(appPath) {
|
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
function tryGitInit(appPath) {
|
|
16
|
+
export function tryGitInit(appPath) {
|
|
16
17
|
try {
|
|
17
18
|
if (isInGitRepository()) {
|
|
18
19
|
return false;
|
|
@@ -20,7 +21,7 @@ function tryGitInit(appPath) {
|
|
|
20
21
|
execSync('git --version', { stdio: 'ignore', cwd: appPath });
|
|
21
22
|
|
|
22
23
|
execSync('git init', { stdio: 'ignore', cwd: appPath });
|
|
23
|
-
|
|
24
|
+
logger.log('Initialized git repo in app');
|
|
24
25
|
return true;
|
|
25
26
|
} catch (e) {
|
|
26
27
|
console.warn('Git repo not initialized', e);
|
|
@@ -28,14 +29,14 @@ function tryGitInit(appPath) {
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
function tryGitCommit(appPath) {
|
|
32
|
+
export function tryGitCommit(appPath) {
|
|
32
33
|
try {
|
|
33
34
|
execSync('git add -A', { stdio: 'ignore', cwd: appPath });
|
|
34
35
|
execSync('git commit -m "chore: initialize project using @corva/create-app"', {
|
|
35
36
|
stdio: 'ignore',
|
|
36
37
|
cwd: appPath,
|
|
37
38
|
});
|
|
38
|
-
|
|
39
|
+
logger.log('Added first git commit');
|
|
39
40
|
return true;
|
|
40
41
|
} catch (e) {
|
|
41
42
|
// We couldn't commit in already initialized git repo,
|
|
@@ -55,7 +56,7 @@ function tryGitCommit(appPath) {
|
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
function shouldUseYarn(appPath) {
|
|
59
|
+
export function shouldUseYarn(appPath) {
|
|
59
60
|
try {
|
|
60
61
|
execSync('yarnpkg --version', { stdio: 'ignore', cwd: appPath });
|
|
61
62
|
return true;
|
|
@@ -63,9 +64,3 @@ function shouldUseYarn(appPath) {
|
|
|
63
64
|
return false;
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
-
module.exports = {
|
|
68
|
-
isInGitRepository,
|
|
69
|
-
tryGitInit,
|
|
70
|
-
tryGitCommit,
|
|
71
|
-
};
|