@lark-apaas/fullstack-cli 1.1.61-alpha.20260819082510 → 1.1.61-alpha.20260819094224
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.js +1 -1
- package/package.json +1 -1
- package/templates/scripts/lint.js +40 -2
package/dist/index.js
CHANGED
|
@@ -7723,7 +7723,7 @@ function sanitizeStructuredLog(value) {
|
|
|
7723
7723
|
delete sanitized.pid;
|
|
7724
7724
|
return sanitized;
|
|
7725
7725
|
}
|
|
7726
|
-
var TRANSIENT_CONNECTION_ERROR_PATTERN = /ECONNREFUSED|ECONNRESET|ETIMEDOUT|ENETUNREACH|proxy error|\[Proxy\] (?:Error:\s*$|Error during|Connection error|Non-connection error|Headers already sent|Service (?:recovered|did not recover))/i;
|
|
7726
|
+
var TRANSIENT_CONNECTION_ERROR_PATTERN = /ECONNREFUSED|ECONNRESET|ETIMEDOUT|ENETUNREACH|socket hang up|proxy error|\[Proxy\] (?:Error:\s*$|Error during|Connection error|Non-connection error|Headers already sent|Service (?:recovered|did not recover))/i;
|
|
7727
7727
|
function hasErrorInStdLines(lines) {
|
|
7728
7728
|
const filtered = lines.filter((line) => !TRANSIENT_CONNECTION_ERROR_PATTERN.test(line));
|
|
7729
7729
|
const combined = filtered.join("\n");
|
package/package.json
CHANGED
|
@@ -76,13 +76,49 @@ function isStylelintTarget(filePath) {
|
|
|
76
76
|
return filePath.endsWith('.css');
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
const STYLELINT_CONFIG_FILES = [
|
|
80
|
+
'.stylelintrc',
|
|
81
|
+
'.stylelintrc.js',
|
|
82
|
+
'.stylelintrc.cjs',
|
|
83
|
+
'.stylelintrc.json',
|
|
84
|
+
'stylelint.config.js',
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 老模板(fullstack-nestjs-template 1.x 时代)的应用跑不了 stylelint,跑了就挂、把 pre-commit
|
|
89
|
+
* 卡死。两种形态都实测过:
|
|
90
|
+
*
|
|
91
|
+
* - 缺 scripts.stylelint → `npm error Missing script: "stylelint"`
|
|
92
|
+
* - 缺 .stylelintrc.* → `ConfigurationError: No configuration provided`
|
|
93
|
+
*
|
|
94
|
+
* 注意光判断 stylelint 装没装拦不住:@lark-apaas/fullstack-presets 的 dependencies 里有
|
|
95
|
+
* stylelint,只要 dep 了 presets 二进制就在。缺任一件就跳过这一步。
|
|
96
|
+
*/
|
|
97
|
+
function canRunStylelint() {
|
|
98
|
+
let pkg;
|
|
99
|
+
try {
|
|
100
|
+
pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf8'));
|
|
101
|
+
} catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (!pkg.scripts || !pkg.scripts.stylelint) return false;
|
|
106
|
+
|
|
107
|
+
return STYLELINT_CONFIG_FILES.some(file => fs.existsSync(path.join(cwd, file)));
|
|
108
|
+
}
|
|
109
|
+
|
|
79
110
|
async function runDefaultLint() {
|
|
80
111
|
const taskSpecs = [
|
|
81
112
|
[getBinName('npm'), ['run', 'eslint']],
|
|
82
113
|
[getBinName('npm'), ['run', 'type:check']],
|
|
83
|
-
[getBinName('npm'), ['run', 'stylelint']],
|
|
84
114
|
];
|
|
85
115
|
|
|
116
|
+
if (canRunStylelint()) {
|
|
117
|
+
taskSpecs.push([getBinName('npm'), ['run', 'stylelint']]);
|
|
118
|
+
} else {
|
|
119
|
+
console.warn('[lint] Skip stylelint: missing scripts.stylelint or stylelint config');
|
|
120
|
+
}
|
|
121
|
+
|
|
86
122
|
process.exit(await runTasksSerially(taskSpecs));
|
|
87
123
|
}
|
|
88
124
|
|
|
@@ -120,7 +156,9 @@ async function runSelectiveLint(inputFiles) {
|
|
|
120
156
|
taskSpecs.push([getBinName('npx'), ['eslint', '--quiet', ...eslintFiles]]);
|
|
121
157
|
}
|
|
122
158
|
|
|
123
|
-
if (stylelintFiles.length > 0) {
|
|
159
|
+
if (stylelintFiles.length > 0 && !canRunStylelint()) {
|
|
160
|
+
console.warn('[lint] Skip stylelint: missing scripts.stylelint or stylelint config');
|
|
161
|
+
} else if (stylelintFiles.length > 0) {
|
|
124
162
|
taskSpecs.push([getBinName('npx'), ['stylelint', '--quiet', ...stylelintFiles]]);
|
|
125
163
|
}
|
|
126
164
|
|