mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-23 23:39:47 +08:00
chore(projects): update @sa/scripts
This commit is contained in:
@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const path = require('node:path');
|
||||
const jiti = require('jiti')(__filename);
|
||||
|
||||
jiti(path.resolve(__dirname, './src/index.ts'));
|
3
packages/scripts/bin.ts
Executable file
3
packages/scripts/bin.ts
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env tsx
|
||||
|
||||
import './src/index.ts';
|
@ -2,7 +2,7 @@
|
||||
"name": "@sa/scripts",
|
||||
"version": "1.0.0",
|
||||
"bin": {
|
||||
"sa": "./bin.cjs"
|
||||
"sa": "./bin.ts"
|
||||
},
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
@ -18,8 +18,6 @@
|
||||
"consola": "3.2.3",
|
||||
"enquirer": "2.4.1",
|
||||
"execa": "8.0.1",
|
||||
"jiti": "1.21.0",
|
||||
"lint-staged": "15.2.0",
|
||||
"npm-check-updates": "16.14.12",
|
||||
"rimraf": "5.0.5"
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
export * from './git-commit';
|
||||
export * from './cleanup';
|
||||
export * from './update-pkg';
|
||||
export * from './prettier';
|
||||
export * from './lint-staged';
|
||||
|
@ -1,5 +0,0 @@
|
||||
export async function execLintStaged(config: Record<string, string | string[]>) {
|
||||
const lintStaged = (await import('lint-staged')).default;
|
||||
|
||||
return lintStaged({ config, allowEmpty: true });
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
import { execCommand } from '../shared';
|
||||
|
||||
export async function prettierWrite(writeGlob: string[]) {
|
||||
await execCommand('npx', ['prettier', '--write', '.', ...writeGlob], {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
import cac from 'cac';
|
||||
import { blue, lightGreen } from 'kolorist';
|
||||
import { version } from '../package.json';
|
||||
import { cleanup, execLintStaged, gitCommit, gitCommitVerify, prettierWrite, updatePkg } from './commands';
|
||||
import { cleanup, gitCommit, gitCommitVerify, updatePkg } from './commands';
|
||||
import { loadCliOptions } from './config';
|
||||
|
||||
type Command = 'cleanup' | 'update-pkg' | 'git-commit' | 'git-commit-verify' | 'prettier-write' | 'lint-staged';
|
||||
type Command = 'cleanup' | 'update-pkg' | 'git-commit' | 'git-commit-verify';
|
||||
|
||||
type CommandAction<A extends object> = (args?: A) => Promise<void> | void;
|
||||
|
||||
@ -45,18 +45,6 @@ export async function setupCli() {
|
||||
action: async () => {
|
||||
await gitCommitVerify();
|
||||
}
|
||||
},
|
||||
'prettier-write': {
|
||||
desc: 'run prettier --write',
|
||||
action: async () => {
|
||||
await prettierWrite(cliOptions.prettierWriteGlob);
|
||||
}
|
||||
},
|
||||
'lint-staged': {
|
||||
desc: 'run lint-staged',
|
||||
action: async () => {
|
||||
await execLintStaged(cliOptions.lintStagedConfig);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user