Skip to content
Merged
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
36 changes: 30 additions & 6 deletions .github/workflows/test-nitro-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
pm: ['bun', 'yarn']
pm: ['bun', 'yarn', 'pnpm']
package-type: ['module', 'view']

env:
Expand All @@ -83,8 +83,14 @@ jobs:
git config --global user.name "GitHub Actions Bot"
git config --global user.email "actions@github.com"

- name: Setup pnpm
if: matrix.pm == 'pnpm'
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Node.js
if: matrix.pm == 'yarn'
if: matrix.pm == 'yarn' || matrix.pm == 'pnpm'
uses: actions/setup-node@v4
with:
node-version: 22.x
Expand Down Expand Up @@ -113,8 +119,14 @@ jobs:

- name: Generate ${{ matrix.package-type }} with ${{ matrix.pm }}
continue-on-error: false
if: matrix.pm != 'pnpm'
run: ${{ matrix.pm }} create nitro-module test-${{ matrix.package-type }} --skip-install --ci

- name: Generate ${{ matrix.package-type }} with ${{ matrix.pm }}
continue-on-error: false
if: matrix.pm == 'pnpm'
run: create-nitro-module test-${{ matrix.package-type }} --skip-install --ci

- name: Verify generated package structure
run: |
PACKAGE_DIR="react-native-test-${{ matrix.package-type }}"
Expand Down Expand Up @@ -182,7 +194,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
pm: ['bun', 'yarn']
pm: ['bun', 'yarn', 'pnpm']
package-type: ['module', 'view']
mode: ['Debug', 'Release']
env:
Expand All @@ -209,8 +221,14 @@ jobs:
ruby-version: '3.2'
bundler-cache: true

- name: Setup pnpm
if: matrix.pm == 'pnpm'
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Node.js
if: matrix.pm == 'yarn'
if: matrix.pm == 'yarn' || matrix.pm == 'pnpm'
uses: actions/setup-node@v4
with:
node-version: 22.x
Expand Down Expand Up @@ -272,7 +290,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
pm: ['bun', 'yarn']
pm: ['bun', 'yarn', 'pnpm']
package-type: ['module', 'view']
mode: ['Debug', 'Release']
env:
Expand All @@ -293,8 +311,14 @@ jobs:
echo "Package structure:"
find . -type f -name "*.json" -o -name "*.js" -o -name "*.ts" | head -20

- name: Setup pnpm
if: matrix.pm == 'pnpm'
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Node.js
if: matrix.pm == 'yarn'
if: matrix.pm == 'yarn' || matrix.pm == 'pnpm'
uses: actions/setup-node@v4
with:
node-version: 22.x
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ bun create nitro-module@latest my-nitro-module
# Using yarn
yarn create nitro-module@latest my-nitro-module

# Using pnpm
pnpm create nitro-module@latest my-nitro-module

# Using npx
npx create-nitro-module@latest my-nitro-module
```
3 changes: 3 additions & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'footer-max-line-length': [0, 'always'],
},
}
5 changes: 5 additions & 0 deletions docs/docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ Options:
yarn create nitro-module@latest my-awesome-module
```
</TabItem>
<TabItem value="pnpm" label="Pnpm">
```bash
pnpm create nitro-module@latest my-awesome-module
```
</TabItem>
</Tabs>

For additional support, please [open an issue](https://github.com/patrickkabwe/create-nitro-module/issues) on our GitHub repository.
93 changes: 45 additions & 48 deletions docs/docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,81 +6,78 @@ This section provides solutions to common issues you might encounter while using

1. **Pod Install Fails**

If you encounter issues during `pod install`, try the following steps:
If you encounter issues during `pod install`, try the following steps:

```bash
cd yourpackage/ios
pod deintegrate
pod install
```
```bash
cd yourpackage/ios
pod deintegrate
pod install
```

2. **Missing Header Files**

If Xcode reports missing header files, follow these steps:
If Xcode reports missing header files, follow these steps:

- Clean the build folder in Xcode (`Product` -> `Clean Build Folder`).
- Ensure all native dependencies are properly linked.
- Rebuild the project.
- Clean the build folder in Xcode (`Product` -> `Clean Build Folder`).
- Ensure all native dependencies are properly linked.
- Rebuild the project.

### Android Build Issues

1. **Gradle Sync Failed**

If Gradle sync fails, try cleaning and rebuilding the project:
If Gradle sync fails, try cleaning and rebuilding the project:

```bash
cd yourpackage/android
./gradlew clean
./gradlew build
```
```bash
cd yourpackage/android
./gradlew clean
./gradlew build
```

2. **Missing Dependencies**

If you encounter missing dependencies, check the following:
If you encounter missing dependencies, check the following:

- Ensure `build.gradle` contains the correct dependencies.
- Sync the project with Gradle files.
- Invalidate caches and restart Android Studio.
- Ensure `build.gradle` contains the correct dependencies.
- Sync the project with Gradle files.
- Invalidate caches and restart Android Studio.

### General Issues

1. **Error Invalid Version: latest**

If you encounter an invalid version error, this is due to an issue with the CLI: See issue: [Invalid Version: latest](https://github.com/react-native-community/cli/issues/2486)
If you encounter an invalid version error, this is due to an issue with the CLI: See issue: [Invalid Version: latest](https://github.com/react-native-community/cli/issues/2486)

```bash
✖ Failed to create nitro module: Command failed: bunx -y @react-native-community/cli@latest init TestToSpeechExample --directory path/react-native-module/example --skip-install
Resolving dependencies
Resolved, downloaded and extracted [2]
Saved lockfile
error Invalid Version: latest.
```
```bash
✖ Failed to create nitro module: Command failed: bunx -y @react-native-community/cli@latest init TestToSpeechExample --directory path/react-native-module/example --skip-install
Resolving dependencies
Resolved, downloaded and extracted [2]
Saved lockfile
error Invalid Version: latest.
```

To resolve this issue, use the following command: keep trying until it works.
To resolve this issue, use the following command: keep trying until it works.

2. **Module Not Found**
2. **Command Not Found**

If a module is not found, ensure it is properly installed and linked:
If a CLI command is not recognized, ensure the CLI is installed globally:

```bash
npm install <module-name>
npx react-native link <module-name>
```
```bash
npm install -g create-nitro-module@latest
# or
pnpm add -g create-nitro-module@latest
# or
yarn global add create-nitro-module@latest
# or
bun i -g create-nitro-module@latest
```

3. **Command Not Found**
3. **Permission Denied**

If a CLI command is not recognized, ensure the CLI is installed globally:
If you encounter permission issues, try running the command with `sudo`:

```bash
npm install -g create-nitro-module
```

4. **Permission Denied**

If you encounter permission issues, try running the command with `sudo`:

```bash
sudo <command>
```
```bash
sudo <command>
```

For additional support, please [open an issue](https://github.com/patrickkabwe/create-nitro-module/issues) on our GitHub repository.
15 changes: 15 additions & 0 deletions docs/docs/usage/create-a-nitro-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ To create a Nitro Module along with an example app, use the following command. T
yarn create nitro-module@latest my-awesome-module
```
</TabItem>
<TabItem value="pnpm" label="Pnpm">
```bash
pnpm create nitro-module@latest my-awesome-module
```
</TabItem>
</Tabs>

## Without example app
Expand All @@ -51,6 +56,11 @@ If you prefer to create a Nitro Module without an example app, use the following
yarn create nitro-module@latest my-awesome-module --skip-example
```
</TabItem>
<TabItem value="pnpm" label="Pnpm">
```bash
pnpm create nitro-module@latest my-awesome-module --skip-example
```
</TabItem>
</Tabs>

The `--skip-example` flag indicates that the example app should be skipped.
Expand All @@ -75,6 +85,11 @@ If you prefer to create a Nitro Module within a specific directory, use the foll
yarn create nitro-module@latest my-awesome-module --module-dir packages
```
</TabItem>
<TabItem value="pnpm" label="Pnpm">
```bash
pnpm create nitro-module@latest my-awesome-module --module-dir packages
```
</TabItem>
</Tabs>

This command will create a Nitro Module within the `packages` directory as shown in the example above.
6 changes: 6 additions & 0 deletions docs/docs/usage/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ bun install -g create-nitro-module
yarn global add create-nitro-module
```

### Using PNPM

```bash
pnpm add -g create-nitro-module
```

### Using NPM

```bash
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
],
"license": "MIT",
"bin": {
"create-nitro-module": "./lib/cli/index.js",
"nitro-module": "./lib/cli/index.js"
"create-nitro-module": "./lib/cli/index.js"
},
"repository": {
"type": "git",
Expand Down
6 changes: 5 additions & 1 deletion src/cli/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const getUserAnswers = async (
platforms: [SupportedPlatform.IOS, SupportedPlatform.ANDROID],
packageType: Nitro.Module,
langs: [SupportedLang.SWIFT, SupportedLang.KOTLIN],
pm: usedPm || 'bun',
pm: usedPm || 'pnpm',
}
}

Expand Down Expand Up @@ -250,6 +250,10 @@ const getUserAnswers = async (
label: 'npm',
value: 'npm',
},
{
label: 'pnpm',
value: 'pnpm',
},
],
})
},
Expand Down
Loading