datagrok-tools 4.14.51 → 4.14.53

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.
@@ -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
- console.log(log);
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;
@@ -207,7 +205,7 @@ async function processPackage(debug, rebuild, host, devKey, packageName, suffix)
207
205
  }
208
206
  async function publish(args) {
209
207
  console.log('publish');
210
- if (!args['skip-check'] && !args['all']) (0, _check.check)({
208
+ if (args['skip-check'] && !args['all']) (0, _check.check)({
211
209
  _: ['check']
212
210
  });
213
211
  config = _jsYaml.default.load(_fs.default.readFileSync(confPath, {
@@ -218,7 +216,7 @@ async function publish(args) {
218
216
  let host = config.default;
219
217
  if (args['_'].length === 2) host = args['_'][1];
220
218
  utils.setHost(host, config);
221
- let baseUrl = config['servers'][host]['url'];
219
+ const baseUrl = config['servers'][host]['url'];
222
220
  let url = process.env.HOST ?? '';
223
221
  const cfg = (0, _testUtils.getDevKey)(url);
224
222
  url = cfg.url;
@@ -226,12 +224,14 @@ async function publish(args) {
226
224
  const token = await (0, _testUtils.getToken)(url, key);
227
225
  url = `${baseUrl}/packages/published/current`;
228
226
  let packagesToLoad = ['all'];
229
- if (args.refresh) packagesToLoad = (await (await (0, _nodeFetch.default)(url, {
230
- method: 'GET',
231
- headers: {
232
- 'Authorization': token // Attach cookies here
233
- }
234
- })).json()).map(item => item.name);
227
+ if (args.refresh) {
228
+ packagesToLoad = (await (await (0, _nodeFetch.default)(url, {
229
+ method: 'GET',
230
+ headers: {
231
+ 'Authorization': token // Attach cookies here
232
+ }
233
+ })).json()).map(item => item.name);
234
+ }
235
235
  console.log('Loading packages:');
236
236
  await (0, _testUtils.loadPackages)(curDir, packagesToLoad.join(' '), host, false, false, args.link, args.release);
237
237
  } else {
@@ -244,15 +244,10 @@ 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 (nArgs > 2 || nOptions > 5) return false;
250
- if (!Object.keys(args).slice(1).every(option => ['build', 'rebuild', 'debug', 'release', 'k', 'key', 'suffix'].includes(option))) return false;
251
- if (args.build && args.rebuild) {
248
+ if (args.build || args.rebuild) {
252
249
  utils.runScript('npm install', curDir, false);
253
250
  utils.runScript('npm run build', curDir, false);
254
- color.error('Incompatible options: --build and --rebuild');
255
- return false;
256
251
  }
257
252
  if (args.debug && args.release) {
258
253
  color.error('Incompatible options: --debug and --release');
@@ -150,7 +150,7 @@ function getFuncAnnotation(data, comment = '//', sep = '\n') {
150
150
  const functionName = (input.options?.name ? input?.options?.name : ` ${input.name?.replaceAll('.', '')}`)?.trim();
151
151
 
152
152
  // eslint-disable-next-line max-len
153
- s += comment + 'input: ' + type + ' ' + functionName + (input.defaultValue !== undefined ? `= ${input.defaultValue}` : '') + ' ' + options.replaceAll('"', '\'') + sep;
153
+ s += comment + 'input: ' + type + ' ' + functionName + (input.defaultValue !== undefined ? `= ${input.defaultValue}` : '') + ' ' + options + sep;
154
154
  }
155
155
  if (data.outputs) {
156
156
  for (const output of data.outputs) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.14.51",
3
+ "version": "4.14.53",
4
4
  "description": "Utility to upload and publish packages to Datagrok",
5
5
  "homepage": "https://github.com/datagrok-ai/public/tree/master/tools#readme",
6
6
  "dependencies": {
@@ -12,6 +12,7 @@ const {
12
12
  typesToAnnotation,
13
13
  dgAnnotationTypes,
14
14
  decoratorOptionToAnnotation,
15
+ inputOptionsNames,
15
16
  } = require('../bin/utils/func-generation');
16
17
 
17
18
  const {api} = require('../bin/commands/api');
@@ -20,30 +21,6 @@ const baseImport = 'import * as DG from \'datagrok-api/dg\';\n';
20
21
  // eslint-disable-next-line max-len
21
22
  const annotationForGeneratedFile = `/**\nThis file is auto-generated by the webpack command.\nIf you notice any changes, please push them to the repository.\nDo not edit this file manually.\n*/\n`;
22
23
 
23
-
24
- const inputOptionsNames = [
25
- 'semType',
26
- 'category',
27
- 'optional',
28
- 'editor',
29
- 'nullable',
30
- 'separators',
31
- 'choices',
32
- 'format',
33
- 'min',
34
- 'max',
35
- 'caption',
36
- 'description',
37
- 'initialValue',
38
- 'viewer',
39
- 'units',
40
- 'optionsType',
41
- 'step',
42
- 'meta.url',
43
- 'metaUrl',
44
- ];
45
-
46
-
47
24
  class FuncGeneratorPlugin {
48
25
  constructor(options = {outputPath: './src/package.g.ts'}) {
49
26
  this.options = options;