@corva/create-app 0.48.0-2 → 0.48.0-4
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 +7 -1
- package/lib/main.js +77 -52
- 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/common/node/.eslintrc.js +0 -1
- package/common/node/.prettierrc +0 -1
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,11 @@ const nodeNpmPackage = {
|
|
|
121
121
|
dependencies: nodeDependencies,
|
|
122
122
|
devDependencies: nodeDevDependencies,
|
|
123
123
|
scripts: nodeNpmScripts,
|
|
124
|
+
jest: {
|
|
125
|
+
setupFiles: ['dotenv/config'],
|
|
126
|
+
},
|
|
127
|
+
prettier: '@corva/eslint-config-node/prettier',
|
|
128
|
+
eslintConfig: { extends: '@corva/eslint-config-node' },
|
|
124
129
|
};
|
|
125
130
|
|
|
126
131
|
const nodeYarnPackage = {
|
|
@@ -135,6 +140,7 @@ const nodeTsNpmPackage = {
|
|
|
135
140
|
jest: {
|
|
136
141
|
preset: 'ts-jest',
|
|
137
142
|
testEnvironment: 'node',
|
|
143
|
+
...nodeNpmPackage.jest,
|
|
138
144
|
},
|
|
139
145
|
};
|
|
140
146
|
|
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
|
}
|
|
@@ -429,7 +438,13 @@ async function addTemplate(root, manifest, runtime) {
|
|
|
429
438
|
// We can't have .gitignore file in our templates.
|
|
430
439
|
// It's missing when @corva/create-app is installed.
|
|
431
440
|
// That's why we manually rename gitignore to .gitignore after copying template
|
|
432
|
-
|
|
441
|
+
const targetGitignore = path.join(root, '.gitignore');
|
|
442
|
+
|
|
443
|
+
fs.renameSync(path.join(root, 'gitignore'), targetGitignore);
|
|
444
|
+
|
|
445
|
+
if (runtime.language === 'typescript' && manifest.isNode()) {
|
|
446
|
+
await fs.appendFile(targetGitignore, '\n**/*.js\n');
|
|
447
|
+
}
|
|
433
448
|
|
|
434
449
|
logger.log(chalk.green('Done: copying app template!'));
|
|
435
450
|
}
|
|
@@ -538,68 +553,78 @@ function addPackageJSON(root, manifest, runtime) {
|
|
|
538
553
|
}
|
|
539
554
|
|
|
540
555
|
/**
|
|
541
|
-
*
|
|
542
556
|
* @param {string} root
|
|
543
557
|
* @param {import('./flows/lib/manifest').Manifest} manifest
|
|
558
|
+
* @param {import('./helpers/resolve-app-runtime.js').Runtime} runtime
|
|
559
|
+
* @returns {Promise<void>}
|
|
560
|
+
* @throws {Error}
|
|
561
|
+
* @throws {import('child_process').ExecException}
|
|
562
|
+
* @throws {import('child_process').SpawnSyncReturns<Buffer>}
|
|
544
563
|
*/
|
|
545
|
-
async function
|
|
564
|
+
async function installDependencies(root, manifest, runtime) {
|
|
546
565
|
const command = manifest.isJs() ? runtime.packageManager : 'make';
|
|
547
566
|
|
|
548
|
-
if (
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
if (process.env.CI && command === 'yarn') {
|
|
553
|
-
args.push('--cache-folder=".yarn-cache"');
|
|
554
|
-
}
|
|
567
|
+
if (IS_WINDOWS && !manifest.isJs()) {
|
|
568
|
+
logger.log();
|
|
569
|
+
logger.log(`⚠️ ${chalk.yellow('Please install project dependencies manually')}`);
|
|
555
570
|
|
|
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
|
-
}
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
576
573
|
|
|
577
|
-
|
|
578
|
-
|
|
574
|
+
const args = ['install'];
|
|
575
|
+
const opts = { stdio: ['inherit', 'inherit', 'pipe'], cwd: root };
|
|
579
576
|
|
|
580
|
-
|
|
581
|
-
|
|
577
|
+
if (process.env.CI && command === 'yarn') {
|
|
578
|
+
args.push('--cache-folder=".yarn-cache"');
|
|
579
|
+
}
|
|
582
580
|
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
581
|
+
logger.log(chalk.yellow(`Installing template dependencies using ${runtime.packageManager}...`));
|
|
582
|
+
|
|
583
|
+
const proc =
|
|
584
|
+
manifest.isJs() && existsSync(`${os.homedir()}/.nvm/nvm.sh`)
|
|
585
|
+
? spawn.sync(`\\. ${os.homedir()}/.nvm/nvm.sh && nvm i && ${command} ${args.join(' ')}`, {
|
|
586
|
+
shell: true,
|
|
587
|
+
...opts,
|
|
588
|
+
})
|
|
589
|
+
: spawn.sync(command, args, opts);
|
|
590
|
+
|
|
591
|
+
if (proc.stderr) {
|
|
592
|
+
const error = proc.stderr
|
|
593
|
+
.toString('utf8')
|
|
594
|
+
.split('\n')
|
|
595
|
+
// NOTE: filter out warnings caused by @corva/ui peer dependencies
|
|
596
|
+
.filter((line) => !line.includes('@corva/ui'))
|
|
597
|
+
.join('\n');
|
|
598
|
+
|
|
599
|
+
console.log(error);
|
|
587
600
|
}
|
|
588
601
|
|
|
589
|
-
if (
|
|
590
|
-
|
|
591
|
-
logger.log('Initialized a git repository.');
|
|
602
|
+
if (proc.status !== 0) {
|
|
603
|
+
console.error(`\`${command} ${args.join(' ')}\` failed`);
|
|
592
604
|
|
|
593
|
-
|
|
594
|
-
logger.log();
|
|
595
|
-
logger.log('Created git commit.');
|
|
596
|
-
}
|
|
605
|
+
return;
|
|
597
606
|
}
|
|
598
607
|
|
|
608
|
+
logger.log(chalk.green('Successfull project install'));
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
*
|
|
613
|
+
* @param {string} root
|
|
614
|
+
*/
|
|
615
|
+
async function initVersioning(root) {
|
|
599
616
|
logger.log();
|
|
600
|
-
logger.log(`Success! Created ${chalk.green(manifest.name)} at ${chalk.yellow(root)}`);
|
|
601
617
|
|
|
602
|
-
|
|
618
|
+
if (!versioning.tryGitInit(root)) {
|
|
619
|
+
logger.log('Already in a git repository. Skipping git initialization.');
|
|
620
|
+
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
if (versioning.tryGitCommit(root)) {
|
|
625
|
+
logger.log();
|
|
626
|
+
logger.log('Created git commit');
|
|
627
|
+
}
|
|
603
628
|
}
|
|
604
629
|
|
|
605
630
|
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
|
package/common/node/.eslintrc.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = { extends: '@corva/eslint-config-node' };
|
package/common/node/.prettierrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"@corva/eslint-config-node/prettier"
|