lovdacn 0.0.1
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 +17 -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 +21 -0
- package/README.md +106 -0
- package/eslint.config.mjs +118 -0
- package/package.json +74 -0
- package/patches/@changesets__get-github-info@0.6.0.patch +48 -0
- package/scripts/copy-package-json.ts +35 -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 +370 -0
- package/src/services/commands/add.ts +128 -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 +223 -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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
|
|
3
|
+
"changelog": [
|
|
4
|
+
"@changesets/changelog-github",
|
|
5
|
+
{
|
|
6
|
+
"repo": "entangle-labs/lavdacn"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"commit": false,
|
|
10
|
+
"fixed": [],
|
|
11
|
+
"linked": [],
|
|
12
|
+
"access": "restricted",
|
|
13
|
+
"baseBranch": "main",
|
|
14
|
+
"updateInternalDependencies": "patch",
|
|
15
|
+
"ignore": []
|
|
16
|
+
}
|
|
17
|
+
|
|
@@ -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
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-present Entangle Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# LavdaCN 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 lavdacn, 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 lavdacn@latest <command>
|
|
19
|
+
pnpm dlx lavdacn@latest <command>
|
|
20
|
+
yarn dlx lavdacn@latest <command>
|
|
21
|
+
bunx --bun lavdacn@latest <command>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or use the shorthand `lvcn`:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npx lvcn@latest <command>
|
|
28
|
+
pnpm dlx lvcn@latest <command>
|
|
29
|
+
yarn dlx lvcn@latest <command>
|
|
30
|
+
bunx --bun lvcn@latest <command>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Commands
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
### `lavdacn add [options] [components...]` / `lvcn add [options] [components...]`
|
|
38
|
+
|
|
39
|
+
Add one or more React Native components to your project.
|
|
40
|
+
|
|
41
|
+
| Argument | Description |
|
|
42
|
+
| ---------- | ----------------------------------------------------------------------------- |
|
|
43
|
+
| components | Name of component(s) to add. (e.g. `button`, `input`, `card`, `avatar`, etc.) |
|
|
44
|
+
|
|
45
|
+
| Option | Description | Default |
|
|
46
|
+
| ------------------- | ------------------------------------ | --------------- |
|
|
47
|
+
| `-y, --yes` | Skip confirmation prompts. | false |
|
|
48
|
+
| `-o, --overwrite` | Overwrite existing files. | false |
|
|
49
|
+
| `-c, --cwd <cwd>` | The working directory. | . (current dir) |
|
|
50
|
+
| `-a, --all` | Add all available components. | false |
|
|
51
|
+
| `-p, --path <path>` | The path to add the component(s) to. | |
|
|
52
|
+
| `--styling-library <styling-library>` | Override detected styling library (`nativewind` or `uniwind`). | auto-detect |
|
|
53
|
+
| `-h, --help` | Display help for command. | |
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
### `lavdacn doctor [options]` / `lvcn doctor [options]`
|
|
58
|
+
|
|
59
|
+
Check your project setup and diagnose issues.
|
|
60
|
+
|
|
61
|
+
| Option | Description | Default |
|
|
62
|
+
| ----------------- | ------------------------------------------------------ | --------------- |
|
|
63
|
+
| `-y, --yes` | Skip confirmation prompts for installing dependencies. | false |
|
|
64
|
+
| `-c, --cwd <cwd>` | The working directory. | . (current dir) |
|
|
65
|
+
| `--summary` | Output a summary only. | false |
|
|
66
|
+
| `-h, --help` | Display help for command. | |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### `lavdacn init [options]` / `lvcn init [options]`
|
|
71
|
+
|
|
72
|
+
Initialize a new React Native project with lavdacn.
|
|
73
|
+
|
|
74
|
+
| Option | Description | Default |
|
|
75
|
+
| ----------------- | ------------------------- | --------------- |
|
|
76
|
+
| `-c, --cwd <cwd>` | The working directory. | . (current dir) |
|
|
77
|
+
| `-h, --help` | Display help for command. | |
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Development
|
|
82
|
+
|
|
83
|
+
### Scripts
|
|
84
|
+
|
|
85
|
+
- `pnpm build` – Build the CLI for production.
|
|
86
|
+
- `pnpm dev` – Run the CLI in development mode.
|
|
87
|
+
|
|
88
|
+
> **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:
|
|
89
|
+
>
|
|
90
|
+
> ```sh
|
|
91
|
+
> pnpm dev:docs
|
|
92
|
+
> ```
|
|
93
|
+
>
|
|
94
|
+
> This serves the component registry required for local development.
|
|
95
|
+
|
|
96
|
+
### Structure
|
|
97
|
+
|
|
98
|
+
- `src/cli.ts` – Main CLI entrypoint and command definitions.
|
|
99
|
+
- `src/bin.ts` – Node boot-strapper.
|
|
100
|
+
- `src/services/commands/` – Command implementations (`add`, `doctor`, `init`).
|
|
101
|
+
- `src/contexts/` – CLI option/context definitions.
|
|
102
|
+
- `src/utils/` – Utility functions.
|
|
103
|
+
|
|
104
|
+
## Contributing
|
|
105
|
+
|
|
106
|
+
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
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lovdacn",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "A CLI for Lavdacn-UI",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/lovdacn-ui/ui.git",
|
|
10
|
+
"directory": "apps/cli"
|
|
11
|
+
},
|
|
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": "cross-env 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 && cross-env 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
|
+
"cross-env": "^7.0.3",
|
|
52
|
+
"effect": "latest",
|
|
53
|
+
"eslint": "^9.10.0",
|
|
54
|
+
"eslint-import-resolver-typescript": "^3.6.3",
|
|
55
|
+
"eslint-plugin-codegen": "0.28.0",
|
|
56
|
+
"eslint-plugin-deprecation": "^3.0.0",
|
|
57
|
+
"eslint-plugin-import": "^2.30.0",
|
|
58
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
59
|
+
"eslint-plugin-sort-destructure-keys": "^2.0.0",
|
|
60
|
+
"execa": "^7.2.0",
|
|
61
|
+
"log-symbols": "^7.0.1",
|
|
62
|
+
"ora": "^6.1.2",
|
|
63
|
+
"package-manager-detector": "^1.3.0",
|
|
64
|
+
"tsup": "^8.2.4",
|
|
65
|
+
"tsx": "^4.19.1",
|
|
66
|
+
"typescript": "^5.9.3",
|
|
67
|
+
"vitest": "^2.0.5"
|
|
68
|
+
},
|
|
69
|
+
"pnpm": {
|
|
70
|
+
"patchedDependencies": {
|
|
71
|
+
"@changesets/get-github-info@0.6.0": "patches/@changesets__get-github-info@0.6.0.patch"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -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,35 @@
|
|
|
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: {
|
|
17
|
+
lavdacn: "bin.cjs",
|
|
18
|
+
lvcn: "bin.cjs"
|
|
19
|
+
},
|
|
20
|
+
engines: json.engines,
|
|
21
|
+
dependencies: json.dependencies,
|
|
22
|
+
peerDependencies: json.peerDependencies,
|
|
23
|
+
repository: json.repository,
|
|
24
|
+
author: json.author,
|
|
25
|
+
license: json.license,
|
|
26
|
+
bugs: json.bugs,
|
|
27
|
+
homepage: json.homepage,
|
|
28
|
+
tags: json.tags,
|
|
29
|
+
keywords: json.keywords
|
|
30
|
+
}
|
|
31
|
+
yield* fs.writeFileString(path.join("dist", "package.json"), JSON.stringify(pkg, null, 2))
|
|
32
|
+
yield* Effect.log("[Build] Build completed.")
|
|
33
|
+
}).pipe(Effect.provide(NodeContext.layer))
|
|
34
|
+
|
|
35
|
+
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 lavdacn"))
|
|
22
|
+
.pipe(Command.withHandler(Init.make))
|
|
23
|
+
|
|
24
|
+
const Cli = Command.make("lavdacn", { cwd })
|
|
25
|
+
.pipe(Command.withDescription("LavdaCN CLI - A powerful toolkit for React Native development"))
|
|
26
|
+
.pipe(
|
|
27
|
+
Command.withHandler((options) =>
|
|
28
|
+
Effect.gen(function* () {
|
|
29
|
+
yield* Effect.log("LavdaCN 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: "lavdacn",
|
|
64
|
+
version: "1.0.0"
|
|
65
|
+
})
|
|
66
|
+
)
|