datagrok-tools 4.12.17 → 4.12.19
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/.eslintrc.json +43 -0
- package/bin/_deprecated/migrate.js +9 -9
- package/bin/_deprecated/upload.js +36 -36
- package/bin/commands/add.js +16 -29
- package/bin/commands/api.js +22 -21
- package/bin/commands/check.js +10 -12
- package/bin/commands/config.js +120 -140
- package/bin/commands/create.js +6 -11
- package/bin/commands/help.js +11 -5
- package/bin/commands/init.js +11 -13
- package/bin/commands/link.js +6 -7
- package/bin/commands/publish.js +220 -226
- package/bin/commands/test.js +178 -184
- package/bin/grok.js +3 -3
- package/bin/utils/color-utils.js +5 -10
- package/bin/utils/ent-helpers.js +2 -3
- package/bin/utils/func-generation.js +19 -20
- package/bin/utils/test-utils.js +140 -150
- package/bin/utils/utils.js +20 -41
- package/bin/validators/config-validator.js +1 -3
- package/package-template/ts.webpack.config.js +3 -3
- package/package-template/webpack.config.js +1 -1
- package/package.json +26 -21
- package/plugins/func-gen-plugin.js +12 -12
- package/script-template/node.js +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const {
|
|
3
|
+
const {parse} = require('@babel/parser');
|
|
4
4
|
const traverse = require('@babel/traverse').default;
|
|
5
|
-
const {
|
|
5
|
+
const {reservedDecorators, getFuncAnnotation, generateImport, generateExport} = require('../bin/utils/func-generation');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class FuncGeneratorPlugin {
|
|
@@ -28,7 +28,7 @@ class FuncGeneratorPlugin {
|
|
|
28
28
|
sourceType: 'module',
|
|
29
29
|
plugins: ['typescript', [
|
|
30
30
|
'decorators',
|
|
31
|
-
{
|
|
31
|
+
{decoratorsBeforeExport: true},
|
|
32
32
|
]],
|
|
33
33
|
});
|
|
34
34
|
const functions = [];
|
|
@@ -43,9 +43,9 @@ class FuncGeneratorPlugin {
|
|
|
43
43
|
const content = fs.readFileSync(this.options.outputPath, 'utf-8');
|
|
44
44
|
const output = content ? this._insertImports(content, imports) : imports.join('\n');
|
|
45
45
|
fs.writeFileSync(this.options.outputPath, output, 'utf-8');
|
|
46
|
-
} else
|
|
46
|
+
} else
|
|
47
47
|
fs.writeFileSync(this.options.outputPath, imports.join('\n'), 'utf-8');
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
|
|
50
50
|
fs.appendFileSync(this.options.outputPath, functions.join('\n'), 'utf-8');
|
|
51
51
|
}
|
|
@@ -63,11 +63,11 @@ class FuncGeneratorPlugin {
|
|
|
63
63
|
const files = fs.readdirSync(dir);
|
|
64
64
|
for (const file of files) {
|
|
65
65
|
const fullPath = path.join(dir, file);
|
|
66
|
-
if (fs.statSync(fullPath).isDirectory())
|
|
66
|
+
if (fs.statSync(fullPath).isDirectory())
|
|
67
67
|
findFiles(fullPath);
|
|
68
|
-
|
|
68
|
+
else if (extPattern.test(file) && !excludedFiles.includes(file))
|
|
69
69
|
tsFiles.push(fullPath);
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -127,15 +127,15 @@ class FuncGeneratorPlugin {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
_insertImports(content, imports) {
|
|
130
|
-
const ast = parse(content, {
|
|
130
|
+
const ast = parse(content, {sourceType: 'module', plugins: ['typescript', 'decorators']});
|
|
131
131
|
let lastImportLoc = null;
|
|
132
132
|
traverse(ast, {
|
|
133
133
|
ImportDeclaration(nodePath) {
|
|
134
134
|
lastImportLoc = nodePath.node.end + 1;
|
|
135
|
-
}
|
|
135
|
+
},
|
|
136
136
|
});
|
|
137
|
-
return lastImportLoc === null ? imports.join('\n') + content
|
|
138
|
-
|
|
137
|
+
return lastImportLoc === null ? imports.join('\n') + content :
|
|
138
|
+
content.slice(0, lastImportLoc) + imports.join('\n') +
|
|
139
139
|
(content[lastImportLoc] === '\n' ? '' : '\n') +
|
|
140
140
|
content.slice(lastImportLoc, content.length);
|
|
141
141
|
}
|
package/script-template/node.js
CHANGED