Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"packages/coinbase-ethers",
"packages/ethers5",
"packages/ethers",
"packages/cli",
"apps/*"
],
"scripts": {
Expand Down
10 changes: 10 additions & 0 deletions packages/cli/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.log
*.env
npm-debug.log*
node_modules
package-lock.json
src
tests
index.ts
.eslintrc.json
.turbo
7 changes: 7 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @reown/appkit-react-native-cli

## 1.3.0

### Minor Changes

- [#414](https://github.com/reown-com/appkit-react-native/pull/414) [`c88fa8c`](https://github.com/reown-com/appkit-react-native/commit/c88fa8c29d0dcb7cc99392534b62bcb11b41e2cb) Thanks [@ignaciosantise](https://github.com/ignaciosantise)! - feat: added appkit cli for react native
14 changes: 14 additions & 0 deletions packages/cli/bob.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
source: 'src',
output: 'lib',
targets: [
'commonjs',
'module',
[
'typescript',
{
tsc: '../../node_modules/.bin/tsc'
}
]
]
};
52 changes: 52 additions & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "@reown/appkit-react-native-cli",
"version": "1.3.0",
"sideEffects": false,
"description": "Reown AppKit CLI for React Native",
"main": "lib/commonjs/index.js",
"types": "lib/typescript/index.d.ts",
"module": "lib/module/index.js",
"bin": {
"appkit-react-native": "lib/commonjs/index.js"
},
"repository": "https://github.com/reown-com/appkit-react-native",
"author": "Reown (https://discord.gg/reown)",
"homepage": "https://reown.com/appkit",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/reown-com/appkit-react-native/issues"
},
"scripts": {
"build": "bob build",
"clean": "rm -rf lib",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"files": [
"src",
"lib",
"!**/__tests__",
"!**/__fixtures__",
"!**/__mocks__"
],
"dependencies": {
"chalk": "5.4.1"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"eslintIgnore": [
"node_modules/",
"lib/"
],
"keywords": [
"appkit",
"wallet",
"onboarding",
"reown",
"dapps",
"web3",
"wagmi",
"ethereum"
]
}
56 changes: 56 additions & 0 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env node
import chalk from 'chalk';
import { spawn } from 'child_process';

import { banner } from './utils';

// Define styles
const redTip = chalk.hex('#C70039'); // Red for tips

// Display CLI Banner
// eslint-disable-next-line no-console
console.log(banner);

const TEMPLATE_URL =
'https://github.com/reown-com/react-native-examples/tree/main/dapps/appkit-expo-wagmi';

function runExpoCreate() {
return new Promise<void>((resolve, reject) => {
const child = spawn('npx', ['create-expo', '--template', TEMPLATE_URL], {
stdio: 'inherit',
shell: process.platform === 'win32'
});

child.on('error', reject);
child.on('close', code => {
if (code === 0) {
resolve();
} else {
reject(new Error(`create-expo exited with code ${code}`));
}
});
});
}

export async function main() {
try {
await runExpoCreate();
} catch (error: any) {
// eslint-disable-next-line no-console
console.error('Failed to run Expo initializer:', error?.message || error);
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'any' type defeats the purpose of TypeScript's type safety. Consider using 'unknown' type instead and properly type guard the error, or create a specific error type.

Suggested change
console.error('Failed to run Expo initializer:', error?.message || error);
} catch (error: unknown) {
// eslint-disable-next-line no-console
let errorMessage: string;
if (typeof error === 'object' && error !== null && 'message' in error && typeof (error as any).message === 'string') {
errorMessage = (error as { message: string }).message;
} else {
errorMessage = String(error);
}
console.error('Failed to run Expo initializer:', errorMessage);

Copilot uses AI. Check for mistakes.
process.exitCode = 1;

return;
}

const url = 'https://dashboard.reown.com';
// eslint-disable-next-line no-console
console.log(`Your ${redTip('Project Id')} will work only on the Expo Go environment`);
// eslint-disable-next-line no-console
console.log(`
Go to: ${url}
To create a personal ProjectId
`);
}

main();
17 changes: 17 additions & 0 deletions packages/cli/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export const banner = `
@@@@@@@ @@@@@@@@@@@@@@@@@@
@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@ @@@@@@@@@@@
@@@@@@@@@@@@@@@ @@@@@@@@@@@@@ @@@@@@@@@@@@
@@@@@@@@@@@@@@@ @@@@@@@@@@@@@ @@@@@@@@@@@@@ Reown AppKit React Native CLI
@@@@@@@@@@@@@@@ @@@@@@@@@@@@ @@@@@@@@@@@@@ The easiest way to build dApps!
@@@@@@ @@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@@@
@@@@@@ @@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@ @@@@@@@@@@ @@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@
@@@@@ @@@@@@@@@@@@@@@@@@
`;
5 changes: 5 additions & 0 deletions packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../../tsconfig.json",
"include": ["src"],
"exclude": ["lib", "node_modules"]
}
17 changes: 17 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7326,6 +7326,16 @@ __metadata:
languageName: node
linkType: hard

"@reown/appkit-react-native-cli@workspace:packages/cli":
version: 0.0.0-use.local
resolution: "@reown/appkit-react-native-cli@workspace:packages/cli"
dependencies:
chalk: "npm:5.4.1"
bin:
appkit-react-native: lib/commonjs/index.js
languageName: unknown
linkType: soft

"@reown/appkit-scaffold-react-native@npm:1.3.0, @reown/appkit-scaffold-react-native@workspace:packages/scaffold":
version: 0.0.0-use.local
resolution: "@reown/appkit-scaffold-react-native@workspace:packages/scaffold"
Expand Down Expand Up @@ -11549,6 +11559,13 @@ __metadata:
languageName: node
linkType: hard

"chalk@npm:5.4.1":
version: 5.4.1
resolution: "chalk@npm:5.4.1"
checksum: b23e88132c702f4855ca6d25cb5538b1114343e41472d5263ee8a37cccfccd9c4216d111e1097c6a27830407a1dc81fecdf2a56f2c63033d4dbbd88c10b0dcef
languageName: node
linkType: hard

"chalk@npm:^2.0.1, chalk@npm:^2.4.2":
version: 2.4.2
resolution: "chalk@npm:2.4.2"
Expand Down