Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/RNApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@callstack/brownfield-cli": "workspace:^",
"@react-native-community/cli": "20.0.0",
"@react-native-community/cli-platform-android": "20.0.0",
"@react-native-community/cli-platform-ios": "20.0.0",
Expand Down
1 change: 0 additions & 1 deletion apps/TesterIntegrated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@callstack/brownfield-cli": "workspace:^",
"@react-native-community/cli": "20.0.0",
"@react-native-community/cli-platform-android": "20.0.0",
"@react-native-community/cli-platform-ios": "20.0.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/brownie/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "0.0.1",
"license": "MIT",
"author": "Oskar Kwaśniewski <oskarkwasniewski@icloud.com>",
"bin": {
"brownfield": "./lib/commonjs/scripts/brownfield.js"
},
"contributors": [
"Artur Morys-Magiera <artus9033@gmail.com>",
"Oskar Kwasniewski <oskarkwasniewski@icloud.com>"
Expand Down
5 changes: 5 additions & 0 deletions packages/brownie/src/scripts/brownfield.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node

import { runCLI } from '@callstack/brownfield-cli';

runCLI(process.argv);
16 changes: 14 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"author": "Artur Morys-Magiera <artus9033@gmail.com>",
"bin": {
"brownfield": "./dist/index.js"
"brownfield": "./dist/main.js"
},
"type": "module",
"contributors": [
Expand All @@ -15,7 +15,19 @@
"description": "Brownfield CLI for React Native, gathering all packages of the RN brownfield ecosystem",
"exports": {
".": {
"source": "./src/index.ts"
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./brownfield": {
"source": "./src/brownfield/index.ts",
"types": "./dist/brownfield/index.d.ts",
"default": "./dist/brownfield/index.js"
},
"./brownie": {
"source": "./src/brownie/index.ts",
"types": "./dist/brownie/index.d.ts",
"default": "./dist/brownie/index.js"
},
"./package.json": "./package.json"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/brownfield/utils/rn-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function getProjectInfo<Platform extends 'ios' | 'android'>(
} {
const projectRoot = findProjectRoot();

const userConfig = cliConfig.default({
const userConfig = cliConfig({
projectRoot,
selectedPlatform: platform,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ type SecondStore = {
enabled: boolean;
};

// @ts-expect-error: inexistent module augmentation
declare module '@callstack/brownie' {
interface BrownieStores {
SecondStore: SecondStore;
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/brownie/__fixtures__/TestStore.brownie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ type TestStore = {
isActive: boolean;
};

// @ts-expect-error: inexistent module augmentation
declare module '@callstack/brownie' {
interface BrownieStores {
TestStore: TestStore;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/brownie/commands/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { generateSwift } from '../generators/swift.js';
import { generateKotlin } from '../generators/kotlin.js';
import { discoverStores, type DiscoveredStore } from '../store-discovery.js';
import { Platform } from '../types.js';
import type { Platform } from '../types.js';

function getOutputPath(dir: string, name: string, ext: string): string {
return path.join(dir, `${name}.${ext}`);
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env node

import { styleText } from 'node:util';

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

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

program.parse(process.argv);
export function runCLI(argv: string[]): void {
program.parse(argv);

if (!process.argv.slice(2).length) {
program.outputHelp();
if (!argv.slice(2).length) {
program.outputHelp();
}
}
5 changes: 5 additions & 0 deletions packages/cli/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node

import { runCLI } from './index.js';

runCLI(process.argv);
4 changes: 2 additions & 2 deletions packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */

/* Modules */
"module": "node16", /* Specify what module code is generated. */
"module": "esnext", /* Specify what module code is generated. */
"rootDir": "./src", /* Specify the root folder within your source files. */
"moduleResolution": "node16", /* Specify how TypeScript looks up a file from a given module specifier. */
"moduleResolution": "bundler", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
Expand Down
3 changes: 3 additions & 0 deletions packages/react-native-brownfield/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "2.0.1",
"license": "MIT",
"author": "Michal Chudziak <mike.chudziak@callstack.com>",
"bin": {
"brownfield": "./lib/commonjs/scripts/brownfield.js"
},
"contributors": [
"Piotr Drapich <piotr.drapich@callstack.com>"
],
Expand Down
5 changes: 5 additions & 0 deletions packages/react-native-brownfield/src/scripts/brownfield.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node

import { runCLI } from '@callstack/brownfield-cli';

runCLI(process.argv);
8 changes: 5 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2176,7 +2176,7 @@ __metadata:
"@react-native-community/cli-config": "*"
"@react-native-community/cli-config-android": "*"
bin:
brownfield: ./dist/index.js
brownfield: ./dist/main.js
languageName: unknown
linkType: soft

Expand All @@ -2199,7 +2199,6 @@ __metadata:
"@babel/core": "npm:^7.25.2"
"@babel/preset-env": "npm:^7.25.3"
"@babel/runtime": "npm:^7.25.0"
"@callstack/brownfield-cli": "workspace:^"
"@callstack/brownie": "npm:*"
"@callstack/react-native-brownfield": "npm:*"
"@react-native-community/cli": "npm:20.0.0"
Expand Down Expand Up @@ -2284,6 +2283,8 @@ __metadata:
peerDependencies:
react: "*"
react-native: "*"
bin:
brownfield: ./lib/commonjs/scripts/brownfield.js
languageName: unknown
linkType: soft

Expand All @@ -2294,7 +2295,6 @@ __metadata:
"@babel/core": "npm:^7.25.2"
"@babel/preset-env": "npm:^7.25.3"
"@babel/runtime": "npm:^7.25.0"
"@callstack/brownfield-cli": "workspace:^"
"@callstack/brownie": "npm:*"
"@callstack/react-native-brownfield": "npm:*"
"@react-native-community/cli": "npm:20.0.0"
Expand Down Expand Up @@ -2336,6 +2336,8 @@ __metadata:
peerDependencies:
react: "*"
react-native: "*"
bin:
brownfield: ./lib/commonjs/scripts/brownfield.js
languageName: unknown
linkType: soft

Expand Down
Loading