@zohodesk/codestandard-validator 0.0.4-exp-19 → 0.0.4-exp-20
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.
|
@@ -54,11 +54,10 @@ function getConfigurationPrecommit() {
|
|
|
54
54
|
* @returns {Array<string>}
|
|
55
55
|
*/
|
|
56
56
|
function getSupportedLanguage() {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
_language
|
|
61
|
-
_language.push('.tsx');
|
|
57
|
+
const {
|
|
58
|
+
supportedExtensions
|
|
59
|
+
} = getConfigurationPrecommit();
|
|
60
|
+
const _language = supportedExtensions;
|
|
62
61
|
return _language;
|
|
63
62
|
}
|
|
64
63
|
function getRunningEnv() {
|
package/package.json
CHANGED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
Worker
|
|
5
|
-
} = require('worker_threads');
|
|
6
|
-
async function installPluginsByWorker(plugins) {
|
|
7
|
-
try {
|
|
8
|
-
const results = await Promise.all(plugins.map(pkg => runWorker({
|
|
9
|
-
packageName: pkg.packageName,
|
|
10
|
-
version: pkg.version
|
|
11
|
-
})));
|
|
12
|
-
console.log('Package are installed By from workers:', results.join('\n'));
|
|
13
|
-
} catch (error) {
|
|
14
|
-
console.error('Error:', error);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function runWorker(data) {
|
|
18
|
-
return new Promise((resolve, reject) => {
|
|
19
|
-
const worker = new Worker(`${__dirname}/worker.js`, {
|
|
20
|
-
workerData: data
|
|
21
|
-
});
|
|
22
|
-
worker.on('message', result => {
|
|
23
|
-
resolve(result);
|
|
24
|
-
});
|
|
25
|
-
worker.on('error', error => {
|
|
26
|
-
reject(error);
|
|
27
|
-
});
|
|
28
|
-
worker.on('exit', code => {
|
|
29
|
-
if (code !== 0) {
|
|
30
|
-
reject(new Error(`Worker stopped with exit code ${code}`));
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
module.exports = installPluginsByWorker;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
workerData,
|
|
5
|
-
parentPort
|
|
6
|
-
} = require('worker_threads');
|
|
7
|
-
const {
|
|
8
|
-
spawnSync
|
|
9
|
-
} = require('child_process');
|
|
10
|
-
const {
|
|
11
|
-
getNodeModulesPath
|
|
12
|
-
} = require('../../General/getNodeModulesPath');
|
|
13
|
-
function performanceInstalllation({
|
|
14
|
-
packageName,
|
|
15
|
-
version
|
|
16
|
-
}) {
|
|
17
|
-
const start = performance.now();
|
|
18
|
-
try {
|
|
19
|
-
require.resolve(packageName);
|
|
20
|
-
} catch (err) {
|
|
21
|
-
spawnSync('npm', ['install', `${packageName}@${version}`, '--no-save'], {
|
|
22
|
-
stdio: 'inherit',
|
|
23
|
-
cwd: getNodeModulesPath()
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
const end = performance.now();
|
|
27
|
-
return `Package ${packageName}@${version} installed successfully and installed in ${end - start} ms`;
|
|
28
|
-
}
|
|
29
|
-
const result = performanceInstalllation({
|
|
30
|
-
packageName: workerData.packageName,
|
|
31
|
-
version: workerData.version
|
|
32
|
-
});
|
|
33
|
-
parentPort.postMessage(result);
|