Commit 6211ba877aa68ec6533f13149cc6e892548aa63e

Authored by vben
1 parent 70fba7ec

chore: repair window system execution command failure

build/jsc.js renamed to build/jsc.ts
1 1 // js调用cli 兼容调用ts
2 2  
3   -// const { sh } = require('tasksfile');
  3 +const { sh } = require('tasksfile');
4 4 const { argv } = require('yargs');
5   -const execa = require('execa');
  5 +// const execa = require('execa');
6 6  
7 7 let command = ``;
8 8  
... ... @@ -25,28 +25,28 @@ if (taskList.includes('build') || taskList.includes('report') || taskList.includ
25 25 }
26 26  
27 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 1 // #!/usr/bin/env node
2 2  
3   -// import { sh } from 'tasksfile';
  3 +import { sh } from 'tasksfile';
4 4  
5 5 import { argv } from 'yargs';
6 6 import { runBuildConfig } from './buildConf';
7 7 import { runUpdateHtml } from './updateHtml';
8   -import { errorConsole, successConsole, run } from '../utils';
  8 +import { errorConsole, successConsole } from '../utils';
9 9  
10 10 export const runBuild = async () => {
11 11 try {
12 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 20 // Generate configuration file
21 21 if (!argvList.includes('no-conf')) {
... ...
build/script/changelog.ts
1 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 6 export const runChangeLog = async () => {
7 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 18 successConsole('CHANGE_LOG.md generated successfully!');
28 19 } catch (error) {
29 20 errorConsole('CHANGE_LOG.md generated error\n' + error);
... ...
build/script/preserve.ts
... ... @@ -3,8 +3,8 @@
3 3 import path from 'path';
4 4 import fs from 'fs-extra';
5 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 9 const resolve = (dir: string) => {
10 10 return path.resolve(process.cwd(), dir);
... ... @@ -46,11 +46,10 @@ export async function runPreserve() {
46 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 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 54 successConsole('Dependency installation is successful, start running the project!');
56 55  
... ...
build/script/preview.ts
1 1 import chalk from 'chalk';
2 2 import Koa from 'koa';
3 3 import inquirer from 'inquirer';
4   -// import { sh } from 'tasksfile';
  4 +import { sh } from 'tasksfile';
5 5 import staticServer from 'koa-static';
6 6 import portfinder from 'portfinder';
7 7 import { resolve } from 'path';
8 8 import viteConfig from '../../vite.config';
9   -import { getIPAddress, run } from '../utils';
  9 +import { getIPAddress } from '../utils';
10 10  
11 11 const BUILD = 1;
12 12 const NO_BUILD = 2;
... ... @@ -53,11 +53,10 @@ export const runPreview = async () => {
53 53 });
54 54 const { type } = await prompt;
55 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 61 startApp();
63 62 };
... ...
build/utils.ts
... ... @@ -3,7 +3,7 @@ import path from 'path';
3 3 import { networkInterfaces } from 'os';
4 4 import dotenv from 'dotenv';
5 5 import chalk from 'chalk';
6   -import execa from 'execa';
  6 +// import execa from 'execa';
7 7  
8 8 export const isFunction = (arg: unknown): arg is (...args: any[]) => any =>
9 9 typeof arg === 'function';
... ... @@ -149,5 +149,5 @@ export function getCwdPath(...dir: string[]) {
149 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 3 "version": "2.0.0-rc.1",
4 4 "scripts": {
5 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 8 "build:site": "cross-env SITE=true npm run build ",
9 9 "build:no-cache": "yarn clean:cache && npm run build",
10 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 14 "clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite_opt_cache",
15 15 "clean:lib": "npx rimraf node_modules",
16 16 "ls-lint": "npx ls-lint",
... ... @@ -18,7 +18,7 @@
18 18 "lint:prettier": "prettier --write --loglevel warn \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"",
19 19 "lint:stylelint": "stylelint --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
20 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 23 "dependencies": {
24 24 "@iconify/iconify": "^2.0.0-rc.1",
... ...
src/components/Menu/src/index.less
... ... @@ -206,10 +206,10 @@
206 206 }
207 207  
208 208 .ant-menu-submenu-title {
209   - // margin: 0;
210 209 // line-height: @app-menu-item-height;
211 210 display: flex;
212 211 height: @app-menu-item-height;
  212 + margin: 0;
213 213 align-items: center;
214 214 }
215 215  
... ...
src/design/var/index.less
... ... @@ -18,4 +18,4 @@
18 18 // app menu
19 19  
20 20 // left-menu
21   -@app-menu-item-height: 48px;
  21 +@app-menu-item-height: 44px;
... ...