Skip to content

Commit

Permalink
chore(projects): update @sa/scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Dec 14, 2023
1 parent a748166 commit d778560
Show file tree
Hide file tree
Showing 9 changed files with 419 additions and 47 deletions.
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"cleanup": "sa cleanup",
"commit": "sa git-commit",
"dev": "vite",
"format": "sa prettier-write",
"lint": "eslint . --fix",
"prepare": "simple-git-hooks",
"preview": "vite preview",
"release": "soy release",
"typecheck": "vue-tsc --noEmit --skipLibCheck",
"update-pkg": "sa update-pkg"
},
Expand Down Expand Up @@ -46,6 +46,7 @@
"@iconify/json": "2.2.157",
"@sa/scripts": "workspace:*",
"@sa/uno-preset": "workspace:*",
"@soybeanjs/cli": "1.0.0-beta.7",
"@soybeanjs/eslint-config": "1.1.3",
"@types/lodash-es": "4.17.12",
"@types/node": "20.10.4",
Expand All @@ -60,9 +61,11 @@
"cross-env": "7.0.3",
"eslint": "8.55.0",
"eslint-plugin-vue": "9.19.2",
"lint-staged": "15.2.0",
"npm-run-all": "4.1.5",
"sass": "1.69.5",
"simple-git-hooks": "2.9.0",
"tsx": "4.6.2",
"typescript": "5.3.3",
"unplugin-icons": "0.18.1",
"unplugin-vue-components": "0.26.0",
Expand All @@ -75,6 +78,9 @@
},
"simple-git-hooks": {
"commit-msg": "pnpm sa git-commit-verify",
"pre-commit": "pnpm typecheck"
"pre-commit": "pnpm typecheck && pnpm lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
}
}
6 changes: 0 additions & 6 deletions packages/scripts/bin.cjs

This file was deleted.

3 changes: 3 additions & 0 deletions packages/scripts/bin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env tsx

import './src/index.ts';
4 changes: 1 addition & 3 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@sa/scripts",
"version": "1.0.0",
"bin": {
"sa": "./bin.cjs"
"sa": "./bin.ts"
},
"exports": {
".": "./src/index.ts"
Expand All @@ -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"
}
Expand Down
2 changes: 0 additions & 2 deletions packages/scripts/src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export * from './git-commit';
export * from './cleanup';
export * from './update-pkg';
export * from './prettier';
export * from './lint-staged';
5 changes: 0 additions & 5 deletions packages/scripts/src/commands/lint-staged.ts

This file was deleted.

7 changes: 0 additions & 7 deletions packages/scripts/src/commands/prettier.ts

This file was deleted.

16 changes: 2 additions & 14 deletions packages/scripts/src/index.ts
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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);
}
}
};

Expand Down
Loading

0 comments on commit d778560

Please sign in to comment.