datagrok-tools 4.5.3 → 4.5.4
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/add.js +5 -1
- package/package.json +1 -1
package/bin/commands/add.js
CHANGED
|
@@ -356,12 +356,15 @@ function add(args) {
|
|
|
356
356
|
if (!/(?<=entry:\s*{\s*(\r\n|\r|\n))[^}]*test:/.test(config)) {
|
|
357
357
|
var entryIdx = config.search(/(?<=entry:\s*{\s*(\r\n|\r|\n)).*/);
|
|
358
358
|
if (entryIdx === -1) return color.error('Entry point not found during config parsing');
|
|
359
|
-
var testEntry = " test: {filename: 'package-test.js', library: " + "{type: 'var', name:`${packageName}_test`}, import: './src/package-test.ts'}
|
|
359
|
+
var testEntry = " test: {filename: 'package-test.js', library: " + "{type: 'var', name:`${packageName}_test`}, import: './src/package-test.ts'},";
|
|
360
360
|
|
|
361
361
|
_fs["default"].writeFileSync(webpackConfigPath, config.slice(0, entryIdx) + testEntry + config.slice(entryIdx), 'utf8');
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
var packageObj = JSON.parse(_fs["default"].readFileSync(packagePath, 'utf8'));
|
|
365
|
+
Object.assign(packageObj.dependencies, {
|
|
366
|
+
'@datagrok-libraries/utils': 'latest'
|
|
367
|
+
});
|
|
365
368
|
Object.assign(packageObj.devDependencies, {
|
|
366
369
|
'jest-html-reporter': '^3.5.0',
|
|
367
370
|
'jest': '^27.0.0',
|
|
@@ -381,6 +384,7 @@ function add(args) {
|
|
|
381
384
|
_fs["default"].writeFileSync(packagePath, JSON.stringify(packageObj, null, 2), 'utf8');
|
|
382
385
|
|
|
383
386
|
if (!_fs["default"].existsSync(_path["default"].join(curDir, 'jest.config.js'))) _fs["default"].writeFileSync(_path["default"].join(curDir, 'jest.config.js'), _fs["default"].readFileSync(_path["default"].join(_path["default"].dirname(_path["default"].dirname(__dirname)), 'package-template', 'jest.config.js')));
|
|
387
|
+
if (!_fs["default"].existsSync(_path["default"].join(srcDir, '__jest__'))) _fs["default"].mkdirSync(_path["default"].join(srcDir, '__jest__'));
|
|
384
388
|
if (!_fs["default"].existsSync(_path["default"].join(srcDir, '__jest__', 'remote.test.ts'))) _fs["default"].writeFileSync(_path["default"].join(srcDir, '__jest__', 'remote.test.ts'), _fs["default"].readFileSync(_path["default"].join(_path["default"].dirname(_path["default"].dirname(__dirname)), 'package-template', 'src', '__jest__', 'remote.test.ts')));
|
|
385
389
|
if (!_fs["default"].existsSync(_path["default"].join(srcDir, '__jest__', 'test-node.ts'))) _fs["default"].writeFileSync(_path["default"].join(srcDir, '__jest__', 'test-node.ts'), _fs["default"].readFileSync(_path["default"].join(_path["default"].dirname(_path["default"].dirname(__dirname)), 'package-template', 'src', '__jest__', 'test-node.ts')));
|
|
386
390
|
if (!_fs["default"].existsSync(_path["default"].join(srcDir, 'package-test.ts'))) _fs["default"].writeFileSync(_path["default"].join(srcDir, 'package-test.ts'), _fs["default"].readFileSync(_path["default"].join(_path["default"].dirname(_path["default"].dirname(__dirname)), 'package-template', 'src', 'package-test.ts')));
|
package/package.json
CHANGED