@corva/create-app 0.33.0-1 → 0.33.0-rc.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 CHANGED
@@ -42,27 +42,28 @@ Arguments:
42
42
  project-directory project directory to work with (default: "Current working dir")
43
43
 
44
44
  Options:
45
- --developerName [string] Enter the Developer Name (default: "O&G Company")
46
- --developerIdentifier [string] Enter the Developer Identifier (default: "oandgc")
45
+ --appKey [string] Enter the App Key (default: "app.key-goes-here")
46
+ --appName [string] Enter the App Name
47
47
  --appType [string] Choose the App Type (choices: "ui", "scheduler", "stream", "task", default: "ui")
48
- --schedulerType [number] Choose the scheduler type (choices: "1", "2", "4", default: 1)
48
+ --bump-version <string> DEPRECATED Use with zip or release command instead (choices: "major", "minor", "patch", "skip")
49
+ --category [string] Enter category (default: "")
49
50
  --cronString [string] Provide CRON string for the scheduler (default: "*/5 * * * *")
50
51
  --depthMilestone [number] Provide depth milestone for the scheduler (default: 1)
51
- --appKey [string] Enter the App Key (default: "app.key-goes-here")
52
- --appName [string] Enter the App Name
53
52
  --description [string] Enter description (default: "This is the description of my app. You can do great things with it!")
53
+ --developerIdentifier [string] Enter the Developer Identifier (default: "oandgc")
54
+ --developerName [string] Enter the Developer Name (default: "O&G Company")
55
+ --ignored-files File patters to skip zip
56
+ --release DEPRECATED Use release command instead
57
+ --runtime [string] Choose runtime (choices: "ui", "nodejs12.x", "nodejs14.x", "python3.8")
58
+ --schedulerType [number] Choose the scheduler type (choices: "1", "2", "4", default: 1)
59
+ --segments [string] Choose segments (choices: "drilling", "completion")
54
60
  --summary [string] Enter summary (default: "More information about this app goes here")
55
- --category [string] Enter category (default: "")
56
61
  --website [string] Enter website (default: "https://www.oandgexample.com/my-app/")
57
- --segments [string] Choose segments (choices: "drilling", "completion")
58
- --runtime [string] Choose runtime (choices: "ui", "nodejs12.x", "nodejs14.x", "python3.8")
62
+ -V, --version output the version number
63
+ -h, --help display help for command
59
64
  -p, --packageManager [string] Please select the desired package manager (choices: "yarn", "npm", default: "yarn")
60
65
  -t, --useTypescript [boolean] Would you like to use TypesScript? (default: false)
61
- -V, --version output the version number
62
66
  -z, --zip [string] DEPRECATED Use zip command instead
63
- --release DEPRECATED Use release command instead
64
- --bump-version <string> DEPRECATED Use with zip or release command instead (choices: "major", "minor", "patch", "skip")
65
- -h, --help display help for command
66
67
  ```
67
68
 
68
69
  ### Examples
@@ -134,6 +135,7 @@ For apps that written in `python`:
134
135
  - all `*.py` files
135
136
 
136
137
  If you want to zip some files that are not included pass that as `patterns` arguments.
138
+ To skip some files from zipping please use `--ignored-files` option.
137
139
 
138
140
  ### Examples
139
141
 
@@ -15,11 +15,11 @@ const uiDependencies = {
15
15
  'prop-types': '^15.6.1',
16
16
  'react': '17.0.1',
17
17
  'react-dom': '17.0.1',
18
- }
18
+ };
19
19
 
20
20
  const jsUiDevDependencies = {
21
21
  'postcss-loader': '4.1.0',
22
- }
22
+ };
23
23
 
24
24
  const tsUiDevDependencies = {
25
25
  ...jsUiDevDependencies,
@@ -30,7 +30,7 @@ const tsUiDevDependencies = {
30
30
  '@typescript-eslint/eslint-plugin': '^4.31.2',
31
31
  '@typescript-eslint/parser': '^4.31.2',
32
32
  'ts-loader': '8.2.0',
33
- 'typescript': '^4.4.3',
33
+ 'typescript': '4.6.3',
34
34
  };
35
35
 
36
36
  const uiScripts = {
@@ -46,49 +46,49 @@ const uiPackage = {
46
46
  main: 'src/index.js',
47
47
  scripts: uiScripts,
48
48
  dependencies: uiDependencies,
49
- devDependencies: jsUiDevDependencies
50
- }
49
+ devDependencies: jsUiDevDependencies,
50
+ };
51
51
 
52
52
  const tsUiPackage = {
53
53
  ...uiPackage,
54
- devDependencies: tsUiDevDependencies
55
- }
54
+ devDependencies: tsUiDevDependencies,
55
+ };
56
56
 
57
57
  const nodeNpmScripts = {
58
- "bundle": "create-corva-app zip .",
59
- "test": "npm audit --production && npm run unit",
60
- "unit": "jest --passWithNoTests"
58
+ bundle: 'create-corva-app zip .',
59
+ test: 'npm audit --production && npm run unit',
60
+ unit: 'jest --passWithNoTests',
61
61
  };
62
62
 
63
63
  const nodeDependencies = {
64
- "@corva/node-sdk": "^6.2.0"
65
- }
64
+ '@corva/node-sdk': '^6.2.0',
65
+ };
66
66
 
67
67
  const nodeDevDependencies = {
68
- "jest": "^27.5.1"
69
- }
68
+ jest: '^27.5.1',
69
+ };
70
70
 
71
71
  const nodeTsDevDependencies = {
72
- "@types/jest": "^27.4.1",
73
- "jest": "^27.5.1",
74
- "ts-jest": "^27.1.4",
75
- "typescript": "^4.6.3"
76
- }
72
+ '@types/jest': '^27.4.1',
73
+ 'jest': '^27.5.1',
74
+ 'ts-jest': '^27.1.4',
75
+ 'typescript': '^4.6.3',
76
+ };
77
77
 
78
78
  const nodeYarnScripts = {
79
79
  ...nodeNpmScripts,
80
- "test": "yarn audit --groups dependencies && yarn unit",
81
- }
80
+ test: 'yarn audit --groups dependencies && yarn unit',
81
+ };
82
82
 
83
83
  const nodeTsScripts = {
84
84
  ...nodeNpmScripts,
85
- "build": "tsc -p tsconfig.build.json",
86
- }
85
+ build: 'tsc -p tsconfig.build.json',
86
+ };
87
87
 
88
88
  const nodeTsYarnScripts = {
89
89
  ...nodeYarnScripts,
90
- "build": "tsc -p tsconfig.build.json",
91
- }
90
+ build: 'tsc -p tsconfig.build.json',
91
+ };
92
92
 
93
93
  const nodeNpmPackage = {
94
94
  version: '0.0.1',
@@ -96,24 +96,24 @@ const nodeNpmPackage = {
96
96
  private: true,
97
97
  dependencies: nodeDependencies,
98
98
  devDependencies: nodeDevDependencies,
99
- scripts: nodeNpmScripts
100
- }
99
+ scripts: nodeNpmScripts,
100
+ };
101
101
 
102
102
  const nodeYarnPackage = {
103
103
  ...nodeNpmPackage,
104
- scripts: nodeYarnScripts
105
- }
104
+ scripts: nodeYarnScripts,
105
+ };
106
106
 
107
107
  const nodeTsNpmPackage = {
108
108
  ...nodeNpmPackage,
109
109
  devDependencies: nodeTsDevDependencies,
110
- scripts: nodeTsScripts
111
- }
110
+ scripts: nodeTsScripts,
111
+ };
112
112
 
113
113
  const nodeTsYarnPackage = {
114
114
  ...nodeTsNpmPackage,
115
- scripts: nodeTsYarnScripts
116
- }
115
+ scripts: nodeTsYarnScripts,
116
+ };
117
117
 
118
118
  const extendWithTsConfig = (package, version) => {
119
119
  package.devDependencies = {
@@ -122,7 +122,7 @@ const extendWithTsConfig = (package, version) => {
122
122
  };
123
123
 
124
124
  return package;
125
- }
125
+ };
126
126
 
127
127
  const defaults = {
128
128
  javascript: {
@@ -130,13 +130,13 @@ const defaults = {
130
130
  ui: () => uiPackage,
131
131
  task: () => nodeYarnPackage,
132
132
  scheduler: () => nodeYarnPackage,
133
- stream: () => nodeYarnPackage
133
+ stream: () => nodeYarnPackage,
134
134
  },
135
135
  npm: {
136
136
  ui: () => uiPackage,
137
137
  task: () => nodeNpmPackage,
138
138
  scheduler: () => nodeNpmPackage,
139
- stream: () => nodeNpmPackage
139
+ stream: () => nodeNpmPackage,
140
140
  },
141
141
  },
142
142
  typescript: {
@@ -144,19 +144,19 @@ const defaults = {
144
144
  ui: () => tsUiPackage,
145
145
  task: ({ version }) => extendWithTsConfig(nodeTsYarnPackage, version),
146
146
  scheduler: ({ version }) => extendWithTsConfig(nodeTsYarnPackage, version),
147
- stream: ({ version }) => extendWithTsConfig(nodeTsYarnPackage, version)
147
+ stream: ({ version }) => extendWithTsConfig(nodeTsYarnPackage, version),
148
148
  },
149
149
  npm: {
150
150
  ui: () => tsUiPackage,
151
151
  task: ({ version }) => extendWithTsConfig(nodeTsNpmPackage, version),
152
152
  scheduler: ({ version }) => extendWithTsConfig(nodeTsNpmPackage, version),
153
- stream: ({ version }) => extendWithTsConfig(nodeTsNpmPackage, version)
154
- }
155
- }
153
+ stream: ({ version }) => extendWithTsConfig(nodeTsNpmPackage, version),
154
+ },
155
+ },
156
156
  };
157
157
 
158
158
  module.exports = {
159
159
  getDefaultsForPackageJson: (manifest, runtime) => {
160
160
  return defaults[runtime.language][runtime.packageManager][manifest.type](runtime);
161
- }
162
- }
161
+ },
162
+ };
@@ -17,8 +17,8 @@ const uniqueValues = (array) => Array.from(new Set(array));
17
17
  const FILE_LIST_RESOLVE_STEP = {
18
18
  message: 'Resolving files list...',
19
19
  fn: async (context) => {
20
- const { patterns, manifest, dirName } = context;
21
- const files = await transformPatternsIntoFileNames(dirName, patterns);
20
+ const { patterns, manifest, dirName, options } = context;
21
+ const files = await transformPatternsIntoFileNames(dirName, patterns, options.ignoredFiles);
22
22
 
23
23
  if (manifest.isUi()) {
24
24
  return resolveDataToZipUiApp(files, context);
@@ -36,7 +36,7 @@ const FILE_LIST_RESOLVE_STEP = {
36
36
  },
37
37
  };
38
38
 
39
- const transformPatternsIntoFileNames = async (dirName, patterns) => {
39
+ const transformPatternsIntoFileNames = async (dirName, patterns, ignoredFiles = []) => {
40
40
  const filesFromPatterns = [];
41
41
 
42
42
  for (const pattern of patterns) {
@@ -52,7 +52,10 @@ const transformPatternsIntoFileNames = async (dirName, patterns) => {
52
52
  continue;
53
53
  }
54
54
 
55
- const files = await glob(pattern, { cwd: dirName, ignore: '**/node_modules' });
55
+ const files = await glob(pattern, {
56
+ cwd: dirName,
57
+ ignore: ['**/node_modules', ...ignoredFiles],
58
+ });
56
59
 
57
60
  filesFromPatterns.push(...files);
58
61
  }
@@ -99,7 +102,7 @@ const resolveDataToZipUiApp = async (itemsToZip = [], { options, pkg, dirName })
99
102
  '.nvmrc',
100
103
  'yarn.lock',
101
104
  { path: resolve(dirName, 'packageForSource.json'), name: 'package.json' },
102
- 'src'
105
+ ...(await transformPatternsIntoFileNames(dirName, ['src/**/*'], options.ignoredFiles))
103
106
  );
104
107
 
105
108
  return {
@@ -152,10 +155,16 @@ const resolveDataForZipNodeJsApp = async (itemsToZip = [], { options, pkg, dirNa
152
155
  itemsToZip.push('tsconfig.json', 'tsconfig.build.json');
153
156
 
154
157
  if (shouldPushDefaultSrc) {
155
- itemsToZip.push('index.ts', ...(await glob('+(src|lib)/**/*.ts', { cwd: dirName })));
158
+ itemsToZip.push(
159
+ 'index.ts',
160
+ ...(await glob('+(src|lib)/**/*.ts', { cwd: dirName, ignore: options.ignoredFiles }))
161
+ );
156
162
  }
157
163
  } else if (shouldPushDefaultSrc) {
158
- itemsToZip.push('index.js', ...(await glob('+(src|lib)/**/*.js', { cwd: dirName })));
164
+ itemsToZip.push(
165
+ 'index.js',
166
+ ...(await glob('+(src|lib)/**/*.js', { cwd: dirName, ignore: options.ignoredFiles }))
167
+ );
159
168
  }
160
169
 
161
170
  return {
@@ -166,11 +175,11 @@ const resolveDataForZipNodeJsApp = async (itemsToZip = [], { options, pkg, dirNa
166
175
  };
167
176
  };
168
177
 
169
- const resolveDataForZipPythonApp = async (itemsToZip = [], { manifest, dirName }) => {
178
+ const resolveDataForZipPythonApp = async (itemsToZip = [], { manifest, dirName, options }) => {
170
179
  const zipFileName = `${manifest.manifest.application.name}.zip`;
171
180
 
172
181
  if (!itemsToZip.length) {
173
- itemsToZip.push(...(await glob('**/*.py', { cwd: dirName })));
182
+ itemsToZip.push(...(await glob('**/*.py', { cwd: dirName, ignore: options.ignoredFiles })));
174
183
  }
175
184
 
176
185
  itemsToZip.push('manifest.json', 'requirements.txt');
package/lib/index.js CHANGED
@@ -178,6 +178,7 @@ async function initialChecks() {
178
178
  .argument('<project-directory>', 'Project directory to work with')
179
179
  .argument('[patterns...]', 'Additional patterns to zip', [])
180
180
  .addOption(bumpVersionOption)
181
+ .addOption(new Option('--ignored-files [ignoredFiles...]', 'Patterns to skip zip', []))
181
182
  .action(async (dirName, patterns, options) => {
182
183
  options.bumpVersion = await ensureBumpVersion(options.bumpVersion);
183
184
 
@@ -190,6 +191,7 @@ async function initialChecks() {
190
191
  .argument('<project-directory>', 'Project directory to work with')
191
192
  .argument('[patterns...]', 'Additional patterns to zip', [])
192
193
  .addOption(bumpVersionOption)
194
+ .addOption(new Option('--ignored-files [ignoredFiles...]', 'Patterns to skip zip', []))
193
195
  .action(async (dirName, patterns, options) => {
194
196
  options.bumpVersion = await ensureBumpVersion(options.bumpVersion);
195
197
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/create-app",
3
- "version": "0.33.0-1",
3
+ "version": "0.33.0-rc.1",
4
4
  "private": false,
5
5
  "description": "Create app to use it in CORVA.AI",
6
6
  "keywords": [