datagrok-tools 4.8.2 → 4.8.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/link.js
CHANGED
|
@@ -38,23 +38,33 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
38
38
|
* Link: api > utils > other libs - npm install, npm run build, npm link
|
|
39
39
|
* Unlink: npm install in the package and its dependencies, npm unlink
|
|
40
40
|
*/
|
|
41
|
+
var curDir = process.cwd();
|
|
42
|
+
|
|
43
|
+
var packageDir = _path["default"].join(curDir, 'package.json');
|
|
44
|
+
|
|
41
45
|
var apiPackageName = 'datagrok-api';
|
|
42
46
|
var libScope = '@datagrok-libraries';
|
|
43
|
-
var paths = (_paths = {}, (0, _defineProperty2["default"])(_paths, apiPackageName, _path["default"].join(_path["default"].dirname(_path["default"].dirname(
|
|
47
|
+
var paths = (_paths = {}, (0, _defineProperty2["default"])(_paths, apiPackageName, _path["default"].join(_path["default"].dirname(_path["default"].dirname(curDir)), 'js-api')), (0, _defineProperty2["default"])(_paths, libScope, _path["default"].join(_path["default"].dirname(_path["default"].dirname(curDir)), 'libraries')), _paths);
|
|
44
48
|
/** Links local packages. */
|
|
45
49
|
|
|
46
50
|
function link(args) {
|
|
47
51
|
var nOptions = Object.keys(args).length - 1;
|
|
48
52
|
if (nOptions > 0 || args['_'].length > 1) return false;
|
|
49
|
-
var curDir = process.cwd();
|
|
50
|
-
|
|
51
|
-
var packageDir = _path["default"].join(curDir, 'package.json');
|
|
52
53
|
|
|
53
54
|
if (!utils.isPackageDir(curDir)) {
|
|
54
55
|
color.error('File `package.json` not found. Run the command from the package directory');
|
|
55
56
|
return false;
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
for (var _i = 0, _Object$values = Object.values(paths); _i < _Object$values.length; _i++) {
|
|
60
|
+
var p = _Object$values[_i];
|
|
61
|
+
|
|
62
|
+
if (!_fs["default"].existsSync(p)) {
|
|
63
|
+
color.error("Directory ".concat(p, " not found. Run the command from the public package repository"));
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
58
68
|
var dependencies = readDependencies(JSON.parse(_fs["default"].readFileSync(packageDir, 'utf-8')));
|
|
59
69
|
|
|
60
70
|
var modulesDir = _path["default"].join(curDir, 'node_modules');
|
|
@@ -125,7 +135,7 @@ function link(args) {
|
|
|
125
135
|
|
|
126
136
|
var isLinked = lib.isSymbolicLink();
|
|
127
137
|
console.log(isLinked ? "Package \"".concat(lib.name, "\" is linked. Updating dependencies and running the build script...") : "Linking \"".concat(lib.name, "\"..."));
|
|
128
|
-
(0, _child_process.exec)(isLinked ? 'npm update && npm run build' : 'npm install && npm run build && npm link', {
|
|
138
|
+
(0, _child_process.exec)(isLinked ? 'npm update && npm run build' : 'npm install && npm run link-all && npm run build && npm link', {
|
|
129
139
|
cwd: libPath
|
|
130
140
|
}, function (err, stdout, stderr) {
|
|
131
141
|
if (err) throw err;else console.log(stderr, stdout);
|
|
@@ -148,7 +158,7 @@ function link(args) {
|
|
|
148
158
|
|
|
149
159
|
var isLinked = utilsModule.isSymbolicLink();
|
|
150
160
|
console.log(isLinked ? "Package \"".concat(utilsModule.name, "\" is linked. Updating dependencies and running the build script...") : "Linking \"".concat(utilsModule.name, "\"..."));
|
|
151
|
-
(0, _child_process.exec)(isLinked ? 'npm update && npm run build' : 'npm install && npm run build && npm link', {
|
|
161
|
+
(0, _child_process.exec)(isLinked ? 'npm update && npm run build' : 'npm install && npm run link-all && npm run build && npm link', {
|
|
152
162
|
cwd: libPath
|
|
153
163
|
}, function (err, stdout, stderr) {
|
|
154
164
|
if (err) throw err;else {
|
|
@@ -184,9 +194,6 @@ function link(args) {
|
|
|
184
194
|
function unlink(args) {
|
|
185
195
|
var nOptions = Object.keys(args).length - 1;
|
|
186
196
|
if (nOptions > 0 || args['_'].length > 1) return false;
|
|
187
|
-
var curDir = process.cwd();
|
|
188
|
-
|
|
189
|
-
var packageDir = _path["default"].join(curDir, 'package.json');
|
|
190
197
|
|
|
191
198
|
if (!utils.isPackageDir(curDir)) {
|
|
192
199
|
color.error('File `package.json` not found. Run the command from the package directory');
|
package/package.json
CHANGED