Skip to content

Commit

Permalink
Merge pull request #1 from patrickkabwe/feat/refactor
Browse files Browse the repository at this point in the history
Feat/refactor
  • Loading branch information
patrickkabwe authored Dec 1, 2024
2 parents c3fb4fc + c49e7a7 commit 50b72ef
Show file tree
Hide file tree
Showing 21 changed files with 777 additions and 389 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.4/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
labels:
- 'dependencies'

- package-ecosystem: 'npm'
directories:
- '/src'
schedule:
interval: 'daily'
26 changes: 26 additions & 0 deletions .github/workflows/lint-and-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint and Format

on:
push:
branches:
- main
pull_request:

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js 20.x
uses: oven-sh/setup-bun@v2

- name: Install npm dependencies (bun)
run: bun install

- name: Lint and Format
run: bun lint && bun format
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js 20.x
uses: oven-sh/setup-bun@v2

- name: Install npm dependencies (bun)
run: bun install

- name: Restore ccache
uses: hendrikmuhs/ccache-action@v1.2

- name: Get Version
id: get-version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: bun release
commit: 'chore(release): version packages v${{ steps.get-version.outputs.version }}'
title: 'chore(release): version packages v${{ steps.get-version.outputs.version }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 🚀 Nitro CLI

Create cross-platform native modules with ease!

## 📦 Quick Start

```bash
# Using bun
bun create nitro-module

# Using npx
npx create-nitro-module

# Using pnpm
pnpm create nitro-module

# Using yarn
yarn create nitro-module

# Using global install
nitro-module
```

## ⚡️ Options

```bash
Usage: nitro-module [options] [command]

CLI that enables you to create react native modules with Nitro Modules

Options:
-v, --version output the version number
-h, --help display help for command

Commands:
create [moduleName] create a new nitro module. If no moduleName is provided, you will be prompted for one.
generate <moduleName> generate a hybrid object into the package directory
```

## 🎯 Examples

```bash
# Create a new module
bun create nitro-module my-awesome-module
```

## 🔧 Supported Features

### Platforms

- 📱 iOS
- 🤖 Android

### Languages

- 🔵 Swift (iOS)
- ☕️ Kotlin (Android)
- 🔧 C++ (Both)

### Package Managers

- 🥟 bun (default)
- 🧶 yarn
- 📦 pnpm
- 🎁 npm
Binary file modified bun.lockb
Binary file not shown.
26 changes: 26 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import js from '@eslint/js'
import ts from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import nodePlugin from 'eslint-plugin-n'

export default [
js.configs.recommended,
nodePlugin.configs['flat/recommended-script'],
{
files: ['src/**/*.ts'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
plugins: {
'@typescript-eslint': ts,
},
rules: {
...ts.configs.recommended.rules,
},
ignores: ['lib/*', 'node_modules/*', 'src/assets/*'],
},
]
36 changes: 31 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,58 @@
{
"name": "create-nitro-module",
"version": "0.17.0",
"description": "CLI that enables you to create react native modules with Nitro Modules",
"private": false,
"type": "module",
"files": [
"lib"
"lib",
"README.md"
],
"bin": {
"create-nitro-module": "./lib/cli.js",
"nitro-module": "./lib/cli.js"
},
"scripts": {
"dev": "bun typecheck && tsx src/cli.ts",
"build": "tsup src",
"typecheck": "tsc --noEmit"
"build": "bun typecheck && tsup src",
"typecheck": "tsc --noEmit",
"changeset": "changeset",
"version": "changeset version",
"prerelease": "rm -rf ./lib/assets",
"release": "bun run build && changeset publish",
"lint": "eslint . --ignore-pattern 'eslint.config.js' --no-warn-ignored",
"format": "prettier --write src/*.ts"
},
"dependencies": {
"@changesets/cli": "^2.27.10",
"commander": "^12.1.0",
"inquirer": "^12.1.0",
"kleur": "^4.1.5",
"ora": "^8.1.1",
"tsup": "^8.3.5"
},
"eslintConfig": {},
"prettier": {},
"prettier": {
"semi": false,
"singleQuote": true,
"trailingComma": "es5",
"tabWidth": 2,
"arrowParens": "avoid"
},
"devDependencies": {
"@types/node": "^22.10.0",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"eslint": "^9.16.0",
"eslint-plugin-n": "^17.14.0",
"prettier": "^3.4.1",
"tsx": "^4.19.2",
"typescript": "^5.7.2"
},
"engines": {
"node": ">=18.0.0"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
}
}
119 changes: 59 additions & 60 deletions src/assets/workspace-package.json
Original file line number Diff line number Diff line change
@@ -1,67 +1,66 @@
{
"name": "template",
"private": true,
"version": "0.0.0",
"repository": "",
"author": "",
"scripts": {
"bootstrap": "bun --filter=\"**\" install && bun tsc && bun --filter=\"example\" pods",
"typescript": "bun --filter=\"**\" typescript",
"release": "release-it"
"name": "template",
"private": true,
"version": "0.0.0",
"repository": "",
"author": "",
"scripts": {
"bootstrap": "bun --filter=\"**\" install && bun tsc && bun --filter=\"example\" pods",
"typescript": "bun --filter=\"**\" typescript",
"release": "release-it"
},
"workspaces": [],
"devDependencies": {
"@release-it/conventional-changelog": "^8.0.1",
"@release-it/bumper": "^6.0.1",
"@jamesacarr/eslint-formatter-github-actions": "^0.2.0",
"release-it": "^17.6.0"
},
"release-it": {
"npm": {
"publish": false
},
"workspaces": [],
"devDependencies": {
"@release-it/conventional-changelog": "^8.0.1",
"@release-it/bumper": "^6.0.1",
"@jamesacarr/eslint-formatter-github-actions": "^0.2.0",
"release-it": "^17.6.0"
"git": {
"commitMessage": "chore: release ${version}",
"tagName": "v${version}",
"requireCleanWorkingDir": false
},
"release-it": {
"npm": {
"publish": false
},
"git": {
"commitMessage": "chore: release ${version}",
"tagName": "v${version}",
"requireCleanWorkingDir": false
},
"github": {
"release": true
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": {
"name": "conventionalcommits",
"types": [
{
"type": "feat",
"section": "✨ Features"
},
{
"type": "perf",
"section": "💨 Performance Improvements"
},
{
"type": "fix",
"section": "🐛 Bug Fixes"
},
{
"type": "chore(deps)",
"section": "🛠️ Dependency Upgrades"
},
{
"type": "docs",
"section": "📚 Documentation"
}
]
}
"github": {
"release": true
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": {
"name": "conventionalcommits",
"types": [
{
"type": "feat",
"section": "✨ Features"
},
{
"type": "perf",
"section": "💨 Performance Improvements"
},
{
"type": "fix",
"section": "🐛 Bug Fixes"
},
{
"type": "chore(deps)",
"section": "🛠️ Dependency Upgrades"
},
{
"type": "docs",
"section": "📚 Documentation"
}
]
}
}
},
"dependencies": {
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"prettier": "^3.4.1"
}
},
"dependencies": {
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"prettier": "^3.4.1"
}
}
Loading

0 comments on commit 50b72ef

Please sign in to comment.