-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(insert-emit-option): migrate to citty and consola (#61)
* chore(deps): add citty and consola * refactor: migrate to citty * refactor(insert-emit-option): migrate to consola
- Loading branch information
Showing
9 changed files
with
80 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineBuildConfig } from "unbuild"; | ||
|
||
export default defineBuildConfig({ | ||
entries: ["./src/cli.ts"], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
#!/usr/bin/env node | ||
|
||
import yargs from "yargs"; | ||
import { hideBin } from "yargs/helpers"; | ||
import { runMain } from "citty"; | ||
import main from "./main"; | ||
|
||
yargs(hideBin(process.argv)) | ||
.commandDir("commands") | ||
.strict() | ||
.alias({ h: "help", v: "version" }).argv; | ||
runMain(main); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { handleCommand } from "./handlers"; | ||
import { colorize } from "consola/utils"; | ||
import { defineCommand } from "citty"; | ||
import pkgJson from "../package.json"; | ||
import { globby } from "globby"; | ||
|
||
export default defineCommand({ | ||
meta: { | ||
name: pkgJson.name, | ||
version: pkgJson.version, | ||
description: pkgJson.description, | ||
}, | ||
args: { | ||
targetFilePaths: { | ||
type: "positional", | ||
required: true, | ||
description: | ||
"Path to the target vue file, which can be set with the glob pattern. eg: 'src/**/*.vue'", | ||
}, | ||
tsconfigPath: { | ||
type: "string", | ||
required: false, | ||
alias: "t", | ||
}, | ||
}, | ||
async run({ args }) { | ||
const { targetFilePaths } = args; | ||
const files = await globby(targetFilePaths); | ||
const { insertedCount } = await handleCommand(files, args.tsconfigPath); | ||
console.log("\nCompleted 🎉"); | ||
console.log(`${colorize("green", insertedCount)} files changed.`); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.