datagrok-tools 4.1.20 → 4.3.0

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.
@@ -123,6 +123,8 @@ function createDirectoryContents(name, config, templateDir, packageDir) {
123
123
  }
124
124
 
125
125
  if (file === 'package.js' && ts) copyFilePath = _path["default"].join(packageDir, 'package.ts');
126
+ if (file === 'package-test.js' && ts) return false;
127
+ if (file === 'package-test.ts' && !ts) return false;
126
128
  if (file === 'tsconfig.json' && !ts) return false;
127
129
  if (file === 'ts.webpack.config.js') return false;
128
130
 
@@ -56,7 +56,7 @@ function processPackage(_x, _x2, _x3, _x4, _x5, _x6) {
56
56
 
57
57
  function _processPackage() {
58
58
  _processPackage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(debug, rebuild, host, devKey, packageName, suffix) {
59
- var timestamps, url, zip, localTimestamps, files, distFiles, contentValidationLog, uploadPromise, log;
59
+ var timestamps, url, zip, localTimestamps, files, isWebpack, distFiles, contentValidationLog, uploadPromise, log;
60
60
  return _regenerator["default"].wrap(function _callee3$(_context3) {
61
61
  while (1) {
62
62
  switch (_context3.prev = _context3.next) {
@@ -108,25 +108,26 @@ function _processPackage() {
108
108
  _context3.next = 22;
109
109
  return (0, _ignoreWalk["default"])({
110
110
  path: '.',
111
- ignoreFiles: ['.npmignore', '.gitignore'],
111
+ ignoreFiles: ['.npmignore', '.gitignore', '.grokignore'],
112
112
  includeEmpty: false,
113
113
  follow: true
114
114
  });
115
115
 
116
116
  case 22:
117
117
  files = _context3.sent;
118
+ isWebpack = _fs["default"].existsSync('webpack.config.js');
118
119
 
119
- if (!(!rebuild && _fs["default"].existsSync('webpack.config.js'))) {
120
- _context3.next = 35;
120
+ if (!(!rebuild && isWebpack)) {
121
+ _context3.next = 36;
121
122
  break;
122
123
  }
123
124
 
124
125
  if (!_fs["default"].existsSync('dist/package.js')) {
125
- _context3.next = 31;
126
+ _context3.next = 32;
126
127
  break;
127
128
  }
128
129
 
129
- _context3.next = 27;
130
+ _context3.next = 28;
130
131
  return (0, _ignoreWalk["default"])({
131
132
  path: './dist',
132
133
  ignoreFiles: [],
@@ -134,21 +135,21 @@ function _processPackage() {
134
135
  follow: true
135
136
  });
136
137
 
137
- case 27:
138
+ case 28:
138
139
  distFiles = _context3.sent;
139
140
  distFiles.forEach(function (df) {
140
141
  files.push("dist/".concat(df));
141
142
  });
142
- _context3.next = 35;
143
+ _context3.next = 36;
143
144
  break;
144
145
 
145
- case 31:
146
+ case 32:
146
147
  console.log("File 'dist/package.js' not found. Building the package on the server side...");
147
148
  console.log("Next time, please build your package locally with Webpack beforehand");
148
149
  console.log("or run `grok publish` with the `--rebuild` option");
149
150
  rebuild = true;
150
151
 
151
- case 35:
152
+ case 36:
152
153
  contentValidationLog = '';
153
154
  files.forEach(function (file) {
154
155
  var fullPath = file;
@@ -160,6 +161,11 @@ function _processPackage() {
160
161
  if (canonicalRelativePath.startsWith('.')) return;
161
162
  if (relativePath.startsWith('node_modules')) return;
162
163
  if (relativePath.startsWith('dist') && rebuild) return;
164
+
165
+ if (relativePath.startsWith('src') && !rebuild && isWebpack) {
166
+ if (!relativePath.startsWith('src/package') && !relativePath.startsWith('src\\package')) return;
167
+ }
168
+
163
169
  if (relativePath.startsWith('upload.keys.json')) return;
164
170
  if (relativePath === 'zip') return;
165
171
 
@@ -230,21 +236,21 @@ function _processPackage() {
230
236
  })["catch"](function (error) {
231
237
  console.error(error);
232
238
  });
233
- _context3.next = 43;
239
+ _context3.next = 44;
234
240
  return zip.finalize();
235
241
 
236
- case 43:
237
- _context3.prev = 43;
238
- _context3.next = 46;
242
+ case 44:
243
+ _context3.prev = 44;
244
+ _context3.next = 47;
239
245
  return uploadPromise;
240
246
 
241
- case 46:
247
+ case 47:
242
248
  log = _context3.sent;
243
249
 
244
250
  _fs["default"].unlinkSync('zip');
245
251
 
246
252
  if (!(log['#type'] === 'ApiError')) {
247
- _context3.next = 54;
253
+ _context3.next = 55;
248
254
  break;
249
255
  }
250
256
 
@@ -252,29 +258,29 @@ function _processPackage() {
252
258
  console.log(log['innerMessage']);
253
259
  return _context3.abrupt("return", 1);
254
260
 
255
- case 54:
261
+ case 55:
256
262
  console.log(log);
257
263
  console.log(contentValidationLog);
258
264
 
259
- case 56:
260
- _context3.next = 62;
265
+ case 57:
266
+ _context3.next = 63;
261
267
  break;
262
268
 
263
- case 58:
264
- _context3.prev = 58;
265
- _context3.t1 = _context3["catch"](43);
269
+ case 59:
270
+ _context3.prev = 59;
271
+ _context3.t1 = _context3["catch"](44);
266
272
  console.error(_context3.t1);
267
273
  return _context3.abrupt("return", 1);
268
274
 
269
- case 62:
275
+ case 63:
270
276
  return _context3.abrupt("return", 0);
271
277
 
272
- case 63:
278
+ case 64:
273
279
  case "end":
274
280
  return _context3.stop();
275
281
  }
276
282
  }
277
- }, _callee3, null, [[3, 14], [43, 58]]);
283
+ }, _callee3, null, [[3, 14], [44, 59]]);
278
284
  }));
279
285
  return _processPackage.apply(this, arguments);
280
286
  }
@@ -261,13 +261,7 @@ var dgToTsTypeMap = {
261
261
  dataframe: 'DG.DataFrame',
262
262
  column: 'DG.Column',
263
263
  column_list: 'string[]',
264
- file: 'DG.FileInfo' // graphics: '',
265
- // datetime: '',
266
- // blob: '',
267
- // map: '',
268
- // list: '',
269
- //'list<T>'
270
-
264
+ file: 'DG.FileInfo'
271
265
  };
272
266
  exports.dgToTsTypeMap = dgToTsTypeMap;
273
267
 
@@ -29,7 +29,10 @@
29
29
  "brace-style": [
30
30
  "error",
31
31
  "1tbs",
32
- { "allowSingleLine": true }
33
- ]
32
+ {
33
+ "allowSingleLine": true
34
+ }
35
+ ],
36
+ "block-spacing": 2
34
37
  }
35
- }
38
+ }
@@ -14,9 +14,16 @@
14
14
  "webpack-cli": "latest"
15
15
  },
16
16
  "scripts": {
17
- "debug-#{PACKAGE_NAME_LOWERCASE}": "grok publish --rebuild",
18
- "release-#{PACKAGE_NAME_LOWERCASE}": "grok publish --rebuild --release",
17
+ "link-all": "",
18
+ "debug-#{PACKAGE_NAME_LOWERCASE}": "webpack && grok publish ",
19
+ "release-#{PACKAGE_NAME_LOWERCASE}": "webpack && grok publish --release",
19
20
  "build-#{PACKAGE_NAME_LOWERCASE}": "webpack",
20
21
  "build": "webpack"
21
- }
22
+ },
23
+ "canEdit": [
24
+ "Developers"
25
+ ],
26
+ "canView": [
27
+ "All users"
28
+ ]
22
29
  }
@@ -0,0 +1,13 @@
1
+ import * as DG from "datagrok-api/dg";
2
+ import * as grok from "datagrok-api/grok";
3
+ import {runTests} from "@datagrok-libraries/utils/src/test";
4
+ import "./tests/chem-tests";
5
+
6
+ export let _package = new DG.Package();
7
+
8
+ //name: test
9
+ //output: dataframe result
10
+ export async function test() {
11
+ let data = await runTests();
12
+ return DG.DataFrame.fromObjects(data);
13
+ }
@@ -0,0 +1,14 @@
1
+ import * as DG from "datagrok-api/dg";
2
+ import * as grok from "datagrok-api/grok";
3
+ import {runTests, tests} from '@datagrok-libraries/utils/src/test';
4
+ import "./tests/chem-tests";
5
+
6
+ export let _package = new DG.Package();
7
+ export {tests}
8
+
9
+ //name: test
10
+ //output: dataframe result
11
+ export async function test(): Promise<DG.DataFrame> {
12
+ let data = await runTests();
13
+ return DG.DataFrame.fromObjects(data)!;
14
+ }
@@ -1,11 +1,11 @@
1
- /* Do not change these import lines to match external modules in webpack configuration */
2
- import * as grok from 'datagrok-api/grok';
3
- import * as ui from 'datagrok-api/ui';
4
- import * as DG from 'datagrok-api/dg';
5
-
6
- export const _package = new DG.Package();
7
-
8
- //name: test
9
- export function test() {
10
- grok.shell.info(_package.webRoot);
11
- }
1
+ /* Do not change these import lines to match external modules in webpack configuration */
2
+ import * as grok from 'datagrok-api/grok';
3
+ import * as ui from 'datagrok-api/ui';
4
+ import * as DG from 'datagrok-api/dg';
5
+
6
+ export const _package = new DG.Package();
7
+
8
+ //name: info
9
+ export function info() {
10
+ grok.shell.info(_package.webRoot);
11
+ }
@@ -1,34 +1,36 @@
1
- const path = require('path');
2
-
3
- module.exports = {
4
- mode: 'development',
5
- entry: {
6
- package: './src/package.ts'
7
- },
8
- resolve: {
9
- extensions: ['.wasm', '.mjs', '.js', '.json', '.ts', '.tsx'],
10
- },
11
- module: {
12
- rules: [
13
- { test: /\.tsx?$/, loader: 'ts-loader' }
14
- ],
15
- },
16
- devtool: 'inline-source-map',
17
- externals: {
18
- 'datagrok-api/dg': 'DG',
19
- 'datagrok-api/grok': 'grok',
20
- 'datagrok-api/ui': 'ui',
21
- 'openchemlib/full.js': 'OCL',
22
- 'rxjs': 'rxjs',
23
- 'rxjs/operators': 'rxjs.operators',
24
- 'cash-dom': '$',
25
- 'dayjs': 'dayjs',
26
- 'wu': 'wu',
27
- },
28
- output: {
29
- filename: '[name].js',
30
- library: '#{PACKAGE_NAME_LOWERCASE_WORD}',
31
- libraryTarget: 'var',
32
- path: path.resolve(__dirname, 'dist'),
33
- },
34
- };
1
+ const path = require('path');
2
+ const packageName = path.parse(require('./package.json').name).name.toLowerCase().replace(/-/g, '');
3
+
4
+ module.exports = {
5
+ mode: 'development',
6
+ entry: {
7
+ test: {filename: 'package-test.js', library: {type: 'var', name:`${packageName}_test`}, import: './src/package-test.ts'},
8
+ package: './src/package.ts'
9
+ },
10
+ resolve: {
11
+ extensions: ['.wasm', '.mjs', '.js', '.json', '.ts', '.tsx'],
12
+ },
13
+ module: {
14
+ rules: [
15
+ { test: /\.tsx?$/, loader: 'ts-loader' }
16
+ ],
17
+ },
18
+ devtool: 'inline-source-map',
19
+ externals: {
20
+ 'datagrok-api/dg': 'DG',
21
+ 'datagrok-api/grok': 'grok',
22
+ 'datagrok-api/ui': 'ui',
23
+ 'openchemlib/full.js': 'OCL',
24
+ 'rxjs': 'rxjs',
25
+ 'rxjs/operators': 'rxjs.operators',
26
+ 'cash-dom': '$',
27
+ 'dayjs': 'dayjs',
28
+ 'wu': 'wu',
29
+ },
30
+ output: {
31
+ filename: '[name].js',
32
+ library: packageName,
33
+ libraryTarget: 'var',
34
+ path: path.resolve(__dirname, 'dist'),
35
+ },
36
+ };
@@ -1,71 +1,71 @@
1
- {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
-
5
- /* Basic Options */
6
- // "incremental": true, /* Enable incremental compilation */
7
- "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8
- "module": "es2020", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9
- "lib": ["es2020", "dom"], /* Specify library files to be included in the compilation. */
10
- // "allowJs": true, /* Allow javascript files to be compiled. */
11
- // "checkJs": true, /* Report errors in .js files. */
12
- // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
13
- // "declaration": true, /* Generates corresponding '.d.ts' file. */
14
- // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15
- // "sourceMap": true, /* Generates corresponding '.map' file. */
16
- // "outFile": "./", /* Concatenate and emit output to single file. */
17
- // "outDir": "./", /* Redirect output structure to the directory. */
18
- // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
19
- // "composite": true, /* Enable project compilation */
20
- // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
21
- // "removeComments": true, /* Do not emit comments to output. */
22
- // "noEmit": true, /* Do not emit outputs. */
23
- // "importHelpers": true, /* Import emit helpers from 'tslib'. */
24
- // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
25
- // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
26
-
27
- /* Strict Type-Checking Options */
28
- "strict": true, /* Enable all strict type-checking options. */
29
- // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
30
- // "strictNullChecks": true, /* Enable strict null checks. */
31
- // "strictFunctionTypes": true, /* Enable strict checking of function types. */
32
- // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
33
- // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
34
- // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
35
- // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
36
-
37
- /* Additional Checks */
38
- // "noUnusedLocals": true, /* Report errors on unused locals. */
39
- // "noUnusedParameters": true, /* Report errors on unused parameters. */
40
- // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
41
- // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
42
- // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
43
- // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
44
-
45
- /* Module Resolution Options */
46
- "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
47
- // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
48
- // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
49
- // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
50
- // "typeRoots": [], /* List of folders to include type definitions from. */
51
- // "types": [], /* Type declaration files to be included in compilation. */
52
- // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
53
- "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
54
- // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
55
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
56
-
57
- /* Source Map Options */
58
- // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
59
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
60
- // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
61
- // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
62
-
63
- /* Experimental Options */
64
- // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
65
- // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
66
-
67
- /* Advanced Options */
68
- "skipLibCheck": false, /* Skip type checking of declaration files. */
69
- "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
70
- }
71
- }
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
+
5
+ /* Basic Options */
6
+ // "incremental": true, /* Enable incremental compilation */
7
+ "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8
+ "module": "es2020", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9
+ "lib": ["es2020", "dom"], /* Specify library files to be included in the compilation. */
10
+ // "allowJs": true, /* Allow javascript files to be compiled. */
11
+ // "checkJs": true, /* Report errors in .js files. */
12
+ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
13
+ // "declaration": true, /* Generates corresponding '.d.ts' file. */
14
+ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15
+ // "sourceMap": true, /* Generates corresponding '.map' file. */
16
+ // "outFile": "./", /* Concatenate and emit output to single file. */
17
+ // "outDir": "./", /* Redirect output structure to the directory. */
18
+ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
19
+ // "composite": true, /* Enable project compilation */
20
+ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
21
+ // "removeComments": true, /* Do not emit comments to output. */
22
+ // "noEmit": true, /* Do not emit outputs. */
23
+ // "importHelpers": true, /* Import emit helpers from 'tslib'. */
24
+ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
25
+ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
26
+
27
+ /* Strict Type-Checking Options */
28
+ "strict": true, /* Enable all strict type-checking options. */
29
+ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
30
+ // "strictNullChecks": true, /* Enable strict null checks. */
31
+ // "strictFunctionTypes": true, /* Enable strict checking of function types. */
32
+ // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
33
+ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
34
+ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
35
+ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
36
+
37
+ /* Additional Checks */
38
+ // "noUnusedLocals": true, /* Report errors on unused locals. */
39
+ // "noUnusedParameters": true, /* Report errors on unused parameters. */
40
+ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
41
+ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
42
+ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
43
+ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
44
+
45
+ /* Module Resolution Options */
46
+ "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
47
+ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
48
+ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
49
+ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
50
+ // "typeRoots": [], /* List of folders to include type definitions from. */
51
+ // "types": [], /* Type declaration files to be included in compilation. */
52
+ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
53
+ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
54
+ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
55
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
56
+
57
+ /* Source Map Options */
58
+ // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
59
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
60
+ // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
61
+ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
62
+
63
+ /* Experimental Options */
64
+ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
65
+ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
66
+
67
+ /* Advanced Options */
68
+ "skipLibCheck": false, /* Skip type checking of declaration files. */
69
+ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
70
+ }
71
+ }
@@ -1,4 +1,5 @@
1
1
  const path = require('path');
2
+ const packageName = path.parse(require('./package.json').name).name.toLowerCase().replace(/-/g, '');
2
3
 
3
4
  module.exports = {
4
5
  mode: 'development',
@@ -19,7 +20,7 @@ module.exports = {
19
20
  },
20
21
  output: {
21
22
  filename: '[name].js',
22
- library: '#{PACKAGE_NAME_LOWERCASE_WORD}',
23
+ library: packageName,
23
24
  libraryTarget: 'var',
24
25
  path: path.resolve(__dirname, 'dist'),
25
26
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.1.20",
3
+ "version": "4.3.0",
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": {