@varlet/cli 2.11.8 → 2.12.0-alpha.1687974059976

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.
@@ -4,8 +4,8 @@ interface PCLocationInfo {
4
4
  menuName: string;
5
5
  hash: string;
6
6
  }
7
- export declare type Theme = 'lightTheme' | 'darkTheme';
8
- export declare type StyleVars = Record<string, string>;
7
+ export type Theme = 'lightTheme' | 'darkTheme';
8
+ export type StyleVars = Record<string, string>;
9
9
  export declare function StyleProvider(styleVars?: StyleVars | null): void;
10
10
  export declare function getPCLocationInfo(): PCLocationInfo;
11
11
  export declare function getBrowserTheme(): Theme;
@@ -23,14 +23,12 @@ export function getCheckBlocks(html) {
23
23
  if (!children) {
24
24
  return;
25
25
  }
26
- const list = children.map((child) => {
27
- return child
28
- .replaceAll('<li>', '')
29
- .replaceAll('</li>', '')
30
- .replaceAll('<p>', '')
31
- .replaceAll('</p>', '')
32
- .replaceAll('\n', '');
33
- });
26
+ const list = children.map((child) => child
27
+ .replaceAll('<li>', '')
28
+ .replaceAll('</li>', '')
29
+ .replaceAll('<p>', '')
30
+ .replaceAll('</p>', '')
31
+ .replaceAll('\n', ''));
34
32
  checkBlocks.push({
35
33
  type,
36
34
  list,
@@ -1,3 +1,3 @@
1
1
  import { type ExtensionMode } from '../config/vite.config.js';
2
- export declare type ExtensionCommandMode = ExtensionMode;
2
+ export type ExtensionCommandMode = ExtensionMode;
3
3
  export declare function extension(mode: ExtensionCommandMode): Promise<void>;
@@ -12,35 +12,33 @@ async function removeDir() {
12
12
  await Promise.all([ensureDir(ICONS_FONTS_DIR), ensureDir(ICONS_CSS_DIR), ensureDir(ICONS_PNG_DIR)]);
13
13
  }
14
14
  async function buildPNG(svgFiles) {
15
- await Promise.all(svgFiles.map((svg) => {
16
- return new Promise((done) => {
17
- const { name } = parse(svg);
18
- sharp(resolve(ICONS_SVG_DIR, svg))
19
- .resize({ height: 100 })
20
- .toBuffer()
21
- .then((buffer) => {
22
- sharp({
23
- create: {
24
- width: 100,
25
- height: 100,
26
- channels: 4,
27
- background: '#4a7afe',
28
- },
29
- })
30
- .composite([
31
- {
32
- input: buffer,
33
- blend: 'dest-in',
34
- },
35
- ])
36
- .png()
37
- .toFile(resolve(ICONS_PNG_DIR, `${name}.png`))
38
- .then(() => {
39
- done();
40
- });
15
+ await Promise.all(svgFiles.map((svg) => new Promise((done) => {
16
+ const { name } = parse(svg);
17
+ sharp(resolve(ICONS_SVG_DIR, svg))
18
+ .resize({ height: 100 })
19
+ .toBuffer()
20
+ .then((buffer) => {
21
+ sharp({
22
+ create: {
23
+ width: 100,
24
+ height: 100,
25
+ channels: 4,
26
+ background: '#4a7afe',
27
+ },
28
+ })
29
+ .composite([
30
+ {
31
+ input: buffer,
32
+ blend: 'dest-in',
33
+ },
34
+ ])
35
+ .png()
36
+ .toFile(resolve(ICONS_PNG_DIR, `${name}.png`))
37
+ .then(() => {
38
+ done();
41
39
  });
42
40
  });
43
- }));
41
+ })));
44
42
  }
45
43
  function buildWebFont(name) {
46
44
  return webfont.default({
@@ -88,11 +86,9 @@ ${iconNames.join(',\n')}
88
86
  }
89
87
 
90
88
  ${icons
91
- .map((icon) => {
92
- return `.${namespace}-${icon.name}::before {
89
+ .map((icon) => `.${namespace}-${icon.name}::before {
93
90
  content: "\\${icon.pointCode}";
94
- }`;
95
- })
91
+ }`)
96
92
  .join('\n\n')}
97
93
  `;
98
94
  await Promise.all([
@@ -9,12 +9,6 @@ export async function lint() {
9
9
  spinner.start({ text: 'prettier starting...' });
10
10
  await execa('prettier', ['--write', '--cache', '.']);
11
11
  spinner.success({ text: 'prettier success' });
12
- spinner.start({ text: 'stylelint starting...' });
13
- const stylelintPattern = ['./src/**/*.vue', './src/**/*.css', './src/**/*.less'];
14
- const hasPackages = isDir(resolve(CWD, 'packages'));
15
- hasPackages && stylelintPattern.push('./packages/**/*.vue', './packages/**/*.css', './packages/**/*.less');
16
- await execa('stylelint', [...stylelintPattern, '--fix', '--cache']);
17
- spinner.success({ text: 'stylelint success' });
18
12
  spinner.start({ text: 'eslint starting...' });
19
13
  const eslintPatterns = [
20
14
  './src',
@@ -22,8 +16,10 @@ export async function lint() {
22
16
  './packages/varlet-ui/src',
23
17
  './packages/varlet-icons/lib',
24
18
  './packages/varlet-vite-plugins/src',
19
+ './packages/varlet-use/src',
25
20
  './packages/varlet-touch-emulator',
26
21
  './packages/varlet-vscode-extension/src',
22
+ './packages/varlet-ui-playground/src',
27
23
  ];
28
24
  const { stdout } = await execa('eslint', [
29
25
  ...eslintPatterns.filter((pattern) => isDir(resolve(CWD, pattern))),
@@ -1,2 +1,2 @@
1
- export declare type ViteCommandMode = 'dev' | 'build';
1
+ export type ViteCommandMode = 'dev' | 'build';
2
2
  export declare function vite(mode: ViteCommandMode): Promise<void>;
@@ -11,7 +11,7 @@ const EXAMPLE_INDEX_RE = /\/([-\w]+)\/example\/index(?:.draft)?\.vue/;
11
11
  const COMPONENT_DOCS_RE = /\/([-\w]+)\/docs\/([-\w]+)(?:.draft)?\.md/;
12
12
  export function getExampleRoutePath(examplePath) {
13
13
  var _a;
14
- return '/' + ((_a = examplePath.match(EXAMPLE_INDEX_RE)) === null || _a === void 0 ? void 0 : _a[1]);
14
+ return '/' + ((_a = examplePath.match(EXAMPLE_INDEX_RE)) === null || _a === void 0 ? void 0 : _a[1]); // eslint-disable-line
15
15
  }
16
16
  export function getComponentDocRoutePath(componentDocsPath) {
17
17
  var _a;
@@ -49,14 +49,10 @@ export async function findExamples(draftMode) {
49
49
  glob(`${SRC_DIR}/**/${EXAMPLE_DIR_NAME}/index.draft.vue`),
50
50
  ]);
51
51
  const mergedExamples = [...examples, ...draftExamples];
52
- return mergedExamples.filter((example) => {
53
- return draftMode ? isDraftExample(example) || !hasDraftExample(mergedExamples, example) : !isDraftExample(example);
54
- });
52
+ return mergedExamples.filter((example) => draftMode ? isDraftExample(example) || !hasDraftExample(mergedExamples, example) : !isDraftExample(example));
55
53
  }
56
54
  export function filterDraftDocs(docs, draftMode) {
57
- return docs.filter((doc) => {
58
- return draftMode ? isDraftDoc(doc) || !hasDraftDoc(docs, doc) : !isDraftDoc(doc);
59
- });
55
+ return docs.filter((doc) => (draftMode ? isDraftDoc(doc) || !hasDraftDoc(docs, doc) : !isDraftDoc(doc)));
60
56
  }
61
57
  export async function findComponentDocs(draftMode) {
62
58
  const componentDocs = await glob(`${SRC_DIR}/**/${DOCS_DIR_NAME}/*.md`);
@@ -4,6 +4,7 @@ import glob from 'glob';
4
4
  import { replaceExt, smartAppendFileSync } from '../shared/fsUtils.js';
5
5
  import { parse, resolve } from 'path';
6
6
  import { getScriptExtname } from './compileScript.js';
7
+ import { CWD } from '../shared/constant.js';
7
8
  const { render } = less;
8
9
  const { readFileSync, writeFileSync, unlinkSync } = fse;
9
10
  export const EMPTY_SPACE_RE = /[\s]+/g;
@@ -32,7 +33,10 @@ export function extractStyleDependencies(file, code, styleReg) {
32
33
  }
33
34
  export async function compileLess(file) {
34
35
  const source = readFileSync(file, 'utf-8');
35
- const { css } = await render(source, { filename: file });
36
+ const { css } = await render(source, {
37
+ filename: file,
38
+ paths: [resolve(CWD, 'node_modules')],
39
+ });
36
40
  writeFileSync(replaceExt(file, '.css'), clearEmptyLine(css), 'utf-8');
37
41
  }
38
42
  export function clearLessFiles(dir) {
@@ -9,5 +9,5 @@ export interface BundleBuildOptions {
9
9
  emptyOutDir: boolean;
10
10
  }
11
11
  export declare function getBundleConfig(varletConfig: Required<VarletConfig>, buildOptions: BundleBuildOptions): InlineConfig;
12
- export declare type ExtensionMode = 'dev' | 'build';
12
+ export type ExtensionMode = 'dev' | 'build';
13
13
  export declare function getExtensionConfig(mode: ExtensionMode): InlineConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/cli",
3
- "version": "2.11.8",
3
+ "version": "2.12.0-alpha.1687974059976",
4
4
  "type": "module",
5
5
  "description": "cli of varlet",
6
6
  "bin": {
@@ -35,16 +35,16 @@
35
35
  "url": "https://github.com/varletjs/varlet/issues"
36
36
  },
37
37
  "dependencies": {
38
- "@babel/core": "^7.14.8",
39
- "@babel/helper-plugin-utils": "^7.14.5",
40
- "@babel/plugin-transform-typescript": "^7.14.5",
41
- "@babel/preset-env": "^7.14.8",
42
- "@babel/preset-typescript": "^7.14.5",
43
- "@vitejs/plugin-vue": "4.2.2",
38
+ "@babel/core": "^7.22.5",
39
+ "@babel/helper-plugin-utils": "^7.22.5",
40
+ "@babel/plugin-transform-typescript": "^7.22.5",
41
+ "@babel/preset-env": "^7.22.5",
42
+ "@babel/preset-typescript": "^7.22.5",
43
+ "@vitejs/plugin-vue": "4.2.3",
44
44
  "@vitejs/plugin-vue-jsx": "3.0.1",
45
- "@vue/babel-plugin-jsx": "1.1.1",
46
- "@vue/compiler-sfc": "3.3.1",
47
- "@vue/runtime-core": "3.3.1",
45
+ "@vue/babel-plugin-jsx": "1.1.4",
46
+ "@vue/compiler-sfc": "3.3.4",
47
+ "@vue/runtime-core": "3.3.4",
48
48
  "@vue/vue3-jest": "^29.2.3",
49
49
  "babel-jest": "^29.5.0",
50
50
  "chokidar": "^3.5.2",
@@ -66,15 +66,15 @@
66
66
  "semver": "^7.3.5",
67
67
  "sharp": "0.31.1",
68
68
  "slash": "^3.0.0",
69
- "typescript": "^4.4.4",
69
+ "typescript": "^5.1.5",
70
70
  "vite": "4.3.5",
71
- "vue": "3.3.2",
71
+ "vue": "3.3.4",
72
72
  "webfont": "^9.0.0",
73
- "@varlet/shared": "2.11.8",
74
- "@varlet/vite-plugins": "2.11.8"
73
+ "@varlet/shared": "2.12.0-alpha.1687974059976",
74
+ "@varlet/vite-plugins": "2.12.0-alpha.1687974059976"
75
75
  },
76
76
  "devDependencies": {
77
- "@types/babel__core": "^7.1.12",
77
+ "@types/babel__core": "^7.20.1",
78
78
  "@types/ejs": "^3.1.1",
79
79
  "@types/fs-extra": "^9.0.2",
80
80
  "@types/glob": "^7.1.3",
@@ -85,19 +85,19 @@
85
85
  "@types/node": "^18.7.20",
86
86
  "@types/semver": "^7.3.9",
87
87
  "@types/sharp": "0.31.1",
88
- "@varlet/touch-emulator": "2.11.8",
89
- "@varlet/icons": "2.11.8"
88
+ "@varlet/touch-emulator": "2.12.0-alpha.1687974059976",
89
+ "@varlet/icons": "2.12.0-alpha.1687974059976"
90
90
  },
91
91
  "peerDependencies": {
92
- "@vue/runtime-core": "3.2.47",
92
+ "@vue/runtime-core": "3.3.4",
93
93
  "@vue/test-utils": "2.3.2",
94
94
  "clipboard": "^2.0.6",
95
95
  "live-server": "^1.2.1",
96
96
  "lodash-es": "^4.17.21",
97
- "vue": "3.3.1",
97
+ "vue": "3.3.4",
98
98
  "vue-router": "4.2.0",
99
- "@varlet/icons": "2.11.8",
100
- "@varlet/touch-emulator": "2.11.8"
99
+ "@varlet/icons": "2.12.0-alpha.1687974059976",
100
+ "@varlet/touch-emulator": "2.12.0-alpha.1687974059976"
101
101
  },
102
102
  "scripts": {
103
103
  "dev": "tsc --watch",
@@ -107,7 +107,7 @@ const TransitionGroupHost = {
107
107
 
108
108
  if (isAllowMultiple) reactiveSnackOptions.position = 'top'
109
109
 
110
- const position = isAllowMultiple ? 'relative' : 'absolute' // avoid stylelint value-keyword-case error
110
+ const position = isAllowMultiple ? 'relative' : 'absolute'
111
111
 
112
112
  const style = {
113
113
  position,
@@ -126,7 +126,7 @@ const TransitionGroupHost = {
126
126
  )
127
127
  })
128
128
 
129
- const zindex = context.zIndex // avoid stylelint value-keyword-case error
129
+ const zindex = context.zIndex
130
130
 
131
131
  return (
132
132
  <TransitionGroup
@@ -142,7 +142,7 @@ watch(
142
142
  <style>
143
143
  .varlet-site-playground-container {
144
144
  width: calc(100vw - 256px);
145
- max-width: 1360px;
145
+ max-width: 1660px;
146
146
  height: 100vh;
147
147
  }
148
148
 
@@ -0,0 +1,18 @@
1
+ {
2
+ "root": true,
3
+ "ignorePatterns": [
4
+ "lib/**",
5
+ "es/**",
6
+ "umd/**",
7
+ "site/**",
8
+ "public/**",
9
+ "src/*/__tests__/**",
10
+ "coverage/**",
11
+ "highlight/**",
12
+ "types/index.d.ts",
13
+ ".varlet/**"
14
+ ],
15
+ "extends": [
16
+ "@varlet"
17
+ ]
18
+ }
@@ -3,6 +3,7 @@ node_modules
3
3
  .varlet
4
4
  .idea
5
5
  .vscode
6
+ .history
6
7
  *.log
7
8
  .DS_Store
8
9
  index.draft.vue
@@ -15,6 +16,4 @@ umd
15
16
  coverage
16
17
  highlight
17
18
 
18
-
19
- .eslintcache
20
- .stylelintcache
19
+ .eslintcache
@@ -40,64 +40,29 @@
40
40
  "@varlet/cli": "workspace:*",
41
41
  "@varlet/eslint-config": "workspace:*",
42
42
  "@varlet/icons": "workspace:*",
43
- "@varlet/stylelint-config": "workspace:*",
44
43
  "@varlet/touch-emulator": "workspace:*",
45
44
  "@varlet/shared": "workspace:*",
46
45
  "@vue/test-utils": "2.3.2",
46
+ "@vue/runtime-core": "3.3.4",
47
47
  "clipboard": "^2.0.6",
48
- "eslint": "^7.30.0",
48
+ "eslint": "^8.43.0",
49
49
  "lint-staged": "^10.5.0",
50
50
  "live-server": "^1.2.1",
51
51
  "lodash-es": "^4.17.21",
52
- "prettier": "^2.3.2",
52
+ "prettier": "^2.8.8",
53
53
  "simple-git-hooks": "^2.8.0",
54
- "stylelint": "^13.13.1",
55
- "typescript": "^4.4.4",
56
- "vue": "3.3.2",
54
+ "typescript": "^5.1.5",
55
+ "vue": "3.3.4",
57
56
  "vue-router": "4.2.0"
58
57
  },
59
58
  "lint-staged": {
60
59
  "*.{ts,tsx,js,vue,less}": "prettier --write",
61
- "*.{ts,tsx,js,vue}": "eslint --fix",
62
- "*.{vue,css,less}": "stylelint --fix"
60
+ "*.{ts,tsx,js,vue}": "eslint --fix"
63
61
  },
64
62
  "simple-git-hooks": {
65
63
  "pre-commit": "pnpm exec lint-staged --allow-empty --concurrent false",
66
64
  "commit-msg": "pnpm exec varlet-cli commit-lint $1"
67
65
  },
68
- "eslintConfig": {
69
- "root": true,
70
- "ignorePatterns": [
71
- "lib/**",
72
- "es/**",
73
- "umd/**",
74
- "site/**",
75
- "public/**",
76
- "src/*/__tests__/**",
77
- "coverage/**",
78
- "highlight/**",
79
- "types/index.d.ts",
80
- ".varlet/**"
81
- ],
82
- "extends": [
83
- "@varlet"
84
- ]
85
- },
86
- "stylelint": {
87
- "extends": [
88
- "@varlet/stylelint-config"
89
- ],
90
- "ignoreFiles": [
91
- "lib/**",
92
- "es/**",
93
- "umd/**",
94
- "site/**",
95
- "coverage/**",
96
- "public/**",
97
- "highlight/**",
98
- ".varlet/**"
99
- ]
100
- },
101
66
  "browserslist": [
102
67
  "Chrome >= 54",
103
68
  "iOS >= 10"
@@ -1,109 +0,0 @@
1
- {
2
- "name": "@varlet/ui",
3
- "version": "0.0.0",
4
- "description": "A components library example",
5
- "main": "lib/varlet.cjs.js",
6
- "module": "es/index.mjs",
7
- "typings": "types/index.d.ts",
8
- "web-types": "highlight/web-types.en-US.json",
9
- "keywords": [
10
- "Vue",
11
- "UI"
12
- ],
13
- "license": "MIT",
14
- "sideEffects": [
15
- "es/**/style/*",
16
- "lib/**/style/*",
17
- "es/style.mjs",
18
- "lib/style.js",
19
- "*.css"
20
- ],
21
- "scripts": {
22
- "preinstall": "npx only-allow pnpm",
23
- "postinstall": "simple-git-hooks",
24
- "dev": "varlet-cli dev",
25
- "build": "varlet-cli build",
26
- "preview": "varlet-cli preview",
27
- "compile": "varlet-cli compile",
28
- "lint": "varlet-cli lint",
29
- "changelog": "varlet-cli changelog",
30
- "release": "pnpm compile && varlet-cli release",
31
- "test": "varlet-cli jest",
32
- "test:watch": "varlet-cli jest -w",
33
- "test:watchAll": "varlet-cli jest -wa",
34
- "create": "varlet-cli create"
35
- },
36
- "peerDependencies": {
37
- "vue": "^3.2.0"
38
- },
39
- "devDependencies": {
40
- "@varlet/cli": "workspace:*",
41
- "@varlet/eslint-config": "workspace:*",
42
- "@varlet/icons": "workspace:*",
43
- "@varlet/stylelint-config": "workspace:*",
44
- "@varlet/touch-emulator": "workspace:*",
45
- "@varlet/shared": "workspace:*",
46
- "@vue/test-utils": "2.3.2",
47
- "clipboard": "^2.0.6",
48
- "eslint": "^7.30.0",
49
- "lint-staged": "^10.5.0",
50
- "live-server": "^1.2.1",
51
- "lodash-es": "^4.17.21",
52
- "prettier": "^2.3.2",
53
- "simple-git-hooks": "^2.8.0",
54
- "stylelint": "^13.13.1",
55
- "typescript": "^4.4.4",
56
- "vue": "3.3.2",
57
- "vue-router": "4.2.0"
58
- },
59
- "lint-staged": {
60
- "*.{ts,tsx,js,vue,less}": "prettier --write",
61
- "*.{ts,tsx,js,vue}": "eslint --fix",
62
- "*.{vue,css,less}": "stylelint --fix"
63
- },
64
- "simple-git-hooks": {
65
- "pre-commit": "pnpm exec lint-staged --allow-empty --concurrent false",
66
- "commit-msg": "pnpm exec varlet-cli commit-lint $1"
67
- },
68
- "eslintConfig": {
69
- "root": true,
70
- "ignorePatterns": [
71
- "lib/**",
72
- "es/**",
73
- "umd/**",
74
- "site/**",
75
- "public/**",
76
- "src/*/__tests__/**",
77
- "coverage/**",
78
- "highlight/**",
79
- "types/index.d.ts",
80
- ".varlet/**"
81
- ],
82
- "extends": [
83
- "@varlet"
84
- ]
85
- },
86
- "stylelint": {
87
- "extends": [
88
- "@varlet/stylelint-config"
89
- ],
90
- "ignoreFiles": [
91
- "lib/**",
92
- "es/**",
93
- "umd/**",
94
- "site/**",
95
- "coverage/**",
96
- "public/**",
97
- "highlight/**",
98
- ".varlet/**"
99
- ]
100
- },
101
- "browserslist": [
102
- "Chrome >= 54",
103
- "iOS >= 10"
104
- ],
105
- "packageManager": "pnpm@8.0.0",
106
- "engines": {
107
- "pnpm": ">=8.0"
108
- }
109
- }