datagrok-tools 4.14.52 → 4.14.54
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/bin/commands/help.js
CHANGED
|
@@ -110,11 +110,13 @@ Uploads a package
|
|
|
110
110
|
Checks for errors before publishing — the package won't be published if there are any.
|
|
111
111
|
|
|
112
112
|
Options:
|
|
113
|
-
[--
|
|
113
|
+
[--all] [--refresh] [--link] [--build] [--release] [--skip-check]
|
|
114
114
|
|
|
115
|
-
--all Publish all available packages
|
|
116
|
-
--refresh Publish all available already loaded packages
|
|
117
|
-
--link Link the package to local
|
|
115
|
+
--all Publish all available packages(run in packages directory)
|
|
116
|
+
--refresh Publish all available already loaded packages(run in packages directory)
|
|
117
|
+
--link Link the package to local packages
|
|
118
|
+
--build Builds the package
|
|
119
|
+
--release Publish package as release version
|
|
118
120
|
--skip-check Skip check stage
|
|
119
121
|
|
|
120
122
|
Running \`grok publish\` is the same as running \`grok publish defaultHost --build --debug\`
|
|
@@ -134,7 +136,7 @@ const HELP_TEST = `
|
|
|
134
136
|
Usage: grok test
|
|
135
137
|
|
|
136
138
|
Options:
|
|
137
|
-
[--package] [--category] [--test] [--host] [--csv] [--gui] [--skip-build] [--skip-publish] [--link] [--catchUnhandled] [--report] [--record] [--verbose] [--platform] [--benchmark] [--stress-test] --
|
|
139
|
+
[--package] [--category] [--test] [--host] [--csv] [--gui] [--skip-build] [--skip-publish] [--link] [--catchUnhandled] [--report] [--record] [--verbose] [--platform] [--benchmark] [--stress-test] [--debug] [--all]
|
|
138
140
|
|
|
139
141
|
--package Specify a package name to run tests for
|
|
140
142
|
--category Specify a category name to run tests for
|
|
@@ -154,6 +156,7 @@ Options:
|
|
|
154
156
|
--core Runs package & auto tests & core tests (core tests run only from DevTools package)
|
|
155
157
|
--benchmark Runs tests in benchmark mode
|
|
156
158
|
--stress-test Runs shuffled stress-test only
|
|
159
|
+
--all Runs tests for all available packages(run in packages directory)
|
|
157
160
|
|
|
158
161
|
Run package tests
|
|
159
162
|
|
|
@@ -204,6 +207,7 @@ Options:
|
|
|
204
207
|
--repo-only Links packages only from the current repository
|
|
205
208
|
--unlink Unlinks packages and sets last versions instead of local path in package.json dependencies
|
|
206
209
|
--verbose Prints detailed information about linked packages
|
|
210
|
+
--all Links all available packages(run in packages directory)
|
|
207
211
|
`;
|
|
208
212
|
|
|
209
213
|
// const HELP_MIGRATE = `
|
package/bin/commands/publish.js
CHANGED
|
@@ -195,10 +195,8 @@ async function processPackage(debug, rebuild, host, devKey, packageName, suffix)
|
|
|
195
195
|
console.error(log['innerMessage']);
|
|
196
196
|
console.log(log);
|
|
197
197
|
return 1;
|
|
198
|
-
} else
|
|
199
|
-
|
|
200
|
-
// color.warn(contentValidationLog);
|
|
201
|
-
}
|
|
198
|
+
} else console.log(log);
|
|
199
|
+
// color.warn(contentValidationLog);
|
|
202
200
|
} catch (error) {
|
|
203
201
|
console.error(error);
|
|
204
202
|
return 1;
|
|
@@ -206,8 +204,7 @@ async function processPackage(debug, rebuild, host, devKey, packageName, suffix)
|
|
|
206
204
|
return 0;
|
|
207
205
|
}
|
|
208
206
|
async function publish(args) {
|
|
209
|
-
|
|
210
|
-
if (!args['skip-check'] && !args['all']) (0, _check.check)({
|
|
207
|
+
if (!args['skip-check'] && !args['all'] && !args['refresh']) (0, _check.check)({
|
|
211
208
|
_: ['check']
|
|
212
209
|
});
|
|
213
210
|
config = _jsYaml.default.load(_fs.default.readFileSync(confPath, {
|
|
@@ -218,7 +215,7 @@ async function publish(args) {
|
|
|
218
215
|
let host = config.default;
|
|
219
216
|
if (args['_'].length === 2) host = args['_'][1];
|
|
220
217
|
utils.setHost(host, config);
|
|
221
|
-
|
|
218
|
+
const baseUrl = config['servers'][host]['url'];
|
|
222
219
|
let url = process.env.HOST ?? '';
|
|
223
220
|
const cfg = (0, _testUtils.getDevKey)(url);
|
|
224
221
|
url = cfg.url;
|
|
@@ -226,16 +223,19 @@ async function publish(args) {
|
|
|
226
223
|
const token = await (0, _testUtils.getToken)(url, key);
|
|
227
224
|
url = `${baseUrl}/packages/published/current`;
|
|
228
225
|
let packagesToLoad = ['all'];
|
|
229
|
-
if (args.refresh)
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
226
|
+
if (args.refresh) {
|
|
227
|
+
packagesToLoad = (await (await (0, _nodeFetch.default)(url, {
|
|
228
|
+
method: 'GET',
|
|
229
|
+
headers: {
|
|
230
|
+
'Authorization': token // Attach cookies here
|
|
231
|
+
}
|
|
232
|
+
})).json()).map(item => item.name);
|
|
233
|
+
}
|
|
235
234
|
console.log('Loading packages:');
|
|
236
235
|
await (0, _testUtils.loadPackages)(curDir, packagesToLoad.join(' '), host, false, false, args.link, args.release);
|
|
237
236
|
} else {
|
|
238
237
|
if (args.link) {
|
|
238
|
+
console.log('Linking');
|
|
239
239
|
await utils.runScript(`npm install`, curDir);
|
|
240
240
|
await utils.runScript(`grok link`, curDir);
|
|
241
241
|
await utils.runScript(`npm run build`, curDir);
|
|
@@ -244,21 +244,19 @@ async function publish(args) {
|
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
async function publishPackage(args) {
|
|
247
|
-
const nOptions = Object.keys(args).length - 1;
|
|
248
247
|
const nArgs = args['_'].length;
|
|
249
|
-
if (
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
return false;
|
|
248
|
+
if (!args.link) {
|
|
249
|
+
if (args.build || args.rebuild) {
|
|
250
|
+
console.log('Building');
|
|
251
|
+
utils.runScript('npm install', curDir, false);
|
|
252
|
+
utils.runScript('npm run build', curDir, false);
|
|
253
|
+
}
|
|
256
254
|
}
|
|
257
255
|
if (args.debug && args.release) {
|
|
258
256
|
color.error('Incompatible options: --debug and --release');
|
|
259
257
|
return false;
|
|
260
258
|
}
|
|
261
|
-
|
|
259
|
+
console.log('Publishing');
|
|
262
260
|
// Create `config.yaml` if it doesn't exist yet
|
|
263
261
|
if (!_fs.default.existsSync(grokDir)) _fs.default.mkdirSync(grokDir);
|
|
264
262
|
if (!_fs.default.existsSync(confPath)) _fs.default.writeFileSync(confPath, _jsYaml.default.dump(confTemplate));
|
|
@@ -143,7 +143,7 @@ function getFuncAnnotation(data, comment = '//', sep = '\n') {
|
|
|
143
143
|
isArray = true;
|
|
144
144
|
}
|
|
145
145
|
const annotationType = typesToAnnotation[type ?? ''];
|
|
146
|
-
if (input?.options?.type) type = input?.options?.type;else if (annotationType) {
|
|
146
|
+
if (input?.options?.type || input?.options?.options?.type) type = input?.options?.type ?? input?.options?.options?.type;else if (annotationType) {
|
|
147
147
|
if (isArray) type = `list<${annotationType}>`;else type = annotationType;
|
|
148
148
|
} else type = 'dynamic';
|
|
149
149
|
const options = input?.options?.options ? buildStringOfOptions(input.options ?? {}) : '';
|
|
@@ -184,13 +184,15 @@ function getFuncAnnotation(data, comment = '//', sep = '\n') {
|
|
|
184
184
|
return s;
|
|
185
185
|
}
|
|
186
186
|
const inputOptionsNames = exports.inputOptionsNames = ['semType', 'category', 'optional', 'editor', 'nullable', 'separators', 'choices', 'format', 'min', 'max', 'caption', 'description', 'initialValue', 'viewer', 'units', 'type', 'optionsType', 'step', 'meta.url', 'metaUrl'];
|
|
187
|
+
const nonquotedValues = ['true', 'false'];
|
|
187
188
|
function buildStringOfOptions(input) {
|
|
188
189
|
const optionsInString = [];
|
|
189
190
|
const opt = input.options ?? {};
|
|
190
191
|
let defaultValue = '';
|
|
192
|
+
if (opt['initialValue'] && /[A-Za-z]/.test(opt['initialValue']) && !opt['initialValue'].includes('\'') && !opt['initialValue'].includes('"') && !nonquotedValues.includes(opt['initialValue'])) opt['initialValue'] = `'${opt['initialValue']}'`;
|
|
191
193
|
if (opt['initialValue']) defaultValue = `= ${opt['initialValue']}`;
|
|
192
194
|
for (const [key, value] of Object.entries(opt)) {
|
|
193
|
-
if (key === 'initialValue') continue;
|
|
195
|
+
if (key === 'initialValue' || key === 'name' || key === 'type' && !input?.options?.key) continue;
|
|
194
196
|
let val = value;
|
|
195
197
|
let option = key;
|
|
196
198
|
option = decoratorOptionToAnnotation.get(option) ?? option;
|
|
@@ -198,7 +200,7 @@ function buildStringOfOptions(input) {
|
|
|
198
200
|
optionsInString.push(`${option}: ${val}`);
|
|
199
201
|
}
|
|
200
202
|
const optString = optionsInString.length > 0 ? `{ ${optionsInString.join('; ')} }` : '';
|
|
201
|
-
return `${defaultValue} ${optString}`;
|
|
203
|
+
return defaultValue ? `${defaultValue} ${optString}` : `${optString}`;
|
|
202
204
|
}
|
|
203
205
|
const reservedDecorators = exports.reservedDecorators = {
|
|
204
206
|
viewer: {
|
package/bin/utils/utils.js
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
"datagrok-api": "^1.26.0",
|
|
8
8
|
"cash-dom": "^8.1.5",
|
|
9
9
|
"dayjs": "^1.11.13",
|
|
10
|
-
"@datagrok-libraries/utils": "^4.6.
|
|
10
|
+
"@datagrok-libraries/utils": "^4.6.5"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"datagrok-tools": "^4.14.
|
|
13
|
+
"datagrok-tools": "^4.14.53",
|
|
14
14
|
"webpack": "^5.95.0",
|
|
15
15
|
"webpack-cli": "^5.1.4"
|
|
16
16
|
},
|
package/package.json
CHANGED