lucy-cli 2.0.0-alpha.20 → 2.0.0-alpha.21
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/args.js.map +1 -1
- package/dist/commands/checks.d.ts +2 -2
- package/dist/commands/checks.js.map +1 -1
- package/dist/commands/edit.d.ts +2 -2
- package/dist/commands/edit.js +1 -3
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/exec.d.ts +2 -0
- package/dist/commands/exec.js +27 -1
- package/dist/commands/exec.js.map +1 -1
- package/dist/commands/git.d.ts +2 -2
- package/dist/commands/git.js +1 -1
- package/dist/commands/git.js.map +1 -1
- package/dist/commands/install.d.ts +3 -3
- package/dist/commands/install.js +91 -40
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/read.d.ts +1 -1
- package/dist/commands/read.js +4 -5
- package/dist/commands/read.js.map +1 -1
- package/dist/config.d.ts +0 -1
- package/dist/config.js +3 -2
- package/dist/config.js.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/init/blocks.d.ts +1 -1
- package/dist/init/blocks.js +1 -1
- package/dist/init/blocks.js.map +1 -1
- package/dist/init/cargo.d.ts +1 -1
- package/dist/init/expo.d.ts +1 -1
- package/dist/init/expo.js +1 -1
- package/dist/init/expo.js.map +1 -1
- package/dist/init/gitModules.d.ts +1 -1
- package/dist/init/index.d.ts +1 -1
- package/dist/init/index.js +15 -0
- package/dist/init/index.js.map +1 -1
- package/dist/init/monorepo.d.ts +1 -1
- package/dist/init/monorepo.js +15 -4
- package/dist/init/monorepo.js.map +1 -1
- package/dist/init/prepareVelo.d.ts +1 -1
- package/dist/init/prepareVelo.js +2 -2
- package/dist/init/prepareVelo.js.map +1 -1
- package/dist/init/tauri.d.ts +1 -1
- package/dist/init/tauri.js +1 -1
- package/dist/init/tauri.js.map +1 -1
- package/dist/init/templates.d.ts +1 -1
- package/dist/init/templates.js +2 -2
- package/dist/init/templates.js.map +1 -1
- package/dist/init/velo.d.ts +1 -1
- package/dist/init/velo.js +2 -2
- package/dist/init/velo.js.map +1 -1
- package/dist/schemas/lucy.d.ts +3 -0
- package/dist/schemas/lucy.js +3 -0
- package/dist/schemas/lucy.js.map +1 -1
- package/dist/tasks/index.d.ts +1 -1
- package/dist/wix-sdk/index.d.ts +1 -1
- package/dist/wix-sdk/init.d.ts +1 -1
- package/dist/wix-sdk/run.d.ts +1 -1
- package/dist/wix-sync/index.d.ts +1 -1
- package/dist/wix-sync/init.d.ts +1 -1
- package/files/templates/block[D]/lucy.json +2 -1
- package/files/templates/cargo[D]/lucy.json +2 -1
- package/files/templates/expo[D]/lucy.json +1 -0
- package/files/templates/monorepo[D]/files/.editorconfig +10 -0
- package/files/templates/monorepo[D]/files/README.md +63 -91
- package/files/templates/monorepo[D]/files/nx.json +25 -0
- package/files/templates/monorepo[D]/files/pnpm-workspace.yaml +10 -0
- package/files/templates/monorepo[D]/files/tsconfig.json +6 -0
- package/files/templates/monorepo[D]/lucy.json +26 -3
- package/files/templates/tauri[D]/lucy.json +2 -1
- package/files/templates/velo[D]/lucy.json +2 -1
- package/package.json +1 -1
- package/src/args.ts +1 -0
- package/src/commands/checks.ts +1 -1
- package/src/commands/edit.ts +0 -2
- package/src/commands/exec.ts +32 -1
- package/src/commands/git.ts +1 -1
- package/src/commands/install.ts +115 -59
- package/src/commands/read.ts +5 -6
- package/src/config.ts +4 -4
- package/src/index.ts +0 -1
- package/src/init/blocks.ts +1 -1
- package/src/init/expo.ts +1 -1
- package/src/init/index.ts +18 -0
- package/src/init/monorepo.ts +36 -6
- package/src/init/prepareVelo.ts +2 -2
- package/src/init/tauri.ts +1 -3
- package/src/init/templates.ts +1 -1
- package/src/init/velo.ts +2 -2
- package/src/schemas/lucy.ts +3 -0
- package/files/templates/monorepo[D]/files/package.json +0 -39
- package/files/templates/monorepo[D]/files/turbo.json +0 -34
@@ -1,137 +1,109 @@
|
|
1
|
-
#
|
1
|
+
# Test
|
2
2
|
|
3
|
-
|
3
|
+
<a alt="Nx logo" href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a>
|
4
4
|
|
5
|
-
|
5
|
+
✨ Your new, shiny [Nx workspace](https://nx.dev) is ready ✨.
|
6
6
|
|
7
|
-
|
7
|
+
[Learn more about this workspace setup and its capabilities](https://nx.dev/nx-api/js?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) or run `npx nx graph` to visually explore what was created. Now, let's get you up to speed!
|
8
8
|
|
9
|
-
|
10
|
-
npx create-turbo@latest
|
11
|
-
```
|
9
|
+
## Run tasks
|
12
10
|
|
13
|
-
|
11
|
+
To run the dev server for your app, use:
|
14
12
|
|
15
|
-
|
13
|
+
```sh
|
14
|
+
npx nx serve test
|
15
|
+
```
|
16
16
|
|
17
|
-
|
17
|
+
To create a production bundle:
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
- `@repo/eslint-config`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
|
23
|
-
- `@repo/typescript-config`: `tsconfig.json`s used throughout the monorepo
|
19
|
+
```sh
|
20
|
+
npx nx build test
|
21
|
+
```
|
24
22
|
|
25
|
-
|
23
|
+
To see all available targets to run for a project, run:
|
26
24
|
|
27
|
-
|
25
|
+
```sh
|
26
|
+
npx nx show project test
|
27
|
+
```
|
28
28
|
|
29
|
-
|
29
|
+
These targets are either [inferred automatically](https://nx.dev/concepts/inferred-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) or defined in the `project.json` or `package.json` files.
|
30
30
|
|
31
|
-
|
32
|
-
- [ESLint](https://eslint.org/) for code linting
|
33
|
-
- [Prettier](https://prettier.io) for code formatting
|
31
|
+
[More about running tasks in the docs »](https://nx.dev/features/run-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
34
32
|
|
35
|
-
|
33
|
+
## Versioning and releasing
|
36
34
|
|
37
|
-
To
|
35
|
+
To version and release the library use
|
38
36
|
|
39
37
|
```
|
40
|
-
|
41
|
-
|
42
|
-
# With [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation) installed (recommended)
|
43
|
-
turbo build
|
44
|
-
|
45
|
-
# Without [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation), use your package manager
|
46
|
-
npx turbo build
|
47
|
-
yarn dlx turbo build
|
48
|
-
pnpm exec turbo build
|
38
|
+
npx nx release
|
49
39
|
```
|
50
40
|
|
51
|
-
|
41
|
+
Pass `--dry-run` to see what would happen without actually releasing the library.
|
52
42
|
|
53
|
-
|
54
|
-
# With [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation) installed (recommended)
|
55
|
-
turbo build --filter=docs
|
43
|
+
[Learn more about Nx release »](https://nx.dev/features/manage-releases?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
56
44
|
|
57
|
-
|
58
|
-
npx turbo build --filter=docs
|
59
|
-
yarn exec turbo build --filter=docs
|
60
|
-
pnpm exec turbo build --filter=docs
|
61
|
-
```
|
45
|
+
## Keep TypeScript project references up to date
|
62
46
|
|
63
|
-
|
47
|
+
Nx automatically updates TypeScript [project references](https://www.typescriptlang.org/docs/handbook/project-references.html) in `tsconfig.json` files to ensure they remain accurate based on your project dependencies (`import` or `require` statements). This sync is automatically done when running tasks such as `build` or `typecheck`, which require updated references to function correctly.
|
64
48
|
|
65
|
-
To
|
49
|
+
To manually trigger the process to sync the project graph dependencies information to the TypeScript project references, run the following command:
|
66
50
|
|
51
|
+
```sh
|
52
|
+
npx nx sync
|
67
53
|
```
|
68
|
-
cd my-turborepo
|
69
54
|
|
70
|
-
|
71
|
-
turbo dev
|
55
|
+
You can enforce that the TypeScript project references are always in the correct state when running in CI by adding a step to your CI job configuration that runs the following command:
|
72
56
|
|
73
|
-
|
74
|
-
npx
|
75
|
-
yarn exec turbo dev
|
76
|
-
pnpm exec turbo dev
|
57
|
+
```sh
|
58
|
+
npx nx sync:check
|
77
59
|
```
|
78
60
|
|
79
|
-
|
61
|
+
[Learn more about nx sync](https://nx.dev/reference/nx-commands#sync)
|
80
62
|
|
81
|
-
|
82
|
-
# With [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation) installed (recommended)
|
83
|
-
turbo dev --filter=web
|
63
|
+
## Set up CI!
|
84
64
|
|
85
|
-
|
86
|
-
npx turbo dev --filter=web
|
87
|
-
yarn exec turbo dev --filter=web
|
88
|
-
pnpm exec turbo dev --filter=web
|
89
|
-
```
|
65
|
+
### Step 1
|
90
66
|
|
91
|
-
|
67
|
+
To connect to Nx Cloud, run the following command:
|
92
68
|
|
93
|
-
|
94
|
-
|
69
|
+
```sh
|
70
|
+
npx nx connect
|
71
|
+
```
|
95
72
|
|
96
|
-
|
73
|
+
Connecting to Nx Cloud ensures a [fast and scalable CI](https://nx.dev/ci/intro/why-nx-cloud?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) pipeline. It includes features such as:
|
97
74
|
|
98
|
-
|
75
|
+
- [Remote caching](https://nx.dev/ci/features/remote-cache?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
76
|
+
- [Task distribution across multiple machines](https://nx.dev/ci/features/distribute-task-execution?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
77
|
+
- [Automated e2e test splitting](https://nx.dev/ci/features/split-e2e-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
78
|
+
- [Task flakiness detection and rerunning](https://nx.dev/ci/features/flaky-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
99
79
|
|
100
|
-
|
101
|
-
cd my-turborepo
|
80
|
+
### Step 2
|
102
81
|
|
103
|
-
|
104
|
-
turbo login
|
82
|
+
Use the following command to configure a CI workflow for your workspace:
|
105
83
|
|
106
|
-
|
107
|
-
npx
|
108
|
-
yarn exec turbo login
|
109
|
-
pnpm exec turbo login
|
84
|
+
```sh
|
85
|
+
npx nx g ci-workflow
|
110
86
|
```
|
111
87
|
|
112
|
-
|
88
|
+
[Learn more about Nx on CI](https://nx.dev/ci/intro/ci-with-nx#ready-get-started-with-your-provider?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
113
89
|
|
114
|
-
|
90
|
+
## Install Nx Console
|
115
91
|
|
116
|
-
|
117
|
-
# With [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation) installed (recommended)
|
118
|
-
turbo link
|
92
|
+
Nx Console is an editor extension that enriches your developer experience. It lets you run tasks, generate code, and improves code autocompletion in your IDE. It is available for VSCode and IntelliJ.
|
119
93
|
|
120
|
-
|
121
|
-
npx turbo link
|
122
|
-
yarn exec turbo link
|
123
|
-
pnpm exec turbo link
|
124
|
-
```
|
94
|
+
[Install Nx Console »](https://nx.dev/getting-started/editor-setup?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
125
95
|
|
126
|
-
## Useful
|
96
|
+
## Useful links
|
127
97
|
|
128
|
-
Learn more
|
98
|
+
Learn more:
|
129
99
|
|
130
|
-
- [
|
131
|
-
- [
|
132
|
-
- [
|
133
|
-
- [
|
134
|
-
- [Configuration Options](https://turborepo.com/docs/reference/configuration)
|
135
|
-
- [CLI Usage](https://turborepo.com/docs/reference/command-line-reference)
|
100
|
+
- [Learn more about this workspace setup](https://nx.dev/nx-api/js?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
101
|
+
- [Learn about Nx on CI](https://nx.dev/ci/intro/ci-with-nx?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
102
|
+
- [Releasing Packages with Nx release](https://nx.dev/features/manage-releases?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
103
|
+
- [What are Nx plugins?](https://nx.dev/concepts/nx-plugins?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
136
104
|
|
137
|
-
|
105
|
+
And join the Nx community:
|
106
|
+
- [Discord](https://go.nx.dev/community)
|
107
|
+
- [Follow us on X](https://twitter.com/nxdevtools) or [LinkedIn](https://www.linkedin.com/company/nrwl)
|
108
|
+
- [Our Youtube channel](https://www.youtube.com/@nxdevtools)
|
109
|
+
- [Our blog](https://nx.dev/blog?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "./node_modules/nx/schemas/nx-schema.json",
|
3
|
+
"defaultBase": "master",
|
4
|
+
"namedInputs": {
|
5
|
+
"default": ["{projectRoot}/**/*", "sharedGlobals"],
|
6
|
+
"production": ["default"],
|
7
|
+
"sharedGlobals": []
|
8
|
+
},
|
9
|
+
"plugins": [
|
10
|
+
{
|
11
|
+
"plugin": "@nx/js/typescript",
|
12
|
+
"options": {
|
13
|
+
"typecheck": {
|
14
|
+
"targetName": "typecheck"
|
15
|
+
},
|
16
|
+
"build": {
|
17
|
+
"targetName": "build",
|
18
|
+
"configName": "tsconfig.lib.json",
|
19
|
+
"buildDepsName": "build-deps",
|
20
|
+
"watchDepsName": "watch-deps"
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
]
|
25
|
+
}
|
@@ -37,9 +37,32 @@
|
|
37
37
|
"branch": "1.0.0"
|
38
38
|
}
|
39
39
|
},
|
40
|
-
"devDependencies": {
|
40
|
+
"devDependencies": {
|
41
|
+
"vitest": "",
|
42
|
+
"@vitest/ui": "",
|
43
|
+
"syncpack": "",
|
44
|
+
"typescript-eslint": "",
|
45
|
+
"typescript-eslint-language-service": "",
|
46
|
+
"@typescript-eslint/parser": ""
|
47
|
+
},
|
41
48
|
"dependencies": {},
|
42
|
-
"scripts": {
|
49
|
+
"scripts": {
|
50
|
+
"build": "turbo run build",
|
51
|
+
"dev": "turbo run dev",
|
52
|
+
"lint": "turbo run lint",
|
53
|
+
"format": "prettier --write \"./*.json\" \"**/*.{ts,tsx,md,json,jsonc,json5}\"",
|
54
|
+
"check-types": "turbo run check-types",
|
55
|
+
"update": "syncpack -- update",
|
56
|
+
"update:list": "syncpack -- list",
|
57
|
+
"test": "turbo run test",
|
58
|
+
"test:projects": "vitest run",
|
59
|
+
"test:projects:watch": "vitest --watch",
|
60
|
+
"view-report": "turbo run view-report",
|
61
|
+
"test:ui": "vitest --ui",
|
62
|
+
"test:e2e": "turbo run test:e2e"
|
63
|
+
},
|
43
64
|
"initialized": false,
|
44
|
-
"type": "monorepo"
|
65
|
+
"type": "monorepo",
|
66
|
+
"packageManager": "pnpm",
|
67
|
+
"defaultModulePath": "shared"
|
45
68
|
}
|
package/package.json
CHANGED
package/src/args.ts
CHANGED
package/src/commands/checks.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Effect, Schema } from "effect/index";
|
2
|
-
import {
|
2
|
+
import { FileSystem, Path } from "@effect/platform"
|
3
3
|
import { Config, lucyJsonName } from "../config.js";
|
4
4
|
import { logger } from "../utils/logger.js";
|
5
5
|
import { AppError } from "../error.js";
|
package/src/commands/edit.ts
CHANGED
@@ -54,9 +54,7 @@ export const setProjectName = Effect.gen(function*() {
|
|
54
54
|
})
|
55
55
|
|
56
56
|
export const setInitialized = Effect.gen(function*() {
|
57
|
-
const config = yield* Config;
|
58
57
|
const fs = yield* FileSystem.FileSystem;
|
59
|
-
const path = yield* Path.Path;
|
60
58
|
const lucyRaw = yield* fs.readFileString(lucyJsonPath);
|
61
59
|
const lucyJSON = (yield* Schema.decodeUnknown(JsonSchema)(lucyRaw)) as any;
|
62
60
|
lucyJSON.initialized = true;
|
package/src/commands/exec.ts
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
import { Effect } from "effect/index";
|
1
|
+
import { Effect, Schema } from "effect/index";
|
2
2
|
import { Config } from "../config.js";
|
3
3
|
import { Command } from "@effect/platform/index";
|
4
4
|
import { logger } from "../utils/logger.js";
|
5
5
|
import { FileSystem } from "@effect/platform"
|
6
|
+
import Enquirer from "enquirer";
|
7
|
+
import { AppError } from "../error.js";
|
6
8
|
|
7
9
|
export const execCommand = Effect.gen(function*() {
|
8
10
|
const config = yield* Config;
|
@@ -35,3 +37,32 @@ export const open = Effect.scoped(Effect.gen(function*() {
|
|
35
37
|
command.pipe().pipe(Command.stdout("inherit"), Command.exitCode);
|
36
38
|
yield* command.pipe().pipe(Command.stdout("inherit"), Command.exitCode);
|
37
39
|
}))
|
40
|
+
|
41
|
+
export const openVSCode = Effect.gen(function*() {
|
42
|
+
const config = yield* Config;
|
43
|
+
const open = Command.make(
|
44
|
+
"code",
|
45
|
+
config.config.cwd,
|
46
|
+
).pipe(
|
47
|
+
Command.stdout("inherit"), // Stream stdout to process.stdout
|
48
|
+
Command.exitCode // Get the exit code
|
49
|
+
)
|
50
|
+
const overwriteQuestion = new Enquirer();
|
51
|
+
const openVScodeQuestion = yield* Effect.tryPromise({
|
52
|
+
try: () => overwriteQuestion.prompt({
|
53
|
+
type: 'confirm',
|
54
|
+
name: 'openVSCode',
|
55
|
+
message: `Do you want to open the project in VSCode?`,
|
56
|
+
}),
|
57
|
+
catch: (e) => {
|
58
|
+
return new AppError({
|
59
|
+
cause: e,
|
60
|
+
message: "Error opening VSCode",
|
61
|
+
});
|
62
|
+
}
|
63
|
+
})
|
64
|
+
const choice = yield* Schema.decodeUnknown(Schema.Struct({ openVSCode: Schema.Boolean }))(openVScodeQuestion);
|
65
|
+
if (choice.openVSCode) {
|
66
|
+
yield* open
|
67
|
+
}
|
68
|
+
})
|
package/src/commands/git.ts
CHANGED
@@ -61,7 +61,7 @@ export const initSubmodules = (update: boolean = false) => Effect.gen(function*
|
|
61
61
|
|
62
62
|
for (const [name, repo] of Object.entries(config.config.lucySettings.modules)) {
|
63
63
|
logger.action(`Processing submodule ${name}`);
|
64
|
-
const clonePath = repo.path || path.join(config.config.
|
64
|
+
const clonePath = repo.path || path.join(config.config.lucySettings.defaultModulePath ?? '', name);
|
65
65
|
|
66
66
|
const isRegistered = yield* isSubmoduleRegistered(git, clonePath);
|
67
67
|
const isConfiguredInFile = (yield* fs.exists(gitmodulesPath)) && (yield* fs.readFileString(gitmodulesPath, 'utf-8')).includes(`[submodule "${clonePath}"]`);
|
package/src/commands/install.ts
CHANGED
@@ -5,77 +5,115 @@ import { logger } from "../utils/logger.js";
|
|
5
5
|
import { CommandExecutor, ExitCode } from "@effect/platform/CommandExecutor";
|
6
6
|
import { PlatformError } from "@effect/platform/Error";
|
7
7
|
|
8
|
-
export const installPackages =
|
9
|
-
|
8
|
+
export const installPackages = (workspace: boolean = false) => {
|
9
|
+
return Effect.gen(function*() {
|
10
|
+
const config = yield* Config;
|
11
|
+
|
12
|
+
const pkgs: string[] = []
|
13
|
+
for (const [key, value] of Object.entries(config.config.lucySettings.dependencies)) {
|
14
|
+
if (value.length > 0) {
|
15
|
+
pkgs.push(`${key}@${value}`);
|
16
|
+
continue
|
17
|
+
}
|
18
|
+
pkgs.push(key);
|
19
|
+
}
|
20
|
+
const devPkgs: string[] = []
|
21
|
+
for (const [key, value] of Object.entries(config.config.lucySettings.devDependencies)) {
|
22
|
+
if (value.length > 0) {
|
23
|
+
devPkgs.push(`${key}@${value}`);
|
24
|
+
continue
|
25
|
+
}
|
26
|
+
devPkgs.push(key);
|
27
|
+
}
|
10
28
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
29
|
+
const manager = config.config.lucySettings.packageManager;
|
30
|
+
function pkgMgrParamsInstall():string[] {
|
31
|
+
if (manager === "npm") {
|
32
|
+
return ["install"];
|
33
|
+
}
|
34
|
+
if (manager === "pnpm") {
|
35
|
+
return ["install"];
|
36
|
+
}
|
37
|
+
return ["add"];
|
16
38
|
}
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
39
|
+
function pkgMgrParamsInstallDev():string[] {
|
40
|
+
if (manager === "npm") {
|
41
|
+
return ["install", "-D"];
|
42
|
+
}
|
43
|
+
if (manager === "pnpm") {
|
44
|
+
return ["install", "-D"];
|
45
|
+
}
|
46
|
+
return ["add", "-D"];
|
24
47
|
}
|
25
|
-
devPkgs.push(key);
|
26
|
-
}
|
27
48
|
|
49
|
+
function workspaceEnabled() {
|
50
|
+
if(config.config.lucySettings.packageManager === "pnpm" && workspace) {
|
51
|
+
return ["--workspace-root"];
|
52
|
+
}
|
53
|
+
return [];
|
54
|
+
}
|
55
|
+
logger.info("Installing dependencies");
|
28
56
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
logger.info("Installing dev dependencies");
|
39
|
-
const yarnDev = Command.make(
|
40
|
-
"yarn",
|
41
|
-
"add",
|
42
|
-
"-D",
|
43
|
-
...devPkgs,
|
44
|
-
).pipe(
|
45
|
-
Command.stdout("inherit"), // Stream stdout to process.stdout
|
46
|
-
Command.exitCode // Get the exit code
|
47
|
-
)
|
57
|
+
const install = Command.make(
|
58
|
+
manager,
|
59
|
+
...pkgMgrParamsInstall(),
|
60
|
+
...workspaceEnabled(),
|
61
|
+
...pkgs,
|
62
|
+
).pipe(
|
63
|
+
Command.stdout("inherit"), // Stream stdout to process.stdout
|
64
|
+
Command.exitCode // Get the exit code
|
65
|
+
)
|
48
66
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
67
|
+
logger.info("Installing dev dependencies");
|
68
|
+
const installDev = Command.make(
|
69
|
+
manager,
|
70
|
+
...pkgMgrParamsInstallDev(),
|
71
|
+
...workspaceEnabled(),
|
72
|
+
...devPkgs,
|
73
|
+
).pipe(
|
74
|
+
Command.stdout("inherit"), // Stream stdout to process.stdout
|
75
|
+
Command.exitCode // Get the exit code
|
76
|
+
)
|
56
77
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
}
|
78
|
+
if(Object.keys(config.config.lucySettings.dependencies).length > 0) {
|
79
|
+
if ((yield* install) !== 0) {
|
80
|
+
return logger.error("Failed to install dependencies. Please check the error message above.");
|
81
|
+
}
|
82
|
+
}
|
83
|
+
if(Object.keys(config.config.lucySettings.devDependencies).length > 0) {
|
84
|
+
if ((yield* installDev) !== 0) {
|
85
|
+
return logger.error("Failed to install dev dependencies. Please check the error message above.");
|
86
|
+
}
|
87
|
+
}
|
88
|
+
})
|
89
|
+
}
|
66
90
|
|
67
|
-
export const
|
68
|
-
const
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
91
|
+
export const runInstall = Effect.gen(function*() {
|
92
|
+
const config = yield* Config;
|
93
|
+
|
94
|
+
const manager = config.config.lucySettings.packageManager;
|
95
|
+
const install = Command.make(
|
96
|
+
manager,
|
97
|
+
"install",
|
98
|
+
).pipe(
|
74
99
|
Command.stdout("inherit"), // Stream stdout to process.stdout
|
75
100
|
Command.exitCode // Get the exit code
|
76
101
|
)
|
77
|
-
yield*
|
102
|
+
yield* install;
|
78
103
|
})
|
104
|
+
|
105
|
+
// export const yarnSetVersion = Effect.gen(function*() {
|
106
|
+
// const yarnDev = Command.make(
|
107
|
+
// "yarn",
|
108
|
+
// "set",
|
109
|
+
// "version",
|
110
|
+
// "berry",
|
111
|
+
// ).pipe(
|
112
|
+
// Command.stdout("inherit"), // Stream stdout to process.stdout
|
113
|
+
// Command.exitCode // Get the exit code
|
114
|
+
// )
|
115
|
+
// yield* yarnDev;
|
116
|
+
// })
|
79
117
|
export const installVeloPackages = Effect.gen(function*() {
|
80
118
|
const config = yield* Config;
|
81
119
|
const simpleSchedule = Schedule.tapOutput(
|
@@ -183,4 +221,22 @@ export const installVeloPackages = Effect.gen(function*() {
|
|
183
221
|
return logger.error("Failed to install dev dependencies. Please check the error message above.");
|
184
222
|
}
|
185
223
|
|
224
|
+
})
|
225
|
+
|
226
|
+
export const approveBuilds = Effect.gen(function*() {
|
227
|
+
const config = yield* Config;
|
228
|
+
|
229
|
+
const manager = config.config.lucySettings.packageManager;
|
230
|
+
const approve = Command.make(
|
231
|
+
"pnpm",
|
232
|
+
"approve-build",
|
233
|
+
).pipe(
|
234
|
+
Command.stdout("inherit"), // Stream stdout to process.stdout
|
235
|
+
Command.exitCode // Get the exit code
|
236
|
+
)
|
237
|
+
if (manager !== "pnpm") {
|
238
|
+
logger.warning("The 'approve-build' command is only available for pnpm. Skipping...");
|
239
|
+
return;
|
240
|
+
}
|
241
|
+
yield* approve;
|
186
242
|
})
|
package/src/commands/read.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Effect, Schema } from "effect/index";
|
2
2
|
import { FileSystem, Path } from "@effect/platform"
|
3
|
-
import { Config, lucyJsonName,
|
3
|
+
import { Config, lucyJsonName, packageJsonPath, veloSyncJsonPath } from "../config.js";
|
4
4
|
import { JsonSchema, veloSyncSettings } from "../schemas/index.js";
|
5
5
|
import { lucySettings } from "../schemas/lucy.js";
|
6
6
|
import { logger } from "../utils/logger.js";
|
@@ -18,18 +18,18 @@ export const readLucyJsonFromTemplate = Effect.gen(function* () {
|
|
18
18
|
const config = yield* Config;
|
19
19
|
const fs = yield* FileSystem.FileSystem;
|
20
20
|
const path = yield* Path.Path;
|
21
|
-
|
22
|
-
const lucyRaw = yield* fs.readFileString(
|
21
|
+
|
22
|
+
const lucyRaw = yield* fs.readFileString(path.join(config.config.templateDir, lucyJsonName));
|
23
23
|
const lucySettingsJSON = yield* Schema.decodeUnknown(JsonSchema)(lucyRaw);
|
24
24
|
const lucySetting = yield* Schema.decodeUnknown(lucySettings)(lucySettingsJSON)
|
25
25
|
|
26
26
|
if(config.config.lucySettings.initialized) {
|
27
27
|
if(config.config.force) {
|
28
|
-
logger.warning(`${lucyJsonName} already exists in the
|
28
|
+
logger.warning(`${lucyJsonName} already exists in the target directory, but 'force' is set. Overwriting...`);
|
29
29
|
config.config.lucySettings = lucySetting;
|
30
30
|
return;
|
31
31
|
}
|
32
|
-
logger.warning(`${lucyJsonName} already exists in the
|
32
|
+
logger.warning(`${lucyJsonName} already exists in the target directory. Skipping reading ${lucyJsonName} from template.`);
|
33
33
|
return;
|
34
34
|
}
|
35
35
|
config.config.lucySettings = lucySetting;
|
@@ -38,7 +38,6 @@ export const readLucyJsonFromTemplate = Effect.gen(function* () {
|
|
38
38
|
export const readVeloSyncSettings = Effect.gen(function* () {
|
39
39
|
const config = yield* Config;
|
40
40
|
const fs = yield* FileSystem.FileSystem;
|
41
|
-
const path = yield* Path.Path;
|
42
41
|
if (yield* fs.exists(veloSyncJsonPath)) {
|
43
42
|
const snyConfigRaw = yield* fs.readFileString(veloSyncJsonPath)
|
44
43
|
config.config.veloSyncSettings = yield* Schema.decodeUnknown(veloSyncSettings)(snyConfigRaw);
|