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.
Files changed (90) hide show
  1. package/dist/args.js.map +1 -1
  2. package/dist/commands/checks.d.ts +2 -2
  3. package/dist/commands/checks.js.map +1 -1
  4. package/dist/commands/edit.d.ts +2 -2
  5. package/dist/commands/edit.js +1 -3
  6. package/dist/commands/edit.js.map +1 -1
  7. package/dist/commands/exec.d.ts +2 -0
  8. package/dist/commands/exec.js +27 -1
  9. package/dist/commands/exec.js.map +1 -1
  10. package/dist/commands/git.d.ts +2 -2
  11. package/dist/commands/git.js +1 -1
  12. package/dist/commands/git.js.map +1 -1
  13. package/dist/commands/install.d.ts +3 -3
  14. package/dist/commands/install.js +91 -40
  15. package/dist/commands/install.js.map +1 -1
  16. package/dist/commands/read.d.ts +1 -1
  17. package/dist/commands/read.js +4 -5
  18. package/dist/commands/read.js.map +1 -1
  19. package/dist/config.d.ts +0 -1
  20. package/dist/config.js +3 -2
  21. package/dist/config.js.map +1 -1
  22. package/dist/index.js +0 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/init/blocks.d.ts +1 -1
  25. package/dist/init/blocks.js +1 -1
  26. package/dist/init/blocks.js.map +1 -1
  27. package/dist/init/cargo.d.ts +1 -1
  28. package/dist/init/expo.d.ts +1 -1
  29. package/dist/init/expo.js +1 -1
  30. package/dist/init/expo.js.map +1 -1
  31. package/dist/init/gitModules.d.ts +1 -1
  32. package/dist/init/index.d.ts +1 -1
  33. package/dist/init/index.js +15 -0
  34. package/dist/init/index.js.map +1 -1
  35. package/dist/init/monorepo.d.ts +1 -1
  36. package/dist/init/monorepo.js +15 -4
  37. package/dist/init/monorepo.js.map +1 -1
  38. package/dist/init/prepareVelo.d.ts +1 -1
  39. package/dist/init/prepareVelo.js +2 -2
  40. package/dist/init/prepareVelo.js.map +1 -1
  41. package/dist/init/tauri.d.ts +1 -1
  42. package/dist/init/tauri.js +1 -1
  43. package/dist/init/tauri.js.map +1 -1
  44. package/dist/init/templates.d.ts +1 -1
  45. package/dist/init/templates.js +2 -2
  46. package/dist/init/templates.js.map +1 -1
  47. package/dist/init/velo.d.ts +1 -1
  48. package/dist/init/velo.js +2 -2
  49. package/dist/init/velo.js.map +1 -1
  50. package/dist/schemas/lucy.d.ts +3 -0
  51. package/dist/schemas/lucy.js +3 -0
  52. package/dist/schemas/lucy.js.map +1 -1
  53. package/dist/tasks/index.d.ts +1 -1
  54. package/dist/wix-sdk/index.d.ts +1 -1
  55. package/dist/wix-sdk/init.d.ts +1 -1
  56. package/dist/wix-sdk/run.d.ts +1 -1
  57. package/dist/wix-sync/index.d.ts +1 -1
  58. package/dist/wix-sync/init.d.ts +1 -1
  59. package/files/templates/block[D]/lucy.json +2 -1
  60. package/files/templates/cargo[D]/lucy.json +2 -1
  61. package/files/templates/expo[D]/lucy.json +1 -0
  62. package/files/templates/monorepo[D]/files/.editorconfig +10 -0
  63. package/files/templates/monorepo[D]/files/README.md +63 -91
  64. package/files/templates/monorepo[D]/files/nx.json +25 -0
  65. package/files/templates/monorepo[D]/files/pnpm-workspace.yaml +10 -0
  66. package/files/templates/monorepo[D]/files/tsconfig.json +6 -0
  67. package/files/templates/monorepo[D]/lucy.json +26 -3
  68. package/files/templates/tauri[D]/lucy.json +2 -1
  69. package/files/templates/velo[D]/lucy.json +2 -1
  70. package/package.json +1 -1
  71. package/src/args.ts +1 -0
  72. package/src/commands/checks.ts +1 -1
  73. package/src/commands/edit.ts +0 -2
  74. package/src/commands/exec.ts +32 -1
  75. package/src/commands/git.ts +1 -1
  76. package/src/commands/install.ts +115 -59
  77. package/src/commands/read.ts +5 -6
  78. package/src/config.ts +4 -4
  79. package/src/index.ts +0 -1
  80. package/src/init/blocks.ts +1 -1
  81. package/src/init/expo.ts +1 -1
  82. package/src/init/index.ts +18 -0
  83. package/src/init/monorepo.ts +36 -6
  84. package/src/init/prepareVelo.ts +2 -2
  85. package/src/init/tauri.ts +1 -3
  86. package/src/init/templates.ts +1 -1
  87. package/src/init/velo.ts +2 -2
  88. package/src/schemas/lucy.ts +3 -0
  89. package/files/templates/monorepo[D]/files/package.json +0 -39
  90. package/files/templates/monorepo[D]/files/turbo.json +0 -34
@@ -1,137 +1,109 @@
1
- # Turborepo starter
1
+ # Test
2
2
 
3
- This Turborepo starter is maintained by the Turborepo core team.
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
- ## Using this example
5
+ Your new, shiny [Nx workspace](https://nx.dev) is ready ✨.
6
6
 
7
- Run the following command:
7
+ [Learn more about this workspace setup and its capabilities](https://nx.dev/nx-api/js?utm_source=nx_project&amp;utm_medium=readme&amp;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
- ```sh
10
- npx create-turbo@latest
11
- ```
9
+ ## Run tasks
12
10
 
13
- ## What's inside?
11
+ To run the dev server for your app, use:
14
12
 
15
- This Turborepo includes the following packages/apps:
13
+ ```sh
14
+ npx nx serve test
15
+ ```
16
16
 
17
- ### Apps and Packages
17
+ To create a production bundle:
18
18
 
19
- - `docs`: a [Next.js](https://nextjs.org/) app
20
- - `web`: another [Next.js](https://nextjs.org/) app
21
- - `@repo/ui`: a stub React component library shared by both `web` and `docs` applications
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
- Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
23
+ To see all available targets to run for a project, run:
26
24
 
27
- ### Utilities
25
+ ```sh
26
+ npx nx show project test
27
+ ```
28
28
 
29
- This Turborepo has some additional tools already setup for you:
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
- - [TypeScript](https://www.typescriptlang.org/) for static type checking
32
- - [ESLint](https://eslint.org/) for code linting
33
- - [Prettier](https://prettier.io) for code formatting
31
+ [More about running tasks in the docs &raquo;](https://nx.dev/features/run-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
34
32
 
35
- ### Build
33
+ ## Versioning and releasing
36
34
 
37
- To build all apps and packages, run the following command:
35
+ To version and release the library use
38
36
 
39
37
  ```
40
- cd my-turborepo
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
- You can build a specific package by using a [filter](https://turborepo.com/docs/crafting-your-repository/running-tasks#using-filters):
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 &raquo;](https://nx.dev/features/manage-releases?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
56
44
 
57
- # Without [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation), use your package manager
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
- ### Develop
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 develop all apps and packages, run the following command:
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
- # With [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation) installed (recommended)
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
- # Without [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation), use your package manager
74
- npx turbo dev
75
- yarn exec turbo dev
76
- pnpm exec turbo dev
57
+ ```sh
58
+ npx nx sync:check
77
59
  ```
78
60
 
79
- You can develop a specific package by using a [filter](https://turborepo.com/docs/crafting-your-repository/running-tasks#using-filters):
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
- # Without [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation), use your package manager
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
- ### Remote Caching
67
+ To connect to Nx Cloud, run the following command:
92
68
 
93
- > [!TIP]
94
- > Vercel Remote Cache is free for all plans. Get started today at [vercel.com](https://vercel.com/signup?/signup?utm_source=remote-cache-sdk&utm_campaign=free_remote_cache).
69
+ ```sh
70
+ npx nx connect
71
+ ```
95
72
 
96
- Turborepo can use a technique known as [Remote Caching](https://turborepo.com/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
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
- By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup?utm_source=turborepo-examples), then enter the following commands:
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
- # With [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation) installed (recommended)
104
- turbo login
82
+ Use the following command to configure a CI workflow for your workspace:
105
83
 
106
- # Without [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation), use your package manager
107
- npx turbo login
108
- yarn exec turbo login
109
- pnpm exec turbo login
84
+ ```sh
85
+ npx nx g ci-workflow
110
86
  ```
111
87
 
112
- This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview).
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
- Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:
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
- # Without [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation), use your package manager
121
- npx turbo link
122
- yarn exec turbo link
123
- pnpm exec turbo link
124
- ```
94
+ [Install Nx Console &raquo;](https://nx.dev/getting-started/editor-setup?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
125
95
 
126
- ## Useful Links
96
+ ## Useful links
127
97
 
128
- Learn more about the power of Turborepo:
98
+ Learn more:
129
99
 
130
- - [Tasks](https://turborepo.com/docs/crafting-your-repository/running-tasks)
131
- - [Caching](https://turborepo.com/docs/crafting-your-repository/caching)
132
- - [Remote Caching](https://turborepo.com/docs/core-concepts/remote-caching)
133
- - [Filtering](https://turborepo.com/docs/crafting-your-repository/running-tasks#using-filters)
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&amp;utm_medium=readme&amp;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
- rm -rf .yarn/cache .yarn/install-state.gz node_modules apps/*/node_modules packages/*/node_modules wix_apps/*/node_modules
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
+ }
@@ -0,0 +1,10 @@
1
+ packages:
2
+ - packages/*
3
+ - apps/*
4
+ - shared/*
5
+
6
+ nodeLinker: hoisted
7
+
8
+ onlyBuiltDependencies:
9
+ - '@swc/core'
10
+ - nx
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./tsconfig.base.json",
3
+ "compileOnSave": false,
4
+ "files": [],
5
+ "references": []
6
+ }
@@ -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
  }
@@ -4,5 +4,6 @@
4
4
  "dependencies": {},
5
5
  "scripts": {},
6
6
  "initialized": false,
7
- "type": "tauri"
7
+ "type": "tauri",
8
+ "packageManager": "pnpm"
8
9
  }
@@ -132,5 +132,6 @@
132
132
  "cypress": "cypress open",
133
133
  "e2e": "cypress-cloud run --parallel --record"
134
134
  },
135
- "type": "velo"
135
+ "type": "velo",
136
+ "packageManager": "pnpm"
136
137
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "lucy-cli",
4
- "version": "2.0.0-alpha.20",
4
+ "version": "2.0.0-alpha.21",
5
5
  "description": "Lucy Framework for WIX Studio Editor",
6
6
  "main": ".dist/index.js",
7
7
  "scripts": {
package/src/args.ts CHANGED
@@ -76,5 +76,6 @@ export async function get_args(): Promise<LucyArgs> {
76
76
  .parseAsync();
77
77
 
78
78
  // The cast is now safer with the defined interface.
79
+
79
80
  return argv as LucyArgs;
80
81
  }
@@ -1,5 +1,5 @@
1
1
  import { Effect, Schema } from "effect/index";
2
- import { Command, FileSystem, Path } from "@effect/platform"
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";
@@ -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;
@@ -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
+ })
@@ -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.defaultModuleBasePath, name);
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}"]`);
@@ -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 = Effect.gen(function*() {
9
- const config = yield* Config;
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
- const pkgs: string[] = []
12
- for (const [key, value] of Object.entries(config.config.lucySettings.dependencies)) {
13
- if (value.length > 0) {
14
- pkgs.push(`${key}@${value}`);
15
- continue
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
- pkgs.push(key);
18
- }
19
- const devPkgs: string[] = []
20
- for (const [key, value] of Object.entries(config.config.lucySettings.devDependencies)) {
21
- if (value.length > 0) {
22
- devPkgs.push(`${key}@${value}`);
23
- continue
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
- logger.info("Installing dependencies");
30
- const yarn = Command.make(
31
- "yarn",
32
- "add",
33
- ...pkgs,
34
- ).pipe(
35
- Command.stdout("inherit"), // Stream stdout to process.stdout
36
- Command.exitCode // Get the exit code
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
- if ((yield* yarn) !== 0) {
50
- return logger.error("Failed to install dependencies. Please check the error message above.");
51
- }
52
- if ((yield* yarnDev) !== 0) {
53
- return logger.error("Failed to install dev dependencies. Please check the error message above.");
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
- export const runYarn = Effect.gen(function*() {
58
- const yarnDev = Command.make(
59
- "yarn",
60
- ).pipe(
61
- Command.stdout("inherit"), // Stream stdout to process.stdout
62
- Command.exitCode // Get the exit code
63
- )
64
- yield* yarnDev;
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 yarnSetVersion = Effect.gen(function*() {
68
- const yarnDev = Command.make(
69
- "yarn",
70
- "set",
71
- "version",
72
- "berry",
73
- ).pipe(
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* yarnDev;
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
  })
@@ -1,6 +1,6 @@
1
1
  import { Effect, Schema } from "effect/index";
2
2
  import { FileSystem, Path } from "@effect/platform"
3
- import { Config, lucyJsonName, lucyJsonPath, packageJsonPath, veloSyncJsonPath } from "../config.js";
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(lucyJsonPath);
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 template directory, but 'force' is set. Overwriting...`);
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 template directory. Skipping reading ${lucyJsonName} from template.`);
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);