@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.
Files changed (97) hide show
  1. package/lib/constants/manifest.js +1 -1
  2. package/lib/constants/package.js +150 -39
  3. package/lib/flows/lib/manifest.js +17 -1
  4. package/lib/helpers/resolve-app-runtime.js +29 -0
  5. package/lib/helpers/utils.js +17 -17
  6. package/lib/index.js +145 -142
  7. package/package.json +1 -1
  8. package/templates/{scheduler/node → javascript/scheduler}/README.md +0 -0
  9. package/templates/{scheduler/node → javascript/scheduler}/__test__/processor.test.js +0 -0
  10. package/templates/{scheduler/node → javascript/scheduler}/index.js +0 -0
  11. package/templates/{scheduler/node → javascript/scheduler}/src/processor.js +0 -0
  12. package/templates/{stream/node → javascript/stream}/README.md +0 -0
  13. package/templates/{stream/node → javascript/stream}/__test__/processor.test.js +0 -0
  14. package/templates/{stream/node → javascript/stream}/index.js +0 -0
  15. package/templates/{stream/node → javascript/stream}/src/processor.js +0 -0
  16. package/templates/{task/node → javascript/task}/README.md +0 -0
  17. package/templates/{task/node → javascript/task}/__test__/processor.test.js +0 -0
  18. package/templates/{task/node → javascript/task}/index.js +0 -0
  19. package/templates/{task/node → javascript/task}/src/processor.js +0 -0
  20. package/templates/{ui/js → javascript/ui}/.env +0 -0
  21. package/templates/{ui/js → javascript/ui}/.env.sample +0 -0
  22. package/templates/{ui/js → javascript/ui}/.eslintrc +0 -0
  23. package/templates/{ui/js → javascript/ui}/.prettierrc +0 -0
  24. package/templates/{ui/js → javascript/ui}/README.md +0 -0
  25. package/templates/{ui/js → javascript/ui}/config-overrides.js +0 -0
  26. package/templates/{ui/js → javascript/ui}/gitignore +0 -0
  27. package/templates/{ui/js → javascript/ui}/src/App.css +0 -0
  28. package/templates/{ui/js → javascript/ui}/src/App.js +0 -0
  29. package/templates/{ui/js → javascript/ui}/src/AppSettings.js +0 -0
  30. package/templates/{ui/js → javascript/ui}/src/assets/logo.svg +0 -0
  31. package/templates/{ui/js → javascript/ui}/src/constants.js +0 -0
  32. package/templates/{ui/js → javascript/ui}/src/index.js +0 -0
  33. package/templates/{scheduler/python → python/scheduler}/README.md +0 -0
  34. package/templates/{scheduler/python → python/scheduler}/lambda_function.py +0 -0
  35. package/templates/{scheduler/python → python/scheduler}/test/__init__.py +0 -0
  36. package/templates/{scheduler/python → python/scheduler}/test/app_test.py +0 -0
  37. package/templates/{stream/python → python/stream}/README.md +0 -0
  38. package/templates/{stream/python → python/stream}/lambda_function.py +0 -0
  39. package/templates/{stream/python → python/stream}/test/__init__.py +0 -0
  40. package/templates/{stream/python → python/stream}/test/app_test.py +0 -0
  41. package/templates/{task/python → python/task}/README.md +0 -0
  42. package/templates/{task/python → python/task}/lambda_function.py +0 -0
  43. package/templates/{task/python → python/task}/test/__init__.py +0 -0
  44. package/templates/{task/python → python/task}/test/app_test.py +0 -0
  45. package/templates/{scheduler/node-ts → typescript/scheduler}/README.md +0 -0
  46. package/templates/{scheduler/node-ts → typescript/scheduler}/__test__/processor.spec.ts +0 -0
  47. package/templates/{scheduler/node-ts → typescript/scheduler}/index.ts +0 -0
  48. package/templates/{scheduler/node-ts → typescript/scheduler}/lib/processor.ts +0 -0
  49. package/templates/{stream/node-ts → typescript/stream}/README.md +0 -0
  50. package/templates/{stream/node-ts → typescript/stream}/__test__/processor.spec.ts +0 -0
  51. package/templates/{stream/node-ts → typescript/stream}/index.ts +0 -0
  52. package/templates/{stream/node-ts → typescript/stream}/lib/processor.ts +0 -0
  53. package/templates/{task/node-ts → typescript/task}/README.md +0 -0
  54. package/templates/{task/node-ts → typescript/task}/__test__/processor.spec.ts +0 -0
  55. package/templates/{task/node-ts → typescript/task}/index.ts +0 -0
  56. package/templates/{task/node-ts → typescript/task}/src/processor.ts +0 -0
  57. package/templates/{ui/ts → typescript/ui}/.env +0 -0
  58. package/templates/{ui/ts → typescript/ui}/.env.sample +0 -0
  59. package/templates/{ui/ts → typescript/ui}/.eslintrc +0 -0
  60. package/templates/{ui/ts → typescript/ui}/.prettierrc +0 -0
  61. package/templates/{ui/ts → typescript/ui}/README.md +0 -0
  62. package/templates/{ui/ts → typescript/ui}/config-overrides.js +0 -0
  63. package/templates/{ui/ts → typescript/ui}/gitignore +0 -0
  64. package/templates/{ui/ts → typescript/ui}/src/App.css +0 -0
  65. package/templates/{ui/ts → typescript/ui}/src/App.tsx +0 -0
  66. package/templates/{ui/ts → typescript/ui}/src/AppSettings.tsx +0 -0
  67. package/templates/{ui/ts → typescript/ui}/src/assets/logo.svg +0 -0
  68. package/templates/{ui/ts → typescript/ui}/src/constants.ts +0 -0
  69. package/templates/{ui/ts → typescript/ui}/src/custom.d.ts +0 -0
  70. package/templates/{ui/ts → typescript/ui}/src/index.js +0 -0
  71. package/templates/{ui/ts → typescript/ui}/tsconfig.json +0 -0
  72. package/templates/scheduler/node/gitignore +0 -21
  73. package/templates/scheduler/node/package.json +0 -17
  74. package/templates/scheduler/node-ts/gitignore +0 -25
  75. package/templates/scheduler/node-ts/lib/processor.js +0 -16
  76. package/templates/scheduler/node-ts/lib/processor.js.map +0 -1
  77. package/templates/scheduler/node-ts/package.json +0 -37
  78. package/templates/scheduler/node-ts/tsconfig.build.json +0 -11
  79. package/templates/scheduler/node-ts/tsconfig.json +0 -34
  80. package/templates/scheduler/python/Makefile +0 -15
  81. package/templates/scheduler/python/requirements.txt +0 -2
  82. package/templates/stream/node/gitignore +0 -21
  83. package/templates/stream/node/package.json +0 -17
  84. package/templates/stream/node-ts/gitignore +0 -25
  85. package/templates/stream/node-ts/package.json +0 -37
  86. package/templates/stream/node-ts/tsconfig.build.json +0 -11
  87. package/templates/stream/node-ts/tsconfig.json +0 -34
  88. package/templates/stream/python/Makefile +0 -15
  89. package/templates/stream/python/requirements.txt +0 -2
  90. package/templates/task/node/gitignore +0 -21
  91. package/templates/task/node/package.json +0 -17
  92. package/templates/task/node-ts/gitignore +0 -25
  93. package/templates/task/node-ts/package.json +0 -37
  94. package/templates/task/node-ts/tsconfig.build.json +0 -11
  95. package/templates/task/node-ts/tsconfig.json +0 -34
  96. package/templates/task/python/Makefile +0 -15
  97. package/templates/task/python/requirements.txt +0 -2
@@ -103,7 +103,7 @@ const SCHEDULER_TYPE_NATURAL_TIME = { name: 'Natural Time', value: 1 };
103
103
  const SCHEDULER_TYPE_DATA_TIME = { name: 'Data Time', value: 2 };
104
104
  const SCHEDULER_TYPE_DEPTH = { name: 'Date Depth', value: 4 };
105
105
 
106
- const manifestOptions = (projectName) => [
106
+ const manifestOptions = (projectName = 'Corva Dev Center App') => [
107
107
  { name: 'developerName', message: 'Enter the Developer Name', default: 'O&G Company' },
108
108
  { name: 'developerIdentifier', message: 'Enter the Developer Identifier', default: 'oandgc' },
109
109
  {
@@ -1,41 +1,38 @@
1
- const dependencies = {
2
- devDependencies: {
3
- 'postcss-loader': '4.1.0',
4
- },
5
- dependencies: {
6
- '@corva/ui': 'latest',
7
- '@material-ui/core': '4.11.2',
8
- '@material-ui/icons': '4.9.1',
9
- '@material-ui/lab': '4.0.0-alpha.57',
10
- '@material-ui/pickers': '3.2.10',
11
- 'classnames': '2.2.6',
12
- 'corva-convert-units': '1.10.17',
13
- 'highcharts': '8.1.2',
14
- 'highcharts-react-official': '2.2.2',
15
- 'lodash': '^4.17.4',
16
- 'mapbox.js': '3.2.1',
17
- 'moment': '2.23.0',
18
- 'moment-timezone': '0.5.23',
19
- 'prop-types': '^15.6.1',
20
- 'react': '17.0.1',
21
- 'react-dom': '17.0.1',
22
- },
23
- };
1
+ const uiDependencies = {
2
+ '@corva/ui': 'latest',
3
+ '@material-ui/core': '4.11.2',
4
+ '@material-ui/icons': '4.9.1',
5
+ '@material-ui/lab': '4.0.0-alpha.57',
6
+ '@material-ui/pickers': '3.2.10',
7
+ 'classnames': '2.2.6',
8
+ 'corva-convert-units': '1.10.17',
9
+ 'highcharts': '8.1.2',
10
+ 'highcharts-react-official': '2.2.2',
11
+ 'lodash': '^4.17.4',
12
+ 'mapbox.js': '3.2.1',
13
+ 'moment': '2.23.0',
14
+ 'moment-timezone': '0.5.23',
15
+ 'prop-types': '^15.6.1',
16
+ 'react': '17.0.1',
17
+ 'react-dom': '17.0.1',
18
+ }
24
19
 
25
- const tsDependencies = {
26
- devDependencies: {
27
- '@tsconfig/create-react-app': '1.0.2',
28
- '@types/material-ui': '0.21.9',
29
- '@types/react': '^17.0.22',
30
- '@types/react-dom': '^17.0.9',
31
- '@typescript-eslint/eslint-plugin': '^4.31.2',
32
- '@typescript-eslint/parser': '^4.31.2',
33
- 'ts-loader': '8.2.0',
34
- 'typescript': '^4.4.3',
35
- },
20
+ const jsUiDevDependencies = {
21
+ 'postcss-loader': '4.1.0',
22
+ }
23
+
24
+ const tsUiDevDependencies = {
25
+ '@tsconfig/create-react-app': '1.0.2',
26
+ '@types/material-ui': '0.21.9',
27
+ '@types/react': '^17.0.22',
28
+ '@types/react-dom': '^17.0.9',
29
+ '@typescript-eslint/eslint-plugin': '^4.31.2',
30
+ '@typescript-eslint/parser': '^4.31.2',
31
+ 'ts-loader': '8.2.0',
32
+ 'typescript': '^4.4.3',
36
33
  };
37
34
 
38
- const scripts = {
35
+ const uiScripts = {
39
36
  build: 'webpack --config=./config-overrides.js --mode production',
40
37
  start: 'webpack-dev-server --config=./config-overrides.js --open --mode development',
41
38
  zip: 'create-corva-app zip .',
@@ -43,8 +40,122 @@ const scripts = {
43
40
  release: 'create-corva-app release .',
44
41
  };
45
42
 
46
- module.exports = {
47
- tsDependencies,
48
- dependencies,
49
- scripts,
43
+ const uiPackage = {
44
+ version: '0.0.1',
45
+ main: 'src/index.js',
46
+ scripts: uiScripts,
47
+ dependencies: uiDependencies,
48
+ devDependencies: jsUiDevDependencies
49
+ }
50
+
51
+ const tsUiPackage = {
52
+ ...uiPackage,
53
+ devDependencies: tsUiDevDependencies
54
+ }
55
+
56
+ const nodeNpmScripts = {
57
+ "bundle": "create-corva-app zip .",
58
+ "test": "npm audit --production && npm run unit",
59
+ "unit": "jest --passWithNoTests"
50
60
  };
61
+
62
+ const nodeDependencies = {
63
+ "@corva/node-sdk": "^6.2.0"
64
+ }
65
+
66
+ const nodeDevDependencies = {
67
+ "jest": "^27.5.1"
68
+ }
69
+
70
+ const nodeTsDevDependencies = {
71
+ "@types/jest": "^27.4.1",
72
+ "jest": "^27.5.1",
73
+ "ts-jest": "^27.1.4",
74
+ "typescript": "^4.6.3"
75
+ }
76
+
77
+ const nodeYarnScripts = {
78
+ ...nodeNpmScripts,
79
+ "test": "yarn audit --groups dependencies && yarn unit",
80
+ }
81
+
82
+ const nodeTsScripts = {
83
+ ...nodeNpmScripts,
84
+ "build": "tsc -p tsconfig.build.json",
85
+ }
86
+
87
+ const nodeTsYarnScripts = {
88
+ ...nodeYarnScripts,
89
+ "build": "tsc -p tsconfig.build.json",
90
+ }
91
+
92
+ const nodeNpmPackage = {
93
+ version: '0.0.1',
94
+ main: 'index.js',
95
+ private: true,
96
+ dependencies: nodeDependencies,
97
+ devDependencies: nodeDevDependencies,
98
+ scripts: nodeNpmScripts
99
+ }
100
+
101
+ const nodeYarnPackage = {
102
+ ...nodeNpmPackage,
103
+ scripts: nodeYarnScripts
104
+ }
105
+
106
+ const nodeTsNpmPackage = {
107
+ ...nodeNpmPackage,
108
+ devDependencies: nodeTsDevDependencies,
109
+ scripts: nodeTsScripts
110
+ }
111
+
112
+ const nodeTsYarnPackage = {
113
+ ...nodeTsNpmPackage,
114
+ scripts: nodeTsYarnScripts
115
+ }
116
+
117
+ const extendWithTsConfig = (package, version) => {
118
+ package.devDependencies = {
119
+ [`@tsconfig/node${version}`]: `^${version === '12' ? '1.0.9' : '1.0.1'}`,
120
+ ...package.devDependencies,
121
+ };
122
+
123
+ return package;
124
+ }
125
+
126
+ const defaults = {
127
+ javascript: {
128
+ yarn: {
129
+ ui: () => uiPackage,
130
+ task: () => nodeYarnPackage,
131
+ scheduler: () => nodeYarnPackage,
132
+ stream: () => nodeYarnPackage
133
+ },
134
+ npm: {
135
+ ui: () => uiPackage,
136
+ task: () => nodeNpmPackage,
137
+ scheduler: () => nodeNpmPackage,
138
+ stream: () => nodeNpmPackage
139
+ },
140
+ },
141
+ typescript: {
142
+ yarn: {
143
+ ui: () => tsUiPackage,
144
+ task: ({ version }) => extendWithTsConfig(nodeTsYarnPackage, version),
145
+ scheduler: ({ version }) => extendWithTsConfig(nodeTsYarnPackage, version),
146
+ stream: ({ version }) => extendWithTsConfig(nodeTsYarnPackage, version)
147
+ },
148
+ npm: {
149
+ ui: () => tsUiPackage,
150
+ task: ({ version }) => extendWithTsConfig(nodeTsNpmPackage, version),
151
+ scheduler: ({ version }) => extendWithTsConfig(nodeTsNpmPackage, version),
152
+ stream: ({ version }) => extendWithTsConfig(nodeTsNpmPackage, version)
153
+ }
154
+ }
155
+ };
156
+
157
+ module.exports = {
158
+ getDefaultsForPackageJson: (manifest, runtime) => {
159
+ return defaults[runtime.language][runtime.packageManager][manifest.type](runtime);
160
+ }
161
+ }
@@ -1,4 +1,4 @@
1
- const { APP_TYPES, APP_RUNTIMES } = require('../../constants/cli');
1
+ const { APP_TYPES, APP_RUNTIMES, TEMPLATE_TYPES } = require('../../constants/cli');
2
2
 
3
3
  const NODE_RUNTIMES = [APP_RUNTIMES.NODE12, APP_RUNTIMES.NODE14];
4
4
 
@@ -11,6 +11,18 @@ class Manifest {
11
11
  return this.manifest.settings.runtime;
12
12
  }
13
13
 
14
+ get type() {
15
+ return this.manifest.application.type
16
+ }
17
+
18
+ get name() {
19
+ return this.manifest.application.name
20
+ }
21
+
22
+ get description() {
23
+ return this.manifest.application.description
24
+ }
25
+
14
26
  isNode() {
15
27
  return NODE_RUNTIMES.includes(this.manifest.settings.runtime);
16
28
  }
@@ -26,6 +38,10 @@ class Manifest {
26
38
  isPython() {
27
39
  return this.manifest.settings.runtime === APP_RUNTIMES.PYTHON3;
28
40
  }
41
+
42
+ isScheduler() {
43
+ return this.manifest.application.type === APP_TYPES.SCHEDULER;
44
+ }
29
45
  }
30
46
 
31
47
  module.exports = { Manifest };
@@ -0,0 +1,29 @@
1
+ const { APP_TYPES } = require("../constants/cli");
2
+
3
+ const resolveAppRuntime = (opts) => {
4
+ if (opts.appType === APP_TYPES.UI) {
5
+ return {
6
+ language: opts.useTypescript ? "typescript" : "javascript",
7
+ packageManager: opts.packageManager,
8
+ version: process.version.replace(/^v/, ""),
9
+ }
10
+ }
11
+
12
+ if (opts.runtime.startsWith('node')) {
13
+ const version = /nodejs(\d{2})\.x/.exec(opts.runtime)[1];
14
+
15
+ return {
16
+ language: opts.useTypescript ? "typescript" : "javascript",
17
+ packageManager: opts.packageManager,
18
+ version
19
+ }
20
+ }
21
+
22
+ return {
23
+ language: "python",
24
+ packageManager: 'pip',
25
+ version: '3.8'
26
+ }
27
+ };
28
+
29
+ module.exports = { resolveAppRuntime };
@@ -13,29 +13,29 @@ function copyFileSync(source, target) {
13
13
  fs.writeFileSync(targetFile, fs.readFileSync(source));
14
14
  }
15
15
 
16
- function copyFolderRecursiveSync(source, target, excludeFolderName) {
17
- let files = [];
18
-
16
+ function copyFolderRecursiveSync(sourceFolder, targetFolder) {
19
17
  //check if folder needs to be created or integrated
20
- let targetFolder;
21
- if (path.basename(source) !== excludeFolderName) {
22
- targetFolder = path.join(target, path.basename(source));
23
- } else targetFolder = target;
24
18
  if (!fs.existsSync(targetFolder)) {
25
19
  fs.mkdirSync(targetFolder);
26
20
  }
27
21
 
22
+ if (!fs.lstatSync(sourceFolder).isDirectory()) {
23
+ return;
24
+ }
25
+
28
26
  //copy
29
- if (fs.lstatSync(source).isDirectory()) {
30
- files = fs.readdirSync(source);
31
- files.forEach(function (file) {
32
- const curSource = path.join(source, file);
33
- if (fs.lstatSync(curSource).isDirectory()) {
34
- copyFolderRecursiveSync(curSource, targetFolder, excludeFolderName);
35
- } else {
36
- copyFileSync(curSource, targetFolder);
37
- }
38
- });
27
+ const items = fs.readdirSync(sourceFolder);
28
+
29
+ for (const item of items) {
30
+ const curSource = path.join(sourceFolder, item);
31
+
32
+ if (fs.lstatSync(curSource).isDirectory()) {
33
+ copyFolderRecursiveSync(curSource, path.join(targetFolder, item));
34
+
35
+ continue;
36
+ }
37
+
38
+ copyFileSync(curSource, targetFolder);
39
39
  }
40
40
  }
41
41