datagrok-tools 4.14.3 → 4.14.5
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/api.js +6 -5
- package/bin/commands/check.js +5 -2
- package/package.json +1 -1
package/bin/commands/api.js
CHANGED
|
@@ -20,9 +20,7 @@ const srcDir = _path.default.join(curDir, 'src');
|
|
|
20
20
|
const funcFilePath = _path.default.join(_fs.default.existsSync(srcDir) ? srcDir : curDir, apiFile);
|
|
21
21
|
const packagePath = _path.default.join(curDir, 'package.json');
|
|
22
22
|
const names = new Set();
|
|
23
|
-
|
|
24
|
-
encoding: 'utf-8'
|
|
25
|
-
}));
|
|
23
|
+
let _package = {};
|
|
26
24
|
function generateQueryWrappers() {
|
|
27
25
|
const queriesDir = _path.default.join(curDir, 'queries');
|
|
28
26
|
if (!_fs.default.existsSync(queriesDir)) {
|
|
@@ -45,7 +43,7 @@ function generateQueryWrappers() {
|
|
|
45
43
|
const name = utils.getScriptName(q, utils.commentMap[utils.queryExtension]);
|
|
46
44
|
if (!name) continue;
|
|
47
45
|
checkNameColision(name);
|
|
48
|
-
const tb = new utils.TemplateBuilder(utils.queryWrapperTemplate).replace('FUNC_NAME', name).replace('FUNC_NAME_LOWERCASE', name).replace('PACKAGE_NAMESPACE', _package
|
|
46
|
+
const tb = new utils.TemplateBuilder(utils.queryWrapperTemplate).replace('FUNC_NAME', name).replace('FUNC_NAME_LOWERCASE', name).replace('PACKAGE_NAMESPACE', _package?.name ?? '');
|
|
49
47
|
const description = utils.getScriptDescription(q, utils.commentMap[utils.queryExtension]);
|
|
50
48
|
const inputs = utils.getScriptInputs(q, utils.commentMap[utils.queryExtension]);
|
|
51
49
|
const outputType = utils.getScriptOutputType(q, utils.commentMap[utils.queryExtension]);
|
|
@@ -109,7 +107,7 @@ function generateFunctionWrappers() {
|
|
|
109
107
|
outputType = utils.dgToTsTypeMap[outputAnnotation[1]] ?? 'any';
|
|
110
108
|
}
|
|
111
109
|
checkNameColision(name);
|
|
112
|
-
const tb = new utils.TemplateBuilder(utils.scriptWrapperTemplate).replace('FUNC_NAME', name).replace('FUNC_NAME_LOWERCASE', name).replace('PACKAGE_NAMESPACE', _package
|
|
110
|
+
const tb = new utils.TemplateBuilder(utils.scriptWrapperTemplate).replace('FUNC_NAME', name).replace('FUNC_NAME_LOWERCASE', name).replace('PACKAGE_NAMESPACE', _package?.name ?? '').replace('PARAMS_OBJECT', annotationInputs).replace('FUNC_DESCRIPTION', description).replace('TYPED_PARAMS', annotationInputs).replace('OUTPUT_TYPE', outputType);
|
|
113
111
|
wrappers.push(tb.build(1));
|
|
114
112
|
}
|
|
115
113
|
}
|
|
@@ -133,6 +131,9 @@ function checkNameColision(name) {
|
|
|
133
131
|
names.add(name);
|
|
134
132
|
}
|
|
135
133
|
function api(args) {
|
|
134
|
+
_package = JSON.parse(_fs.default.readFileSync(packagePath, {
|
|
135
|
+
encoding: 'utf-8'
|
|
136
|
+
}));
|
|
136
137
|
const nOptions = Object.keys(args).length - 1;
|
|
137
138
|
if (args['_'].length !== 1 || nOptions > 0) return false;
|
|
138
139
|
if (!utils.isPackageDir(process.cwd())) {
|
package/bin/commands/check.js
CHANGED
|
@@ -360,8 +360,11 @@ function checkPackageFile(packagePath, json, options) {
|
|
|
360
360
|
if (api) {
|
|
361
361
|
if (api === '../../js-api') {} else if (api === 'latest') warnings.push('File "package.json": you should specify Datagrok API version constraint (for example ^1.16.0, >=1.16.0).');else if (options?.isReleaseCandidateVersion === false && !/^(\^|>|<|~).+/.test(api)) warnings.push('File "package.json": Datagrok API version should starts with > | >= | ~ | ^ | < | <=');
|
|
362
362
|
}
|
|
363
|
-
|
|
364
|
-
|
|
363
|
+
|
|
364
|
+
// const dt = json.devDependencies?.['datagrok-tools'] ?? json.dependencies?.['datagrok-tools'];
|
|
365
|
+
// if (dt && dt !== 'latest')
|
|
366
|
+
// warnings.push('File "package.json": "datagrok-tools" dependency must be "latest" version.');
|
|
367
|
+
|
|
365
368
|
if (Array.isArray(json.sources) && json.sources.length > 0) {
|
|
366
369
|
for (const source of json.sources) {
|
|
367
370
|
if (typeof source !== 'string') warnings.push(`File "package.json": Only file paths and URLs are allowed in sources. Modify the source ${source}`);
|
package/package.json
CHANGED