-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(create-kosko): Introduce package
- Loading branch information
Showing
57 changed files
with
243 additions
and
65 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,6 @@ | ||
--- | ||
"create-kosko": minor | ||
"@kosko/cli-utils": minor | ||
--- | ||
|
||
First release. |
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,2 +1,3 @@ | ||
save-workspace-protocol = rolling | ||
auto-install-peers = false | ||
public-hoist-pattern[] = "yargs" |
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,4 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", | ||
"extends": "../../api-extractor.json" | ||
} |
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,58 @@ | ||
{ | ||
"name": "@kosko/cli-utils", | ||
"version": "0.0.0", | ||
"description": "CLI utilities used in Kosko.", | ||
"homepage": "https://kosko.dev", | ||
"repository": "https://github.com/tommy351/kosko/tree/master/packages/cli-utils", | ||
"author": "Tommy Chen <[email protected]>", | ||
"license": "MIT", | ||
"main": "dist/index.node.cjs", | ||
"module": "dist/index.node.mjs", | ||
"types": "dist/types.d.ts", | ||
"sideEffects": false, | ||
"scripts": { | ||
"build": "build-scripts" | ||
}, | ||
"exports": { | ||
"node": { | ||
"import": { | ||
"types": "./dist/types.d.mts", | ||
"default": "./dist/index.node.mjs" | ||
}, | ||
"types": "./dist/types.d.ts", | ||
"require": "./dist/index.node.cjs" | ||
}, | ||
"import": { | ||
"types": "./dist/types.d.mts", | ||
"default": "./dist/index.base.mjs" | ||
}, | ||
"types": "./dist/types.d.ts", | ||
"require": "./dist/index.node.cjs" | ||
}, | ||
"files": [ | ||
"/dist/" | ||
], | ||
"keywords": [ | ||
"kosko" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"engines": { | ||
"node": ">=18" | ||
}, | ||
"dependencies": { | ||
"@kosko/log": "workspace:^" | ||
}, | ||
"devDependencies": { | ||
"@kosko/build-scripts": "workspace:^", | ||
"@kosko/jest-preset": "workspace:^", | ||
"@types/yargs": "^17.0.12" | ||
}, | ||
"peerDependencies": { | ||
"yargs": "^17.0.0" | ||
}, | ||
"jest": { | ||
"preset": "@kosko/jest-preset" | ||
} | ||
} |
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
packages/cli/src/cli/command.ts → packages/cli-utils/src/command.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
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,4 @@ | ||
export { type RootArguments, type Command, parse } from "./command"; | ||
export { CLIError, handleError } from "./error"; | ||
export { setupLogger } from "./logger"; | ||
export { createRootCommand } from "./root"; |
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,37 @@ | ||
import { isAbsolute, resolve } from "node:path"; | ||
// eslint-disable-next-line node/no-missing-import | ||
import yargs from "yargs"; | ||
import { cwd } from "node:process"; | ||
import { setupLogger } from "./logger"; | ||
|
||
/** | ||
* @public | ||
*/ | ||
export function createRootCommand(args?: readonly string[]) { | ||
return yargs(args) | ||
.exitProcess(false) | ||
.option("cwd", { | ||
type: "string", | ||
describe: "Path of working directory", | ||
global: true, | ||
default: cwd(), | ||
defaultDescription: "CWD", | ||
coerce(arg) { | ||
return isAbsolute(arg) ? arg : resolve(arg); | ||
} | ||
}) | ||
.option("log-level", { | ||
type: "string", | ||
describe: "Set log level", | ||
global: true, | ||
default: "info" | ||
}) | ||
.option("silent", { | ||
type: "boolean", | ||
describe: "Disable log output", | ||
global: true, | ||
default: false | ||
}) | ||
.group(["cwd", "log-level", "silent", "help", "version"], "Global Options:") | ||
.middleware(setupLogger); | ||
} |
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,3 @@ | ||
{ | ||
"extends": "../../tsconfig.build.json" | ||
} |
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
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
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
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", | ||
"extends": "../../api-extractor.json" | ||
"extends": "../../api-extractor.json", | ||
"mainEntryPointFilePath": "<projectFolder>/dist/src/index.d.ts" | ||
} |
Empty file.
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
File renamed without changes.
Oops, something went wrong.