@react-native-reusables/cli 0.6.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/config.json +16 -0
- package/.github/actions/setup/action.yml +21 -0
- package/.github/workflows/check.yml +54 -0
- package/.github/workflows/release.yml +0 -0
- package/.github/workflows/snapshot.yml +24 -0
- package/.prettierrc +8 -0
- package/.vscode/extensions.json +6 -0
- package/.vscode/settings.json +46 -0
- package/LICENSE +1 -1
- package/README.md +97 -0
- package/eslint.config.mjs +118 -0
- package/package.json +64 -8
- package/patches/@changesets__get-github-info@0.6.0.patch +48 -0
- package/scripts/copy-package-json.ts +32 -0
- package/src/bin.ts +18 -0
- package/src/cli.ts +66 -0
- package/src/contexts/cli-options.ts +29 -0
- package/src/project-manifest.ts +369 -0
- package/src/services/commands/add.ts +127 -0
- package/src/services/commands/doctor.ts +287 -0
- package/src/services/commands/init.ts +94 -0
- package/src/services/git.ts +39 -0
- package/src/services/package-manager.ts +48 -0
- package/src/services/project-config.ts +295 -0
- package/src/services/required-files-checker.ts +375 -0
- package/src/services/spinner.ts +15 -0
- package/src/services/template.ts +222 -0
- package/src/utils/retry-with.ts +9 -0
- package/src/utils/run-command.ts +10 -0
- package/test/Dummy.test.ts +7 -0
- package/tsconfig.base.json +53 -0
- package/tsconfig.json +14 -0
- package/tsconfig.scripts.json +17 -0
- package/tsconfig.src.json +10 -0
- package/tsconfig.test.json +10 -0
- package/tsup.config.ts +9 -0
- package/vitest.config.ts +12 -0
- package/bin.cjs +0 -59056
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
|
|
3
|
+
"changelog": [
|
|
4
|
+
"@changesets/changelog-github",
|
|
5
|
+
{
|
|
6
|
+
"repo": "founded-labs/react-native-reusables"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"commit": false,
|
|
10
|
+
"fixed": [],
|
|
11
|
+
"linked": [],
|
|
12
|
+
"access": "restricted",
|
|
13
|
+
"baseBranch": "main",
|
|
14
|
+
"updateInternalDependencies": "patch",
|
|
15
|
+
"ignore": []
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Setup
|
|
2
|
+
description: Perform standard setup and install dependencies using pnpm.
|
|
3
|
+
inputs:
|
|
4
|
+
node-version:
|
|
5
|
+
description: The version of Node.js to install
|
|
6
|
+
required: true
|
|
7
|
+
default: 20.16.0
|
|
8
|
+
|
|
9
|
+
runs:
|
|
10
|
+
using: composite
|
|
11
|
+
steps:
|
|
12
|
+
- name: Install pnpm
|
|
13
|
+
uses: pnpm/action-setup@v3
|
|
14
|
+
- name: Install node
|
|
15
|
+
uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
cache: pnpm
|
|
18
|
+
node-version: ${{ inputs.node-version }}
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
shell: bash
|
|
21
|
+
run: pnpm install
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: Check
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [main]
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
14
|
+
permissions: {}
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build:
|
|
18
|
+
name: Build
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
timeout-minutes: 10
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
uses: ./.github/actions/setup
|
|
25
|
+
|
|
26
|
+
types:
|
|
27
|
+
name: Types
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
timeout-minutes: 10
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
- name: Install dependencies
|
|
33
|
+
uses: ./.github/actions/setup
|
|
34
|
+
- run: pnpm check
|
|
35
|
+
|
|
36
|
+
lint:
|
|
37
|
+
name: Lint
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
timeout-minutes: 10
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
- name: Install dependencies
|
|
43
|
+
uses: ./.github/actions/setup
|
|
44
|
+
- run: pnpm lint
|
|
45
|
+
|
|
46
|
+
test:
|
|
47
|
+
name: Test
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
timeout-minutes: 10
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v4
|
|
52
|
+
- name: Install dependencies
|
|
53
|
+
uses: ./.github/actions/setup
|
|
54
|
+
- run: pnpm test
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Snapshot
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [main, next-minor, next-major]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions: {}
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
snapshot:
|
|
12
|
+
name: Snapshot
|
|
13
|
+
if: github.repository_owner == 'Effect-Ts'
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
timeout-minutes: 10
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- name: Install dependencies
|
|
19
|
+
uses: ./.github/actions/setup
|
|
20
|
+
- name: Build package
|
|
21
|
+
run: pnpm build
|
|
22
|
+
- name: Create snapshot
|
|
23
|
+
id: snapshot
|
|
24
|
+
run: pnpx pkg-pr-new@0.0.24 publish --pnpm --comment=off
|
package/.prettierrc
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"typescript.tsdk": "node_modules/typescript/lib",
|
|
3
|
+
"typescript.preferences.importModuleSpecifier": "relative",
|
|
4
|
+
"typescript.enablePromptUseWorkspaceTsdk": true,
|
|
5
|
+
"editor.formatOnSave": true,
|
|
6
|
+
"eslint.format.enable": true,
|
|
7
|
+
"[json]": {
|
|
8
|
+
"editor.defaultFormatter": "vscode.json-language-features"
|
|
9
|
+
},
|
|
10
|
+
"[markdown]": {
|
|
11
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
12
|
+
"prettier.semi": false,
|
|
13
|
+
"prettier.trailingComma": "none"
|
|
14
|
+
},
|
|
15
|
+
"[javascript]": {
|
|
16
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
17
|
+
},
|
|
18
|
+
"[javascriptreact]": {
|
|
19
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
20
|
+
},
|
|
21
|
+
"[typescript]": {
|
|
22
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
23
|
+
},
|
|
24
|
+
"[typescriptreact]": {
|
|
25
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
26
|
+
},
|
|
27
|
+
"eslint.validate": ["markdown", "javascript", "typescript"],
|
|
28
|
+
"editor.codeActionsOnSave": {
|
|
29
|
+
"source.fixAll.eslint": "explicit"
|
|
30
|
+
},
|
|
31
|
+
"editor.quickSuggestions": {
|
|
32
|
+
"other": true,
|
|
33
|
+
"comments": false,
|
|
34
|
+
"strings": false
|
|
35
|
+
},
|
|
36
|
+
"editor.acceptSuggestionOnCommitCharacter": true,
|
|
37
|
+
"editor.acceptSuggestionOnEnter": "on",
|
|
38
|
+
"editor.quickSuggestionsDelay": 10,
|
|
39
|
+
"editor.suggestOnTriggerCharacters": true,
|
|
40
|
+
"editor.tabCompletion": "off",
|
|
41
|
+
"editor.suggest.localityBonus": true,
|
|
42
|
+
"editor.suggestSelection": "recentlyUsed",
|
|
43
|
+
"editor.wordBasedSuggestions": "matchingDocuments",
|
|
44
|
+
"editor.parameterHints.enabled": true,
|
|
45
|
+
"files.insertFinalNewline": true
|
|
46
|
+
}
|
package/LICENSE
CHANGED
package/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# React Native Reusables CLI
|
|
2
|
+
|
|
3
|
+
A command-line toolkit to streamline the integration, setup, and maintenance of reusable React Native components in your projects.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Add**: Quickly add reusable React Native components to your project, with style and path options.
|
|
8
|
+
- **Doctor**: Diagnose your project for missing files, misconfigurations, and required dependencies. Optionally auto-install missing dependencies.
|
|
9
|
+
- **Init**: Bootstrap a new React Native project pre-configured for reusables, or inspect/repair an existing setup.
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
### Installation
|
|
14
|
+
|
|
15
|
+
You can run the CLI directly with your favorite package manager:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npx @react-native-reusables/cli@latest <command>
|
|
19
|
+
pnpm dlx @react-native-reusables/cli@latest <command>
|
|
20
|
+
yarn dlx @react-native-reusables/cli@latest <command>
|
|
21
|
+
bunx --bun @react-native-reusables/cli@latest <command>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Commands
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
### `@react-native-reusables/cli@latest add [options] [components...]`
|
|
29
|
+
|
|
30
|
+
Add one or more React Native components to your project.
|
|
31
|
+
|
|
32
|
+
| Argument | Description |
|
|
33
|
+
| ---------- | ----------------------------------------------------------------------------- |
|
|
34
|
+
| components | Name of component(s) to add. (e.g. `button`, `input`, `card`, `avatar`, etc.) |
|
|
35
|
+
|
|
36
|
+
| Option | Description | Default |
|
|
37
|
+
| ------------------- | ------------------------------------ | --------------- |
|
|
38
|
+
| `-y, --yes` | Skip confirmation prompts. | false |
|
|
39
|
+
| `-o, --overwrite` | Overwrite existing files. | false |
|
|
40
|
+
| `-c, --cwd <cwd>` | The working directory. | . (current dir) |
|
|
41
|
+
| `-a, --all` | Add all available components. | false |
|
|
42
|
+
| `-p, --path <path>` | The path to add the component(s) to. | |
|
|
43
|
+
| `--styling-library <styling-library>` | Override detected styling library (`nativewind` or `uniwind`). | auto-detect |
|
|
44
|
+
| `-h, --help` | Display help for command. | |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### `rnr doctor [options]`
|
|
49
|
+
|
|
50
|
+
Check your project setup and diagnose issues.
|
|
51
|
+
|
|
52
|
+
| Option | Description | Default |
|
|
53
|
+
| ----------------- | ------------------------------------------------------ | --------------- |
|
|
54
|
+
| `-y, --yes` | Skip confirmation prompts for installing dependencies. | false |
|
|
55
|
+
| `-c, --cwd <cwd>` | The working directory. | . (current dir) |
|
|
56
|
+
| `--summary` | Output a summary only. | false |
|
|
57
|
+
| `-h, --help` | Display help for command. | |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### `rnr init [options]`
|
|
62
|
+
|
|
63
|
+
Initialize a new React Native project with reusables.
|
|
64
|
+
|
|
65
|
+
| Option | Description | Default |
|
|
66
|
+
| ----------------- | ------------------------- | --------------- |
|
|
67
|
+
| `-c, --cwd <cwd>` | The working directory. | . (current dir) |
|
|
68
|
+
| `-h, --help` | Display help for command. | |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Development
|
|
73
|
+
|
|
74
|
+
### Scripts
|
|
75
|
+
|
|
76
|
+
- `pnpm build` – Build the CLI for production.
|
|
77
|
+
- `pnpm dev` – Run the CLI in development mode.
|
|
78
|
+
|
|
79
|
+
> **Note:** If you are developing locally and want to use the `add` command in development mode, you must have the `apps/docs` app running. Start it from the root with:
|
|
80
|
+
>
|
|
81
|
+
> ```sh
|
|
82
|
+
> pnpm dev:docs
|
|
83
|
+
> ```
|
|
84
|
+
>
|
|
85
|
+
> This serves the component registry required for local development.
|
|
86
|
+
|
|
87
|
+
### Structure
|
|
88
|
+
|
|
89
|
+
- `src/cli.ts` – Main CLI entrypoint and command definitions.
|
|
90
|
+
- `src/bin.ts` – Node boot-strapper.
|
|
91
|
+
- `src/services/commands/` – Command implementations (`add`, `doctor`, `init`).
|
|
92
|
+
- `src/contexts/` – CLI option/context definitions.
|
|
93
|
+
- `src/utils/` – Utility functions.
|
|
94
|
+
|
|
95
|
+
## Contributing
|
|
96
|
+
|
|
97
|
+
See the [main repo README](../../README.md) for guidelines.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { fixupPluginRules } from "@eslint/compat"
|
|
2
|
+
import { FlatCompat } from "@eslint/eslintrc"
|
|
3
|
+
import js from "@eslint/js"
|
|
4
|
+
import tsParser from "@typescript-eslint/parser"
|
|
5
|
+
import codegen from "eslint-plugin-codegen"
|
|
6
|
+
import _import from "eslint-plugin-import"
|
|
7
|
+
import simpleImportSort from "eslint-plugin-simple-import-sort"
|
|
8
|
+
import sortDestructureKeys from "eslint-plugin-sort-destructure-keys"
|
|
9
|
+
import path from "node:path"
|
|
10
|
+
import { fileURLToPath } from "node:url"
|
|
11
|
+
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
13
|
+
const __dirname = path.dirname(__filename)
|
|
14
|
+
const compat = new FlatCompat({
|
|
15
|
+
baseDirectory: __dirname,
|
|
16
|
+
recommendedConfig: js.configs.recommended,
|
|
17
|
+
allConfig: js.configs.all
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export default [
|
|
21
|
+
{
|
|
22
|
+
ignores: ["**/dist", "**/build", "**/docs", "**/*.md"]
|
|
23
|
+
},
|
|
24
|
+
...compat.extends(
|
|
25
|
+
"eslint:recommended",
|
|
26
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
27
|
+
"plugin:@typescript-eslint/recommended",
|
|
28
|
+
"plugin:@effect/recommended"
|
|
29
|
+
),
|
|
30
|
+
{
|
|
31
|
+
plugins: {
|
|
32
|
+
import: fixupPluginRules(_import),
|
|
33
|
+
"sort-destructure-keys": sortDestructureKeys,
|
|
34
|
+
"simple-import-sort": simpleImportSort,
|
|
35
|
+
codegen
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
languageOptions: {
|
|
39
|
+
parser: tsParser,
|
|
40
|
+
ecmaVersion: 2018,
|
|
41
|
+
sourceType: "module"
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
settings: {
|
|
45
|
+
"import/parsers": {
|
|
46
|
+
"@typescript-eslint/parser": [".ts", ".tsx"]
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
"import/resolver": {
|
|
50
|
+
typescript: {
|
|
51
|
+
alwaysTryTypes: true
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
rules: {
|
|
57
|
+
"codegen/codegen": "error",
|
|
58
|
+
"no-fallthrough": "off",
|
|
59
|
+
"no-irregular-whitespace": "off",
|
|
60
|
+
"object-shorthand": "error",
|
|
61
|
+
"prefer-destructuring": "off",
|
|
62
|
+
"sort-imports": "off",
|
|
63
|
+
|
|
64
|
+
"no-restricted-syntax": [
|
|
65
|
+
"error",
|
|
66
|
+
{
|
|
67
|
+
selector: "CallExpression[callee.property.name='push'] > SpreadElement.arguments",
|
|
68
|
+
message: "Do not use spread arguments in Array.push"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
|
|
72
|
+
"no-unused-vars": "off",
|
|
73
|
+
"prefer-rest-params": "off",
|
|
74
|
+
"prefer-spread": "off",
|
|
75
|
+
"import/first": "error",
|
|
76
|
+
"import/newline-after-import": "error",
|
|
77
|
+
"import/no-duplicates": "error",
|
|
78
|
+
"import/no-unresolved": "off",
|
|
79
|
+
"import/order": "off",
|
|
80
|
+
"simple-import-sort/imports": "off",
|
|
81
|
+
"sort-destructure-keys/sort-destructure-keys": "error",
|
|
82
|
+
"deprecation/deprecation": "off",
|
|
83
|
+
|
|
84
|
+
"@typescript-eslint/array-type": [
|
|
85
|
+
"warn",
|
|
86
|
+
{
|
|
87
|
+
default: "generic",
|
|
88
|
+
readonly: "generic"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
|
|
92
|
+
"@typescript-eslint/member-delimiter-style": 0,
|
|
93
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
94
|
+
"@typescript-eslint/ban-types": "off",
|
|
95
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
96
|
+
"@typescript-eslint/no-empty-interface": "off",
|
|
97
|
+
"@typescript-eslint/consistent-type-imports": "warn",
|
|
98
|
+
|
|
99
|
+
"@typescript-eslint/no-unused-vars": [
|
|
100
|
+
"error",
|
|
101
|
+
{
|
|
102
|
+
argsIgnorePattern: "^_",
|
|
103
|
+
varsIgnorePattern: "^_"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
|
|
107
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
108
|
+
"@typescript-eslint/camelcase": "off",
|
|
109
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
110
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
111
|
+
"@typescript-eslint/interface-name-prefix": "off",
|
|
112
|
+
"@typescript-eslint/no-array-constructor": "off",
|
|
113
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
114
|
+
"@typescript-eslint/no-namespace": "off",
|
|
115
|
+
"@effect/dprint": "off"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
]
|
package/package.json
CHANGED
|
@@ -1,17 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-reusables/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"description": "A CLI for React Native Reusables",
|
|
6
|
-
"main": "bin.cjs",
|
|
7
|
-
"bin": "bin.cjs",
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"tsconfig-paths": "^4.2.0"
|
|
10
|
-
},
|
|
11
7
|
"repository": {
|
|
12
8
|
"type": "git",
|
|
13
9
|
"url": "https://github.com/founded-labs/react-native-reusables.git",
|
|
14
10
|
"directory": "apps/cli"
|
|
15
11
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public",
|
|
14
|
+
"directory": "dist"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsup && pnpm copy-package-json",
|
|
18
|
+
"build:ts": "tsup",
|
|
19
|
+
"clean": "rimraf dist/*",
|
|
20
|
+
"check": "tsc -b tsconfig.json",
|
|
21
|
+
"dev": "INTERNAL_ENV=development tsx src/bin.ts",
|
|
22
|
+
"lint": "eslint \"**/{src,test,examples,scripts,dtslint}/**/*.{ts,mjs}\"",
|
|
23
|
+
"lint-fix": "pnpm lint --fix",
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"coverage": "vitest run --coverage",
|
|
26
|
+
"copy-package-json": "tsx scripts/copy-package-json.ts",
|
|
27
|
+
"changeset-version": "changeset version && node scripts/version.mjs",
|
|
28
|
+
"changeset-publish": "pnpm build && TEST_DIST= pnpm vitest && changeset publish",
|
|
29
|
+
"pub:beta": "pnpm publish --no-git-checks --access public --tag beta",
|
|
30
|
+
"pub:next": "pnpm publish --no-git-checks --access public --tag next",
|
|
31
|
+
"pub:release": "pnpm publish --access public"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"tsconfig-paths": "^4.2.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@changesets/changelog-github": "^0.5.0",
|
|
38
|
+
"@changesets/cli": "^2.27.8",
|
|
39
|
+
"@effect/cli": "latest",
|
|
40
|
+
"@effect/eslint-plugin": "^0.2.0",
|
|
41
|
+
"@effect/language-service": "^0.1.0",
|
|
42
|
+
"@effect/platform": "latest",
|
|
43
|
+
"@effect/platform-node": "latest",
|
|
44
|
+
"@effect/vitest": "latest",
|
|
45
|
+
"@eslint/compat": "1.1.1",
|
|
46
|
+
"@eslint/eslintrc": "3.1.0",
|
|
47
|
+
"@eslint/js": "9.10.0",
|
|
48
|
+
"@types/node": "22.10.5",
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^8.4.0",
|
|
50
|
+
"@typescript-eslint/parser": "^8.4.0",
|
|
51
|
+
"effect": "latest",
|
|
52
|
+
"eslint": "^9.10.0",
|
|
53
|
+
"eslint-import-resolver-typescript": "^3.6.3",
|
|
54
|
+
"eslint-plugin-codegen": "0.28.0",
|
|
55
|
+
"eslint-plugin-deprecation": "^3.0.0",
|
|
56
|
+
"eslint-plugin-import": "^2.30.0",
|
|
57
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
58
|
+
"eslint-plugin-sort-destructure-keys": "^2.0.0",
|
|
59
|
+
"execa": "^7.2.0",
|
|
60
|
+
"log-symbols": "^7.0.1",
|
|
61
|
+
"ora": "^6.1.2",
|
|
62
|
+
"package-manager-detector": "^1.3.0",
|
|
63
|
+
"tsup": "^8.2.4",
|
|
64
|
+
"tsx": "^4.19.1",
|
|
65
|
+
"typescript": "^5.9.3",
|
|
66
|
+
"vitest": "^2.0.5"
|
|
67
|
+
},
|
|
68
|
+
"pnpm": {
|
|
69
|
+
"patchedDependencies": {
|
|
70
|
+
"@changesets/get-github-info@0.6.0": "patches/@changesets__get-github-info@0.6.0.patch"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
diff --git a/dist/changesets-get-github-info.cjs.js b/dist/changesets-get-github-info.cjs.js
|
|
2
|
+
index a74df59f8a5988f458a3476087399f5e6dfe4818..ce5e60ef9916eb0cb76ab1e9dd422abcad752bf6 100644
|
|
3
|
+
--- a/dist/changesets-get-github-info.cjs.js
|
|
4
|
+
+++ b/dist/changesets-get-github-info.cjs.js
|
|
5
|
+
@@ -251,18 +251,13 @@ async function getInfo(request) {
|
|
6
|
+
b = new Date(b.mergedAt);
|
|
7
|
+
return a > b ? 1 : a < b ? -1 : 0;
|
|
8
|
+
})[0] : null;
|
|
9
|
+
-
|
|
10
|
+
- if (associatedPullRequest) {
|
|
11
|
+
- user = associatedPullRequest.author;
|
|
12
|
+
- }
|
|
13
|
+
-
|
|
14
|
+
return {
|
|
15
|
+
user: user ? user.login : null,
|
|
16
|
+
pull: associatedPullRequest ? associatedPullRequest.number : null,
|
|
17
|
+
links: {
|
|
18
|
+
commit: `[\`${request.commit.slice(0, 7)}\`](${data.commitUrl})`,
|
|
19
|
+
pull: associatedPullRequest ? `[#${associatedPullRequest.number}](${associatedPullRequest.url})` : null,
|
|
20
|
+
- user: user ? `[@${user.login}](${user.url})` : null
|
|
21
|
+
+ user: user ? `@${user.login}` : null
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
diff --git a/dist/changesets-get-github-info.esm.js b/dist/changesets-get-github-info.esm.js
|
|
26
|
+
index 27e5c972ab1202ff16f5124b471f4bbcc46be2b5..3940a8fe86e10cb46d8ff6436dea1103b1839927 100644
|
|
27
|
+
--- a/dist/changesets-get-github-info.esm.js
|
|
28
|
+
+++ b/dist/changesets-get-github-info.esm.js
|
|
29
|
+
@@ -242,18 +242,13 @@ async function getInfo(request) {
|
|
30
|
+
b = new Date(b.mergedAt);
|
|
31
|
+
return a > b ? 1 : a < b ? -1 : 0;
|
|
32
|
+
})[0] : null;
|
|
33
|
+
-
|
|
34
|
+
- if (associatedPullRequest) {
|
|
35
|
+
- user = associatedPullRequest.author;
|
|
36
|
+
- }
|
|
37
|
+
-
|
|
38
|
+
return {
|
|
39
|
+
user: user ? user.login : null,
|
|
40
|
+
pull: associatedPullRequest ? associatedPullRequest.number : null,
|
|
41
|
+
links: {
|
|
42
|
+
commit: `[\`${request.commit.slice(0, 7)}\`](${data.commitUrl})`,
|
|
43
|
+
pull: associatedPullRequest ? `[#${associatedPullRequest.number}](${associatedPullRequest.url})` : null,
|
|
44
|
+
- user: user ? `[@${user.login}](${user.url})` : null
|
|
45
|
+
+ user: user ? `@${user.login}` : null
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FileSystem, Path } from "@effect/platform"
|
|
2
|
+
import { NodeContext } from "@effect/platform-node"
|
|
3
|
+
import { Effect } from "effect"
|
|
4
|
+
|
|
5
|
+
const program = Effect.gen(function* () {
|
|
6
|
+
const fs = yield* FileSystem.FileSystem
|
|
7
|
+
const path = yield* Path.Path
|
|
8
|
+
yield* Effect.log("[Build] Copying package.json ...")
|
|
9
|
+
const json: any = yield* fs.readFileString("package.json").pipe(Effect.map(JSON.parse))
|
|
10
|
+
const pkg = {
|
|
11
|
+
name: json.name,
|
|
12
|
+
version: json.version,
|
|
13
|
+
type: json.type,
|
|
14
|
+
description: json.description,
|
|
15
|
+
main: "bin.cjs",
|
|
16
|
+
bin: "bin.cjs",
|
|
17
|
+
engines: json.engines,
|
|
18
|
+
dependencies: json.dependencies,
|
|
19
|
+
peerDependencies: json.peerDependencies,
|
|
20
|
+
repository: json.repository,
|
|
21
|
+
author: json.author,
|
|
22
|
+
license: json.license,
|
|
23
|
+
bugs: json.bugs,
|
|
24
|
+
homepage: json.homepage,
|
|
25
|
+
tags: json.tags,
|
|
26
|
+
keywords: json.keywords
|
|
27
|
+
}
|
|
28
|
+
yield* fs.writeFileString(path.join("dist", "package.json"), JSON.stringify(pkg, null, 2))
|
|
29
|
+
yield* Effect.log("[Build] Build completed.")
|
|
30
|
+
}).pipe(Effect.provide(NodeContext.layer))
|
|
31
|
+
|
|
32
|
+
Effect.runPromise(program).catch(console.error)
|
package/src/bin.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import * as NodeContext from "@effect/platform-node/NodeContext"
|
|
4
|
+
import * as NodeRuntime from "@effect/platform-node/NodeRuntime"
|
|
5
|
+
import * as Effect from "effect/Effect"
|
|
6
|
+
import * as Cli from "./cli.js"
|
|
7
|
+
|
|
8
|
+
Effect.suspend(Cli.run).pipe(
|
|
9
|
+
Effect.provide(NodeContext.layer),
|
|
10
|
+
Effect.catchAll((error) => {
|
|
11
|
+
if (error instanceof Error) {
|
|
12
|
+
Effect.logDebug(error)
|
|
13
|
+
return Effect.logError(error.message)
|
|
14
|
+
}
|
|
15
|
+
return Effect.logError(error)
|
|
16
|
+
}),
|
|
17
|
+
NodeRuntime.runMain({ disableErrorReporting: true })
|
|
18
|
+
)
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { all, cwd, overwrite, path, stylingLibrary, summary, template, yes } from "@cli/contexts/cli-options.js"
|
|
2
|
+
import * as Add from "@cli/services/commands/add.js"
|
|
3
|
+
import * as Doctor from "@cli/services/commands/doctor.js"
|
|
4
|
+
import * as Init from "@cli/services/commands/init.js"
|
|
5
|
+
import { Args, Command, Prompt } from "@effect/cli"
|
|
6
|
+
import { Effect, pipe } from "effect"
|
|
7
|
+
|
|
8
|
+
const addArgs = Args.all({
|
|
9
|
+
components: Args.text({ name: "components" }).pipe(Args.repeated)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const AddCommand = Command.make("add", { args: addArgs, cwd, yes, overwrite, all, path, stylingLibrary })
|
|
13
|
+
.pipe(Command.withDescription("Add React Native components to your project"))
|
|
14
|
+
.pipe(Command.withHandler(Add.make))
|
|
15
|
+
|
|
16
|
+
const DoctorCommand = Command.make("doctor", { cwd, summary, yes })
|
|
17
|
+
.pipe(Command.withDescription("Check your project setup and diagnose issues"))
|
|
18
|
+
.pipe(Command.withHandler(Doctor.make))
|
|
19
|
+
|
|
20
|
+
const InitCommand = Command.make("init", { cwd, template })
|
|
21
|
+
.pipe(Command.withDescription("Initialize a new React Native project with reusables"))
|
|
22
|
+
.pipe(Command.withHandler(Init.make))
|
|
23
|
+
|
|
24
|
+
const Cli = Command.make("react-native-reusables/cli", { cwd })
|
|
25
|
+
.pipe(Command.withDescription("React Native Reusables CLI - A powerful toolkit for React Native development"))
|
|
26
|
+
.pipe(
|
|
27
|
+
Command.withHandler((options) =>
|
|
28
|
+
Effect.gen(function* () {
|
|
29
|
+
yield* Effect.log("React Native Reusables CLI - A powerful toolkit for React Native development")
|
|
30
|
+
const choice = yield* Prompt.select({
|
|
31
|
+
message: "What would you like to do?",
|
|
32
|
+
choices: [
|
|
33
|
+
{ title: "Add a component", value: "add" },
|
|
34
|
+
{ title: "Inspect project configuration", value: "doctor" },
|
|
35
|
+
{ title: "Initialize a new project", value: "init" }
|
|
36
|
+
]
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
if (choice === "add") {
|
|
40
|
+
yield* Add.make({
|
|
41
|
+
cwd: options.cwd,
|
|
42
|
+
yes: true,
|
|
43
|
+
overwrite: false,
|
|
44
|
+
all: false,
|
|
45
|
+
path: "",
|
|
46
|
+
stylingLibrary: undefined,
|
|
47
|
+
args: { components: [] }
|
|
48
|
+
})
|
|
49
|
+
} else if (choice === "doctor") {
|
|
50
|
+
yield* Doctor.make({ cwd: options.cwd, summary: false, yes: false })
|
|
51
|
+
} else if (choice === "init") {
|
|
52
|
+
yield* Init.make({ cwd: options.cwd, template: "" })
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
.pipe(Command.withSubcommands([AddCommand, DoctorCommand, InitCommand]))
|
|
58
|
+
|
|
59
|
+
export const run = () =>
|
|
60
|
+
pipe(
|
|
61
|
+
process.argv,
|
|
62
|
+
Command.run(Cli, {
|
|
63
|
+
name: "@react-native-reusables/cli",
|
|
64
|
+
version: "1.0.0"
|
|
65
|
+
})
|
|
66
|
+
)
|