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
package/src/config.ts CHANGED
@@ -30,7 +30,6 @@ export class Config extends Context.Tag("Config")<
30
30
  templateDir: string;
31
31
  templateFiles: string;
32
32
  projectName: string;
33
- defaultModuleBasePath: string;
34
33
  veloSyncSettings?: VeloSyncSettings;
35
34
  wixSDKSettings?: WixSDKSettings;
36
35
  }
@@ -95,7 +94,7 @@ export const ConfigLayer = (args: Awaited<ReturnType<typeof get_args>>) => {
95
94
 
96
95
  const defaultModulePath = () => {
97
96
  if (args.type === 'monorepo') {
98
- return join('packages');
97
+ return 'packages';
99
98
  }
100
99
  return '';
101
100
  };
@@ -131,10 +130,11 @@ export const ConfigLayer = (args: Awaited<ReturnType<typeof get_args>>) => {
131
130
  scripts: {},
132
131
  initialized: false,
133
132
  type: args.initType || 'velo',
133
+ packageManager: 'npm',
134
+ defaultModulePath: ''
134
135
  },
135
136
  templateFiles: '',
136
- templateDir: '',
137
- defaultModuleBasePath: defaultModulePath(),
137
+ templateDir: '',
138
138
  }
139
139
  });
140
140
  }).pipe(Effect.provide(NodeContext.layer))
package/src/index.ts CHANGED
@@ -52,7 +52,6 @@ process.on('SIGTERM', () => {
52
52
  const lucyCLI = pipe(
53
53
  Effect.gen(function* (_) {
54
54
  const config = yield* Config;
55
- const t = Config;
56
55
  if (config.config.action.action === 'init') {
57
56
  return yield* init;
58
57
  }
@@ -73,7 +73,7 @@ export const init_blocks = () => {
73
73
  yield* writePackageJson;
74
74
  yield* copyTemplateFiles;
75
75
  yield* execCommand;
76
- yield* installPackages;
76
+ yield* installPackages();
77
77
  yield* cleanup;
78
78
  yield* setInitialized;
79
79
 
package/src/init/expo.ts CHANGED
@@ -56,7 +56,7 @@ export const init_expo = () => {
56
56
  yield* writePackageJson;
57
57
  yield* copyTemplateFiles;
58
58
  yield* execCommand;
59
- yield* installPackages;
59
+ yield* installPackages();
60
60
  yield* cleanup;
61
61
  yield* setInitialized;
62
62
 
package/src/init/index.ts CHANGED
@@ -12,6 +12,7 @@ import { init_blocks } from "./blocks.js";
12
12
  import { init_velo } from "./velo.js";
13
13
  import { init_submodules } from "./gitModules.js";
14
14
  import { init_tauri } from "./tauri.js";
15
+ import { pkgManagers } from "../schemas/lucy.js";
15
16
 
16
17
 
17
18
  export const init = Effect.gen(function* (_) {
@@ -38,6 +39,23 @@ export const init = Effect.gen(function* (_) {
38
39
  config.config.projectName = selectedName.projectName.trim();
39
40
  yield* selectTemplate();
40
41
  yield* readLucyJsonFromTemplate;
42
+
43
+ const pkgMgrQuestion = new Enquirer();
44
+ const pkgMgr = yield* Effect.tryPromise({
45
+ try: () => pkgMgrQuestion.prompt({
46
+ type: 'select',
47
+ name: 'packageManager',
48
+ message: 'Select a package manager',
49
+ choices: [...pkgManagers],
50
+ }),
51
+ catch: (e) => {
52
+ return new AppError({ cause: e, message: 'Error selecting package manager' });
53
+ }
54
+ })
55
+ const selectedPkgMgr = yield* Schema.decodeUnknown(Schema.Struct({ packageManager: Schema.Literal(...pkgManagers) }))(pkgMgr)
56
+ config.config.lucySettings.packageManager = selectedPkgMgr.packageManager;
57
+
58
+
41
59
  if(config.config.action.initType === 'expo') {
42
60
  return yield* init_expo();
43
61
  }
@@ -1,25 +1,54 @@
1
- import { Effect, Schema } from "effect/index"
1
+ import { Effect } from "effect/index"
2
2
  import { Config } from "../config.js";
3
- import { FileSystem, Path } from "@effect/platform"
3
+ import { Command, FileSystem, Path } from "@effect/platform"
4
4
  import { logger } from "../utils/logger.js";
5
5
  import { mergeAdditions, mergeLucySettings2PackageJson, setInitialized, setProjectName, stringReplace } from "../commands/edit.js";
6
6
  import { writeLucySettings, writePackageJson } from "../commands/write.js";
7
7
  import { copyTemplateFiles } from "../commands/copy.js";
8
8
  import { readPackageJson } from "../commands/read.js";
9
- import { runYarn, yarnSetVersion } from "../commands/install.js";
9
+ import { installPackages, runInstall } from "../commands/install.js";
10
10
  import { cleanup } from "../commands/cleanup.js";
11
11
  import { gitInit } from "../commands/git.js";
12
12
  import { checkForDirty } from "../commands/checks.js";
13
+ import { openVSCode } from "../commands/exec.js";
13
14
 
14
15
  export const init_monorepo = () => {
15
16
  return Effect.gen(function*() {
16
17
  const config = yield* Config;
17
18
  const path = yield* Path.Path;
19
+ const fs = yield* FileSystem.FileSystem;
18
20
 
19
21
  logger.action("Initializing monorepo...");
20
22
 
21
23
  yield* checkForDirty();
22
24
 
25
+ const createMonoRepo = Command.make(
26
+ "npx",
27
+ "-y",
28
+ "create-nx-workspace",
29
+ config.config.projectName,
30
+ `--appName=${config.config.projectName}`,
31
+ `--pm=${config.config.lucySettings.packageManager}`,
32
+ "--preset=ts",
33
+ "--g=true",
34
+ "--e2eTestRunner=cypress",
35
+ "--formatter=prettier"
36
+ ).pipe(
37
+ Command.stdout("inherit"), // Stream stdout to process.stdout
38
+ Command.exitCode // Get the exit code
39
+ )
40
+
41
+ yield* createMonoRepo;
42
+
43
+ const tempPath = path.join(config.config.cwd, config.config.projectName)
44
+ const projectFiles = yield* fs.readDirectory(tempPath)
45
+ yield* Effect.forEach(
46
+ projectFiles.filter(file => file !== '.git'),
47
+ (file) => fs.copy(path.join(tempPath, file), path.join(config.config.cwd, file), { overwrite: true }),
48
+ { discard: true }
49
+ )
50
+ yield* fs.remove(tempPath, { recursive: true })
51
+
23
52
  yield* copyTemplateFiles;
24
53
  yield* stringReplace(path.join(config.config.cwd, 'currents.config.ts'), ['__ProjectName__'], [config.config.projectName]);
25
54
  yield* readPackageJson;
@@ -29,11 +58,12 @@ export const init_monorepo = () => {
29
58
  yield* writeLucySettings;
30
59
  yield* writePackageJson;
31
60
  yield* gitInit();
32
- yield* yarnSetVersion;
33
- yield* runYarn;
61
+ yield* runInstall;
62
+ yield* installPackages(true);
34
63
  yield* cleanup;
35
64
  yield* setInitialized;
36
-
65
+ yield* openVSCode;
66
+
37
67
  logger.success("Monorepo initialized successfully!");
38
68
  })
39
69
  }
@@ -2,7 +2,7 @@ import { Effect } from 'effect/index';
2
2
  import { logger } from '../utils/logger.js';
3
3
  import { checkForVelo } from '../commands/checks.js';
4
4
  import { gitInit } from '../commands/git.js';
5
- import { installVeloPackages, yarnSetVersion } from '../commands/install.js';
5
+ import { installVeloPackages, runInstall } from '../commands/install.js';
6
6
  import { setInitialized } from '../commands/edit.js';
7
7
 
8
8
  export const prepareVelo = Effect.gen(function*() {
@@ -10,8 +10,8 @@ export const prepareVelo = Effect.gen(function*() {
10
10
  yield* checkForVelo();
11
11
 
12
12
  yield* gitInit(true);
13
- yield* yarnSetVersion;
14
13
  yield* installVeloPackages
14
+ yield* runInstall
15
15
  yield* setInitialized;
16
16
 
17
17
  logger.success("Velo Prepared initialized successfully!");
package/src/init/tauri.ts CHANGED
@@ -7,10 +7,8 @@ import { checkForDirty } from "../commands/checks.js";
7
7
  import { setInitialized } from "../commands/edit.js";
8
8
  import { Config } from "../config.js";
9
9
  import { Command, FileSystem, Path } from "@effect/platform"
10
- import { JsonSchema } from "../schemas/index.js";
11
10
  import { AppError } from "../error.js";
12
11
  import { installPackages } from "../commands/install.js";
13
- import { Terminal } from "@effect/platform"
14
12
 
15
13
  export const init_tauri = () => {
16
14
  return Effect.gen(function*() {
@@ -30,7 +28,7 @@ export const init_tauri = () => {
30
28
  yield* Effect.fail(new AppError({ message: "Failed to initialize Tauri project. Please check the error message above.", cause: new Error("Failed to initialize Tauri project") }));
31
29
  }
32
30
  yield* copyTemplateFiles;
33
- yield* installPackages;
31
+ yield* installPackages();
34
32
  yield* writeLucySettings;
35
33
  yield* gitInit();
36
34
  yield* setInitialized;
@@ -25,7 +25,7 @@ export const selectTemplate = () => {
25
25
  const templateChoices: string[] = [];
26
26
  for (const dirent of files) {
27
27
  if (dirent.isDirectory()) {
28
- const lucyRaw = yield* fs.readFileString(lucyJsonPath);
28
+ const lucyRaw = yield* fs.readFileString(join(templatesPath, dirent.name, lucyJsonName));
29
29
  const lucySettingsJSON = yield* Schema.decodeUnknown(JsonSchema)(lucyRaw);
30
30
  const lucySetting = yield* Schema.decodeUnknown(lucySettings)(lucySettingsJSON)
31
31
  if (lucySetting.type === config.config.action.initType) {
package/src/init/velo.ts CHANGED
@@ -6,7 +6,7 @@ import { mergeAdditions, mergeLucySettings2PackageJson, setInitialized, setProje
6
6
  import { writeLucySettings, writePackageJson } from "../commands/write.js";
7
7
  import { copyTemplateFiles } from "../commands/copy.js";
8
8
  import { readPackageJson } from "../commands/read.js";
9
- import { installVeloPackages, runYarn, yarnSetVersion } from "../commands/install.js";
9
+ import { installVeloPackages, runInstall } from "../commands/install.js";
10
10
  import { cleanup } from "../commands/cleanup.js";
11
11
  import { gitInit } from "../commands/git.js";
12
12
  import { checkForVelo } from "../commands/checks.js";
@@ -52,8 +52,8 @@ export const init_velo = () => {
52
52
  yield* writeLucySettings;
53
53
  yield* writePackageJson;
54
54
  yield* gitInit();
55
- yield* yarnSetVersion;
56
55
  yield* installVeloPackages;
56
+ yield* runInstall;
57
57
  yield* cleanup;
58
58
  yield* setInitialized;
59
59
 
@@ -1,6 +1,7 @@
1
1
  import { Schema } from "effect/index";
2
2
  import { initTypes } from "./types.js";
3
3
 
4
+ export const pkgManagers = ['npm', 'yarn', 'pnpm'] as const;
4
5
  export const lucySettings = Schema.mutable(Schema.Struct({
5
6
  modules: Schema.Record({
6
7
  key: Schema.String,
@@ -35,6 +36,8 @@ export const lucySettings = Schema.mutable(Schema.Struct({
35
36
  }),
36
37
  additionalCommands: Schema.optional(Schema.Array(Schema.Array(Schema.String))),
37
38
  additionalPkgProps: Schema.optional(Schema.Object),
39
+ packageManager: Schema.mutable(Schema.Literal(...pkgManagers)),
40
+ defaultModulePath: Schema.optional(Schema.String),
38
41
  }));
39
42
 
40
43
  export type LucySettings = typeof lucySettings.Type;
@@ -1,39 +0,0 @@
1
- {
2
- "name": "vitest",
3
- "private": true,
4
- "type": "module",
5
- "scripts": {
6
- "build": "turbo run build",
7
- "dev": "turbo run dev",
8
- "lint": "turbo run lint",
9
- "format": "prettier --write \"./*.json\" \"**/*.{ts,tsx,md,json,jsonc,json5}\"",
10
- "check-types": "turbo run check-types",
11
- "update": "syncpack -- update",
12
- "update:list": "syncpack -- list",
13
- "test": "turbo run test",
14
- "test:projects": "vitest run",
15
- "test:projects:watch": "vitest --watch",
16
- "view-report": "turbo run view-report",
17
- "test:ui": "vitest --ui",
18
- "test:e2e": "turbo run test:e2e"
19
- },
20
- "devDependencies": {
21
- "prettier": "^3.5.0",
22
- "syncpack": "13.0.4",
23
- "turbo": "^2.5.5",
24
- "typescript": "5.8.3",
25
- "vitest": "^3.2.4",
26
- "@vitest/ui": "3.2.4",
27
- "eslint": "^9.31.0",
28
- "typescript-eslint": "^8.35.0",
29
- "typescript-eslint-language-service": "^5.0.5",
30
- "@typescript-eslint/parser": "^8.37.0"
31
- },
32
- "engines": {
33
- "node": ">=20"
34
- },
35
- "workspaces": [
36
- "apps/*",
37
- "packages/*"
38
- ]
39
- }
@@ -1,34 +0,0 @@
1
- {
2
- "$schema": "https://turborepo.com/schema.json",
3
- "ui": "tui",
4
- "tasks": {
5
- "build": {
6
- "dependsOn": ["^build"],
7
- "inputs": ["$TURBO_DEFAULT$", ".env*"],
8
- "outputs": [".next/**", "!.next/cache/**", "dist/**"]
9
- },
10
- "lint": {
11
- "dependsOn": ["^lint"]
12
- },
13
- "check-types": {
14
- "dependsOn": ["^check-types"]
15
- },
16
- "dev": {
17
- "cache": false,
18
- "persistent": true
19
- },
20
- "test:e2e": {
21
- "cache": false,
22
- "persistent": true
23
- },
24
- "test": {
25
- "inputs": ["$TURBO_DEFAULT$", "$TURBO_ROOT$/vitest.config.ts"],
26
- "dependsOn": ["transit", "@lucy/vitest-config#build", "//#test:ui"],
27
- "outputs": ["coverage.json"]
28
- },
29
- "transit": {
30
- "dependsOn": ["^transit"]
31
- },
32
- "//#test:ui": {}
33
- }
34
- }