@corva/create-app 0.48.0-2 → 0.48.0-3
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 +12 -10
- package/lib/constants/manifest.js +8 -0
- package/lib/constants/package.js +5 -1
- package/lib/main.js +70 -51
- package/package.json +1 -1
- /package/templates/scheduler_data-time/javascript/{__test__ → __tests__}/processor.spec.js +0 -0
- /package/templates/scheduler_data-time/typescript/{__test__ → __tests__}/processor.spec.ts +0 -0
- /package/templates/scheduler_depth/javascript/{__test__ → __tests__}/processor.spec.js +0 -0
- /package/templates/scheduler_depth/typescript/{__test__ → __tests__}/processor.spec.ts +0 -0
- /package/templates/scheduler_natural-time/javascript/{__test__ → __tests__}/processor.spec.js +0 -0
- /package/templates/scheduler_natural-time/typescript/{__test__ → __tests__}/processor.spec.ts +0 -0
- /package/templates/stream_depth/javascript/{__test__ → __tests__}/processor.spec.js +0 -0
- /package/templates/stream_depth/typescript/{__test__ → __tests__}/processor.spec.ts +0 -0
- /package/templates/stream_time/javascript/{__test__ → __tests__}/processor.spec.js +0 -0
- /package/templates/stream_time/typescript/{__test__ → __tests__}/processor.spec.ts +0 -0
- /package/templates/task/javascript/{__test__ → __tests__}/processor.spec.js +0 -0
- /package/templates/task/typescript/{__test__ → __tests__}/processor.spec.ts +0 -0
package/README.md
CHANGED
|
@@ -44,23 +44,25 @@ Arguments:
|
|
|
44
44
|
project-directory project directory to work with (default: "Current working dir")
|
|
45
45
|
|
|
46
46
|
Options:
|
|
47
|
-
--
|
|
48
|
-
--
|
|
49
|
-
--appType
|
|
50
|
-
--
|
|
47
|
+
--developerName [string] Enter the Developer Name (default: "O&G Company")
|
|
48
|
+
--developerIdentifier [string] Enter the Developer Identifier (default: "oandgc")
|
|
49
|
+
--appType Choose the App Type (choices: "ui", "scheduler", "stream", "task")
|
|
50
|
+
--schedulerType Choose the scheduler type (choices: "1", "2", "4")
|
|
51
51
|
--cronString [string] Provide CRON string for the scheduler (default: "*/5 * * * *")
|
|
52
52
|
--depthMilestone [number] Provide depth milestone for the scheduler (default: 1)
|
|
53
|
+
--logType Choose the log type (choices: "time", "depth")
|
|
54
|
+
--appName [string] Enter the App Name (default: "Corva Dev Center App")
|
|
53
55
|
--description [string] Enter description (default: "This is the description of my app. You can do great things with it!")
|
|
54
|
-
--developerIdentifier [string] Enter the Developer Identifier (default: "oandgc")
|
|
55
|
-
--developerName [string] Enter the Developer Name (default: "O&G Company")
|
|
56
|
-
--runtime [string] Choose runtime (choices: "ui", "nodejs16.x", "python3.8", "python3.9")
|
|
57
|
-
--schedulerType [number] Choose the scheduler type (choices: "1", "2", "4", default: 1)
|
|
58
|
-
--segments [string] Choose segments (choices: "drilling", "completion")
|
|
59
56
|
--summary [string] Enter summary (default: "More information about this app goes here")
|
|
57
|
+
--category [string] Enter category (default: "")
|
|
60
58
|
--website [string] Enter website (default: "https://www.oandgexample.com/my-app/")
|
|
61
|
-
|
|
59
|
+
--segments Choose segments (choices: "drilling", "completion")
|
|
60
|
+
--runtime Choose runtime (choices: "ui", "nodejs16.x", "python3.8", "python3.9")
|
|
61
|
+
-p, --packageManager Please select the desired package manager (choices: "yarn", "npm")
|
|
62
62
|
-t, --useTypescript [boolean] Would you like to use TypesScript? (default: false)
|
|
63
63
|
--silent [boolean] Only log result of the operation (default: false)
|
|
64
|
+
--no-dependencies-install Skip installing dependencies
|
|
65
|
+
--no-git-init Skip initializing git repository
|
|
64
66
|
```
|
|
65
67
|
|
|
66
68
|
### Examples
|
|
@@ -244,4 +244,12 @@ export const manifestOptions = (projectName = 'Corva Dev Center App') => [
|
|
|
244
244
|
message: 'Only log result of the operation',
|
|
245
245
|
default: false,
|
|
246
246
|
},
|
|
247
|
+
{
|
|
248
|
+
name: 'no-dependencies-install',
|
|
249
|
+
message: 'Skip installing dependencies',
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: 'no-git-init',
|
|
253
|
+
message: 'Skip initializing git repository',
|
|
254
|
+
},
|
|
247
255
|
];
|
package/lib/constants/package.js
CHANGED
|
@@ -71,7 +71,7 @@ const tsUiPackage = {
|
|
|
71
71
|
const nodeNpmScripts = {
|
|
72
72
|
'bundle': 'create-corva-app zip .',
|
|
73
73
|
'test': 'npm audit --production && npm run unit',
|
|
74
|
-
'unit': 'jest
|
|
74
|
+
'unit': 'jest',
|
|
75
75
|
'lint': 'eslint --ext .js,.ts .',
|
|
76
76
|
'lint:fix': 'eslint --ext .js,.ts --fix .',
|
|
77
77
|
};
|
|
@@ -121,6 +121,9 @@ const nodeNpmPackage = {
|
|
|
121
121
|
dependencies: nodeDependencies,
|
|
122
122
|
devDependencies: nodeDevDependencies,
|
|
123
123
|
scripts: nodeNpmScripts,
|
|
124
|
+
jest: {
|
|
125
|
+
setupFiles: ['dotenv/config'],
|
|
126
|
+
},
|
|
124
127
|
};
|
|
125
128
|
|
|
126
129
|
const nodeYarnPackage = {
|
|
@@ -135,6 +138,7 @@ const nodeTsNpmPackage = {
|
|
|
135
138
|
jest: {
|
|
136
139
|
preset: 'ts-jest',
|
|
137
140
|
testEnvironment: 'node',
|
|
141
|
+
...nodeNpmPackage.jest,
|
|
138
142
|
},
|
|
139
143
|
};
|
|
140
144
|
|
package/lib/main.js
CHANGED
|
@@ -130,10 +130,11 @@ export async function run() {
|
|
|
130
130
|
|
|
131
131
|
manifestConstants.manifestOptions().forEach((value) => {
|
|
132
132
|
const type = typeof value.default;
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
const cliType = type === 'undefined' ? (value.choices ? ' [string]' : '') : ` [${type}]`;
|
|
134
|
+
const alias = value.alias ? `-${value.alias}, ` : '';
|
|
135
|
+
const optionString = `${alias}--${value.name}${cliType}`;
|
|
136
|
+
|
|
137
|
+
const option = new Option(optionString, value.message);
|
|
137
138
|
|
|
138
139
|
if (value.choices) {
|
|
139
140
|
if (typeof value.choices === 'function') {
|
|
@@ -377,7 +378,15 @@ async function initPackage(projectName, opts) {
|
|
|
377
378
|
|
|
378
379
|
await addTemplate(root, manifest, runtime);
|
|
379
380
|
await configureApp(root, manifest, runtime);
|
|
380
|
-
|
|
381
|
+
|
|
382
|
+
opts.dependenciesInstall && (await installDependencies(root, manifest, runtime));
|
|
383
|
+
|
|
384
|
+
opts.gitInit && (await initVersioning(root, manifest, runtime));
|
|
385
|
+
|
|
386
|
+
logger.log();
|
|
387
|
+
logger.log(`Success! Created ${chalk.green(manifest.name)} at ${chalk.yellow(root)}`);
|
|
388
|
+
|
|
389
|
+
helpCommands(manifest, runtime);
|
|
381
390
|
|
|
382
391
|
logger.log();
|
|
383
392
|
}
|
|
@@ -538,68 +547,78 @@ function addPackageJSON(root, manifest, runtime) {
|
|
|
538
547
|
}
|
|
539
548
|
|
|
540
549
|
/**
|
|
541
|
-
*
|
|
542
550
|
* @param {string} root
|
|
543
551
|
* @param {import('./flows/lib/manifest').Manifest} manifest
|
|
552
|
+
* @param {import('./helpers/resolve-app-runtime.js').Runtime} runtime
|
|
553
|
+
* @returns {Promise<void>}
|
|
554
|
+
* @throws {Error}
|
|
555
|
+
* @throws {import('child_process').ExecException}
|
|
556
|
+
* @throws {import('child_process').SpawnSyncReturns<Buffer>}
|
|
544
557
|
*/
|
|
545
|
-
async function
|
|
558
|
+
async function installDependencies(root, manifest, runtime) {
|
|
546
559
|
const command = manifest.isJs() ? runtime.packageManager : 'make';
|
|
547
560
|
|
|
548
|
-
if (
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
if (process.env.CI && command === 'yarn') {
|
|
553
|
-
args.push('--cache-folder=".yarn-cache"');
|
|
554
|
-
}
|
|
561
|
+
if (IS_WINDOWS && !manifest.isJs()) {
|
|
562
|
+
logger.log();
|
|
563
|
+
logger.log(`⚠️ ${chalk.yellow('Please install project dependencies manually')}`);
|
|
555
564
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
const proc =
|
|
559
|
-
manifest.isJs() && existsSync(`${os.homedir()}/.nvm/nvm.sh`)
|
|
560
|
-
? spawn.sync(`\\. ${os.homedir()}/.nvm/nvm.sh && nvm i && ${command} ${args.join(' ')}`, {
|
|
561
|
-
shell: true,
|
|
562
|
-
...opts,
|
|
563
|
-
})
|
|
564
|
-
: spawn.sync(command, args, opts);
|
|
565
|
-
|
|
566
|
-
if (proc.stderr) {
|
|
567
|
-
const error = proc.stderr
|
|
568
|
-
.toString('utf8')
|
|
569
|
-
.split('\n')
|
|
570
|
-
// NOTE: filter out warnings caused by @corva/ui peer dependencies
|
|
571
|
-
.filter((line) => !line.includes('@corva/ui'))
|
|
572
|
-
.join('\n');
|
|
573
|
-
|
|
574
|
-
console.log(error);
|
|
575
|
-
}
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
576
567
|
|
|
577
|
-
|
|
578
|
-
|
|
568
|
+
const args = ['install'];
|
|
569
|
+
const opts = { stdio: ['inherit', 'inherit', 'pipe'], cwd: root };
|
|
579
570
|
|
|
580
|
-
|
|
581
|
-
|
|
571
|
+
if (process.env.CI && command === 'yarn') {
|
|
572
|
+
args.push('--cache-folder=".yarn-cache"');
|
|
573
|
+
}
|
|
582
574
|
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
575
|
+
logger.log(chalk.yellow(`Installing template dependencies using ${runtime.packageManager}...`));
|
|
576
|
+
|
|
577
|
+
const proc =
|
|
578
|
+
manifest.isJs() && existsSync(`${os.homedir()}/.nvm/nvm.sh`)
|
|
579
|
+
? spawn.sync(`\\. ${os.homedir()}/.nvm/nvm.sh && nvm i && ${command} ${args.join(' ')}`, {
|
|
580
|
+
shell: true,
|
|
581
|
+
...opts,
|
|
582
|
+
})
|
|
583
|
+
: spawn.sync(command, args, opts);
|
|
584
|
+
|
|
585
|
+
if (proc.stderr) {
|
|
586
|
+
const error = proc.stderr
|
|
587
|
+
.toString('utf8')
|
|
588
|
+
.split('\n')
|
|
589
|
+
// NOTE: filter out warnings caused by @corva/ui peer dependencies
|
|
590
|
+
.filter((line) => !line.includes('@corva/ui'))
|
|
591
|
+
.join('\n');
|
|
592
|
+
|
|
593
|
+
console.log(error);
|
|
587
594
|
}
|
|
588
595
|
|
|
589
|
-
if (
|
|
590
|
-
|
|
591
|
-
logger.log('Initialized a git repository.');
|
|
596
|
+
if (proc.status !== 0) {
|
|
597
|
+
console.error(`\`${command} ${args.join(' ')}\` failed`);
|
|
592
598
|
|
|
593
|
-
|
|
594
|
-
logger.log();
|
|
595
|
-
logger.log('Created git commit.');
|
|
596
|
-
}
|
|
599
|
+
return;
|
|
597
600
|
}
|
|
598
601
|
|
|
602
|
+
logger.log(chalk.green('Successfull project install'));
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
*
|
|
607
|
+
* @param {string} root
|
|
608
|
+
*/
|
|
609
|
+
async function initVersioning(root) {
|
|
599
610
|
logger.log();
|
|
600
|
-
logger.log(`Success! Created ${chalk.green(manifest.name)} at ${chalk.yellow(root)}`);
|
|
601
611
|
|
|
602
|
-
|
|
612
|
+
if (!versioning.tryGitInit(root)) {
|
|
613
|
+
logger.log('Already in a git repository. Skipping git initialization.');
|
|
614
|
+
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
if (versioning.tryGitCommit(root)) {
|
|
619
|
+
logger.log();
|
|
620
|
+
logger.log('Created git commit');
|
|
621
|
+
}
|
|
603
622
|
}
|
|
604
623
|
|
|
605
624
|
async function helpCommands(manifest, { packageManager: displayedCommand }) {
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/templates/scheduler_natural-time/javascript/{__test__ → __tests__}/processor.spec.js
RENAMED
|
File without changes
|
/package/templates/scheduler_natural-time/typescript/{__test__ → __tests__}/processor.spec.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|