提交 6211ba87 作者: vben

chore: repair window system execution command failure

上级 70fba7ec
// js调用cli 兼容调用ts // js调用cli 兼容调用ts
// const { sh } = require('tasksfile'); const { sh } = require('tasksfile');
const { argv } = require('yargs'); const { argv } = require('yargs');
const execa = require('execa'); // const execa = require('execa');
let command = ``; let command = ``;
...@@ -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
} }
if (taskList && Array.isArray(taskList) && taskList.length) { if (taskList && Array.isArray(taskList) && taskList.length) {
execa( // execa(
'cross-env', // 'cross-env',
[ // [
`NODE_ENV=${NODE_ENV}`, // `NODE_ENV=${NODE_ENV}`,
'ts-node', // 'ts-node',
'--project', // '--project',
'./build/tsconfig.json', // './build/tsconfig.json',
'./build/script/cli.ts', // './build/script/cli.ts',
taskList.join(' '), // taskList.join(' '),
command, // command,
], // ],
{
stdio: 'inherit',
}
);
// sh(
// `cross-env NODE_ENV=${NODE_ENV} ts-node --project ./build/tsconfig.json ./build/script/cli.ts ${taskList.join(
// ' '
// )} ${command}`,
// { // {
// async: true, // stdio: 'inherit',
// nopipe: true,
// } // }
// ); // );
sh(
`cross-env NODE_ENV=${NODE_ENV} ts-node --files -P ./build/tsconfig.json ./build/script/cli.ts ${taskList.join(
' '
)} ${command}`,
{
async: true,
nopipe: true,
}
);
} }
// #!/usr/bin/env node // #!/usr/bin/env node
// import { sh } from 'tasksfile'; import { sh } from 'tasksfile';
import { argv } from 'yargs'; import { argv } from 'yargs';
import { runBuildConfig } from './buildConf'; import { runBuildConfig } from './buildConf';
import { runUpdateHtml } from './updateHtml'; import { runUpdateHtml } from './updateHtml';
import { errorConsole, successConsole, run } from '../utils'; import { errorConsole, successConsole } from '../utils';
export const runBuild = async () => { export const runBuild = async () => {
try { try {
const argvList = argv._; const argvList = argv._;
// let cmd = `cross-env NODE_ENV=production vite build`; let cmd = `cross-env NODE_ENV=production vite build`;
await run('cross-env', ['NODE_ENV=production', 'vite', 'build']); // await run('cross-env', ['NODE_ENV=production', 'vite', 'build']);
// await sh(cmd, { await sh(cmd, {
// async: true, async: true,
// nopipe: true, nopipe: true,
// }); });
// Generate configuration file // Generate configuration file
if (!argvList.includes('no-conf')) { if (!argvList.includes('no-conf')) {
......
// #!/usr/bin/env node // #!/usr/bin/env node
// import { sh } from 'tasksfile'; import { sh } from 'tasksfile';
import { errorConsole, successConsole, run } from '../utils'; import { errorConsole, successConsole } from '../utils';
export const runChangeLog = async () => { export const runChangeLog = async () => {
try { try {
// let cmd = `conventional-changelog -p custom-config -i CHANGELOG.md -s -r 0 `; let cmd = `conventional-changelog -p custom-config -i CHANGELOG.md -s -r 0 `;
await run('conventional-changelog', [
'-p', await sh(cmd, {
'custom-config', async: true,
'-i', nopipe: true,
'CHANGELOG.md', });
'-s', await sh('prettier --write **/CHANGELOG.md ', {
'-r', async: true,
'-0', nopipe: true,
]); });
// await sh(cmd, {
// async: true,
// nopipe: true,
// });
await run('prettier', ['--write', '**/CHANGELOG.md']);
// await sh('prettier --write **/CHANGELOG.md ', {
// async: true,
// nopipe: true,
// });
successConsole('CHANGE_LOG.md generated successfully!'); successConsole('CHANGE_LOG.md generated successfully!');
} catch (error) { } catch (error) {
errorConsole('CHANGE_LOG.md generated error\n' + error); errorConsole('CHANGE_LOG.md generated error\n' + error);
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
import path from 'path'; import path from 'path';
import fs from 'fs-extra'; import fs from 'fs-extra';
import { isEqual } from 'lodash'; import { isEqual } from 'lodash';
// import { sh } from 'tasksfile'; import { sh } from 'tasksfile';
import { successConsole, errorConsole, run } from '../utils'; import { successConsole, errorConsole } from '../utils';
const resolve = (dir: string) => { const resolve = (dir: string) => {
return path.resolve(process.cwd(), dir); return path.resolve(process.cwd(), dir);
...@@ -46,11 +46,10 @@ export async function runPreserve() { ...@@ -46,11 +46,10 @@ export async function runPreserve() {
'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)!' '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)!'
); );
try { try {
await run('npm', ['run', 'bootstrap']); await sh('npm run bootstrap ', {
// await sh('npm run bootstrap ', { async: true,
// async: true, nopipe: true,
// nopipe: true, });
// });
successConsole('Dependency installation is successful, start running the project!'); successConsole('Dependency installation is successful, start running the project!');
......
import chalk from 'chalk'; import chalk from 'chalk';
import Koa from 'koa'; import Koa from 'koa';
import inquirer from 'inquirer'; import inquirer from 'inquirer';
// import { sh } from 'tasksfile'; import { sh } from 'tasksfile';
import staticServer from 'koa-static'; import staticServer from 'koa-static';
import portfinder from 'portfinder'; import portfinder from 'portfinder';
import { resolve } from 'path'; import { resolve } from 'path';
import viteConfig from '../../vite.config'; import viteConfig from '../../vite.config';
import { getIPAddress, run } from '../utils'; import { getIPAddress } from '../utils';
const BUILD = 1; const BUILD = 1;
const NO_BUILD = 2; const NO_BUILD = 2;
...@@ -53,11 +53,10 @@ export const runPreview = async () => { ...@@ -53,11 +53,10 @@ export const runPreview = async () => {
}); });
const { type } = await prompt; const { type } = await prompt;
if (type === BUILD) { if (type === BUILD) {
await run('npm', ['run', 'build']); await sh('npm run build', {
// await sh('npm run build', { async: true,
// async: true, nopipe: true,
// nopipe: true, });
// });
} }
startApp(); startApp();
}; };
...@@ -3,7 +3,7 @@ import path from 'path'; ...@@ -3,7 +3,7 @@ import path from 'path';
import { networkInterfaces } from 'os'; import { networkInterfaces } from 'os';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
import chalk from 'chalk'; import chalk from 'chalk';
import execa from 'execa'; // import execa from 'execa';
export const isFunction = (arg: unknown): arg is (...args: any[]) => any => export const isFunction = (arg: unknown): arg is (...args: any[]) => any =>
typeof arg === 'function'; typeof arg === 'function';
...@@ -149,5 +149,5 @@ export function getCwdPath(...dir: string[]) { ...@@ -149,5 +149,5 @@ export function getCwdPath(...dir: string[]) {
return path.resolve(process.cwd(), ...dir); return path.resolve(process.cwd(), ...dir);
} }
export const run = (bin: string, args: any, opts = {}) => // export const run = (bin: string, args: any, opts = {}) =>
execa(bin, args, { stdio: 'inherit', ...opts }); // execa(bin, args, { stdio: 'inherit', ...opts });
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
"version": "2.0.0-rc.1", "version": "2.0.0-rc.1",
"scripts": { "scripts": {
"bootstrap": "yarn install", "bootstrap": "yarn install",
"serve": "node ./build/jsc.js preserve && cross-env NODE_ENV=development vite", "serve": "node ./build/jsc.ts preserve && cross-env NODE_ENV=development vite",
"build": "node ./build/jsc.js build", "build": "node ./build/jsc.ts build",
"build:site": "cross-env SITE=true npm run build ", "build:site": "cross-env SITE=true npm run build ",
"build:no-cache": "yarn clean:cache && npm run build", "build:no-cache": "yarn clean:cache && npm run build",
"report": "cross-env REPORT=true npm run build ", "report": "cross-env REPORT=true npm run build ",
"preview": "node ./build/jsc.js preview", "preview": "node ./build/jsc.ts preview",
"log": "node ./build/jsc.js log", "log": "node ./build/jsc.ts log",
"gen:gz": "node ./build/jsc.js gzip", "gen:gz": "node ./build/jsc.ts gzip",
"clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite_opt_cache", "clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite_opt_cache",
"clean:lib": "npx rimraf node_modules", "clean:lib": "npx rimraf node_modules",
"ls-lint": "npx ls-lint", "ls-lint": "npx ls-lint",
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
"lint:prettier": "prettier --write --loglevel warn \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"", "lint:prettier": "prettier --write --loglevel warn \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"",
"lint:stylelint": "stylelint --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", "lint:stylelint": "stylelint --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
"reinstall": "rimraf node_modules && rimraf yarn.lock && rimraf package.lock.json && npm run bootstrap", "reinstall": "rimraf node_modules && rimraf yarn.lock && rimraf package.lock.json && npm run bootstrap",
"postinstall": "node ./build/jsc.js postinstall" "postinstall": "node ./build/jsc.ts postinstall"
}, },
"dependencies": { "dependencies": {
"@iconify/iconify": "^2.0.0-rc.1", "@iconify/iconify": "^2.0.0-rc.1",
......
...@@ -206,10 +206,10 @@ ...@@ -206,10 +206,10 @@
} }
.ant-menu-submenu-title { .ant-menu-submenu-title {
// margin: 0;
// line-height: @app-menu-item-height; // line-height: @app-menu-item-height;
display: flex; display: flex;
height: @app-menu-item-height; height: @app-menu-item-height;
margin: 0;
align-items: center; align-items: center;
} }
......
...@@ -18,4 +18,4 @@ ...@@ -18,4 +18,4 @@
// app menu // app menu
// left-menu // left-menu
@app-menu-item-height: 48px; @app-menu-item-height: 44px;
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论