fix: replace taskfile module
This commit is contained in:
parent
ddc3786b16
commit
e828baa67b
|
|
@ -9,27 +9,26 @@
|
||||||
|
|
||||||
[CHANGELOG](CHANGELOG.md)
|
[CHANGELOG](CHANGELOG.md)
|
||||||
|
|
||||||
- [Introduction](#Introduction)
|
- [Introduction](#introduction)
|
||||||
- [GitHub](#Github)
|
- [GitHub](#github)
|
||||||
- [Preview](#Preview)
|
- [Preview](#preview)
|
||||||
- [Documentation](#Documentation)
|
- [Documentation](#documentation)
|
||||||
- [Preinstallation](#Preinstallation)
|
- [Preinstallation](#preinstallation)
|
||||||
- [Environmental requirements](#Environmental requirements)
|
- [Environmental requirements](#environmental-requirements)
|
||||||
- [UI framework](#ui framework)
|
- [UI framework](#ui-framework)
|
||||||
- [Icon](#Icon)
|
- [Icon](#icon)
|
||||||
- [Plugin](#Plugin)
|
- [Plugin](#plugin)
|
||||||
- [Suggested development environment](#Suggested development environment)
|
- [Suggested development environment](#suggested-development-environment)
|
||||||
- [Install](#Install)
|
- [Install](#install)
|
||||||
- [Usage](#Usage)
|
- [Usage](#usage)
|
||||||
- [Development environment](#Development environment)
|
- [Development environment](#development-environment)
|
||||||
- [Build](#Build)
|
- [Build](#build)
|
||||||
- [Format](#Format)
|
- [Format](#format)
|
||||||
- [Other](#Other)
|
- [Other](#other)
|
||||||
- [Git submit specifications](#git submit specifications)
|
- [Git submit specifications](#git-submit-specifications)
|
||||||
- [Code ontribution](#Code ontribution)
|
- [Code contribution](#code-contribution)
|
||||||
- [Finished features](#Finished features)
|
- [Finished features](#finished-features)
|
||||||
- [Developing features](#Developing features)
|
- [Developing features](#developing-features)
|
||||||
- [Join us](#Join us)
|
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
|
|
|
||||||
30
build/jsc.js
30
build/jsc.js
|
|
@ -1,7 +1,8 @@
|
||||||
// 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');
|
||||||
|
|
||||||
let command = ``;
|
let command = ``;
|
||||||
|
|
||||||
|
|
@ -24,13 +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) {
|
||||||
sh(
|
execa(
|
||||||
`cross-env NODE_ENV=${NODE_ENV} ts-node --project ./build/tsconfig.json ./build/script/cli.ts ${taskList.join(
|
'cross-env',
|
||||||
' '
|
[
|
||||||
)} ${command}`,
|
`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 --project ./build/tsconfig.json ./build/script/cli.ts ${taskList.join(
|
||||||
|
// ' '
|
||||||
|
// )} ${command}`,
|
||||||
|
// {
|
||||||
|
// async: true,
|
||||||
|
// nopipe: true,
|
||||||
|
// }
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,21 @@
|
||||||
// #!/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 } from '../utils';
|
import { errorConsole, successConsole, run } from '../utils';
|
||||||
|
|
||||||
export const runBuild = async () => {
|
export const runBuild = async () => {
|
||||||
try {
|
try {
|
||||||
const argvList = argv._;
|
const argvList = argv._;
|
||||||
let cmd = `npx cross-env NODE_ENV=production vite build`;
|
// let cmd = `cross-env NODE_ENV=production vite build`;
|
||||||
await sh(cmd, {
|
await run('cross-env', ['NODE_ENV=production', 'vite', 'build']);
|
||||||
async: true,
|
// await sh(cmd, {
|
||||||
nopipe: true,
|
// async: true,
|
||||||
});
|
// nopipe: true,
|
||||||
|
// });
|
||||||
|
|
||||||
// Generate configuration file
|
// Generate configuration file
|
||||||
if (!argvList.includes('no-conf')) {
|
if (!argvList.includes('no-conf')) {
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,29 @@
|
||||||
// #!/usr/bin/env node
|
// #!/usr/bin/env node
|
||||||
|
|
||||||
import { sh } from 'tasksfile';
|
// import { sh } from 'tasksfile';
|
||||||
import { errorConsole, successConsole } from '../utils';
|
import { errorConsole, successConsole, run } 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 sh(cmd, {
|
await run('conventional-changelog', [
|
||||||
async: true,
|
'-p',
|
||||||
nopipe: true,
|
'custom-config',
|
||||||
});
|
'-i',
|
||||||
|
'CHANGELOG.md',
|
||||||
await sh('prettier --write **/CHANGELOG.md ', {
|
'-s',
|
||||||
async: true,
|
'-r',
|
||||||
nopipe: true,
|
'-0',
|
||||||
});
|
]);
|
||||||
|
// 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 @@
|
||||||
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 } from '../utils';
|
import { successConsole, errorConsole, run } from '../utils';
|
||||||
|
|
||||||
const resolve = (dir: string) => {
|
const resolve = (dir: string) => {
|
||||||
return path.resolve(process.cwd(), dir);
|
return path.resolve(process.cwd(), dir);
|
||||||
|
|
@ -46,10 +46,11 @@ 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 sh('npm run bootstrap ', {
|
await run('npm', ['run', 'bootstrap']);
|
||||||
async: true,
|
// await sh('npm run bootstrap ', {
|
||||||
nopipe: true,
|
// async: true,
|
||||||
});
|
// nopipe: true,
|
||||||
|
// });
|
||||||
|
|
||||||
successConsole('Dependency installation is successful, start running the project!');
|
successConsole('Dependency installation is successful, start running the project!');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
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 } from '../utils';
|
import { getIPAddress, run } from '../utils';
|
||||||
|
|
||||||
const BUILD = 1;
|
const BUILD = 1;
|
||||||
const NO_BUILD = 2;
|
const NO_BUILD = 2;
|
||||||
|
|
@ -53,10 +53,11 @@ export const runPreview = async () => {
|
||||||
});
|
});
|
||||||
const { type } = await prompt;
|
const { type } = await prompt;
|
||||||
if (type === BUILD) {
|
if (type === BUILD) {
|
||||||
await sh('npm run build', {
|
await run('npm', ['run', 'build']);
|
||||||
async: true,
|
// await sh('npm run build', {
|
||||||
nopipe: true,
|
// async: true,
|
||||||
});
|
// nopipe: true,
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
startApp();
|
startApp();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,6 +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';
|
||||||
|
|
||||||
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';
|
||||||
|
|
@ -147,3 +148,6 @@ export function warnConsole(message: any) {
|
||||||
export function getCwdPath(...dir: string[]) {
|
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 = {}) =>
|
||||||
|
execa(bin, args, { stdio: 'inherit', ...opts });
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue