@varlet/cli 3.4.0 → 3.5.0-alpha.1726249557629
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { x } from 'tinyexec';
|
|
2
2
|
import { createSpinner } from 'nanospinner';
|
|
3
3
|
import { CWD, ESLINT_EXTENSIONS } from '../shared/constant.js';
|
|
4
4
|
import { isDir } from '../shared/fsUtils.js';
|
|
@@ -7,7 +7,7 @@ export async function lint() {
|
|
|
7
7
|
const spinner = createSpinner();
|
|
8
8
|
try {
|
|
9
9
|
spinner.start({ text: 'prettier starting...' });
|
|
10
|
-
await
|
|
10
|
+
await x('prettier', ['--write', '--cache', '.'], { nodeOptions: { stdio: 'inherit' }, throwOnError: true });
|
|
11
11
|
spinner.success({ text: 'prettier success' });
|
|
12
12
|
spinner.start({ text: 'eslint starting...' });
|
|
13
13
|
const eslintPatterns = [
|
|
@@ -22,13 +22,13 @@ export async function lint() {
|
|
|
22
22
|
'./packages/varlet-ui-playground/src',
|
|
23
23
|
'./packages/varlet-import-resolver/src',
|
|
24
24
|
];
|
|
25
|
-
const { stdout } = await
|
|
25
|
+
const { stdout } = await x('eslint', [
|
|
26
26
|
...eslintPatterns.filter((pattern) => isDir(resolve(CWD, pattern))),
|
|
27
27
|
'--fix',
|
|
28
28
|
'--cache',
|
|
29
29
|
'--ext',
|
|
30
30
|
ESLINT_EXTENSIONS.join(),
|
|
31
|
-
]);
|
|
31
|
+
], { nodeOptions: { stdio: 'inherit' }, throwOnError: true });
|
|
32
32
|
const type = stdout ? 'warn' : 'success';
|
|
33
33
|
spinner[type]({ text: stdout || 'eslint success' });
|
|
34
34
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fse from 'fs-extra';
|
|
2
2
|
import logger from '../shared/logger.js';
|
|
3
|
-
import
|
|
3
|
+
import { x } from 'tinyexec';
|
|
4
4
|
import { SITE_OUTPUT_PATH } from '../shared/constant.js';
|
|
5
5
|
const { pathExistsSync } = fse;
|
|
6
6
|
export async function preview() {
|
|
@@ -9,7 +9,7 @@ export async function preview() {
|
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
try {
|
|
12
|
-
await
|
|
12
|
+
await x('live-server', ['--port=5500'], { nodeOptions: { cwd: SITE_OUTPUT_PATH, stdio: 'inherit' } });
|
|
13
13
|
}
|
|
14
14
|
catch (e) {
|
|
15
15
|
logger.error(e.toString());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { x } from 'tinyexec';
|
|
2
2
|
import { VITEST_CONFIG } from '../shared/constant.js';
|
|
3
3
|
export async function test({ component, watch, coverage }) {
|
|
4
4
|
process.env.NODE_ENV = 'test';
|
|
@@ -12,5 +12,5 @@ export async function test({ component, watch, coverage }) {
|
|
|
12
12
|
if (component) {
|
|
13
13
|
args.push('--dir', `src/${component.trim()}`);
|
|
14
14
|
}
|
|
15
|
-
await
|
|
15
|
+
await x('vitest', args, { nodeOptions: { stdio: 'inherit' }, throwOnError: true });
|
|
16
16
|
}
|
|
@@ -6,11 +6,8 @@ import { replaceExt, smartAppendFileSync } from '../shared/fsUtils.js';
|
|
|
6
6
|
import { parse, resolve } from 'path';
|
|
7
7
|
import { getScriptExtname } from './compileScript.js';
|
|
8
8
|
import { CWD } from '../shared/constant.js';
|
|
9
|
-
import { createRequire } from 'module';
|
|
10
9
|
const { render: renderLess } = less;
|
|
11
|
-
const { renderSync: renderScss } = sass;
|
|
12
10
|
const { readFileSync, writeFileSync, unlinkSync } = fse;
|
|
13
|
-
const require = createRequire(import.meta.url);
|
|
14
11
|
export const EMPTY_SPACE_RE = /[\s]+/g;
|
|
15
12
|
export const EMPTY_LINE_RE = /[\n\r]*/g;
|
|
16
13
|
export const IMPORT_CSS_RE = /(?<!['"`])import\s+['"](\.{1,2}\/.+\.css)['"]\s*;?(?!\s*['"`])/g;
|
|
@@ -45,22 +42,10 @@ export async function compileLess(file) {
|
|
|
45
42
|
writeFileSync(replaceExt(file, '.css'), compressCss(css), 'utf-8');
|
|
46
43
|
}
|
|
47
44
|
export function compileScss(file) {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
data: source,
|
|
51
|
-
file,
|
|
52
|
-
importer(path) {
|
|
53
|
-
if (!path.endsWith('.scss') || !path.endsWith('.css')) {
|
|
54
|
-
path += '.scss';
|
|
55
|
-
}
|
|
56
|
-
if (path.startsWith('~')) {
|
|
57
|
-
path = path.replace('~', '');
|
|
58
|
-
path = require.resolve(path);
|
|
59
|
-
}
|
|
60
|
-
return { file: path };
|
|
61
|
-
},
|
|
45
|
+
const { css } = sass.compile(file, {
|
|
46
|
+
loadPaths: [resolve(CWD, 'node_modules')],
|
|
62
47
|
});
|
|
63
|
-
writeFileSync(replaceExt(file, '.css'), compressCss(css
|
|
48
|
+
writeFileSync(replaceExt(file, '.css'), compressCss(css), 'utf-8');
|
|
64
49
|
}
|
|
65
50
|
export function clearLessFiles(dir) {
|
|
66
51
|
glob.sync(`${dir}/**/*.less`).forEach(unlinkSync);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0-alpha.1726249557629",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "cli of varlet",
|
|
6
6
|
"bin": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"commander": "^8.3.0",
|
|
47
47
|
"ejs": "^3.1.8",
|
|
48
48
|
"esbuild": "0.19.3",
|
|
49
|
-
"
|
|
49
|
+
"tinyexec": "^0.3.0",
|
|
50
50
|
"fs-extra": "^9.0.1",
|
|
51
51
|
"glob": "^7.2.0",
|
|
52
52
|
"hash-sum": "^2.0.0",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"vite": "5.0.10",
|
|
62
62
|
"vitest": "2.0.5",
|
|
63
63
|
"vue": "3.4.21",
|
|
64
|
-
"@varlet/
|
|
65
|
-
"@varlet/
|
|
64
|
+
"@varlet/shared": "3.5.0-alpha.1726249557629",
|
|
65
|
+
"@varlet/vite-plugins": "3.5.0-alpha.1726249557629"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/babel__core": "^7.20.1",
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
"@types/node": "^18.7.20",
|
|
76
76
|
"@types/sharp": "0.31.1",
|
|
77
77
|
"rimraf": "^5.0.1",
|
|
78
|
-
"@varlet/
|
|
79
|
-
"@varlet/
|
|
80
|
-
"@varlet/
|
|
78
|
+
"@varlet/icons": "3.5.0-alpha.1726249557629",
|
|
79
|
+
"@varlet/ui": "3.5.0-alpha.1726249557629",
|
|
80
|
+
"@varlet/touch-emulator": "3.5.0-alpha.1726249557629"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"@vitest/coverage-istanbul": "2.0.5",
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
"live-server": "^1.2.1",
|
|
89
89
|
"vue": "3.4.21",
|
|
90
90
|
"vue-router": "4.2.0",
|
|
91
|
-
"@varlet/
|
|
92
|
-
"@varlet/
|
|
93
|
-
"@varlet/
|
|
91
|
+
"@varlet/icons": "3.5.0-alpha.1726249557629",
|
|
92
|
+
"@varlet/ui": "3.5.0-alpha.1726249557629",
|
|
93
|
+
"@varlet/touch-emulator": "3.5.0-alpha.1726249557629"
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
|
96
96
|
"dev": "tsc --watch",
|