@corva/create-app 0.28.0-2 → 0.28.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/lib/constants/manifest.js +1 -1
- package/lib/constants/package.js +150 -39
- package/lib/flows/lib/manifest.js +17 -1
- package/lib/helpers/resolve-app-runtime.js +29 -0
- package/lib/helpers/utils.js +17 -17
- package/lib/index.js +145 -142
- package/package.json +1 -1
- package/templates/{scheduler/node → javascript/scheduler}/README.md +0 -0
- package/templates/{scheduler/node → javascript/scheduler}/__test__/processor.test.js +0 -0
- package/templates/{scheduler/node → javascript/scheduler}/index.js +0 -0
- package/templates/{scheduler/node → javascript/scheduler}/src/processor.js +0 -0
- package/templates/{stream/node → javascript/stream}/README.md +0 -0
- package/templates/{stream/node → javascript/stream}/__test__/processor.test.js +0 -0
- package/templates/{stream/node → javascript/stream}/index.js +0 -0
- package/templates/{stream/node → javascript/stream}/src/processor.js +0 -0
- package/templates/{task/node → javascript/task}/README.md +0 -0
- package/templates/{task/node → javascript/task}/__test__/processor.test.js +0 -0
- package/templates/{task/node → javascript/task}/index.js +0 -0
- package/templates/{task/node → javascript/task}/src/processor.js +0 -0
- package/templates/{ui/js → javascript/ui}/.env +0 -0
- package/templates/{ui/js → javascript/ui}/.env.sample +0 -0
- package/templates/{ui/js → javascript/ui}/.eslintrc +0 -0
- package/templates/{ui/js → javascript/ui}/.prettierrc +0 -0
- package/templates/{ui/js → javascript/ui}/README.md +0 -0
- package/templates/{ui/js → javascript/ui}/config-overrides.js +0 -0
- package/templates/{ui/js → javascript/ui}/gitignore +0 -0
- package/templates/{ui/js → javascript/ui}/src/App.css +0 -0
- package/templates/{ui/js → javascript/ui}/src/App.js +0 -0
- package/templates/{ui/js → javascript/ui}/src/AppSettings.js +0 -0
- package/templates/{ui/js → javascript/ui}/src/assets/logo.svg +0 -0
- package/templates/{ui/js → javascript/ui}/src/constants.js +0 -0
- package/templates/{ui/js → javascript/ui}/src/index.js +0 -0
- package/templates/{scheduler/python → python/scheduler}/README.md +0 -0
- package/templates/{scheduler/python → python/scheduler}/lambda_function.py +0 -0
- package/templates/{scheduler/python → python/scheduler}/test/__init__.py +0 -0
- package/templates/{scheduler/python → python/scheduler}/test/app_test.py +0 -0
- package/templates/{stream/python → python/stream}/README.md +0 -0
- package/templates/{stream/python → python/stream}/lambda_function.py +0 -0
- package/templates/{stream/python → python/stream}/test/__init__.py +0 -0
- package/templates/{stream/python → python/stream}/test/app_test.py +0 -0
- package/templates/{task/python → python/task}/README.md +0 -0
- package/templates/{task/python → python/task}/lambda_function.py +0 -0
- package/templates/{task/python → python/task}/test/__init__.py +0 -0
- package/templates/{task/python → python/task}/test/app_test.py +0 -0
- package/templates/{scheduler/node-ts → typescript/scheduler}/README.md +0 -0
- package/templates/{scheduler/node-ts → typescript/scheduler}/__test__/processor.spec.ts +0 -0
- package/templates/{scheduler/node-ts → typescript/scheduler}/index.ts +0 -0
- package/templates/{scheduler/node-ts → typescript/scheduler}/lib/processor.ts +0 -0
- package/templates/{stream/node-ts → typescript/stream}/README.md +0 -0
- package/templates/{stream/node-ts → typescript/stream}/__test__/processor.spec.ts +0 -0
- package/templates/{stream/node-ts → typescript/stream}/index.ts +0 -0
- package/templates/{stream/node-ts → typescript/stream}/lib/processor.ts +0 -0
- package/templates/{task/node-ts → typescript/task}/README.md +0 -0
- package/templates/{task/node-ts → typescript/task}/__test__/processor.spec.ts +0 -0
- package/templates/{task/node-ts → typescript/task}/index.ts +0 -0
- package/templates/{task/node-ts → typescript/task}/src/processor.ts +0 -0
- package/templates/{ui/ts → typescript/ui}/.env +0 -0
- package/templates/{ui/ts → typescript/ui}/.env.sample +0 -0
- package/templates/{ui/ts → typescript/ui}/.eslintrc +0 -0
- package/templates/{ui/ts → typescript/ui}/.prettierrc +0 -0
- package/templates/{ui/ts → typescript/ui}/README.md +0 -0
- package/templates/{ui/ts → typescript/ui}/config-overrides.js +0 -0
- package/templates/{ui/ts → typescript/ui}/gitignore +0 -0
- package/templates/{ui/ts → typescript/ui}/src/App.css +0 -0
- package/templates/{ui/ts → typescript/ui}/src/App.tsx +0 -0
- package/templates/{ui/ts → typescript/ui}/src/AppSettings.tsx +0 -0
- package/templates/{ui/ts → typescript/ui}/src/assets/logo.svg +0 -0
- package/templates/{ui/ts → typescript/ui}/src/constants.ts +0 -0
- package/templates/{ui/ts → typescript/ui}/src/custom.d.ts +0 -0
- package/templates/{ui/ts → typescript/ui}/src/index.js +0 -0
- package/templates/{ui/ts → typescript/ui}/tsconfig.json +0 -0
- package/templates/scheduler/node/gitignore +0 -21
- package/templates/scheduler/node/package.json +0 -17
- package/templates/scheduler/node-ts/gitignore +0 -25
- package/templates/scheduler/node-ts/lib/processor.js +0 -16
- package/templates/scheduler/node-ts/lib/processor.js.map +0 -1
- package/templates/scheduler/node-ts/package.json +0 -37
- package/templates/scheduler/node-ts/tsconfig.build.json +0 -11
- package/templates/scheduler/node-ts/tsconfig.json +0 -34
- package/templates/scheduler/python/Makefile +0 -15
- package/templates/scheduler/python/requirements.txt +0 -2
- package/templates/stream/node/gitignore +0 -21
- package/templates/stream/node/package.json +0 -17
- package/templates/stream/node-ts/gitignore +0 -25
- package/templates/stream/node-ts/package.json +0 -37
- package/templates/stream/node-ts/tsconfig.build.json +0 -11
- package/templates/stream/node-ts/tsconfig.json +0 -34
- package/templates/stream/python/Makefile +0 -15
- package/templates/stream/python/requirements.txt +0 -2
- package/templates/task/node/gitignore +0 -21
- package/templates/task/node/package.json +0 -17
- package/templates/task/node-ts/gitignore +0 -25
- package/templates/task/node-ts/package.json +0 -37
- package/templates/task/node-ts/tsconfig.build.json +0 -11
- package/templates/task/node-ts/tsconfig.json +0 -34
- package/templates/task/python/Makefile +0 -15
- package/templates/task/python/requirements.txt +0 -2
package/lib/index.js
CHANGED
|
@@ -20,31 +20,25 @@ const utils = require('./helpers/utils.js');
|
|
|
20
20
|
const manifestHelpers = require('./helpers/manifest.js');
|
|
21
21
|
const versioning = require('./helpers/versioning.js');
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const { getDefaultsForPackageJson } = require('./constants/package.js');
|
|
24
24
|
const manifestConstants = require('./constants/manifest.js');
|
|
25
25
|
|
|
26
26
|
const packageJson = require('../package.json');
|
|
27
27
|
const { clear } = require('console');
|
|
28
28
|
const spawn = require('cross-spawn');
|
|
29
|
-
const { APP_RUNTIMES, TEMPLATE_TYPES, APP_TYPES } = require('./constants/cli');
|
|
30
29
|
const { runFlow } = require('./flow');
|
|
31
30
|
const { ERROR_ICON } = require('./constants/messages');
|
|
32
31
|
const { StepError } = require('./flows/lib/step-error');
|
|
33
32
|
const { RELEASE_FLOW } = require('./flows/release');
|
|
34
33
|
const { ZIP_FLOW } = require('./flows/zip');
|
|
35
34
|
const { bumpVersionOptionDeprecated, bumpVersionOption } = require('./bump-version.option');
|
|
35
|
+
const { Manifest } = require('./flows/lib/manifest');
|
|
36
|
+
const { resolveAppRuntime } = require('./helpers/resolve-app-runtime');
|
|
36
37
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const shouldUseYarn = () => packageManager === YARN_EXECUTABLE;
|
|
43
|
-
const getLockFileName = (manager) =>
|
|
44
|
-
manager === YARN_EXECUTABLE ? 'yarn.lock' : 'package-lock.json';
|
|
45
|
-
|
|
46
|
-
let projectName;
|
|
47
|
-
let program;
|
|
38
|
+
const writejsonOptions = {
|
|
39
|
+
spaces: 2,
|
|
40
|
+
EOL: os.EOL
|
|
41
|
+
};
|
|
48
42
|
|
|
49
43
|
function startingMessage() {
|
|
50
44
|
clear();
|
|
@@ -60,7 +54,7 @@ function checkNodeVersion() {
|
|
|
60
54
|
console.log(
|
|
61
55
|
chalk.red(
|
|
62
56
|
`\nYou are using Node ${process.version}.\n\n` +
|
|
63
|
-
|
|
57
|
+
`Please update to Node 10 or higher for a better, fully supported experience.\n`
|
|
64
58
|
)
|
|
65
59
|
);
|
|
66
60
|
// Fall back to latest supported react-scripts on Node 4
|
|
@@ -90,11 +84,11 @@ function checkOptions(opts) {
|
|
|
90
84
|
const printDeprecationNotice = (param) =>
|
|
91
85
|
console.warn(
|
|
92
86
|
chalk.bgYellowBright`DEPRECATED OPTION: ${param}` +
|
|
93
|
-
|
|
87
|
+
` Use ${chalk.cyan(`create-corva-app ${param} .`)} instead`
|
|
94
88
|
);
|
|
95
89
|
|
|
96
90
|
async function initialChecks() {
|
|
97
|
-
program = new Command()
|
|
91
|
+
const program = new Command()
|
|
98
92
|
.hook('preAction', async () => {
|
|
99
93
|
checkNodeVersion();
|
|
100
94
|
|
|
@@ -109,11 +103,10 @@ async function initialChecks() {
|
|
|
109
103
|
.argument('[project-directory]', 'project directory to work with', process.cwd())
|
|
110
104
|
.usage(`${chalk.green('<project-directory>')} [options]`);
|
|
111
105
|
|
|
112
|
-
manifestConstants.manifestOptions(
|
|
106
|
+
manifestConstants.manifestOptions().forEach((value) => {
|
|
113
107
|
const type = typeof value.default;
|
|
114
108
|
const option = new Option(
|
|
115
|
-
`${value.alias ? `-${value.alias}, ` : ''}--${value.name} [${
|
|
116
|
-
(type !== 'undefined' && type) || 'string'
|
|
109
|
+
`${value.alias ? `-${value.alias}, ` : ''}--${value.name} [${(type !== 'undefined' && type) || 'string'
|
|
117
110
|
}]`,
|
|
118
111
|
value.message
|
|
119
112
|
);
|
|
@@ -156,10 +149,6 @@ async function initialChecks() {
|
|
|
156
149
|
.addOption(bumpVersionOptionDeprecated);
|
|
157
150
|
|
|
158
151
|
createCommand.action(async (dirName, options) => {
|
|
159
|
-
projectName = dirName;
|
|
160
|
-
packageManager = options.packageManager || packageManager;
|
|
161
|
-
useTypescript = options.useTypescript || useTypescript;
|
|
162
|
-
|
|
163
152
|
if (options.zip || options.release) {
|
|
164
153
|
options.bumpVersion = await ensureBumpVersion(options.bumpVersion);
|
|
165
154
|
}
|
|
@@ -179,7 +168,7 @@ async function initialChecks() {
|
|
|
179
168
|
startingMessage();
|
|
180
169
|
|
|
181
170
|
// NOTE: Default action
|
|
182
|
-
await createApp(options);
|
|
171
|
+
await createApp(dirName, options);
|
|
183
172
|
});
|
|
184
173
|
|
|
185
174
|
program
|
|
@@ -272,9 +261,11 @@ const handleCommanderError = (e) => {
|
|
|
272
261
|
}
|
|
273
262
|
};
|
|
274
263
|
|
|
275
|
-
async function initPackage(
|
|
276
|
-
const
|
|
277
|
-
|
|
264
|
+
async function initPackage(projectName, opts) {
|
|
265
|
+
const manifest = new Manifest(manifestHelpers.fillManifest(opts));
|
|
266
|
+
const runtime = resolveAppRuntime(opts);
|
|
267
|
+
|
|
268
|
+
if (manifest.isUi()) {
|
|
278
269
|
await ensureLatestVersion();
|
|
279
270
|
}
|
|
280
271
|
|
|
@@ -282,31 +273,20 @@ async function initPackage(manifest) {
|
|
|
282
273
|
|
|
283
274
|
console.log(`Creating a new Corva app in ${chalk.green(root)}.`);
|
|
284
275
|
|
|
285
|
-
fs.
|
|
286
|
-
|
|
287
|
-
fs.writeFileSync(path.join(root, 'manifest.json'), JSON.stringify(manifest, null, 2) + os.EOL);
|
|
288
|
-
|
|
289
|
-
let runtime = manifest.settings.runtime;
|
|
290
|
-
|
|
291
|
-
// Runtimes normally include a version number, like python3.8 or nodejs12.x. We don't want to have a directory or
|
|
292
|
-
// config for every possible version at this point, so just consolidate all versions of a runtime into a single
|
|
293
|
-
// template directory.
|
|
294
|
-
if (appType !== APP_TYPES.UI) {
|
|
295
|
-
if (runtime.startsWith(TEMPLATE_TYPES.PYTHON)) {
|
|
296
|
-
runtime = TEMPLATE_TYPES.PYTHON;
|
|
297
|
-
} else {
|
|
298
|
-
runtime = useTypescript ? TEMPLATE_TYPES.NODE_TYPESCRIPT : TEMPLATE_TYPES.NODE;
|
|
299
|
-
}
|
|
300
|
-
} else {
|
|
301
|
-
runtime = useTypescript ? TEMPLATE_TYPES.UI_TS : TEMPLATE_TYPES.UI;
|
|
276
|
+
if (fs.existsSync(root)) {
|
|
277
|
+
throw new Error(`Directory already exists: ${root}`);
|
|
302
278
|
}
|
|
279
|
+
await fs.mkdir(root);
|
|
280
|
+
await fs.writeJSON(path.join(root, 'manifest.json'), manifest.manifest, writejsonOptions);
|
|
303
281
|
|
|
304
|
-
addTemplate(root,
|
|
305
|
-
configureApp(root,
|
|
306
|
-
installApp(root,
|
|
282
|
+
await addTemplate(root, manifest, runtime);
|
|
283
|
+
await configureApp(root, manifest, runtime);
|
|
284
|
+
await installApp(root, manifest, runtime);
|
|
285
|
+
|
|
286
|
+
console.log();
|
|
307
287
|
}
|
|
308
288
|
|
|
309
|
-
async function createApp(opts) {
|
|
289
|
+
async function createApp(dirName, opts) {
|
|
310
290
|
const { isValid, values } = checkOptions(opts);
|
|
311
291
|
|
|
312
292
|
if (isValid) {
|
|
@@ -314,66 +294,106 @@ async function createApp(opts) {
|
|
|
314
294
|
console.log(`${key} : ${values[key]}`);
|
|
315
295
|
});
|
|
316
296
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
await initPackage(manifest);
|
|
320
|
-
} else {
|
|
321
|
-
console.log('Please fill your app Metadata');
|
|
322
|
-
|
|
323
|
-
inquirer.prompt(manifestConstants.manifestOptions(projectName), opts).then((answers) => {
|
|
324
|
-
packageManager = answers.packageManager || packageManager;
|
|
325
|
-
useTypescript = answers.useTypescript || useTypescript;
|
|
297
|
+
return initPackage(dirName, opts);
|
|
298
|
+
}
|
|
326
299
|
|
|
327
|
-
|
|
300
|
+
console.log('Please fill your app Metadata');
|
|
328
301
|
|
|
329
|
-
|
|
330
|
-
});
|
|
331
|
-
}
|
|
302
|
+
const answers = inquirer.prompt(manifestConstants.manifestOptions(dirName), opts)
|
|
332
303
|
|
|
333
|
-
|
|
304
|
+
return initPackage(dirName, answers);
|
|
334
305
|
}
|
|
335
306
|
|
|
336
|
-
|
|
307
|
+
/**
|
|
308
|
+
*
|
|
309
|
+
* @param {string} root
|
|
310
|
+
* @param {import('./flows/lib/manifest').Manifest} manifest
|
|
311
|
+
* @param {*} runtime
|
|
312
|
+
*/
|
|
313
|
+
async function addTemplate(root, manifest, runtime) {
|
|
337
314
|
console.log(chalk.green('Copying app template...'));
|
|
338
315
|
console.log();
|
|
339
316
|
|
|
340
|
-
const templateFolder = path.resolve(__dirname, '..', 'templates',
|
|
341
|
-
|
|
342
|
-
utils.copyFolderRecursiveSync(templateFolder, root, runtime);
|
|
317
|
+
const templateFolder = path.resolve(__dirname, '..', 'templates', runtime.language, manifest.type);
|
|
343
318
|
|
|
344
|
-
|
|
319
|
+
utils.copyFolderRecursiveSync(templateFolder, root);
|
|
345
320
|
|
|
346
|
-
if (
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
// That's why we manually rename gitignore to .gitignore after copying template
|
|
321
|
+
if (manifest.isNode()) {
|
|
322
|
+
utils.copyFolderRecursiveSync(path.resolve(__dirname, '..', 'common', 'node'), root);
|
|
323
|
+
}
|
|
350
324
|
|
|
351
|
-
|
|
325
|
+
if (manifest.isPython()) {
|
|
326
|
+
utils.copyFolderRecursiveSync(path.resolve(__dirname, '..', 'common', 'python'), root);
|
|
352
327
|
}
|
|
353
328
|
|
|
329
|
+
// We can't have .gitignore file in our templates.
|
|
330
|
+
// It's missing when @corva/create-app is installed.
|
|
331
|
+
// That's why we manually rename gitignore to .gitignore after copying template
|
|
332
|
+
fs.renameSync(path.join(root, 'gitignore'), path.join(root, '.gitignore'));
|
|
333
|
+
|
|
354
334
|
console.log(chalk.green('Done: copying app template!'));
|
|
355
335
|
}
|
|
356
336
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
337
|
+
/**
|
|
338
|
+
*
|
|
339
|
+
* @param {string} root
|
|
340
|
+
* @param {import('./flows/lib/manifest').Manifest} manifest
|
|
341
|
+
* @param {*} runtime
|
|
342
|
+
*/
|
|
343
|
+
async function configureApp(root, manifest, runtime) {
|
|
344
|
+
if (manifest.isJs()) {
|
|
345
|
+
await addPackageJSON(root, manifest, runtime);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (manifest.isNode()) {
|
|
349
|
+
await addTsConfigs(root, manifest, runtime);
|
|
362
350
|
}
|
|
363
351
|
|
|
364
|
-
if (
|
|
365
|
-
patchSchedulerForPython(root,
|
|
352
|
+
if (manifest.isPython() && manifest.isScheduler()) {
|
|
353
|
+
patchSchedulerForPython(root, manifest, runtime);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
const addTsConfigs = (root, manifest, runtime) => {
|
|
358
|
+
if (runtime.language !== 'typescript') {
|
|
359
|
+
return;
|
|
366
360
|
}
|
|
361
|
+
|
|
362
|
+
return Promise.all([
|
|
363
|
+
fs.writeJson(path.resolve(root, 'tsconfig.json'),
|
|
364
|
+
{
|
|
365
|
+
extends: `@tsconfig/node${runtime.version}/tsconfig.json`,
|
|
366
|
+
compilerOptions: {
|
|
367
|
+
inlineSourceMap: true
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
writejsonOptions
|
|
371
|
+
),
|
|
372
|
+
fs.writeJson(path.resolve(root, 'tsconfig.build.json'),
|
|
373
|
+
{
|
|
374
|
+
"extends": "./tsconfig.json",
|
|
375
|
+
"include": [
|
|
376
|
+
"lib/**/*.ts",
|
|
377
|
+
"index.ts"
|
|
378
|
+
],
|
|
379
|
+
"exclude": [
|
|
380
|
+
"node_modules",
|
|
381
|
+
"**/*.spec.ts"
|
|
382
|
+
]
|
|
383
|
+
},
|
|
384
|
+
writejsonOptions
|
|
385
|
+
),
|
|
386
|
+
])
|
|
367
387
|
}
|
|
368
388
|
|
|
369
|
-
function patchSchedulerForPython(root,
|
|
370
|
-
const schedulerType = manifest.settings.app.scheduler_type;
|
|
389
|
+
function patchSchedulerForPython(root, manifest, runtime) {
|
|
390
|
+
const schedulerType = manifest.manifest.settings.app.scheduler_type;
|
|
371
391
|
|
|
372
392
|
if (schedulerType === manifestConstants.SCHEDULER_TYPE_DATA_TIME.value) {
|
|
373
393
|
return;
|
|
374
394
|
}
|
|
375
395
|
|
|
376
|
-
const templateFolder = path.resolve(__dirname, '..', 'templates',
|
|
396
|
+
const templateFolder = path.resolve(__dirname, '..', 'templates', runtime.language, manifest.type);
|
|
377
397
|
const originalType = 'ScheduledDataTimeEvent';
|
|
378
398
|
const replacementType =
|
|
379
399
|
schedulerType === manifestConstants.SCHEDULER_TYPE_DEPTH.value
|
|
@@ -386,58 +406,42 @@ function patchSchedulerForPython(root, appType, runtime, manifest) {
|
|
|
386
406
|
fs.writeFileSync(path.join(root, 'lambda_function.py'), patchedCode);
|
|
387
407
|
}
|
|
388
408
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
409
|
+
/**
|
|
410
|
+
*
|
|
411
|
+
* @param {string} root
|
|
412
|
+
* @param {import('./flows/lib/manifest').Manifest} manifest
|
|
413
|
+
*/
|
|
414
|
+
function addPackageJSON(root, manifest, runtime) {
|
|
415
|
+
const defaults = getDefaultsForPackageJson(manifest, runtime);
|
|
416
|
+
|
|
394
417
|
const packageJson = {
|
|
395
|
-
name:
|
|
396
|
-
version:
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
418
|
+
name: manifest.name.replace(/\W/g, ''),
|
|
419
|
+
version: defaults.version,
|
|
420
|
+
description: manifest.description || defaults.description,
|
|
421
|
+
engines: {
|
|
422
|
+
node: `>=12.22.12`,
|
|
423
|
+
// node: `>=${runtime.version}`,
|
|
424
|
+
[runtime.packageManager]: '*'
|
|
425
|
+
},
|
|
426
|
+
scripts: defaults.scripts,
|
|
427
|
+
dependencies: defaults.dependencies,
|
|
428
|
+
devDependencies: defaults.devDependencies,
|
|
401
429
|
};
|
|
402
430
|
|
|
403
|
-
fs.
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
function updatePackageJSON(root, description, appType, runtime) {
|
|
407
|
-
const templateFolder = path.resolve(__dirname, '..', 'templates', appType, runtime);
|
|
408
|
-
|
|
409
|
-
let packageJson = JSON.parse(fs.readFileSync(path.join(templateFolder, 'package.json'), 'utf-8'));
|
|
410
|
-
|
|
411
|
-
packageJson.name = projectName.replace(/\W/g, '-').toLowerCase();
|
|
412
|
-
packageJson.description = description;
|
|
413
|
-
|
|
414
|
-
packageJson.scripts.bundle = packageJson.scripts.bundle.replace(
|
|
415
|
-
'$LOCKFILE',
|
|
416
|
-
getLockFileName(packageManager)
|
|
417
|
-
);
|
|
418
|
-
|
|
419
|
-
fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify(packageJson, null, 2) + os.EOL);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
function installApp(appPath, appType, runtime) {
|
|
423
|
-
switch (runtime) {
|
|
424
|
-
case TEMPLATE_TYPES.PYTHON: {
|
|
425
|
-
break;
|
|
426
|
-
}
|
|
427
|
-
default: {
|
|
428
|
-
installJsApp(appPath, appType);
|
|
429
|
-
|
|
430
|
-
break;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
431
|
+
return fs.writeJSON(path.join(root, 'package.json'), packageJson, writejsonOptions);
|
|
433
432
|
}
|
|
434
433
|
|
|
435
|
-
|
|
436
|
-
|
|
434
|
+
/**
|
|
435
|
+
*
|
|
436
|
+
* @param {string} root
|
|
437
|
+
* @param {import('./flows/lib/manifest').Manifest} manifest
|
|
438
|
+
*/
|
|
439
|
+
async function installApp(root, manifest, runtime) {
|
|
440
|
+
const command = manifest.isJs() ? runtime.packageManager : 'make';
|
|
437
441
|
const args = ['install'];
|
|
438
442
|
|
|
439
|
-
console.log(chalk.yellow(`Installing template dependencies using ${
|
|
440
|
-
const proc = spawn.sync(command, args, { stdio: ['inherit', 'inherit', 'pipe'], cwd:
|
|
443
|
+
console.log(chalk.yellow(`Installing template dependencies using ${runtime.packageManager}...`));
|
|
444
|
+
const proc = spawn.sync(command, args, { stdio: ['inherit', 'inherit', 'pipe'], cwd: root });
|
|
441
445
|
|
|
442
446
|
if (proc.stderr) {
|
|
443
447
|
const error = proc.stderr
|
|
@@ -456,31 +460,30 @@ function installJsApp(appPath, appType) {
|
|
|
456
460
|
|
|
457
461
|
console.log(chalk.green('Successfull project install'));
|
|
458
462
|
|
|
459
|
-
|
|
460
|
-
if (versioning.tryGitInit(appPath)) {
|
|
461
|
-
initializedGit = true;
|
|
463
|
+
if (versioning.tryGitInit(root)) {
|
|
462
464
|
console.log();
|
|
463
465
|
console.log('Initialized a git repository.');
|
|
464
|
-
}
|
|
465
466
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
467
|
+
if (versioning.tryGitCommit(root)) {
|
|
468
|
+
console.log();
|
|
469
|
+
console.log('Created git commit.');
|
|
470
|
+
}
|
|
469
471
|
}
|
|
470
472
|
|
|
471
473
|
console.log();
|
|
472
|
-
console.log(`Success! Created ${
|
|
474
|
+
console.log(`Success! Created ${manifest.name} at ${root}`);
|
|
473
475
|
|
|
474
|
-
|
|
475
|
-
console.log('Inside that directory, you can run several commands:');
|
|
476
|
-
helpCommands();
|
|
477
|
-
}
|
|
476
|
+
helpCommands(manifest, runtime);
|
|
478
477
|
}
|
|
479
478
|
|
|
480
|
-
async function helpCommands() {
|
|
481
|
-
|
|
482
|
-
|
|
479
|
+
async function helpCommands(manifest, { packageManager: displayedCommand }) {
|
|
480
|
+
if (!manifest.isUi()) {
|
|
481
|
+
return
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
const useYarn = displayedCommand === 'yarn';
|
|
483
485
|
|
|
486
|
+
console.log('Inside that directory, you can run several commands:');
|
|
484
487
|
console.log();
|
|
485
488
|
console.log(chalk.cyan(` ${displayedCommand} start`));
|
|
486
489
|
console.log(' Starts the development server.');
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
-
|
|
3
|
-
# dependencies
|
|
4
|
-
/node_modules
|
|
5
|
-
|
|
6
|
-
# testing
|
|
7
|
-
/coverage
|
|
8
|
-
|
|
9
|
-
# misc
|
|
10
|
-
.env
|
|
11
|
-
.DS_Store
|
|
12
|
-
.env.local
|
|
13
|
-
.env.development.local
|
|
14
|
-
.env.test.local
|
|
15
|
-
.env.production.local
|
|
16
|
-
|
|
17
|
-
npm-debug.log*
|
|
18
|
-
yarn-debug.log*
|
|
19
|
-
yarn-error.log*
|
|
20
|
-
|
|
21
|
-
*.zip
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "my-dev-center-polling-scheduler-app",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"description": "My Dev Center Polling Scheduler Data App",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"bundle": "create-corva-app zip .",
|
|
8
|
-
"test": "npm audit --production && npm run unit",
|
|
9
|
-
"unit": "jest"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@corva/node-sdk": "^6.2.0"
|
|
13
|
-
},
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
"jest": "^27.5.1"
|
|
16
|
-
}
|
|
17
|
-
}
|