├── .devcontainer └── devcontainer.json ├── .editorconfig ├── .eslintrc ├── .github ├── CODEOWNERS ├── dependabot.yml └── workflows │ ├── build-test.yml │ └── release.yml ├── .gitignore ├── .mocharc.json ├── .prettierrc.json ├── .release-please-manifest.json ├── .vscode └── launch.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── bin ├── dev.cmd ├── dev.js ├── run.cmd └── run.js ├── eslint.config.mjs ├── package.json ├── pnpm-lock.yaml ├── release-please-config.json ├── src ├── commands │ ├── dotenv.ts │ ├── icons.ts │ └── splash.ts ├── constants.ts ├── index.ts ├── types.ts └── utils │ ├── app.utils.ts │ └── file-utils.ts ├── test ├── assets │ ├── icon.png │ └── splashscreen.png ├── commands │ ├── dotenv.test.ts │ ├── icons.test.ts │ └── splash.test.ts └── tsconfig.json └── tsconfig.json /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node 3 | { 4 | "name": "ForWarD Software - React Native Toolbox", 5 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile 6 | "image": "mcr.microsoft.com/devcontainers/javascript-node:22", 7 | 8 | // Features to add to the dev container. More info: https://containers.dev/features. 9 | "features": { 10 | "ghcr.io/devcontainers/features/common-utils:2": { 11 | "configureZshAsDefaultShell": true, 12 | "username": "node" 13 | }, 14 | "ghcr.io/devcontainers-extra/features/zsh-plugins:0": { 15 | "plugins": "git npm", 16 | "omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions", 17 | "username": "node" 18 | }, 19 | "ghcr.io/devcontainers/features/git:1": {}, 20 | "ghcr.io/devcontainers/features/node:1": {}, 21 | "ghcr.io/joshuanianji/devcontainer-features/mount-pnpm-store:1": {} 22 | }, 23 | 24 | // Volumes to mount 25 | "mounts": [ 26 | "source=${devcontainerId}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume" 27 | ], 28 | 29 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 30 | // "forwardPorts": [], 31 | 32 | // Use 'postCreateCommand' to run commands after the container is created. 33 | "postCreateCommand": "sudo chown node node_modules; pnpm install", 34 | 35 | // Configure tool-specific properties. 36 | "customizations": { 37 | "vscode": { 38 | "extensions": [ 39 | "dbaeumer.vscode-eslint", 40 | "esbenp.prettier-vscode", 41 | "yzhang.markdown-all-in-one" 42 | ] 43 | } 44 | }, 45 | 46 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 47 | // "remoteUser": "root" 48 | } 49 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["oclif", "oclif-typescript", "prettier"], 3 | "ignores": ["/dist"] 4 | } -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Each line is a file pattern followed by one or more owners. 2 | 3 | # These owners will be the default owners for everything in 4 | # the repo. Unless a later match takes precedence, 5 | # @panz3r will be requested for review when someone 6 | # opens a pull request. 7 | * @panz3r 8 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for more information: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | # https://containers.dev/guide/dependabot 6 | 7 | version: 2 8 | updates: 9 | - package-ecosystem: "devcontainers" 10 | directory: "/" 11 | schedule: 12 | interval: monthly 13 | 14 | - package-ecosystem: "github-actions" 15 | directory: "/" 16 | schedule: 17 | interval: monthly 18 | 19 | - package-ecosystem: "npm" 20 | directory: "/" 21 | schedule: 22 | interval: weekly 23 | day: tuesday 24 | groups: 25 | oclif: 26 | patterns: 27 | - '@oclif/*' 28 | - 'oclif' 29 | exclude-patterns: 30 | - '@oclif/prettier-config' 31 | eslint: 32 | patterns: 33 | - '@eslint/*' 34 | - 'eslint*' 35 | - '@oclif/prettier-config' 36 | -------------------------------------------------------------------------------- /.github/workflows/build-test.yml: -------------------------------------------------------------------------------- 1 | name: Build & Test 2 | 3 | on: 4 | push: 5 | branches-ignore: [main] 6 | workflow_dispatch: 7 | 8 | permissions: 9 | contents: read 10 | 11 | jobs: 12 | build: 13 | name: Build & Test 14 | 15 | strategy: 16 | matrix: 17 | os: ['ubuntu-latest', 'windows-latest'] 18 | node_version: [lts/-1, lts/*, latest] 19 | fail-fast: false 20 | 21 | runs-on: ${{ matrix.os }} 22 | 23 | steps: 24 | - name: Checkout repository 25 | uses: actions/checkout@v4 26 | 27 | - name: Setup pnpm 28 | uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda 29 | 30 | - name: Setup NodeJS 31 | uses: actions/setup-node@v4 32 | with: 33 | node-version: ${{ matrix.node_version }} 34 | cache: pnpm 35 | 36 | - name: Install dependencies 37 | run: pnpm i --frozen-lockfile 38 | 39 | - name: Build CLI 40 | run: pnpm run build 41 | 42 | - name: Test CLI commands 43 | run: pnpm run test 44 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | release-please: 10 | name: Run Release Please 11 | 12 | runs-on: ubuntu-latest 13 | 14 | permissions: 15 | contents: write 16 | pull-requests: write 17 | 18 | outputs: 19 | releases_created: ${{ steps.release.outputs.releases_created }} 20 | 21 | steps: 22 | - name: Run release-please command 23 | id: release 24 | uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 25 | 26 | build-and-publish: 27 | name: Build & Publish 28 | 29 | runs-on: ubuntu-latest 30 | 31 | needs: [release-please] 32 | 33 | if: needs.release-please.outputs.releases_created != 'false' 34 | 35 | concurrency: publish-group # optional: ensure only one action runs at a time 36 | 37 | permissions: 38 | contents: read 39 | id-token: write 40 | 41 | steps: 42 | - name: Checkout repository 43 | uses: actions/checkout@v4 44 | 45 | - name: Setup pnpm 46 | uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda 47 | 48 | - name: Setup NodeJS 49 | uses: actions/setup-node@v4 50 | with: 51 | node-version: latest 52 | cache: pnpm 53 | registry-url: 'https://registry.npmjs.org' 54 | 55 | - name: Install dependencies 56 | run: pnpm i --frozen-lockfile 57 | 58 | - name: Build CLI 59 | run: pnpm build 60 | 61 | - name: Prepare package 62 | run: pnpm prepack 63 | 64 | - name: Publish package 65 | run: npm publish --provenance --access public 66 | env: 67 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 68 | 69 | - name: Cleanup 70 | run: pnpm run postpack 71 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/macos,windows,node,webstorm,visualstudiocode 2 | 3 | ### macOS ### 4 | # General 5 | .DS_Store 6 | .AppleDouble 7 | .LSOverride 8 | 9 | # Icon must end with two \r 10 | Icon 11 | 12 | # Thumbnails 13 | ._* 14 | 15 | # Files that might appear in the root of a volume 16 | .DocumentRevisions-V100 17 | .fseventsd 18 | .Spotlight-V100 19 | .TemporaryItems 20 | .Trashes 21 | .VolumeIcon.icns 22 | .com.apple.timemachine.donotpresent 23 | 24 | # Directories potentially created on remote AFP share 25 | .AppleDB 26 | .AppleDesktop 27 | Network Trash Folder 28 | Temporary Items 29 | .apdisk 30 | 31 | ### Node ### 32 | # Logs 33 | logs 34 | *.log 35 | npm-debug.log* 36 | yarn-debug.log* 37 | yarn-error.log* 38 | 39 | # Runtime data 40 | pids 41 | *.pid 42 | *.seed 43 | *.pid.lock 44 | 45 | # Directory for instrumented libs generated by jscoverage/JSCover 46 | lib-cov 47 | 48 | # Coverage directory used by tools like istanbul 49 | coverage 50 | 51 | # nyc test coverage 52 | .nyc_output 53 | 54 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 55 | .grunt 56 | 57 | # Bower dependency directory (https://bower.io/) 58 | bower_components 59 | 60 | # node-waf configuration 61 | .lock-wscript 62 | 63 | # Compiled binary addons (https://nodejs.org/api/addons.html) 64 | build/Release 65 | 66 | # Dependency directories 67 | node_modules/ 68 | jspm_packages/ 69 | 70 | # TypeScript v1 declaration files 71 | typings/ 72 | 73 | # Optional npm cache directory 74 | .npm 75 | 76 | # Optional eslint cache 77 | .eslintcache 78 | 79 | # Optional REPL history 80 | .node_repl_history 81 | 82 | # Output of 'npm pack' 83 | *.tgz 84 | 85 | # Yarn Integrity file 86 | .yarn-integrity 87 | 88 | # dotenv environment variables file 89 | .env 90 | 91 | # parcel-bundler cache (https://parceljs.org/) 92 | .cache 93 | 94 | # next.js build output 95 | .next 96 | 97 | # nuxt.js build output 98 | .nuxt 99 | 100 | # vuepress build output 101 | .vuepress/dist 102 | 103 | # Serverless directories 104 | .serverless 105 | 106 | ### VisualStudioCode ### 107 | .vscode/* 108 | !.vscode/settings.json 109 | !.vscode/tasks.json 110 | !.vscode/launch.json 111 | !.vscode/extensions.json 112 | 113 | ### WebStorm ### 114 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm 115 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 116 | 117 | # User-specific stuff 118 | .idea/**/workspace.xml 119 | .idea/**/tasks.xml 120 | .idea/**/usage.statistics.xml 121 | .idea/**/dictionaries 122 | .idea/**/shelf 123 | 124 | # Generated files 125 | .idea/**/contentModel.xml 126 | 127 | # Sensitive or high-churn files 128 | .idea/**/dataSources/ 129 | .idea/**/dataSources.ids 130 | .idea/**/dataSources.local.xml 131 | .idea/**/sqlDataSources.xml 132 | .idea/**/dynamic.xml 133 | .idea/**/uiDesigner.xml 134 | .idea/**/dbnavigator.xml 135 | 136 | # Gradle 137 | .idea/**/gradle.xml 138 | .idea/**/libraries 139 | 140 | # Gradle and Maven with auto-import 141 | # When using Gradle or Maven with auto-import, you should exclude module files, 142 | # since they will be recreated, and may cause churn. Uncomment if using 143 | # auto-import. 144 | # .idea/modules.xml 145 | # .idea/*.iml 146 | # .idea/modules 147 | 148 | # CMake 149 | cmake-build-*/ 150 | 151 | # Mongo Explorer plugin 152 | .idea/**/mongoSettings.xml 153 | 154 | # File-based project format 155 | *.iws 156 | 157 | # IntelliJ 158 | out/ 159 | 160 | # mpeltonen/sbt-idea plugin 161 | .idea_modules/ 162 | 163 | # JIRA plugin 164 | atlassian-ide-plugin.xml 165 | 166 | # Cursive Clojure plugin 167 | .idea/replstate.xml 168 | 169 | # Crashlytics plugin (for Android Studio and IntelliJ) 170 | com_crashlytics_export_strings.xml 171 | crashlytics.properties 172 | crashlytics-build.properties 173 | fabric.properties 174 | 175 | # Editor-based Rest Client 176 | .idea/httpRequests 177 | 178 | # Android studio 3.1+ serialized cache file 179 | .idea/caches/build_file_checksums.ser 180 | 181 | ### WebStorm Patch ### 182 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 183 | 184 | # *.iml 185 | # modules.xml 186 | # .idea/misc.xml 187 | # *.ipr 188 | 189 | # Sonarlint plugin 190 | .idea/sonarlint 191 | 192 | ### Windows ### 193 | # Windows thumbnail cache files 194 | Thumbs.db 195 | ehthumbs.db 196 | ehthumbs_vista.db 197 | 198 | # Dump file 199 | *.stackdump 200 | 201 | # Folder config file 202 | [Dd]esktop.ini 203 | 204 | # Recycle Bin used on file shares 205 | $RECYCLE.BIN/ 206 | 207 | # Windows Installer files 208 | *.cab 209 | *.msi 210 | *.msix 211 | *.msm 212 | *.msp 213 | 214 | # Windows shortcuts 215 | *.lnk 216 | 217 | 218 | # End of https://www.gitignore.io/api/macos,windows,node,webstorm,visualstudiocode 219 | 220 | *-debug.log 221 | *-error.log 222 | /.nyc_output 223 | **/.DS_Store 224 | /.idea 225 | /dist 226 | /tmp 227 | /node_modules 228 | oclif.manifest.json 229 | 230 | # Test-generated resources 231 | /android 232 | /ios 233 | .env 234 | -------------------------------------------------------------------------------- /.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": [ 3 | "ts-node/register" 4 | ], 5 | "watch-extensions": [ 6 | "ts" 7 | ], 8 | "recursive": true, 9 | "reporter": "spec", 10 | "timeout": 60000, 11 | "node-option": [ 12 | "loader=ts-node/esm", 13 | "experimental-specifier-resolution=node" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@oclif/prettier-config" 2 | -------------------------------------------------------------------------------- /.release-please-manifest.json: -------------------------------------------------------------------------------- 1 | {".":"4.1.3"} -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "node", 6 | "request": "attach", 7 | "name": "Attach", 8 | "port": 9229, 9 | "skipFiles": ["/**"] 10 | }, 11 | { 12 | "type": "node", 13 | "request": "launch", 14 | "name": "Execute Command", 15 | "skipFiles": ["/**"], 16 | "runtimeExecutable": "node", 17 | "runtimeArgs": ["--loader", "ts-node/esm", "--no-warnings=ExperimentalWarning"], 18 | "program": "${workspaceFolder}/bin/dev.js", 19 | "args": ["hello", "world"] 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [4.1.3](https://github.com/forwardsoftware/react-native-toolbox/compare/v4.1.2...v4.1.3) (2025-06-04) 4 | 5 | 6 | ### Bug Fixes 7 | 8 | * **deps:** bump ansis from 4.0.0 to 4.1.0 ([#154](https://github.com/forwardsoftware/react-native-toolbox/issues/154)) ([e838cb3](https://github.com/forwardsoftware/react-native-toolbox/commit/e838cb3250c32b10a45668bf6590e5d31bcff88b)) 9 | * **deps:** bump oclif dependencies ([#152](https://github.com/forwardsoftware/react-native-toolbox/issues/152)) ([5d53bcb](https://github.com/forwardsoftware/react-native-toolbox/commit/5d53bcb4ab0b316208427d476eb5f6b1e0aacfcb)) 10 | 11 | ## [4.1.2](https://github.com/forwardsoftware/react-native-toolbox/compare/v4.1.1...v4.1.2) (2025-05-21) 12 | 13 | 14 | ### Bug Fixes 15 | 16 | * **deps:** bump sharp from 0.34.1 to 0.34.2 ([#146](https://github.com/forwardsoftware/react-native-toolbox/issues/146)) ([ed073b6](https://github.com/forwardsoftware/react-native-toolbox/commit/ed073b654e8f7b9f2f91826b47b9602af5c6bfff)) 17 | 18 | ## [4.1.1](https://github.com/forwardsoftware/react-native-toolbox/compare/v4.1.0...v4.1.1) (2025-05-13) 19 | 20 | 21 | ### Bug Fixes 22 | 23 | * **deps:** bump @oclif/plugin-help from 6.2.27 to 6.2.28 ([#133](https://github.com/forwardsoftware/react-native-toolbox/issues/133)) ([e17eeb7](https://github.com/forwardsoftware/react-native-toolbox/commit/e17eeb73f94425a07cbb6d1b1c6bca4825d4eef4)) 24 | * **deps:** bump ansis from 3.17.0 to 4.0.0 ([#141](https://github.com/forwardsoftware/react-native-toolbox/issues/141)) ([47bbb08](https://github.com/forwardsoftware/react-native-toolbox/commit/47bbb08e560491fbc4236f853b74cdbae84f8a04)) 25 | 26 | ## [4.1.0](https://github.com/forwardsoftware/react-native-toolbox/compare/v4.0.6...v4.1.0) (2025-05-01) 27 | 28 | 29 | ### Features 30 | 31 | * Reduce dependencies and enhance CLI commands ([#129](https://github.com/forwardsoftware/react-native-toolbox/issues/129)) ([096c7d3](https://github.com/forwardsoftware/react-native-toolbox/commit/096c7d3e6b7f0b9a223ee9e20de5dca42dbbab78)) 32 | 33 | ## [4.0.6](https://github.com/forwardsoftware/react-native-toolbox/compare/v4.0.5...v4.0.6) (2025-04-30) 34 | 35 | 36 | ### Bug Fixes 37 | 38 | * **deps-dev:** bump oclif from 4.17.44 to 4.17.46 ([#123](https://github.com/forwardsoftware/react-native-toolbox/issues/123)) ([712b16e](https://github.com/forwardsoftware/react-native-toolbox/commit/712b16ebc5287ed2fe482b59439ac2099fbbbb6e)) 39 | * **deps:** bump @oclif/core from 4.2.10 to 4.3.0 ([#126](https://github.com/forwardsoftware/react-native-toolbox/issues/126)) ([c3bf715](https://github.com/forwardsoftware/react-native-toolbox/commit/c3bf71566ee772aa3fd7b1732a0b63db250f666a)) 40 | 41 | ## [4.0.5](https://github.com/forwardsoftware/react-native-toolbox/compare/v4.0.4...v4.0.5) (2025-04-15) 42 | 43 | 44 | ### Bug Fixes 45 | 46 | * **deps-dev:** bump oclif from 4.17.43 to 4.17.44 in the oclif group ([#119](https://github.com/forwardsoftware/react-native-toolbox/issues/119)) ([2a64808](https://github.com/forwardsoftware/react-native-toolbox/commit/2a6480871717dc9358d493028a43f90818f463d3)) 47 | 48 | ## [4.0.4](https://github.com/forwardsoftware/react-native-toolbox/compare/v4.0.3...v4.0.4) (2025-04-08) 49 | 50 | 51 | ### Bug Fixes 52 | 53 | * bump sharp from 0.33.5 to 0.34.1 ([#117](https://github.com/forwardsoftware/react-native-toolbox/issues/117)) ([f8e7ab6](https://github.com/forwardsoftware/react-native-toolbox/commit/f8e7ab63b1e3aecb24b10200e1977b181279fb2a)) 54 | 55 | ## [4.0.3](https://github.com/forwardsoftware/react-native-toolbox/compare/v4.0.2...v4.0.3) (2025-04-02) 56 | 57 | 58 | ### Bug Fixes 59 | 60 | * bump oclif dependencies ([#105](https://github.com/forwardsoftware/react-native-toolbox/issues/105)) ([d1dc018](https://github.com/forwardsoftware/react-native-toolbox/commit/d1dc0184b2bbbde520764f748f14722e9a395fba)) 61 | * bump oclif dependencies ([#110](https://github.com/forwardsoftware/react-native-toolbox/issues/110)) ([6f7c70d](https://github.com/forwardsoftware/react-native-toolbox/commit/6f7c70d42b7d68557c7966d607194bf855dbab77)) 62 | 63 | ## [4.0.2](https://github.com/forwardsoftware/react-native-toolbox/compare/v4.0.1...v4.0.2) (2025-03-18) 64 | 65 | 66 | ### Bug Fixes 67 | 68 | * bump oclif dependencies ([#102](https://github.com/forwardsoftware/react-native-toolbox/issues/102)) ([8253264](https://github.com/forwardsoftware/react-native-toolbox/commit/8253264d6718fa3efc618b37729ff155c1cf878e)) 69 | 70 | ## [4.0.1](https://github.com/forwardsoftware/react-native-toolbox/compare/v4.0.0...v4.0.1) (2025-03-11) 71 | 72 | 73 | ### Bug Fixes 74 | 75 | * Bump oclif dependencies ([#91](https://github.com/forwardsoftware/react-native-toolbox/issues/91)) ([27366cb](https://github.com/forwardsoftware/react-native-toolbox/commit/27366cb6d3cb2b004697e005738c6ed814a74ece)) 76 | * bump oclif dependencies ([#97](https://github.com/forwardsoftware/react-native-toolbox/issues/97)) ([f0cb4f1](https://github.com/forwardsoftware/react-native-toolbox/commit/f0cb4f1d86bb2a395350f34b4ecbc0a92fb4d1d0)) 77 | 78 | ## [4.0.0](https://github.com/forwardsoftware/react-native-toolbox/compare/react-native-toolbox-v3.0.0...react-native-toolbox-v4.0.0) (2025-02-20) 79 | 80 | 81 | ### ⚠ BREAKING CHANGES 82 | 83 | * upgrade project ([#76](https://github.com/forwardsoftware/react-native-toolbox/issues/76)) 84 | 85 | ### Features 86 | 87 | * **dotenv:** Add script to manage 'dotenv' files ([4c971e1](https://github.com/forwardsoftware/react-native-toolbox/commit/4c971e1c484ea7a001ed77aac230f04cd38f6e5a)) 88 | * **icon generator:** Initial implementation ([04d6cab](https://github.com/forwardsoftware/react-native-toolbox/commit/04d6cabb13497e435fce9a21dde2088f985d74a5)) 89 | * **Node12:** Update deps to add support for Node12 ([efe8fe4](https://github.com/forwardsoftware/react-native-toolbox/commit/efe8fe4ff7b1ba600d02ad1b47547c39dbe3909d)) 90 | * **rewrite:** Major rewrite using 'oclif' ([dc9342f](https://github.com/forwardsoftware/react-native-toolbox/commit/dc9342fee08c324b1858d4b0d5fb73a650922657)) 91 | * **Splashscreen:** Add script to generate splashscreen images ([dca5e85](https://github.com/forwardsoftware/react-native-toolbox/commit/dca5e850a2d376b4bfcef595640497f914d4a197)) 92 | * upgrade project ([#76](https://github.com/forwardsoftware/react-native-toolbox/issues/76)) ([0d5bfa0](https://github.com/forwardsoftware/react-native-toolbox/commit/0d5bfa0077b8863dd045037f70d45367f802478f)) 93 | * upgrade to latest oclif version ([21d7b51](https://github.com/forwardsoftware/react-native-toolbox/commit/21d7b5120b739640ce567f669b8f0d28a01304a7)) 94 | 95 | 96 | ### Bug Fixes 97 | 98 | * disable oclif plugins support ([53e3943](https://github.com/forwardsoftware/react-native-toolbox/commit/53e39434fafd9f0b22bc4b41627077fc3f604045)) 99 | * **icon generator:** Migrate 'sharp' removed method to new one ([47349d9](https://github.com/forwardsoftware/react-native-toolbox/commit/47349d9d52c699fe937d23bd2be018e7897ceda0)) 100 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | community@forward.dev. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Welcome to React Native Toolbox contributing guide 2 | 3 | We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: 4 | 5 | - Reporting a bug 6 | - Discussing the current state of the code 7 | - Submitting a fix 8 | - Proposing new features 9 | 10 | Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable. 11 | 12 | In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR. 13 | 14 | > Use the table of contents icon on the top left corner of this document to get to a specific section of this guide quickly. 15 | 16 | ## New contributor guide 17 | 18 | To get an overview of the project, read the [README](README.md). 19 | 20 | Here are some resources to help you get started with open source contributions: 21 | 22 | - [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github) 23 | - [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git) 24 | - [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow) 25 | - [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests) 26 | 27 | ## Getting Started 28 | 29 | We use GitHub to host code, to track issues and feature requests, as well as accept pull requests. 30 | 31 | ### Report bugs using GitHub's [issues](https://github.com/forwardsoftware/react-native-toolbox/issues) 32 | 33 | Report a bug by [opening a new issue](https://github.com/forwardsoftware/react-native-toolbox/issues/new/choose) 34 | 35 | #### Write bug reports with detail, background, and sample code 36 | 37 | **Great Bug Reports** should contain: 38 | 39 | - A quick summary and/or background 40 | - Steps to reproduce 41 | - Be specific! 42 | - Give sample code if you can, the sample code should allow _anyone_ with a base setup to reproduce your issue 43 | - What you expected would happen 44 | - What actually happens 45 | - Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) 46 | 47 | ### We use [GitHub Flow](https://guides.github.com/introduction/flow/index.html), so all code changes happen through Pull Requests 48 | 49 | We actively welcome your pull requests: 50 | 51 | 1. Fork the repo and create your branch from `main`. 52 | 2. If you've added code that should be tested, add tests. 53 | 3. If you've changed APIs, update the documentation. 54 | 4. Ensure the test suite passes. 55 | 5. Make sure your code lints. 56 | 6. Issue your pull request! 57 | 58 | #### Use a consistent Coding Style 59 | 60 | This project uses [ESLint](https://eslint.org/) and [Prettier](https://prettier.io/) to maintain a unified coding style. 61 | Before committing your changes remember to run `pnpm lint` and check possible warnings and errors. 62 | 63 | #### Any contributions you make will be under the Mozilla Public License (version 2.0) 64 | 65 | In short, when you submit code changes, your submissions are understood to be under the same [Mozilla Public License Version 2.0](http://choosealicense.com/licenses/mpl-2.0/) that covers the project. 66 | Feel free to contact the maintainers if that's a concern. 67 | 68 | ## License 69 | 70 | By contributing, you agree that your contributions will be licensed under its [Mozilla Public License Version 2.0](LICENSE). 71 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | React Native Toolbox 2 | ===================== 3 | 4 | > A set of scripts to simplify React Native development 5 | 6 | [![License](https://img.shields.io/npm/l/@forward-software/react-native-toolbox.svg)](https://github.com/forwardsoftware/react-native-toolbox/blob/main/LICENSE) [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io) 7 | 8 | [![Version](https://img.shields.io/npm/v/@forward-software/react-native-toolbox.svg)](https://npmjs.org/package/@forward-software/react-native-toolbox) [![Downloads/week](https://img.shields.io/npm/dw/@forward-software/react-native-toolbox.svg)](https://npmjs.org/package/@forward-software/react-native-toolbox) 9 | 10 | 11 | * [Install](#install) 12 | * [Commands](#commands) 13 | 14 | 15 | # Install 16 | 17 | ```bash 18 | yarn add -D @forward-software/react-native-toolbox 19 | ``` 20 | 21 | or use it directly with 22 | 23 | ```bash 24 | npx @forward-software/react-native-toolbox 25 | ``` 26 | 27 | # Commands 28 | 29 | 30 | * [`rn-toolbox dotenv ENVIRONMENTNAME`](#rn-toolbox-dotenv-environmentname) 31 | * [`rn-toolbox icons [FILE]`](#rn-toolbox-icons-file) 32 | * [`rn-toolbox splash [FILE]`](#rn-toolbox-splash-file) 33 | * [`rn-toolbox help [COMMAND]`](#rn-toolbox-help-command) 34 | 35 | ## `rn-toolbox dotenv ENVIRONMENTNAME` 36 | 37 | Manage .env files for react-native-dotenv for a specific environment (development, production, etc...) 38 | 39 | ``` 40 | USAGE 41 | $ rn-toolbox dotenv ENVIRONMENTNAME [-h] 42 | 43 | ARGUMENTS 44 | ENVIRONMENTNAME name of the environment to load .dotenv file for. 45 | 46 | FLAGS 47 | -h, --help Show CLI help. 48 | 49 | DESCRIPTION 50 | Manage .env files for react-native-dotenv for a specific environment (development, production, etc...) 51 | 52 | EXAMPLES 53 | $ rn-toolbox dotenv 54 | ``` 55 | 56 | _See code: [src/commands/dotenv.ts](https://github.com/forwardsoftware/react-native-toolbox/blob/main/src/commands/dotenv.ts)_ 57 | 58 | ## `rn-toolbox icons [FILE]` 59 | 60 | Generate app icons using a file as template. 61 | 62 | ``` 63 | USAGE 64 | $ rn-toolbox icons [FILE] [-a ] [-h] [-v] 65 | 66 | ARGUMENTS 67 | FILE [default: ./assets/icon.png] Input icon file 68 | 69 | FLAGS 70 | -a, --appName= App name used to build output assets path. Default is retrieved from 'app.json' file. 71 | -h, --help Show CLI help. 72 | -v, --verbose Print more detailed log messages. 73 | 74 | DESCRIPTION 75 | Generate app icons using a file as template. 76 | 77 | The template icon file should be at least 1024x1024px. 78 | 79 | 80 | EXAMPLES 81 | $ rn-toolbox icons 82 | ``` 83 | 84 | _See code: [src/commands/icons.ts](https://github.com/forwardsoftware/react-native-toolbox/blob/main/src/commands/icons.ts)_ 85 | 86 | ## `rn-toolbox splash [FILE]` 87 | 88 | Generate app splashscreens using a file as template. 89 | 90 | ``` 91 | USAGE 92 | $ rn-toolbox splash [FILE] [-a ] [-h] [-v] 93 | 94 | ARGUMENTS 95 | FILE [default: ./assets/splashscreen.png] Input splashscreen file 96 | 97 | FLAGS 98 | -a, --appName= App name used to build output assets path. Default is retrieved from 'app.json' file. 99 | -h, --help Show CLI help. 100 | -v, --verbose Print more detailed log messages. 101 | 102 | DESCRIPTION 103 | Generate app splashscreens using a file as template. 104 | 105 | The template splashscreen file should be at least 1242x2208px. 106 | 107 | 108 | EXAMPLES 109 | $ rn-toolbox splash 110 | ``` 111 | 112 | _See code: [src/commands/splash.ts](https://github.com/forwardsoftware/react-native-toolbox/blob/main/src/commands/splash.ts)_ 113 | 114 | ## `rn-toolbox help [COMMAND]` 115 | 116 | Display help for rn-toolbox. 117 | 118 | ``` 119 | USAGE 120 | $ rn-toolbox help [COMMAND...] [-n] 121 | 122 | ARGUMENTS 123 | COMMAND... Command to show help for. 124 | 125 | FLAGS 126 | -n, --nested-commands Include all nested commands in the output. 127 | 128 | DESCRIPTION 129 | Display help for rn-toolbox. 130 | ``` 131 | 132 | _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.27/src/commands/help.ts)_ 133 | 134 | 135 | ## License 136 | 137 | Mozilla Public License 2.0 138 | 139 | --- 140 | 141 | Made with ✨ & ❤️ by [ForWarD Software](https://github.com/forwardsoftware) and [contributors](https://github.com/forwardsoftware/react-native-toolbox/graphs/contributors) 142 | 143 | If you found this project to be helpful, please consider contacting us to develop your React and React Native projects. 144 | -------------------------------------------------------------------------------- /bin/dev.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %* 4 | -------------------------------------------------------------------------------- /bin/dev.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning 2 | 3 | import {execute} from '@oclif/core' 4 | 5 | await execute({development: true, dir: import.meta.url}) 6 | -------------------------------------------------------------------------------- /bin/run.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | node "%~dp0\run" %* 4 | -------------------------------------------------------------------------------- /bin/run.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | import {execute} from '@oclif/core' 4 | 5 | await execute({dir: import.meta.url}) 6 | -------------------------------------------------------------------------------- /eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import {includeIgnoreFile} from '@eslint/compat' 2 | import oclif from 'eslint-config-oclif' 3 | import prettier from 'eslint-config-prettier' 4 | import path from 'node:path' 5 | import {fileURLToPath} from 'node:url' 6 | 7 | const gitignorePath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.gitignore') 8 | 9 | export default [includeIgnoreFile(gitignorePath), ...oclif, prettier] 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@forward-software/react-native-toolbox", 3 | "version": "4.1.3", 4 | "description": "A set of scripts to simplify React Native development", 5 | "author": "ForWarD Software (https://github.com/forwardsoftware)", 6 | "license": "MPL-2.0", 7 | "repository": "https://github.com/forwardsoftware/react-native-toolbox", 8 | "keywords": [ 9 | "react-native", 10 | "scripts", 11 | "utils", 12 | "development" 13 | ], 14 | "homepage": "https://github.com/forwardsoftware/react-native-toolbox#readme", 15 | "bugs": "https://github.com/forwardsoftware/react-native-toolbox/issues", 16 | "scripts": { 17 | "cleanup": "rimraf android/ ios/ dist/ .nyc_output/ oclif.manifest.json .env", 18 | "build": "rimraf dist && tsc -b", 19 | "lint": "eslint", 20 | "postpack": "rimraf oclif.manifest.json", 21 | "posttest": "pnpm run lint", 22 | "prepack": "oclif manifest && oclif readme", 23 | "test": "mocha --forbid-only \"test/**/*.test.ts\"", 24 | "version": "oclif readme && git add README.md" 25 | }, 26 | "engines": { 27 | "node": ">=18.0.0" 28 | }, 29 | "type": "module", 30 | "main": "dist/index.js", 31 | "types": "dist/index.d.ts", 32 | "files": [ 33 | "./bin", 34 | "./dist", 35 | "./oclif.manifest.json" 36 | ], 37 | "bin": { 38 | "rn-toolbox": "./bin/run.js" 39 | }, 40 | "oclif": { 41 | "bin": "rn-toolbox", 42 | "dirname": "rn-toolbox", 43 | "commands": "./dist/commands", 44 | "plugins": [ 45 | "@oclif/plugin-help" 46 | ], 47 | "topicSeparator": " " 48 | }, 49 | "packageManager": "pnpm@10.4.1+sha512.c753b6c3ad7afa13af388fa6d808035a008e30ea9993f58c6663e2bc5ff21679aa834db094987129aa4d488b86df57f7b634981b2f827cdcacc698cc0cfb88af", 50 | "dependencies": { 51 | "@oclif/core": "^4", 52 | "@oclif/plugin-help": "^6", 53 | "ansis": "^4.0.0", 54 | "sharp": "^0.34.1" 55 | }, 56 | "devDependencies": { 57 | "@eslint/compat": "^1", 58 | "@oclif/prettier-config": "^0.2.1", 59 | "@oclif/test": "^4", 60 | "@types/chai": "^5", 61 | "@types/mocha": "^10", 62 | "@types/node": "^22", 63 | "chai": "^5", 64 | "eslint": "^9", 65 | "eslint-config-oclif": "^6", 66 | "eslint-config-prettier": "^10", 67 | "mocha": "^11", 68 | "oclif": "^4", 69 | "rimraf": "^6", 70 | "ts-node": "^10", 71 | "typescript": "^5" 72 | } 73 | } -------------------------------------------------------------------------------- /release-please-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", 3 | "release-type": "node", 4 | "always-update": true, 5 | "packages": { 6 | ".": { 7 | "include-component-in-tag": false 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/commands/dotenv.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025 ForWarD Software (https://forwardsoftware.solutions/) 3 | * 4 | * This Source Code Form is subject to the terms of the Mozilla Public 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | */ 8 | 9 | import { Args, Command, Flags } from '@oclif/core' 10 | import { cyan, green, red, yellow } from 'ansis' 11 | import { copyFile, unlink } from 'node:fs/promises' 12 | 13 | import { checkAssetFile } from '../utils/file-utils.js' 14 | 15 | export default class Dotenv extends Command { 16 | static override args = { 17 | environmentName: Args.string({ description: 'name of the environment to load .dotenv file for.', required: true }), 18 | } 19 | static override description = `Manage .env files for react-native-dotenv for a specific environment (development, production, etc...)` 20 | static override examples = [ 21 | '<%= config.bin %> <%= command.id %>', 22 | ] 23 | static override flags = { 24 | help: Flags.help({ char: 'h' }), 25 | } 26 | 27 | public async run(): Promise { 28 | const { args } = await this.parse(Dotenv) 29 | 30 | const sourceEnvFilePath = `./.env.${args.environmentName}` 31 | const outputEnvFile = './.env' 32 | 33 | const sourceFilesExists = checkAssetFile(sourceEnvFilePath) 34 | if (!sourceFilesExists) { 35 | this.error(`Source file ${cyan(sourceEnvFilePath)} not found! ${red('ABORTING')}`) 36 | } 37 | 38 | this.log(`${yellow('≈')} Generating .env from ${cyan(sourceEnvFilePath)} file...`) 39 | 40 | // Remove existing .env file 41 | this.log(`${yellow('≈')} Removing existing .env file (if any)...`) 42 | try { 43 | await unlink(outputEnvFile) 44 | this.log(`${green('✔')} Removed existing .env file.`) 45 | } catch { 46 | this.log(`${red('✘')} No existing .env file to remove.`) 47 | } 48 | 49 | // Copy new .env file 50 | this.log(`${yellow('≈')} Generating new .env file...`) 51 | try { 52 | await copyFile(sourceEnvFilePath, outputEnvFile) 53 | this.log(`${green('✔')} Generated new .env file.`) 54 | } catch (error) { 55 | this.error(error as Error) 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/commands/icons.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025 ForWarD Software (https://forwardsoftware.solutions/) 3 | * 4 | * This Source Code Form is subject to the terms of the Mozilla Public 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | */ 8 | 9 | import { Args, Command, Flags } from '@oclif/core' 10 | import { cyan, green, red, yellow } from 'ansis' 11 | import { writeFile } from 'node:fs/promises' 12 | import { join } from 'node:path' 13 | import sharp from 'sharp' 14 | 15 | import type { ContentJson } from '../types.js' 16 | 17 | import { ICON_SIZES_ANDROID, ICON_SIZES_IOS } from '../constants.js' 18 | import { MaskType } from '../types.js' 19 | import { extractAppName } from '../utils/app.utils.js' 20 | import { checkAssetFile, mkdirp } from '../utils/file-utils.js' 21 | 22 | export default class Icons extends Command { 23 | static override args = { 24 | file: Args.string({ 25 | default: './assets/icon.png', 26 | description: 'Input icon file', 27 | required: false, 28 | }), 29 | } 30 | static override description = `Generate app icons using a file as template. 31 | 32 | The template icon file should be at least 1024x1024px. 33 | ` 34 | static override examples = [ 35 | '<%= config.bin %> <%= command.id %>', 36 | ] 37 | static override flags = { 38 | appName: Flags.string({ 39 | char: 'a', 40 | default: extractAppName, 41 | description: "App name used to build output assets path. Default is retrieved from 'app.json' file.", 42 | }), 43 | help: Flags.help({ 44 | char: 'h', 45 | }), 46 | verbose: Flags.boolean({ 47 | char: 'v', 48 | default: false, 49 | description: 'Print more detailed log messages.', 50 | }), 51 | } 52 | private _isVerbose: boolean = false 53 | 54 | public async run(): Promise { 55 | const { args, flags } = await this.parse(Icons) 56 | 57 | this._isVerbose = flags.verbose 58 | 59 | const sourceFilesExists = checkAssetFile(args.file) 60 | if (!sourceFilesExists) { 61 | this.error(`${red('✘')} Source file ${cyan(args.file)} not found! ${red('ABORTING')}`) 62 | } 63 | 64 | if (!flags.appName) { 65 | this.error(`${red('✘')} Failed to retrive ${cyan('appName')} value. Please specify it with the ${green('appName')} flag or check that ${cyan('app.json')} file exists. ${red('ABORTING')}`) 66 | } 67 | 68 | this.log(yellow('≈'), `Generating icons for '${cyan(flags.appName)}' app...`) 69 | 70 | // Run both iOS and Android tasks in parallel 71 | await Promise.all([ 72 | this.generateAndroidIcons(args.file, 'android/app/src/main'), 73 | this.generateIOSIcons(args.file, `ios/${flags.appName}/Images.xcassets/AppIcon.appiconset`), 74 | ]) 75 | 76 | this.log(green('✔'), `Generated icons for '${cyan(flags.appName)}' app.`) 77 | } 78 | 79 | private async generateAndroidIcon(inputPath: string, outputPath: string, size: number, mask: Buffer) { 80 | this.logVerbose(yellow('≈'), cyan('Android'), `Generating icon '${cyan(outputPath)}'...`) 81 | 82 | try { 83 | await sharp(inputPath) 84 | .resize(size) 85 | .composite([ 86 | { 87 | blend: 'dest-in', 88 | gravity: 'center', 89 | input: mask, 90 | }, 91 | ]) 92 | .toFile(outputPath) 93 | 94 | this.logVerbose(green('✔'), cyan('Android'), `Icon '${cyan(outputPath)}' generated.`) 95 | } catch (error) { 96 | this.log(red('✘'), cyan('Android'), `Failed to generate icon '${cyan(outputPath)}':`, error) 97 | } 98 | } 99 | 100 | private generateAndroidIconCircle(inputPath: string, outputPath: string, size: number) { 101 | return this.generateAndroidIcon(inputPath, outputPath, size, this.getMask('circle', size)) 102 | } 103 | 104 | private generateAndroidIconRounded(inputPath: string, outputPath: string, size: number) { 105 | return this.generateAndroidIcon(inputPath, outputPath, size, this.getMask('roundedCorners', size)) 106 | } 107 | 108 | private async generateAndroidIcons(inputFile: string, baseOutputDir: string) { 109 | this.log(yellow('≈'), cyan('Android'), 'Generating icons...') 110 | 111 | await mkdirp(baseOutputDir) 112 | 113 | // Web icon 114 | await this.generateAndroidIconRounded(inputFile, join(baseOutputDir, 'web_hi_res_512.png'), 512) 115 | 116 | // Launcher icons (parallel per density) 117 | const androidTasks = ICON_SIZES_ANDROID.map(({density, size}) => 118 | this.generateAndroidIconsWithDensity(inputFile, join(baseOutputDir, 'res'), density, size), 119 | ) 120 | 121 | await Promise.all(androidTasks) 122 | 123 | this.log(green('✔'), cyan('Android'), 'icons generated.') 124 | } 125 | 126 | private async generateAndroidIconsWithDensity(inputPath: string, outputDir: string, density: string, size: number) { 127 | const densityFolderPath = join(outputDir, `mipmap-${density}`) 128 | 129 | await mkdirp(densityFolderPath) 130 | 131 | this.logVerbose(yellow('≈'), cyan('Android'), `Generating icons for density '${density}'...`) 132 | 133 | await Promise.all([ 134 | // Rounded icon 135 | this.generateAndroidIconRounded(inputPath, join(densityFolderPath, 'ic_launcher.png'), size), 136 | // Circle icon 137 | this.generateAndroidIconCircle(inputPath, join(densityFolderPath, 'ic_launcher_round.png'), size), 138 | ]) 139 | 140 | this.logVerbose(green('✔'), cyan('Android'), `Icons generated for density '${density}'.`) 141 | } 142 | 143 | private async generateIOSIcon(inputPath: string, outputDir: string, filename: string, size: number) { 144 | this.logVerbose(yellow('≈'), cyan('iOS'), `Generating icon '${cyan(filename)}'...`) 145 | 146 | try { 147 | await sharp(inputPath).resize(size, size, {fit: 'cover'}).toFile(join(outputDir, filename)) 148 | 149 | this.logVerbose(green('✔'), cyan('iOS'), `Icon '${cyan(filename)}' generated.`) 150 | } catch (error) { 151 | this.log(red('✘'), cyan('iOS'), `Failed to generate icon '${cyan(filename)}'.`, error) 152 | } 153 | } 154 | 155 | private async generateIOSIcons(inputFile: string, outputDir: string) { 156 | this.log(yellow('≈'), cyan('iOS'), `Generating icons...`) 157 | 158 | await mkdirp(outputDir) 159 | 160 | // Generate Contents.json 161 | const contentJson: ContentJson = { 162 | images: [], 163 | info: { 164 | author: 'react-native-toolbox', 165 | version: 1, 166 | }, 167 | } 168 | 169 | // Generate all iOS icons in parallel 170 | const iOSTasks = ICON_SIZES_IOS.flatMap(({baseSize, idiom, name, scales}) => 171 | scales.map((scale) => { 172 | const filename = this.getIOSIconName(name, scale) 173 | 174 | // Register icon in content.json file 175 | contentJson.images.push({ 176 | filename, 177 | idiom: idiom || 'iphone', 178 | scale: `${scale}x`, 179 | size: `${baseSize}x${baseSize}`, 180 | }) 181 | 182 | return this.generateIOSIcon(inputFile, outputDir, filename, baseSize * scale) 183 | }), 184 | ) 185 | 186 | await Promise.all(iOSTasks) 187 | 188 | // Write Contents.json descriptor file for iconset 189 | await writeFile(join(outputDir, 'Contents.json'), JSON.stringify(contentJson, null, 2)) 190 | 191 | this.log(green('✔'), cyan('iOS'), `Icons generated.`) 192 | } 193 | 194 | private getIOSIconName(baseName: string, scale: number): string { 195 | return `${baseName}${scale > 1 ? `@${scale}x` : ''}.png` 196 | } 197 | 198 | private getMask(type: MaskType, size: number): Buffer { 199 | if (type === 'roundedCorners') { 200 | const cornerRadius = Math.floor(size * 0.1) // Calculate 10% corner radius 201 | return Buffer.from(``) 202 | } 203 | 204 | const radius = Math.floor(size / 2) 205 | return Buffer.from(``) 206 | } 207 | 208 | private logVerbose(message?: string, ...args: unknown[]) { 209 | if (this._isVerbose) { 210 | this.log(message, ...args) 211 | } 212 | } 213 | } 214 | -------------------------------------------------------------------------------- /src/commands/splash.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025 ForWarD Software (https://forwardsoftware.solutions/) 3 | * 4 | * This Source Code Form is subject to the terms of the Mozilla Public 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | */ 8 | 9 | import { Args, Command, Flags } from '@oclif/core' 10 | import { cyan, green, red, yellow } from 'ansis' 11 | import { writeFile } from 'node:fs/promises' 12 | import { join } from 'node:path' 13 | import sharp from 'sharp' 14 | 15 | import type { ContentJson, SplashscreenSize } from '../types.js' 16 | 17 | import { SPLASHSCREEN_SIZES_ANDROID, SPLASHSCREEN_SIZES_IOS } from '../constants.js' 18 | import { extractAppName } from '../utils/app.utils.js' 19 | import { checkAssetFile, mkdirp } from '../utils/file-utils.js' 20 | 21 | export default class Splash extends Command { 22 | static override args = { 23 | file: Args.string({ 24 | default: './assets/splashscreen.png', 25 | description: 'Input splashscreen file', 26 | required: false, 27 | }), 28 | } 29 | static override description = `Generate app splashscreens using a file as template. 30 | 31 | The template splashscreen file should be at least 1242x2208px. 32 | ` 33 | static override examples = [ 34 | '<%= config.bin %> <%= command.id %>', 35 | ] 36 | static override flags = { 37 | appName: Flags.string({ 38 | char: 'a', 39 | default: extractAppName, 40 | description: "App name used to build output assets path. Default is retrieved from 'app.json' file.", 41 | }), 42 | help: Flags.help({ 43 | char: 'h', 44 | }), 45 | verbose: Flags.boolean({ 46 | char: 'v', 47 | default: false, 48 | description: 'Print more detailed log messages.', 49 | }), 50 | } 51 | private _isVerbose: boolean = false 52 | 53 | public async run(): Promise { 54 | const { args, flags } = await this.parse(Splash) 55 | 56 | this._isVerbose = flags.verbose 57 | 58 | const sourceFilesExists = checkAssetFile(args.file) 59 | if (!sourceFilesExists) { 60 | this.error(`${red('✘')} Source file ${cyan(args.file)} not found! ${red('ABORTING')}`) 61 | } 62 | 63 | if (!flags.appName) { 64 | this.error(`${red('✘')} Failed to retrive ${cyan('appName')} value. Please specify it with the ${green('appName')} flag or check that ${cyan('app.json')} file exists. ${red('ABORTING')}`) 65 | } 66 | 67 | this.log(yellow('≈'), `Generating splashscreens for '${cyan(flags.appName)}' app...`) 68 | 69 | // Run both iOS and Android tasks in parallel 70 | await Promise.all([ 71 | this.generateAndroidSplashscreens(args.file, './android/app/src/main/res'), 72 | this.generateIOSSplashscreens(args.file, `./ios/${flags.appName}/Images.xcassets/Splashscreen.imageset`), 73 | ]) 74 | 75 | this.log(green('✔'), `Generated splashscreens for '${cyan(flags.appName)}' app.`) 76 | } 77 | 78 | private async generateAndroidSplashscreen(inputFile: string, outputDir: string, sizeDef: SplashscreenSize) { 79 | const {density, height, width} = sizeDef 80 | 81 | const densityFolderPath = join(outputDir, `drawable-${density}`) 82 | 83 | await mkdirp(densityFolderPath) 84 | 85 | this.logVerbose(yellow('≈'), cyan('Android'), `Generating splashscreen for density '${density}'...`) 86 | 87 | await this.generateSplashscreen(inputFile, join(densityFolderPath, 'splashscreen.png'), width, height) 88 | 89 | this.logVerbose(green('✔'), cyan('Android'), `Generated splashscreen for density '${density}'.`) 90 | } 91 | 92 | private async generateAndroidSplashscreens(inputFile: string, baseOutputDir: string) { 93 | this.log(yellow('≈'), cyan('Android'), 'Generating splashscreens...') 94 | 95 | await mkdirp(baseOutputDir) 96 | 97 | // Generate all Android splashscreens in parallel 98 | await Promise.all( 99 | SPLASHSCREEN_SIZES_ANDROID.map((sizeDefinition) => 100 | this.generateAndroidSplashscreen(inputFile, baseOutputDir, sizeDefinition), 101 | ), 102 | ) 103 | 104 | this.log(green('✔'), cyan('Android'), 'Splashscreens generated.') 105 | } 106 | 107 | private async generateIOSSplashscreen(inputFile: string, outputPath: string, width: number, height: number) { 108 | this.logVerbose(yellow('≈'), cyan('iOS'), `Generating splashscreen ${cyan(outputPath)}...`) 109 | 110 | await this.generateSplashscreen(inputFile, outputPath, width, height) 111 | 112 | this.logVerbose(green('✔'), cyan('iOS'), `Generated splashscreen ${cyan(outputPath)}.`) 113 | } 114 | 115 | private async generateIOSSplashscreens(inputFile: string, outputDir: string) { 116 | this.log(yellow('≈'), cyan('iOS'), 'Generating splashscreens...') 117 | 118 | await mkdirp(outputDir) 119 | 120 | // Generate Contents.json 121 | const contentJson: ContentJson = { 122 | images: [], 123 | info: { 124 | author: 'react-native-toolbox', 125 | version: 1, 126 | }, 127 | } 128 | 129 | // Generate all iOS splashscreens in parallel 130 | await Promise.all( 131 | SPLASHSCREEN_SIZES_IOS.map(({density, height, width}) => { 132 | const filename = this.getIOSAssetNameForDensity(density) 133 | 134 | contentJson.images.push({ 135 | filename, 136 | idiom: 'universal', 137 | scale: `${density || '1x'}`, 138 | }) 139 | 140 | return this.generateIOSSplashscreen(inputFile, join(outputDir, filename), width, height) 141 | }), 142 | ) 143 | 144 | await writeFile(join(outputDir, 'Contents.json'), JSON.stringify(contentJson, null, 2)) 145 | 146 | this.log(green('✔'), cyan('iOS'), 'Splashscreens generated.') 147 | } 148 | 149 | private async generateSplashscreen(inputFilePath: string, outputPath: string, width: number, height: number) { 150 | this.logVerbose(yellow('≈'), `Generating splashscreen '${cyan(outputPath)}'...`) 151 | 152 | try { 153 | await sharp(inputFilePath).resize(width, height, {fit: 'cover'}).toFile(outputPath) 154 | 155 | this.logVerbose(green('✔'), `Splashscreen '${cyan(outputPath)}' generated.`) 156 | } catch (error) { 157 | this.log(red('✘'), `Failed to generate splashscreen '${cyan(outputPath)}':`, error) 158 | } 159 | } 160 | 161 | private getIOSAssetNameForDensity(density?: string): string { 162 | return `splashscreen${density ? `@${density}` : ''}.png` 163 | } 164 | 165 | private logVerbose(message?: string, ...args: unknown[]) { 166 | if (this._isVerbose) { 167 | this.log(message, ...args) 168 | } 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /src/constants.ts: -------------------------------------------------------------------------------- 1 | import type { SplashscreenSize } from "./types.js" 2 | 3 | /** 4 | * Android Assets Sizes 5 | */ 6 | 7 | export const ICON_SIZES_ANDROID = [ 8 | { 9 | density: 'mdpi', 10 | size: 48, 11 | }, 12 | { 13 | density: 'hdpi', 14 | size: 72, 15 | }, 16 | { 17 | density: 'xhdpi', 18 | size: 96, 19 | }, 20 | { 21 | density: 'xxhdpi', 22 | size: 144, 23 | }, 24 | { 25 | density: 'xxxhdpi', 26 | size: 192, 27 | }, 28 | ] 29 | 30 | export const SPLASHSCREEN_SIZES_ANDROID: Array = [ 31 | { 32 | density: 'ldpi', 33 | height: 320, 34 | width: 200, 35 | }, 36 | { 37 | density: 'mdpi', 38 | height: 480, 39 | width: 320, 40 | }, 41 | { 42 | density: 'hdpi', 43 | height: 800, 44 | width: 480, 45 | }, 46 | { 47 | density: 'xhdpi', 48 | height: 1280, 49 | width: 720, 50 | }, 51 | { 52 | density: 'xxhdpi', 53 | height: 1600, 54 | width: 960, 55 | }, 56 | { 57 | density: 'xxxhdpi', 58 | height: 1920, 59 | width: 1280, 60 | }, 61 | ] 62 | 63 | /** 64 | * iOS Assets Sizes 65 | */ 66 | 67 | export const ICON_SIZES_IOS = [ 68 | { 69 | baseSize: 20, 70 | name: 'Icon-Notification', 71 | scales: [2, 3], 72 | }, 73 | { 74 | baseSize: 29, 75 | name: 'Icon-Small', 76 | scales: [2, 3], 77 | }, 78 | { 79 | baseSize: 40, 80 | name: 'Icon-Spotlight-40', 81 | scales: [2, 3], 82 | }, 83 | { 84 | baseSize: 60, 85 | name: 'Icon-60', 86 | scales: [2, 3], 87 | }, 88 | { 89 | baseSize: 1024, 90 | idiom: 'ios-marketing', 91 | name: 'iTunesArtwork', 92 | scales: [1], 93 | }, 94 | ] 95 | 96 | export const SPLASHSCREEN_SIZES_IOS: Array = [ 97 | { 98 | height: 480, 99 | width: 320, 100 | }, 101 | { 102 | density: '2x', 103 | height: 1334, 104 | width: 750, 105 | }, 106 | { 107 | density: '3x', 108 | height: 2208, 109 | width: 1242, 110 | }, 111 | ] 112 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export {run} from '@oclif/core' 2 | -------------------------------------------------------------------------------- /src/types.ts: -------------------------------------------------------------------------------- 1 | export interface SplashscreenSize { 2 | density?: string; 3 | height: number; 4 | width: number; 5 | } 6 | 7 | export interface ContentJsonImage { 8 | filename: string; 9 | idiom: string; 10 | scale: string; 11 | size?: string; 12 | } 13 | 14 | export interface ContentJsonInfo { 15 | author: string; 16 | version: number; 17 | } 18 | 19 | export interface ContentJson { 20 | images: ContentJsonImage[]; 21 | info: ContentJsonInfo; 22 | } 23 | 24 | export type MaskType = "circle" | "roundedCorners"; 25 | -------------------------------------------------------------------------------- /src/utils/app.utils.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025 ForWarD Software (https://forwardsoftware.solutions/) 3 | * 4 | * This Source Code Form is subject to the terms of the Mozilla Public 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | */ 8 | 9 | import { readFileSync } from 'node:fs' 10 | 11 | export function extractAppName() { 12 | try { 13 | const { name } = JSON.parse(readFileSync('./app.json', 'utf8')) 14 | return name 15 | } catch { 16 | return null 17 | } 18 | } -------------------------------------------------------------------------------- /src/utils/file-utils.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025 ForWarD Software (https://forwardsoftware.solutions/) 3 | * 4 | * This Source Code Form is subject to the terms of the Mozilla Public 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | */ 8 | 9 | import { existsSync } from 'node:fs' 10 | import { mkdir } from 'node:fs/promises' 11 | 12 | export function checkAssetFile(filePath: string): boolean { 13 | return existsSync(filePath) 14 | } 15 | 16 | export async function mkdirp(path: string): Promise { 17 | await mkdir(path, { recursive: true }) 18 | } 19 | -------------------------------------------------------------------------------- /test/assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forwardsoftware/react-native-toolbox/c0a495202a37147392f79df0dba89a0a4ded9968/test/assets/icon.png -------------------------------------------------------------------------------- /test/assets/splashscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forwardsoftware/react-native-toolbox/c0a495202a37147392f79df0dba89a0a4ded9968/test/assets/splashscreen.png -------------------------------------------------------------------------------- /test/commands/dotenv.test.ts: -------------------------------------------------------------------------------- 1 | import {runCommand} from '@oclif/test' 2 | import {expect} from 'chai' 3 | import {randomUUID} from 'node:crypto' 4 | import fs from 'node:fs' 5 | import {rimrafSync} from 'rimraf' 6 | 7 | describe('dotenv', () => { 8 | afterEach(() => { 9 | rimrafSync(['.env', '.env.dev', '.env.prod']) 10 | }) 11 | 12 | it('should fail to run dotenv when no environmentName is specified', async () => { 13 | const {error} = await runCommand(['dotenv']) 14 | 15 | expect(error?.oclif?.exit).to.equal(2) 16 | }) 17 | 18 | it('runs dotenv dev', async () => { 19 | // Arrange 20 | 21 | const testID = randomUUID() 22 | fs.writeFileSync('.env.dev', `TEST=${testID}`) 23 | 24 | // Act 25 | 26 | const {stdout} = await runCommand(['dotenv', 'dev']) 27 | 28 | // Assert 29 | 30 | expect(stdout).to.contain('Generating .env from ./.env.dev file...') 31 | 32 | const envContent = fs.readFileSync('.env', 'utf8') 33 | expect(envContent).to.eq(`TEST=${testID}`) 34 | }) 35 | 36 | it('runs dotenv prod', async () => { 37 | // Arrange 38 | 39 | const testID = randomUUID() 40 | fs.writeFileSync('.env.prod', `TEST=${testID}`) 41 | 42 | // Act 43 | 44 | const {stdout} = await runCommand(['dotenv', 'prod']) 45 | 46 | // Assert 47 | expect(stdout).to.contain('Generating .env from ./.env.prod file...') 48 | 49 | const envContent = fs.readFileSync('.env', 'utf8') 50 | expect(envContent).to.contain(`TEST=${testID}`) 51 | }) 52 | }) 53 | -------------------------------------------------------------------------------- /test/commands/icons.test.ts: -------------------------------------------------------------------------------- 1 | import {runCommand} from '@oclif/test' 2 | import {expect} from 'chai' 3 | import fs from 'node:fs' 4 | import path from 'node:path' 5 | import {rimrafSync} from 'rimraf' 6 | 7 | describe('icons', () => { 8 | before(() => { 9 | fs.mkdirSync('assets', {recursive: true}) 10 | fs.copyFileSync('test/assets/icon.png', 'assets/icon.png') 11 | }) 12 | 13 | after(() => { 14 | rimrafSync('assets') 15 | }) 16 | 17 | afterEach(() => { 18 | rimrafSync(['android', 'ios']) 19 | }) 20 | 21 | it('should fail to run icons when no app.json file exists', async () => { 22 | const {error} = await runCommand(['icons']) 23 | 24 | expect(error?.oclif?.exit).to.equal(2) 25 | }) 26 | 27 | it('runs icons --appName test and generates expected files', async () => { 28 | const {stdout} = await runCommand(['icons', '--appName', 'test']) 29 | 30 | expect(stdout).to.contain("Generating icons for 'test' app...") 31 | expect(stdout).to.contain("Generated icons for 'test' app.") 32 | 33 | // Check for iOS output directory and Contents.json 34 | const iosDir = path.join('ios', 'test', 'Images.xcassets', 'AppIcon.appiconset') 35 | expect(fs.existsSync(path.join(iosDir, 'Contents.json'))).to.be.true 36 | 37 | const iosAppIcons = fs.readdirSync(iosDir).filter((f) => f.endsWith('.png')) 38 | expect(iosAppIcons.length).to.eq(9) 39 | 40 | // Check for Android output directory and at least one icon 41 | const baseAndroidOutputDir = path.join('android', 'app', 'src', 'main') 42 | const androidDir = path.join(baseAndroidOutputDir, 'res') 43 | expect(fs.existsSync(androidDir)).to.be.true 44 | 45 | // Check webicon exists 46 | expect(fs.existsSync(path.join(baseAndroidOutputDir, 'web_hi_res_512.png'))).to.be.true 47 | 48 | // Count mipmap directories 49 | const mipmapDirs = fs.readdirSync(androidDir).filter((f) => f.startsWith('mipmap-')) 50 | expect(mipmapDirs.length).to.eq(5) 51 | 52 | // Count icons in mipmap directories 53 | let androidPngCount = 0 54 | for (const mipmapDir of mipmapDirs) { 55 | const pngFilesInDir = fs.readdirSync(path.join(androidDir, mipmapDir)).filter((f) => f.endsWith('.png')) 56 | androidPngCount += pngFilesInDir.length 57 | } 58 | 59 | // Expect 5 densities * 2 launcher icons/density = 10 60 | expect(androidPngCount).to.eq(10) 61 | }) 62 | }) 63 | -------------------------------------------------------------------------------- /test/commands/splash.test.ts: -------------------------------------------------------------------------------- 1 | import {runCommand} from '@oclif/test' 2 | import {expect} from 'chai' 3 | import fs from 'node:fs' 4 | import path from 'node:path' 5 | import {rimrafSync} from 'rimraf' 6 | 7 | describe('splash', () => { 8 | before(() => { 9 | fs.mkdirSync('assets', {recursive: true}) 10 | fs.copyFileSync('test/assets/splashscreen.png', 'assets/splashscreen.png') 11 | }) 12 | 13 | after(() => { 14 | rimrafSync('assets') 15 | }) 16 | 17 | afterEach(() => { 18 | rimrafSync(['android', 'ios']) 19 | }) 20 | 21 | it('should fail to run splash when no app.json file exists', async () => { 22 | const {error} = await runCommand(['splash']) 23 | 24 | expect(error?.oclif?.exit).to.equal(2) 25 | }) 26 | 27 | it('runs splash --appName test and generates expected files', async () => { 28 | const {stdout} = await runCommand(['splash', '--appName', 'test']) 29 | 30 | expect(stdout).to.contain("Generating splashscreens for 'test' app...") 31 | expect(stdout).to.contain("Generated splashscreens for 'test' app.") 32 | 33 | // Check for iOS output directory and Contents.json 34 | const iosDir = path.join('ios', 'test', 'Images.xcassets', 'Splashscreen.imageset') 35 | expect(fs.existsSync(path.join(iosDir, 'Contents.json'))).to.be.true 36 | 37 | // Check for iOS image files (expecting at least one) 38 | const iosSplashImages = fs.readdirSync(iosDir).filter((f) => f.endsWith('.png')) 39 | expect(iosSplashImages.length).to.eq(3) 40 | 41 | // Check for Android output directories and image files 42 | const androidDir = path.join('android', 'app', 'src', 'main', 'res') 43 | expect(fs.existsSync(androidDir)).to.be.true 44 | 45 | // Count drawable directories 46 | const drawableDirs = fs.readdirSync(androidDir).filter((f) => f.startsWith('drawable-')) 47 | expect(drawableDirs.length).to.eq(6) 48 | 49 | // Count icons in drawable directories 50 | let androidSplashscreensCount = 0 51 | for (const drawableDir of drawableDirs) { 52 | const pngFilesInDir = fs.readdirSync(path.join(androidDir, drawableDir)).filter((f) => f.endsWith('.png')) 53 | androidSplashscreensCount += pngFilesInDir.length 54 | } 55 | 56 | // Expect 6 densities * 1 splashscreen = 6 57 | expect(androidSplashscreensCount).to.eq(6) 58 | }) 59 | }) 60 | -------------------------------------------------------------------------------- /test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig", 3 | "compilerOptions": { 4 | "noEmit": true 5 | }, 6 | "references": [ 7 | {"path": ".."} 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "module": "Node16", 5 | "outDir": "dist", 6 | "rootDir": "src", 7 | "strict": true, 8 | "target": "es2022", 9 | "moduleResolution": "node16", 10 | "composite": true 11 | }, 12 | "include": ["./src/**/*"], 13 | "ts-node": { 14 | "esm": true 15 | } 16 | } 17 | --------------------------------------------------------------------------------