@deot/dev-shared 2.6.2 → 2.8.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.
- package/dist/index.cjs +12 -12
- package/dist/index.js +12 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -84,7 +84,7 @@ const logger = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
84
84
|
const SPACE = " ";
|
|
85
85
|
const binDirectory = path__namespace.resolve(process.cwd(), "./node_modules/.bin");
|
|
86
86
|
const toPromise = (target, promise) => {
|
|
87
|
-
|
|
87
|
+
const instance = target;
|
|
88
88
|
instance.then = (resolve, reject) => promise.then(resolve, reject);
|
|
89
89
|
instance.catch = (callback) => promise.catch(callback);
|
|
90
90
|
instance.finally = (callback) => promise.finally(callback);
|
|
@@ -104,7 +104,7 @@ const command = (command$, args) => {
|
|
|
104
104
|
return v || [];
|
|
105
105
|
};
|
|
106
106
|
const exec = (command$, args, options) => {
|
|
107
|
-
|
|
107
|
+
const command$$ = command(command$, args).join(SPACE);
|
|
108
108
|
let reject;
|
|
109
109
|
let resolve;
|
|
110
110
|
const promise = new Promise((resolve$, reject$) => {
|
|
@@ -132,11 +132,11 @@ const exec = (command$, args, options) => {
|
|
|
132
132
|
return toPromise(subprocess, promise);
|
|
133
133
|
};
|
|
134
134
|
const spawn = (command$, args, options) => {
|
|
135
|
-
|
|
136
|
-
args
|
|
135
|
+
const [command$$, ...args$] = command(command$, args).map((i) => LOCAL_COMMAND_MAP[i] || i);
|
|
136
|
+
const args$$ = args$.map((i) => i.replace(/^['"]|['"]$/g, ""));
|
|
137
137
|
const subprocess = childProcess__namespace.spawn(
|
|
138
138
|
command$$,
|
|
139
|
-
args
|
|
139
|
+
args$$,
|
|
140
140
|
{
|
|
141
141
|
stdio: "inherit",
|
|
142
142
|
...options
|
|
@@ -188,13 +188,13 @@ const getNormalizePackage = (dataMap) => {
|
|
|
188
188
|
});
|
|
189
189
|
const needUseMap = Object.keys(dataMap).reduce((pre, key) => (pre[key] = 0, pre), {});
|
|
190
190
|
const queue = [];
|
|
191
|
-
for (
|
|
191
|
+
for (const key in dataMap) {
|
|
192
192
|
const dependencies = dataMap[key];
|
|
193
193
|
dependencies.forEach((dependency) => {
|
|
194
194
|
needUseMap[dependency] += 1;
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
|
-
for (
|
|
197
|
+
for (const key in needUseMap) {
|
|
198
198
|
if (needUseMap[key] === 0) {
|
|
199
199
|
queue.push(key);
|
|
200
200
|
}
|
|
@@ -248,14 +248,14 @@ const getRealPackageName = (names, cwd) => {
|
|
|
248
248
|
return "";
|
|
249
249
|
}).filter((i) => !!i).join(",");
|
|
250
250
|
};
|
|
251
|
-
|
|
251
|
+
const configMap = {};
|
|
252
252
|
const impl = (cwd) => {
|
|
253
253
|
cwd = cwd || cwd$;
|
|
254
254
|
if (configMap[cwd])
|
|
255
255
|
return configMap[cwd];
|
|
256
256
|
const rootPackageOptions = require$(`${cwd}/package.json`);
|
|
257
257
|
let workspace = "packages";
|
|
258
|
-
|
|
258
|
+
const isMonorepo = fs__namespace.existsSync(path__namespace.resolve(cwd, workspace));
|
|
259
259
|
workspace = isMonorepo ? workspace : "";
|
|
260
260
|
const packageFolderName = isMonorepo ? "index" : "";
|
|
261
261
|
const packageDir = path__namespace.resolve(cwd, workspace);
|
|
@@ -279,8 +279,8 @@ const impl = (cwd) => {
|
|
|
279
279
|
return pre;
|
|
280
280
|
}, {});
|
|
281
281
|
const packageRelation = packageFolderNames.reduce((pre, packageFolderName$) => {
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
const packagesOptions = packageOptionsMap[packageFolderName$];
|
|
283
|
+
const deps = {
|
|
284
284
|
...packagesOptions.dependencies || {},
|
|
285
285
|
...packagesOptions.devDependencies || {}
|
|
286
286
|
};
|
|
@@ -288,7 +288,7 @@ const impl = (cwd) => {
|
|
|
288
288
|
return pre;
|
|
289
289
|
}, {});
|
|
290
290
|
const subpackagesMap = packageFolderNames.reduce((pre, packageFolderName$) => {
|
|
291
|
-
|
|
291
|
+
const dir = path__namespace.resolve(packageDir, packageFolderName$);
|
|
292
292
|
pre[packageFolderName$] = workspace && fs__namespace.existsSync(`${dir}/index.ts`) && !fs__namespace.existsSync(`${dir}/src`) ? fs__namespace.readdirSync(dir).filter((file) => {
|
|
293
293
|
const fullpath = path__namespace.join(dir, file);
|
|
294
294
|
const stat = fs__namespace.statSync(fullpath);
|
package/dist/index.js
CHANGED
|
@@ -59,7 +59,7 @@ const logger = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
59
59
|
const SPACE = " ";
|
|
60
60
|
const binDirectory = path.resolve(process.cwd(), "./node_modules/.bin");
|
|
61
61
|
const toPromise = (target, promise) => {
|
|
62
|
-
|
|
62
|
+
const instance = target;
|
|
63
63
|
instance.then = (resolve, reject) => promise.then(resolve, reject);
|
|
64
64
|
instance.catch = (callback) => promise.catch(callback);
|
|
65
65
|
instance.finally = (callback) => promise.finally(callback);
|
|
@@ -79,7 +79,7 @@ const command = (command$, args) => {
|
|
|
79
79
|
return v || [];
|
|
80
80
|
};
|
|
81
81
|
const exec = (command$, args, options) => {
|
|
82
|
-
|
|
82
|
+
const command$$ = command(command$, args).join(SPACE);
|
|
83
83
|
let reject;
|
|
84
84
|
let resolve;
|
|
85
85
|
const promise = new Promise((resolve$, reject$) => {
|
|
@@ -107,11 +107,11 @@ const exec = (command$, args, options) => {
|
|
|
107
107
|
return toPromise(subprocess, promise);
|
|
108
108
|
};
|
|
109
109
|
const spawn = (command$, args, options) => {
|
|
110
|
-
|
|
111
|
-
args
|
|
110
|
+
const [command$$, ...args$] = command(command$, args).map((i) => LOCAL_COMMAND_MAP[i] || i);
|
|
111
|
+
const args$$ = args$.map((i) => i.replace(/^['"]|['"]$/g, ""));
|
|
112
112
|
const subprocess = childProcess.spawn(
|
|
113
113
|
command$$,
|
|
114
|
-
args
|
|
114
|
+
args$$,
|
|
115
115
|
{
|
|
116
116
|
stdio: "inherit",
|
|
117
117
|
...options
|
|
@@ -163,13 +163,13 @@ const getNormalizePackage = (dataMap) => {
|
|
|
163
163
|
});
|
|
164
164
|
const needUseMap = Object.keys(dataMap).reduce((pre, key) => (pre[key] = 0, pre), {});
|
|
165
165
|
const queue = [];
|
|
166
|
-
for (
|
|
166
|
+
for (const key in dataMap) {
|
|
167
167
|
const dependencies = dataMap[key];
|
|
168
168
|
dependencies.forEach((dependency) => {
|
|
169
169
|
needUseMap[dependency] += 1;
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
for (
|
|
172
|
+
for (const key in needUseMap) {
|
|
173
173
|
if (needUseMap[key] === 0) {
|
|
174
174
|
queue.push(key);
|
|
175
175
|
}
|
|
@@ -223,14 +223,14 @@ const getRealPackageName = (names, cwd) => {
|
|
|
223
223
|
return "";
|
|
224
224
|
}).filter((i) => !!i).join(",");
|
|
225
225
|
};
|
|
226
|
-
|
|
226
|
+
const configMap = {};
|
|
227
227
|
const impl = (cwd) => {
|
|
228
228
|
cwd = cwd || cwd$;
|
|
229
229
|
if (configMap[cwd])
|
|
230
230
|
return configMap[cwd];
|
|
231
231
|
const rootPackageOptions = require$(`${cwd}/package.json`);
|
|
232
232
|
let workspace = "packages";
|
|
233
|
-
|
|
233
|
+
const isMonorepo = fs.existsSync(path.resolve(cwd, workspace));
|
|
234
234
|
workspace = isMonorepo ? workspace : "";
|
|
235
235
|
const packageFolderName = isMonorepo ? "index" : "";
|
|
236
236
|
const packageDir = path.resolve(cwd, workspace);
|
|
@@ -254,8 +254,8 @@ const impl = (cwd) => {
|
|
|
254
254
|
return pre;
|
|
255
255
|
}, {});
|
|
256
256
|
const packageRelation = packageFolderNames.reduce((pre, packageFolderName$) => {
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
const packagesOptions = packageOptionsMap[packageFolderName$];
|
|
258
|
+
const deps = {
|
|
259
259
|
...packagesOptions.dependencies || {},
|
|
260
260
|
...packagesOptions.devDependencies || {}
|
|
261
261
|
};
|
|
@@ -263,7 +263,7 @@ const impl = (cwd) => {
|
|
|
263
263
|
return pre;
|
|
264
264
|
}, {});
|
|
265
265
|
const subpackagesMap = packageFolderNames.reduce((pre, packageFolderName$) => {
|
|
266
|
-
|
|
266
|
+
const dir = path.resolve(packageDir, packageFolderName$);
|
|
267
267
|
pre[packageFolderName$] = workspace && fs.existsSync(`${dir}/index.ts`) && !fs.existsSync(`${dir}/src`) ? fs.readdirSync(dir).filter((file) => {
|
|
268
268
|
const fullpath = path.join(dir, file);
|
|
269
269
|
const stat = fs.statSync(fullpath);
|