Skip to content
This repository was archived by the owner on Jun 26, 2021. It is now read-only.

Commit 150134d

Browse files
committed
Cli wip
1 parent d472f48 commit 150134d

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
"version": "1.0.0",
44
"description": "",
55
"main": "index.js",
6-
"types": "index.d.ts",
6+
"types": "lib/index.d.ts",
77
"files": [
8-
"lib/**/*",
9-
"index.d.ts"
8+
"lib/**/*"
109
],
10+
"bin": {
11+
"gostek-generate": "./lib/cli.js"
12+
},
1113
"scripts": {
12-
"build": "tsc",
14+
"build": "tsc && chmod +x ./lib/cli.js",
1315
"test": "jest",
1416
"lint": "eslint src --ext .js,.jsx,.ts,.tsx"
1517
},
@@ -37,6 +39,7 @@
3739
},
3840
"dependencies": {
3941
"@types/lodash": "4.14.149",
42+
"app-root-path": "3.0.0",
4043
"lodash": "4.17.15",
4144
"pg-promise": "10.5.0",
4245
"prettier": "2.0.4"

src/cli.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env node
2+
import Path from 'path';
3+
import Fs from 'fs';
4+
5+
const pkgPath = Path.resolve(process.cwd(), 'package.json');
6+
if (!Fs.existsSync(pkgPath)) {
7+
throw new Error(
8+
'package.json not found! Run this command in the root directory of your project.',
9+
);
10+
}
11+
12+
// const pkg = require(pkgPath);
13+
14+
// const config = {};

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,11 @@ anymatch@^3.0.3:
911911
normalize-path "^3.0.0"
912912
picomatch "^2.0.4"
913913

914+
915+
version "3.0.0"
916+
resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-3.0.0.tgz#210b6f43873227e18a4b810a032283311555d5ad"
917+
integrity sha512-qMcx+Gy2UZynHjOHOIXPNvpf+9cjvk3cWrBBK7zg4gH9+clobJRb9NGzcT7mQTcV/6Gm/1WelUtqxVXnNlrwcw==
918+
914919
argparse@^1.0.7:
915920
version "1.0.10"
916921
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"

0 commit comments

Comments
 (0)