lovdacn 0.0.1 → 0.0.2
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/dist/bin.cjs +59578 -0
- package/package.json +12 -6
- package/.changeset/config.json +0 -17
- package/.github/actions/setup/action.yml +0 -21
- package/.github/workflows/check.yml +0 -54
- package/.github/workflows/release.yml +0 -0
- package/.github/workflows/snapshot.yml +0 -24
- package/.prettierrc +0 -8
- package/.vscode/extensions.json +0 -6
- package/.vscode/settings.json +0 -46
- package/eslint.config.mjs +0 -118
- package/patches/@changesets__get-github-info@0.6.0.patch +0 -48
- package/scripts/copy-package-json.ts +0 -35
- package/src/bin.ts +0 -18
- package/src/cli.ts +0 -66
- package/src/contexts/cli-options.ts +0 -29
- package/src/project-manifest.ts +0 -370
- package/src/services/commands/add.ts +0 -128
- package/src/services/commands/doctor.ts +0 -287
- package/src/services/commands/init.ts +0 -94
- package/src/services/git.ts +0 -39
- package/src/services/package-manager.ts +0 -48
- package/src/services/project-config.ts +0 -295
- package/src/services/required-files-checker.ts +0 -375
- package/src/services/spinner.ts +0 -15
- package/src/services/template.ts +0 -223
- package/src/utils/retry-with.ts +0 -9
- package/src/utils/run-command.ts +0 -10
- package/test/Dummy.test.ts +0 -7
- package/tsconfig.base.json +0 -53
- package/tsconfig.json +0 -14
- package/tsconfig.scripts.json +0 -17
- package/tsconfig.src.json +0 -10
- package/tsconfig.test.json +0 -10
- package/tsup.config.ts +0 -9
- package/vitest.config.ts +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lovdacn",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A CLI for Lavdacn-UI",
|
|
@@ -10,11 +10,18 @@
|
|
|
10
10
|
"directory": "apps/cli"
|
|
11
11
|
},
|
|
12
12
|
"publishConfig": {
|
|
13
|
-
"access": "public"
|
|
14
|
-
"directory": "dist"
|
|
13
|
+
"access": "public"
|
|
15
14
|
},
|
|
15
|
+
"main": "./dist/bin.cjs",
|
|
16
|
+
"bin": {
|
|
17
|
+
"lovdacn": "./dist/bin.cjs",
|
|
18
|
+
"lvcn": "./dist/bin.cjs"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
16
23
|
"scripts": {
|
|
17
|
-
"build": "tsup
|
|
24
|
+
"build": "tsup",
|
|
18
25
|
"build:ts": "tsup",
|
|
19
26
|
"clean": "rimraf dist/*",
|
|
20
27
|
"check": "tsc -b tsconfig.json",
|
|
@@ -23,7 +30,6 @@
|
|
|
23
30
|
"lint-fix": "pnpm lint --fix",
|
|
24
31
|
"test": "vitest run",
|
|
25
32
|
"coverage": "vitest run --coverage",
|
|
26
|
-
"copy-package-json": "tsx scripts/copy-package-json.ts",
|
|
27
33
|
"changeset-version": "changeset version && node scripts/version.mjs",
|
|
28
34
|
"changeset-publish": "pnpm build && cross-env TEST_DIST= pnpm vitest && changeset publish",
|
|
29
35
|
"pub:beta": "pnpm publish --no-git-checks --access public --tag beta",
|
|
@@ -71,4 +77,4 @@
|
|
|
71
77
|
"@changesets/get-github-info@0.6.0": "patches/@changesets__get-github-info@0.6.0.patch"
|
|
72
78
|
}
|
|
73
79
|
}
|
|
74
|
-
}
|
|
80
|
+
}
|
package/.changeset/config.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
|
@@ -1,54 +0,0 @@
|
|
|
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
|
|
@@ -1,24 +0,0 @@
|
|
|
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
DELETED
package/.vscode/extensions.json
DELETED
package/.vscode/settings.json
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
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/eslint.config.mjs
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
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
|
-
]
|
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
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
|
-
)
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Options } from "@effect/cli"
|
|
2
|
-
import { Context, Option } from "effect"
|
|
3
|
-
|
|
4
|
-
type StylingLibrary = "nativewind" | "uniwind"
|
|
5
|
-
|
|
6
|
-
class CliOptions extends Context.Tag("CommandOptions")<
|
|
7
|
-
CliOptions,
|
|
8
|
-
Readonly<{
|
|
9
|
-
cwd: string
|
|
10
|
-
yes: boolean
|
|
11
|
-
stylingLibrary: StylingLibrary | undefined
|
|
12
|
-
}>
|
|
13
|
-
>() { }
|
|
14
|
-
|
|
15
|
-
const cwd = Options.directory("cwd", { exists: "yes" }).pipe(Options.withDefault("."), Options.withAlias("c"))
|
|
16
|
-
const yes = Options.boolean("yes", { aliases: ["y"] })
|
|
17
|
-
const summary = Options.boolean("summary").pipe(Options.withAlias("s"))
|
|
18
|
-
const overwrite = Options.boolean("overwrite", { aliases: ["o"] })
|
|
19
|
-
const all = Options.boolean("all", { aliases: ["a"] })
|
|
20
|
-
const path = Options.text("path").pipe(Options.withDefault(""), Options.withAlias("p"))
|
|
21
|
-
const stylingLibrary = Options.choice("styling-library", ["nativewind", "uniwind"] as const).pipe(
|
|
22
|
-
Options.optional,
|
|
23
|
-
Options.map(Option.getOrUndefined),
|
|
24
|
-
Options.withDescription("Override the detected styling library for this command"),
|
|
25
|
-
)
|
|
26
|
-
const template = Options.text("template").pipe(Options.withAlias("t"), Options.withDefault(""))
|
|
27
|
-
|
|
28
|
-
export { CliOptions, cwd, summary, yes, overwrite, all, path, stylingLibrary, template }
|
|
29
|
-
export type { StylingLibrary }
|