Commit 6211ba877aa68ec6533f13149cc6e892548aa63e

Authored by vben
1 parent 70fba7ec

chore: repair window system execution command failure

build/jsc.js renamed to build/jsc.ts
1 // js调用cli 兼容调用ts 1 // js调用cli 兼容调用ts
2 2
3 -// const { sh } = require('tasksfile'); 3 +const { sh } = require('tasksfile');
4 const { argv } = require('yargs'); 4 const { argv } = require('yargs');
5 -const execa = require('execa'); 5 +// const execa = require('execa');
6 6
7 let command = ``; 7 let command = ``;
8 8
@@ -25,28 +25,28 @@ if (taskList.includes('build') || taskList.includes('report') || taskList.includ @@ -25,28 +25,28 @@ if (taskList.includes('build') || taskList.includes('report') || taskList.includ
25 } 25 }
26 26
27 if (taskList && Array.isArray(taskList) && taskList.length) { 27 if (taskList && Array.isArray(taskList) && taskList.length) {
28 - execa(  
29 - 'cross-env',  
30 - [  
31 - `NODE_ENV=${NODE_ENV}`,  
32 - 'ts-node',  
33 - '--project',  
34 - './build/tsconfig.json',  
35 - './build/script/cli.ts',  
36 - taskList.join(' '),  
37 - command,  
38 - ],  
39 - {  
40 - stdio: 'inherit',  
41 - }  
42 - );  
43 - // sh(  
44 - // `cross-env NODE_ENV=${NODE_ENV} ts-node --project ./build/tsconfig.json ./build/script/cli.ts ${taskList.join(  
45 - // ' '  
46 - // )} ${command}`, 28 + // execa(
  29 + // 'cross-env',
  30 + // [
  31 + // `NODE_ENV=${NODE_ENV}`,
  32 + // 'ts-node',
  33 + // '--project',
  34 + // './build/tsconfig.json',
  35 + // './build/script/cli.ts',
  36 + // taskList.join(' '),
  37 + // command,
  38 + // ],
47 // { 39 // {
48 - // async: true,  
49 - // nopipe: true, 40 + // stdio: 'inherit',
50 // } 41 // }
51 // ); 42 // );
  43 + sh(
  44 + `cross-env NODE_ENV=${NODE_ENV} ts-node --files -P ./build/tsconfig.json ./build/script/cli.ts ${taskList.join(
  45 + ' '
  46 + )} ${command}`,
  47 + {
  48 + async: true,
  49 + nopipe: true,
  50 + }
  51 + );
52 } 52 }
build/script/build.ts
1 // #!/usr/bin/env node 1 // #!/usr/bin/env node
2 2
3 -// import { sh } from 'tasksfile'; 3 +import { sh } from 'tasksfile';
4 4
5 import { argv } from 'yargs'; 5 import { argv } from 'yargs';
6 import { runBuildConfig } from './buildConf'; 6 import { runBuildConfig } from './buildConf';
7 import { runUpdateHtml } from './updateHtml'; 7 import { runUpdateHtml } from './updateHtml';
8 -import { errorConsole, successConsole, run } from '../utils'; 8 +import { errorConsole, successConsole } from '../utils';
9 9
10 export const runBuild = async () => { 10 export const runBuild = async () => {
11 try { 11 try {
12 const argvList = argv._; 12 const argvList = argv._;
13 - // let cmd = `cross-env NODE_ENV=production vite build`;  
14 - await run('cross-env', ['NODE_ENV=production', 'vite', 'build']);  
15 - // await sh(cmd, {  
16 - // async: true,  
17 - // nopipe: true,  
18 - // }); 13 + let cmd = `cross-env NODE_ENV=production vite build`;
  14 + // await run('cross-env', ['NODE_ENV=production', 'vite', 'build']);
  15 + await sh(cmd, {
  16 + async: true,
  17 + nopipe: true,
  18 + });
19 19
20 // Generate configuration file 20 // Generate configuration file
21 if (!argvList.includes('no-conf')) { 21 if (!argvList.includes('no-conf')) {
build/script/changelog.ts
1 // #!/usr/bin/env node 1 // #!/usr/bin/env node
2 2
3 -// import { sh } from 'tasksfile';  
4 -import { errorConsole, successConsole, run } from '../utils'; 3 +import { sh } from 'tasksfile';
  4 +import { errorConsole, successConsole } from '../utils';
5 5
6 export const runChangeLog = async () => { 6 export const runChangeLog = async () => {
7 try { 7 try {
8 - // let cmd = `conventional-changelog -p custom-config -i CHANGELOG.md -s -r 0 `;  
9 - await run('conventional-changelog', [  
10 - '-p',  
11 - 'custom-config',  
12 - '-i',  
13 - 'CHANGELOG.md',  
14 - '-s',  
15 - '-r',  
16 - '-0',  
17 - ]);  
18 - // await sh(cmd, {  
19 - // async: true,  
20 - // nopipe: true,  
21 - // });  
22 - await run('prettier', ['--write', '**/CHANGELOG.md']);  
23 - // await sh('prettier --write **/CHANGELOG.md ', {  
24 - // async: true,  
25 - // nopipe: true,  
26 - // }); 8 + let cmd = `conventional-changelog -p custom-config -i CHANGELOG.md -s -r 0 `;
  9 +
  10 + await sh(cmd, {
  11 + async: true,
  12 + nopipe: true,
  13 + });
  14 + await sh('prettier --write **/CHANGELOG.md ', {
  15 + async: true,
  16 + nopipe: true,
  17 + });
27 successConsole('CHANGE_LOG.md generated successfully!'); 18 successConsole('CHANGE_LOG.md generated successfully!');
28 } catch (error) { 19 } catch (error) {
29 errorConsole('CHANGE_LOG.md generated error\n' + error); 20 errorConsole('CHANGE_LOG.md generated error\n' + error);
build/script/preserve.ts
@@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@
3 import path from 'path'; 3 import path from 'path';
4 import fs from 'fs-extra'; 4 import fs from 'fs-extra';
5 import { isEqual } from 'lodash'; 5 import { isEqual } from 'lodash';
6 -// import { sh } from 'tasksfile';  
7 -import { successConsole, errorConsole, run } from '../utils'; 6 +import { sh } from 'tasksfile';
  7 +import { successConsole, errorConsole } from '../utils';
8 8
9 const resolve = (dir: string) => { 9 const resolve = (dir: string) => {
10 return path.resolve(process.cwd(), dir); 10 return path.resolve(process.cwd(), dir);
@@ -46,11 +46,10 @@ export async function runPreserve() { @@ -46,11 +46,10 @@ export async function runPreserve() {
46 'A dependency change is detected, and the dependency is being installed to ensure that the dependency is consistent! (Tip: The project will be executed for the first time)!' 46 'A dependency change is detected, and the dependency is being installed to ensure that the dependency is consistent! (Tip: The project will be executed for the first time)!'
47 ); 47 );
48 try { 48 try {
49 - await run('npm', ['run', 'bootstrap']);  
50 - // await sh('npm run bootstrap ', {  
51 - // async: true,  
52 - // nopipe: true,  
53 - // }); 49 + await sh('npm run bootstrap ', {
  50 + async: true,
  51 + nopipe: true,
  52 + });
54 53
55 successConsole('Dependency installation is successful, start running the project!'); 54 successConsole('Dependency installation is successful, start running the project!');
56 55
build/script/preview.ts
1 import chalk from 'chalk'; 1 import chalk from 'chalk';
2 import Koa from 'koa'; 2 import Koa from 'koa';
3 import inquirer from 'inquirer'; 3 import inquirer from 'inquirer';
4 -// import { sh } from 'tasksfile'; 4 +import { sh } from 'tasksfile';
5 import staticServer from 'koa-static'; 5 import staticServer from 'koa-static';
6 import portfinder from 'portfinder'; 6 import portfinder from 'portfinder';
7 import { resolve } from 'path'; 7 import { resolve } from 'path';
8 import viteConfig from '../../vite.config'; 8 import viteConfig from '../../vite.config';
9 -import { getIPAddress, run } from '../utils'; 9 +import { getIPAddress } from '../utils';
10 10
11 const BUILD = 1; 11 const BUILD = 1;
12 const NO_BUILD = 2; 12 const NO_BUILD = 2;
@@ -53,11 +53,10 @@ export const runPreview = async () => { @@ -53,11 +53,10 @@ export const runPreview = async () => {
53 }); 53 });
54 const { type } = await prompt; 54 const { type } = await prompt;
55 if (type === BUILD) { 55 if (type === BUILD) {
56 - await run('npm', ['run', 'build']);  
57 - // await sh('npm run build', {  
58 - // async: true,  
59 - // nopipe: true,  
60 - // }); 56 + await sh('npm run build', {
  57 + async: true,
  58 + nopipe: true,
  59 + });
61 } 60 }
62 startApp(); 61 startApp();
63 }; 62 };
build/utils.ts
@@ -3,7 +3,7 @@ import path from 'path'; @@ -3,7 +3,7 @@ import path from 'path';
3 import { networkInterfaces } from 'os'; 3 import { networkInterfaces } from 'os';
4 import dotenv from 'dotenv'; 4 import dotenv from 'dotenv';
5 import chalk from 'chalk'; 5 import chalk from 'chalk';
6 -import execa from 'execa'; 6 +// import execa from 'execa';
7 7
8 export const isFunction = (arg: unknown): arg is (...args: any[]) => any => 8 export const isFunction = (arg: unknown): arg is (...args: any[]) => any =>
9 typeof arg === 'function'; 9 typeof arg === 'function';
@@ -149,5 +149,5 @@ export function getCwdPath(...dir: string[]) { @@ -149,5 +149,5 @@ export function getCwdPath(...dir: string[]) {
149 return path.resolve(process.cwd(), ...dir); 149 return path.resolve(process.cwd(), ...dir);
150 } 150 }
151 151
152 -export const run = (bin: string, args: any, opts = {}) =>  
153 - execa(bin, args, { stdio: 'inherit', ...opts }); 152 +// export const run = (bin: string, args: any, opts = {}) =>
  153 +// execa(bin, args, { stdio: 'inherit', ...opts });
package.json
@@ -3,14 +3,14 @@ @@ -3,14 +3,14 @@
3 "version": "2.0.0-rc.1", 3 "version": "2.0.0-rc.1",
4 "scripts": { 4 "scripts": {
5 "bootstrap": "yarn install", 5 "bootstrap": "yarn install",
6 - "serve": "node ./build/jsc.js preserve && cross-env NODE_ENV=development vite",  
7 - "build": "node ./build/jsc.js build", 6 + "serve": "node ./build/jsc.ts preserve && cross-env NODE_ENV=development vite",
  7 + "build": "node ./build/jsc.ts build",
8 "build:site": "cross-env SITE=true npm run build ", 8 "build:site": "cross-env SITE=true npm run build ",
9 "build:no-cache": "yarn clean:cache && npm run build", 9 "build:no-cache": "yarn clean:cache && npm run build",
10 "report": "cross-env REPORT=true npm run build ", 10 "report": "cross-env REPORT=true npm run build ",
11 - "preview": "node ./build/jsc.js preview",  
12 - "log": "node ./build/jsc.js log",  
13 - "gen:gz": "node ./build/jsc.js gzip", 11 + "preview": "node ./build/jsc.ts preview",
  12 + "log": "node ./build/jsc.ts log",
  13 + "gen:gz": "node ./build/jsc.ts gzip",
14 "clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite_opt_cache", 14 "clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite_opt_cache",
15 "clean:lib": "npx rimraf node_modules", 15 "clean:lib": "npx rimraf node_modules",
16 "ls-lint": "npx ls-lint", 16 "ls-lint": "npx ls-lint",
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 "lint:prettier": "prettier --write --loglevel warn \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"", 18 "lint:prettier": "prettier --write --loglevel warn \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"",
19 "lint:stylelint": "stylelint --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", 19 "lint:stylelint": "stylelint --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
20 "reinstall": "rimraf node_modules && rimraf yarn.lock && rimraf package.lock.json && npm run bootstrap", 20 "reinstall": "rimraf node_modules && rimraf yarn.lock && rimraf package.lock.json && npm run bootstrap",
21 - "postinstall": "node ./build/jsc.js postinstall" 21 + "postinstall": "node ./build/jsc.ts postinstall"
22 }, 22 },
23 "dependencies": { 23 "dependencies": {
24 "@iconify/iconify": "^2.0.0-rc.1", 24 "@iconify/iconify": "^2.0.0-rc.1",
src/components/Menu/src/index.less
@@ -206,10 +206,10 @@ @@ -206,10 +206,10 @@
206 } 206 }
207 207
208 .ant-menu-submenu-title { 208 .ant-menu-submenu-title {
209 - // margin: 0;  
210 // line-height: @app-menu-item-height; 209 // line-height: @app-menu-item-height;
211 display: flex; 210 display: flex;
212 height: @app-menu-item-height; 211 height: @app-menu-item-height;
  212 + margin: 0;
213 align-items: center; 213 align-items: center;
214 } 214 }
215 215
src/design/var/index.less
@@ -18,4 +18,4 @@ @@ -18,4 +18,4 @@
18 // app menu 18 // app menu
19 19
20 // left-menu 20 // left-menu
21 -@app-menu-item-height: 48px; 21 +@app-menu-item-height: 44px;