Skip to content

Commit 1e14fc0

Browse files
committed
🔧chore(build): 更新unbuild支持stub模式使用别名开发
1 parent b758d0f commit 1e14fc0

19 files changed

+394
-1066
lines changed

build.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
import { resolve } from "path";
12
import { defineBuildConfig } from "unbuild";
23

34
export default defineBuildConfig({
45
entries: ["src/index", "src/cli"],
56
clean: true,
67
declaration: true,
8+
stub: true,
9+
alias: {
10+
"@": resolve(__dirname, "src"),
11+
},
712
rollup: {
813
emitCJS: true,
914
inlineDependencies: true,

package-lock.json

Lines changed: 318 additions & 987 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"release-it": "^16.1.5",
6767
"simple-git-hooks": "^2.9.0",
6868
"typescript": "^5.2.2",
69-
"unbuild": "^2.0.0"
69+
"unbuild": "^2.0.0-rc.0"
7070
},
7171
"dependencies": {
7272
"cac": "^6.7.14",

src/cli.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import { handleError } from "./shared/index";
2-
import { version } from "../package.json";
3-
import { commandSet } from "./setup";
41
import cac from "cac";
52

3+
import { handleError } from "@/shared/index";
4+
import { commandSet } from "@/setup";
5+
6+
import { version } from "../package.json";
7+
68
export const setupCli = async () => {
79
const cli = cac("cg");
810

src/command/clear.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { execCommand, loggerInfo } from "../shared/index";
2-
import { ACTIVATION } from "../shared/config";
1+
import { execCommand, loggerInfo } from "@/shared/index";
2+
import { ACTIVATION } from "@/shared/config";
33

44
export const clear = async (paths: string[]) => {
55
if (ACTIVATION) {

src/command/eslint-fix.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { execCommand, loggerInfo } from "./../shared/index";
2-
import { ACTIVATION } from "../shared/config";
1+
import { execCommand, loggerInfo } from "@/shared/index";
2+
import { ACTIVATION } from "@/shared/config";
33

44
export const eslintFix = async (paths: string[]) => {
55
if (ACTIVATION) {

src/command/git-commit-verify.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { printError, printInfo } from "./../shared/index";
2-
import { readFileSync } from "fs";
1+
import { readFileSync } from "node:fs";
32
import path from "node:path";
4-
import { execCommand } from "../shared";
3+
4+
import { printError, printInfo, execCommand } from "@/shared/index";
55

66
export const gitCommitVerify = async () => {
77
const dogit = await execCommand("git", ["rev-parse", "--show-toplevel"], {

src/command/git-commit.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { loggerInfo } from "./../shared/index";
21
import enquirer from "enquirer";
3-
import { CommitScope, CommitType } from "../shared/types";
4-
import { execCommand } from "../shared";
5-
import { ACTIVATION } from "../shared/config";
2+
3+
import { ACTIVATION } from "@/shared/config";
4+
import { CommitScope, CommitType } from "@/shared/types";
5+
import { loggerInfo, execCommand } from "@/shared/index";
66
interface PromptResult {
77
type: string;
88
scope: string;
@@ -16,7 +16,7 @@ interface GitCommitOptions {
1616
export const gitCommit = async (
1717
types: Array<CommitType>,
1818
scopes: Array<CommitScope>,
19-
options: GitCommitOptions,
19+
options: GitCommitOptions
2020
) => {
2121
if (ACTIVATION) {
2222
loggerInfo("gitCommit 参数信息: \n");

src/command/git-init-hooks.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import path from "node:path";
2-
import { existsSync } from "fs";
3-
import { execCommand } from "../shared";
2+
import { existsSync } from "node:fs";
3+
4+
import { execCommand } from "@/shared/index";
45

56
export const gitInitSimpleHooks = async (cwd = process.cwd()) => {
67
const dohusky = path.join(cwd, ".husky");

src/command/npm-dep-check.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { execCommand } from "../shared/index";
1+
import { execCommand } from "@/shared/index";
22

33
export const npmDepCheck = async () => {
44
await execCommand("npx", ["npm-check"], {

0 commit comments

Comments
 (0)