@mouse_484/eslint-config 5.2.13 → 5.3.1
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/cli.js +33 -3
- package/package.json +2 -2
package/bin/cli.js
CHANGED
|
@@ -40,7 +40,7 @@ const isRunningFromSourcePackage = process.argv[1].includes(SOURCE.name)
|
|
|
40
40
|
*/
|
|
41
41
|
function runCommand(command, args = []) {
|
|
42
42
|
console.info(`Running: ${command} ${args.join(' ')}`)
|
|
43
|
-
const spawnedProcess = spawn(command, args, { stdio: 'inherit' })
|
|
43
|
+
const spawnedProcess = spawn(command, args, { stdio: 'inherit', shell: true })
|
|
44
44
|
|
|
45
45
|
return new Promise((resolve, reject) => {
|
|
46
46
|
spawnedProcess.on('close', (code) => {
|
|
@@ -56,6 +56,36 @@ function runCommand(command, args = []) {
|
|
|
56
56
|
})
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Execute antfu's CLI directly via node
|
|
61
|
+
* @returns {Promise<void>}
|
|
62
|
+
*/
|
|
63
|
+
async function runAntfuCLI() {
|
|
64
|
+
console.info('Running @antfu/eslint-config setup...')
|
|
65
|
+
|
|
66
|
+
const cwd = process.cwd()
|
|
67
|
+
const cliPath = path.join(cwd, 'node_modules', SOURCE.name, 'bin', 'index.js')
|
|
68
|
+
|
|
69
|
+
return new Promise((resolve, reject) => {
|
|
70
|
+
const nodeProcess = spawn('node', [cliPath], {
|
|
71
|
+
stdio: 'inherit',
|
|
72
|
+
cwd,
|
|
73
|
+
shell: true,
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
nodeProcess.on('close', (code) => {
|
|
77
|
+
if (code === 0) {
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
resolve()
|
|
80
|
+
}, 300)
|
|
81
|
+
} else {
|
|
82
|
+
reject(new Error(`Antfu CLI failed with exit code ${code}`))
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
nodeProcess.on('error', reject)
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
59
89
|
/**
|
|
60
90
|
* Update JSON file with transform function
|
|
61
91
|
* @param {string} filePath - JSON file path
|
|
@@ -94,12 +124,12 @@ async function main() {
|
|
|
94
124
|
await runCommand(installCmd.command, installCmd.args)
|
|
95
125
|
console.info(`Installed ${SOURCE.name}`)
|
|
96
126
|
|
|
97
|
-
|
|
98
|
-
await runCommand(execCmd.command, execCmd.args)
|
|
127
|
+
await runAntfuCLI()
|
|
99
128
|
|
|
100
129
|
console.info(`Start replacing the config from ${SOURCE.name} to ${TARGET.name}`)
|
|
101
130
|
|
|
102
131
|
const cwd = process.cwd()
|
|
132
|
+
|
|
103
133
|
const packageJSONPath = path.join(cwd, PACKAGE_JSON_FILE)
|
|
104
134
|
|
|
105
135
|
const package_ = await updateJSONFile(packageJSONPath, (packageData) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mouse_484/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.3.1",
|
|
5
5
|
"author": "mouse_484",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/mouse484/config/tree/main/packages/eslint",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@antfu/eslint-config": "^5.4.1",
|
|
26
26
|
"eslint-plugin-better-tailwindcss": "^3.7.9",
|
|
27
|
-
"package-manager-detector": "^1.
|
|
27
|
+
"package-manager-detector": "^1.4.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"eslint-typegen": "2.3.0"
|