Skip to content
This repository was archived by the owner on Sep 27, 2024. It is now read-only.

Commit 6e5b53f

Browse files
committed
add yargs
1 parent 988118c commit 6e5b53f

File tree

4 files changed

+143
-14
lines changed

4 files changed

+143
-14
lines changed

package-lock.json

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

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@omer-x/ts-openapi-interface-generator",
3-
"version": "0.1.2",
3+
"version": "0.2.0",
44
"description": "OpenAPI interface generator for TypeScript",
55
"keywords": [
66
"typescript",
@@ -39,11 +39,13 @@
3939
"dev": "webpack build --progress --mode=development --watch"
4040
},
4141
"dependencies": {
42-
"handlebars": "^4.7.8"
42+
"handlebars": "^4.7.8",
43+
"yargs": "^17.7.2"
4344
},
4445
"devDependencies": {
4546
"@omer-x/eslint-config": "^1.0.5",
4647
"@types/node": "^20.11.24",
48+
"@types/yargs": "^17.0.32",
4749
"raw-loader": "^4.0.2",
4850
"ts-loader": "^9.5.1",
4951
"ts-unused-exports": "^10.0.1",

src/core/arguments.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import yargs from "yargs";
2+
3+
const argv = yargs.option("output", {
4+
alias: "o",
5+
describe: "Specify the output directry",
6+
type: "string",
7+
demandOption: false,
8+
}).argv;
9+
10+
export default async function getArgument(name: string) {
11+
const a = argv instanceof Promise ? await argv : argv;
12+
return a[name] as string | undefined;
13+
}

webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ module.exports = {
3434
},
3535
externals: [
3636
"handlebars",
37+
"yargs",
3738
],
3839
externalsType: "commonjs",
3940
};

0 commit comments

Comments
 (0)