Skip to content

Commit 0bb4ef4

Browse files
committed
feat: bin script wrappers for brownie & brownfield packages
1 parent 74a4028 commit 0bb4ef4

9 files changed

Lines changed: 36 additions & 12 deletions

File tree

packages/brownie/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"version": "0.0.1",
44
"license": "MIT",
55
"author": "Oskar Kwaśniewski <oskarkwasniewski@icloud.com>",
6+
"bin": {
7+
"brownfield": "./lib/commonjs/scripts/brownfield.js"
8+
},
69
"contributors": [
710
"Artur Morys-Magiera <artus9033@gmail.com>",
811
"Oskar Kwasniewski <oskarkwasniewski@icloud.com>"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env node
2+
3+
import { runCLI } from '@callstack/brownfield-cli';
4+
5+
runCLI(process.argv);

packages/cli/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"license": "MIT",
55
"author": "Artur Morys-Magiera <artus9033@gmail.com>",
66
"bin": {
7-
"brownfield": "./dist/index.js"
7+
"brownfield": "./dist/main.js"
88
},
99
"type": "module",
1010
"contributors": [
@@ -15,7 +15,8 @@
1515
"description": "Brownfield CLI for React Native, gathering all packages of the RN brownfield ecosystem",
1616
"exports": {
1717
".": {
18-
"source": "./src/index.ts"
18+
"source": "./src/index.ts",
19+
"default": "./dist/main.js"
1920
},
2021
"./package.json": "./package.json"
2122
},

packages/cli/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env node
2-
31
import { styleText } from 'node:util';
42

53
import { logger } from '@rock-js/tools';
@@ -77,8 +75,10 @@ registrationHelper(brownieCommands, brownieCommandsGroupName);
7775

7876
program.commandsGroup('Utility commands').helpCommand('help [command]');
7977

80-
program.parse(process.argv);
78+
export function runCLI(argv: string[]): void {
79+
program.parse(argv);
8180

82-
if (!process.argv.slice(2).length) {
83-
program.outputHelp();
81+
if (!argv.slice(2).length) {
82+
program.outputHelp();
83+
}
8484
}

packages/cli/src/main.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env node
2+
3+
import { runCLI } from './index.js';
4+
5+
runCLI(process.argv);

packages/cli/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
2727

2828
/* Modules */
29-
"module": "node16", /* Specify what module code is generated. */
29+
"module": "esnext", /* Specify what module code is generated. */
3030
"rootDir": "./src", /* Specify the root folder within your source files. */
31-
"moduleResolution": "node16", /* Specify how TypeScript looks up a file from a given module specifier. */
31+
"moduleResolution": "bundler", /* Specify how TypeScript looks up a file from a given module specifier. */
3232
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
3333
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
3434
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */

packages/react-native-brownfield/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"version": "2.0.1",
44
"license": "MIT",
55
"author": "Michal Chudziak <mike.chudziak@callstack.com>",
6+
"bin": {
7+
"brownfield": "./lib/commonjs/scripts/brownfield.js"
8+
},
69
"contributors": [
710
"Piotr Drapich <piotr.drapich@callstack.com>"
811
],
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env node
2+
3+
import { runCLI } from '@callstack/brownfield-cli';
4+
5+
runCLI(process.argv);

yarn.lock

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2176,7 +2176,7 @@ __metadata:
21762176
"@react-native-community/cli-config": "*"
21772177
"@react-native-community/cli-config-android": "*"
21782178
bin:
2179-
brownfield: ./dist/index.js
2179+
brownfield: ./dist/main.js
21802180
languageName: unknown
21812181
linkType: soft
21822182

@@ -2199,7 +2199,6 @@ __metadata:
21992199
"@babel/core": "npm:^7.25.2"
22002200
"@babel/preset-env": "npm:^7.25.3"
22012201
"@babel/runtime": "npm:^7.25.0"
2202-
"@callstack/brownfield-cli": "workspace:^"
22032202
"@callstack/brownie": "npm:*"
22042203
"@callstack/react-native-brownfield": "npm:*"
22052204
"@react-native-community/cli": "npm:20.0.0"
@@ -2284,6 +2283,8 @@ __metadata:
22842283
peerDependencies:
22852284
react: "*"
22862285
react-native: "*"
2286+
bin:
2287+
brownfield: ./lib/commonjs/scripts/brownfield.js
22872288
languageName: unknown
22882289
linkType: soft
22892290

@@ -2294,7 +2295,6 @@ __metadata:
22942295
"@babel/core": "npm:^7.25.2"
22952296
"@babel/preset-env": "npm:^7.25.3"
22962297
"@babel/runtime": "npm:^7.25.0"
2297-
"@callstack/brownfield-cli": "workspace:^"
22982298
"@callstack/brownie": "npm:*"
22992299
"@callstack/react-native-brownfield": "npm:*"
23002300
"@react-native-community/cli": "npm:20.0.0"
@@ -2336,6 +2336,8 @@ __metadata:
23362336
peerDependencies:
23372337
react: "*"
23382338
react-native: "*"
2339+
bin:
2340+
brownfield: ./lib/commonjs/scripts/brownfield.js
23392341
languageName: unknown
23402342
linkType: soft
23412343

0 commit comments

Comments
 (0)