lucy-cli 2.0.0-alpha.9 → 2.0.0-beta.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/.yarnrc.yml +0 -1
- package/README.md +117 -102
- package/dist/args.d.ts +1 -6
- package/dist/args.js +103 -7
- package/dist/args.js.map +1 -0
- package/dist/commands/checks.d.ts +7 -0
- package/dist/commands/checks.js +47 -0
- package/dist/commands/checks.js.map +1 -0
- package/dist/commands/cleanup.d.ts +4 -0
- package/dist/commands/cleanup.js +10 -0
- package/dist/commands/cleanup.js.map +1 -0
- package/dist/commands/copy.d.ts +6 -0
- package/dist/commands/copy.js +20 -0
- package/dist/commands/copy.js.map +1 -0
- package/dist/commands/edit.d.ts +10 -0
- package/dist/commands/edit.js +67 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/exec.d.ts +7 -0
- package/dist/commands/exec.js +67 -0
- package/dist/commands/exec.js.map +1 -0
- package/dist/commands/git.d.ts +8 -0
- package/dist/commands/git.js +104 -0
- package/dist/commands/git.js.map +1 -0
- package/dist/commands/home.d.ts +4 -0
- package/dist/commands/home.js +18 -0
- package/dist/commands/home.js.map +1 -0
- package/dist/commands/install.d.ts +8 -0
- package/dist/commands/install.js +165 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/read.d.ts +6 -0
- package/dist/commands/read.js +40 -0
- package/dist/commands/read.js.map +1 -0
- package/dist/commands/write.d.ts +7 -0
- package/dist/commands/write.js +28 -0
- package/dist/commands/write.js.map +1 -0
- package/dist/commands.js +1 -0
- package/dist/commands.js.map +1 -0
- package/dist/config.d.ts +29 -7
- package/dist/config.js +90 -26
- package/dist/config.js.map +1 -0
- package/dist/error.d.ts +1 -9
- package/dist/error.js +1 -2
- package/dist/error.js.map +1 -0
- package/dist/helpers.d.ts +9 -0
- package/dist/helpers.js +83 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +77 -9
- package/dist/index.js.map +1 -0
- package/dist/init/blocks.d.ts +5 -0
- package/dist/init/blocks.js +62 -0
- package/dist/init/blocks.js.map +1 -0
- package/dist/init/cargo.d.ts +2 -0
- package/dist/init/cargo.js +21 -0
- package/dist/init/cargo.js.map +1 -0
- package/dist/init/expo.d.ts +5 -0
- package/dist/init/expo.js +52 -0
- package/dist/init/expo.js.map +1 -0
- package/dist/init/gitModules.d.ts +2 -0
- package/dist/init/gitModules.js +13 -0
- package/dist/init/gitModules.js.map +1 -0
- package/dist/init/index.d.ts +4 -0
- package/dist/init/index.js +77 -0
- package/dist/init/index.js.map +1 -0
- package/dist/init/monorepo.d.ts +4 -0
- package/dist/init/monorepo.js +48 -0
- package/dist/init/monorepo.js.map +1 -0
- package/dist/init/prepareVelo.d.ts +2 -0
- package/dist/init/prepareVelo.js +16 -0
- package/dist/init/prepareVelo.js.map +1 -0
- package/dist/init/tauri.d.ts +5 -0
- package/dist/init/tauri.js +32 -0
- package/dist/init/tauri.js.map +1 -0
- package/dist/init/templates.d.ts +5 -0
- package/dist/init/templates.js +93 -0
- package/dist/init/templates.js.map +1 -0
- package/dist/init/velo.d.ts +5 -0
- package/dist/init/velo.js +60 -0
- package/dist/init/velo.js.map +1 -0
- package/dist/policy.js +1 -0
- package/dist/policy.js.map +1 -0
- package/dist/prepare.js +1 -0
- package/dist/prepare.js.map +1 -0
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +1 -0
- package/dist/runtime.js.map +1 -0
- package/dist/schemas/gulp.d.ts +25 -0
- package/dist/schemas/gulp.js +8 -0
- package/dist/schemas/gulp.js.map +1 -0
- package/dist/schemas/index.d.ts +10 -0
- package/dist/schemas/index.js +9 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/lucy.d.ts +29 -0
- package/dist/schemas/lucy.js +42 -0
- package/dist/schemas/lucy.js.map +1 -0
- package/dist/schemas/tsconfig.js +2 -0
- package/dist/schemas/tsconfig.js.map +1 -0
- package/dist/schemas/types.d.ts +33 -0
- package/dist/schemas/types.js +5 -1
- package/dist/schemas/types.js.map +1 -0
- package/dist/states.js +1 -0
- package/dist/states.js.map +1 -0
- package/dist/tasks/Gulpfile.d.ts +4 -0
- package/dist/tasks/Gulpfile.js +111 -0
- package/dist/tasks/Gulpfile.js.map +1 -0
- package/dist/tasks/gulp/backend.d.ts +4 -0
- package/dist/tasks/gulp/backend.js +92 -0
- package/dist/tasks/gulp/backend.js.map +1 -0
- package/dist/tasks/gulp/checks.d.ts +4 -0
- package/dist/tasks/gulp/checks.js +202 -0
- package/dist/tasks/gulp/checks.js.map +1 -0
- package/dist/tasks/gulp/clean.d.ts +3 -0
- package/dist/tasks/gulp/clean.js +33 -0
- package/dist/tasks/gulp/clean.js.map +1 -0
- package/dist/tasks/gulp/copy.d.ts +3 -0
- package/dist/tasks/gulp/copy.js +34 -0
- package/dist/tasks/gulp/copy.js.map +1 -0
- package/dist/tasks/gulp/helpers.d.ts +3 -0
- package/dist/tasks/gulp/helpers.js +19 -0
- package/dist/tasks/gulp/helpers.js.map +1 -0
- package/dist/tasks/gulp/pages.d.ts +2 -0
- package/dist/tasks/gulp/pages.js +39 -0
- package/dist/tasks/gulp/pages.js.map +1 -0
- package/dist/tasks/gulp/pipeline.d.ts +1 -0
- package/dist/tasks/gulp/pipeline.js +29 -0
- package/dist/tasks/gulp/pipeline.js.map +1 -0
- package/dist/tasks/gulp/public.d.ts +3 -0
- package/dist/tasks/gulp/public.js +50 -0
- package/dist/tasks/gulp/public.js.map +1 -0
- package/dist/tasks/gulp/styles.d.ts +3 -0
- package/dist/tasks/gulp/styles.js +40 -0
- package/dist/tasks/gulp/styles.js.map +1 -0
- package/dist/tasks/gulp/templates.d.ts +2 -0
- package/dist/tasks/gulp/templates.js +45 -0
- package/dist/tasks/gulp/templates.js.map +1 -0
- package/dist/tasks/gulp/types.d.ts +4 -0
- package/dist/tasks/gulp/types.js +293 -0
- package/dist/tasks/gulp/types.js.map +1 -0
- package/dist/tasks/gulp/watchers.d.ts +3 -0
- package/dist/tasks/gulp/watchers.js +59 -0
- package/dist/tasks/gulp/watchers.js.map +1 -0
- package/dist/tasks/index.d.ts +4 -0
- package/dist/tasks/index.js +23 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/tasks/syncSettings.d.ts +3 -0
- package/dist/tasks/syncSettings.js +18 -0
- package/dist/tasks/syncSettings.js.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +17 -0
- package/dist/utils/logger.js +37 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/wix-sdk/check.d.ts +4 -0
- package/dist/wix-sdk/check.js +23 -0
- package/dist/wix-sdk/check.js.map +1 -0
- package/dist/wix-sdk/client.d.ts +10 -0
- package/dist/wix-sdk/client.js +18 -0
- package/dist/wix-sdk/client.js.map +1 -0
- package/dist/wix-sdk/index.d.ts +4 -0
- package/dist/wix-sdk/index.js +15 -0
- package/dist/wix-sdk/index.js.map +1 -0
- package/dist/wix-sdk/init.d.ts +4 -0
- package/dist/wix-sdk/init.js +51 -0
- package/dist/wix-sdk/init.js.map +1 -0
- package/dist/wix-sdk/run.d.ts +4 -0
- package/dist/wix-sdk/run.js +53 -0
- package/dist/wix-sdk/run.js.map +1 -0
- package/dist/wix-sync/client.d.ts +3 -0
- package/dist/wix-sync/client.js +5 -0
- package/dist/wix-sync/client.js.map +1 -0
- package/dist/wix-sync/export.d.ts +4 -0
- package/dist/wix-sync/export.js +15 -0
- package/dist/wix-sync/export.js.map +1 -0
- package/dist/wix-sync/import.d.ts +4 -0
- package/dist/wix-sync/import.js +26 -0
- package/dist/wix-sync/import.js.map +1 -0
- package/dist/wix-sync/index.d.ts +4 -0
- package/dist/wix-sync/index.js +35 -0
- package/dist/wix-sync/index.js.map +1 -0
- package/dist/wix-sync/init.d.ts +4 -0
- package/dist/wix-sync/init.js +74 -0
- package/dist/wix-sync/init.js.map +1 -0
- package/dist/wix-sync/is-alive.d.ts +4 -0
- package/dist/wix-sync/is-alive.js +23 -0
- package/dist/wix-sync/is-alive.js.map +1 -0
- package/dist/wix-sync/migrate.d.ts +4 -0
- package/dist/wix-sync/migrate.js +21 -0
- package/dist/wix-sync/migrate.js.map +1 -0
- package/dist/wix-sync/sync.d.ts +4 -0
- package/dist/wix-sync/sync.js +26 -0
- package/dist/wix-sync/sync.js.map +1 -0
- package/files/sync-data/data/test.csv +17 -0
- package/files/sync-data/files/lucy.jpg +0 -0
- package/files/sync-data/schema/test.json +11 -0
- package/files/templates/block[D]/files/.stylelintrc.js +8 -0
- package/files/templates/block[D]/lucy.json +9 -0
- package/files/templates/cargo[D]/files/.env +1 -0
- package/files/templates/cargo[D]/files/Cargo.toml +238 -0
- package/files/templates/cargo[D]/files/Makefile.toml +4 -0
- package/files/templates/cargo[D]/files/build/main.rs +35 -0
- package/files/templates/cargo[D]/files/config/beta.json +19 -0
- package/files/templates/cargo[D]/files/config/ci.json +15 -0
- package/files/templates/cargo[D]/files/config/default.json +71 -0
- package/files/templates/cargo[D]/files/config/development.json +10 -0
- package/files/templates/cargo[D]/files/config/produktion.json +5 -0
- package/files/templates/cargo[D]/files/config/stage.json +4 -0
- package/files/templates/cargo[D]/files/locales/todo.yml +3 -0
- package/files/templates/cargo[D]/files/public/index.html +1 -0
- package/files/templates/cargo[D]/lucy.json +15 -0
- package/files/templates/expo[D]/files/.stylelintrc.js +8 -0
- package/files/{expo → templates/expo[D]/files}/eas.json +9 -3
- package/files/templates/expo[D]/files/lib/data.ts +197 -0
- package/files/{expo → templates/expo[D]/files}/metro.config.js +6 -0
- package/files/templates/expo[D]/files/pnpm-workspace.yaml +3 -0
- package/files/templates/expo[D]/lucy.json +86 -0
- package/files/templates/monorepo[D]/files/.editorconfig +10 -0
- package/files/templates/monorepo[D]/files/.nvmrc +1 -0
- package/files/templates/monorepo[D]/files/.prettierignore +23 -0
- package/files/templates/monorepo[D]/files/.prettierrc.json +15 -0
- package/files/templates/monorepo[D]/files/.stylelintrc.js +8 -0
- package/files/templates/monorepo[D]/files/.yarnrc +1 -0
- package/files/templates/monorepo[D]/files/.yarnrc.yml +3 -0
- package/files/templates/monorepo[D]/files/README.md +109 -0
- package/files/templates/monorepo[D]/files/currents.config.ts +5 -0
- package/files/templates/monorepo[D]/files/nx.json +25 -0
- package/files/templates/monorepo[D]/files/pnpm-workspace.yaml +11 -0
- package/files/templates/monorepo[D]/files/tsconfig.json +6 -0
- package/files/templates/monorepo[D]/files/typedoc.json +25 -0
- package/files/templates/monorepo[D]/files/vitest.config.ts +27 -0
- package/files/templates/monorepo[D]/lucy.json +69 -0
- package/files/templates/tauri[D]/lucy.json +9 -0
- package/files/templates/velo[D]/files/.prettierignore +23 -0
- package/files/templates/velo[D]/files/.prettierrc.js +16 -0
- package/files/templates/velo[D]/lucy.json +137 -0
- package/lucy.jpg +0 -0
- package/old/Gulpfile.d.ts +34 -0
- package/old/Gulpfile.js +116 -0
- package/old/Gulpfile.js.map +1 -0
- package/old/gulp/backend.d.ts +3 -0
- package/old/gulp/backend.js +92 -0
- package/old/gulp/backend.js.map +1 -0
- package/old/gulp/checks.d.ts +3 -0
- package/old/gulp/checks.js +205 -0
- package/old/gulp/checks.js.map +1 -0
- package/old/gulp/clean.d.ts +3 -0
- package/old/gulp/clean.js +29 -0
- package/old/gulp/clean.js.map +1 -0
- package/old/gulp/copy.d.ts +2 -0
- package/old/gulp/copy.js +34 -0
- package/old/gulp/copy.js.map +1 -0
- package/old/gulp/helpers.d.ts +2 -0
- package/old/gulp/helpers.js +25 -0
- package/old/gulp/helpers.js.map +1 -0
- package/old/gulp/pages.d.ts +2 -0
- package/old/gulp/pages.js +37 -0
- package/old/gulp/pages.js.map +1 -0
- package/old/gulp/pipeline.d.ts +1 -0
- package/old/gulp/pipeline.js +29 -0
- package/old/gulp/pipeline.js.map +1 -0
- package/old/gulp/public.d.ts +2 -0
- package/old/gulp/public.js +50 -0
- package/old/gulp/public.js.map +1 -0
- package/old/gulp/styles.d.ts +2 -0
- package/old/gulp/styles.js +40 -0
- package/old/gulp/styles.js.map +1 -0
- package/old/gulp/templates.d.ts +2 -0
- package/old/gulp/templates.js +33 -0
- package/old/gulp/templates.js.map +1 -0
- package/old/gulp/types.d.ts +4 -0
- package/old/gulp/types.js +289 -0
- package/old/gulp/types.js.map +1 -0
- package/old/gulp/watchers.d.ts +9 -0
- package/old/gulp/watchers.js +59 -0
- package/old/gulp/watchers.js.map +1 -0
- package/old/helpers.d.ts +32 -0
- package/old/helpers.js +267 -0
- package/old/helpers.js.map +1 -0
- package/{src copy/helpers.ts → old/helpers.ts} +1 -1
- package/old/index.d.ts +59 -0
- package/old/index.js +288 -0
- package/old/index.js.map +1 -0
- package/old/init.d.ts +8 -0
- package/old/init.js +165 -0
- package/old/init.js.map +1 -0
- package/old/models.d.ts +37 -0
- package/old/models.js +2 -0
- package/old/models.js.map +1 -0
- package/old/prepare.d.ts +8 -0
- package/old/prepare.js +20 -0
- package/old/prepare.js.map +1 -0
- package/old/schemas/index.js +2 -0
- package/old/schemas/index.js.map +1 -0
- package/old/schemas/index.ts +0 -0
- package/old/schemas/types.d.ts +0 -0
- package/old/schemas/types.js +2 -0
- package/old/schemas/types.js.map +1 -0
- package/old/schemas/types.ts +0 -0
- package/old/sync.d.ts +2 -0
- package/old/sync.js +88 -0
- package/old/sync.js.map +1 -0
- package/package.json +18 -19
- package/patches/velo-sync+0.0.9.patch +13 -0
- package/src/args.ts +103 -17
- package/src/commands/checks.ts +51 -0
- package/src/commands/cleanup.ts +11 -0
- package/src/commands/copy.ts +28 -0
- package/src/commands/edit.ts +81 -0
- package/src/commands/exec.ts +69 -0
- package/src/commands/git.ts +113 -0
- package/src/commands/home.ts +22 -0
- package/src/commands/install.ts +249 -0
- package/src/commands/read.ts +45 -0
- package/src/commands/write.ts +45 -0
- package/src/config.ts +116 -35
- package/src/error.ts +1 -2
- package/src/helpers.ts +92 -0
- package/src/index.ts +88 -13
- package/src/init/blocks.ts +85 -0
- package/src/init/cargo.ts +25 -0
- package/src/init/expo.ts +69 -0
- package/src/init/gitModules.ts +15 -0
- package/src/init/index.ts +81 -0
- package/src/init/monorepo.ts +72 -0
- package/src/init/prepareVelo.ts +19 -0
- package/src/init/tauri.ts +42 -0
- package/src/init/templates.ts +98 -0
- package/src/init/velo.ts +65 -0
- package/src/runtime.ts +1 -0
- package/src/schemas/gulp.ts +31 -0
- package/src/schemas/index.ts +13 -1
- package/src/schemas/lucy.ts +43 -0
- package/src/schemas/types.ts +40 -0
- package/src/tasks/Gulpfile.ts +207 -0
- package/src/tasks/gulp/backend.ts +113 -0
- package/src/tasks/gulp/checks.ts +218 -0
- package/src/tasks/gulp/clean.ts +38 -0
- package/src/tasks/gulp/copy.ts +38 -0
- package/src/tasks/gulp/helpers.ts +18 -0
- package/src/tasks/gulp/pages.ts +43 -0
- package/src/tasks/gulp/pipeline.ts +31 -0
- package/src/tasks/gulp/public.ts +61 -0
- package/src/tasks/gulp/styles.ts +47 -0
- package/src/tasks/gulp/templates.ts +53 -0
- package/src/tasks/gulp/types.ts +310 -0
- package/src/tasks/gulp/watchers.ts +97 -0
- package/src/tasks/index.ts +24 -0
- package/src/tasks/syncSettings.ts +21 -0
- package/src/types.d.ts +1 -1
- package/src/utils/index.ts +0 -0
- package/src/utils/logger.ts +40 -0
- package/src/wix-sdk/check.ts +24 -0
- package/src/wix-sdk/client.ts +18 -0
- package/src/wix-sdk/index.ts +17 -0
- package/src/wix-sdk/init.ts +54 -0
- package/src/wix-sdk/run.ts +56 -0
- package/src/wix-sync/client.ts +6 -0
- package/src/wix-sync/export.ts +19 -0
- package/src/wix-sync/import.ts +27 -0
- package/src/wix-sync/index.ts +36 -0
- package/src/wix-sync/init.ts +77 -0
- package/src/wix-sync/is-alive.ts +25 -0
- package/src/wix-sync/migrate.ts +23 -0
- package/src/wix-sync/sync.ts +27 -0
- package/tsconfig.json +6 -5
- package/dist/init.d.ts +0 -4
- package/dist/init.js +0 -275
- package/dist/models.js +0 -1
- package/dist/params.d.ts +0 -7
- package/dist/params.js +0 -23
- package/files/expo/lib/data.ts +0 -48
- package/files/expo/lucy.json +0 -8
- package/src/init.ts +0 -392
- /package/dist/{models.d.ts → schemas/tsconfig.d.ts} +0 -0
- /package/{files/expo/components/.gitkeep → dist/utils/index.d.ts} +0 -0
- /package/files/{expo → templates/expo[D]/files}/.nvmrc +0 -0
- /package/files/{expo → templates/expo[D]/files}/.prettierignore +0 -0
- /package/files/{expo → templates/expo[D]/files}/.prettierrc.js +0 -0
- /package/files/{expo → templates/expo[D]/files}/.yarnrc +0 -0
- /package/files/{expo → templates/expo[D]/files}/.yarnrc.yml +0 -0
- /package/files/{expo → templates/expo[D]/files}/README.md +0 -0
- /package/files/{expo → templates/expo[D]/files}/assets/fonts/SpaceMono-Regular.ttf +0 -0
- /package/files/{expo → templates/expo[D]/files}/assets/images/adaptive-icon.png +0 -0
- /package/files/{expo → templates/expo[D]/files}/assets/images/favicon.png +0 -0
- /package/files/{expo → templates/expo[D]/files}/assets/images/icon.png +0 -0
- /package/files/{expo → templates/expo[D]/files}/assets/images/splash-icon.png +0 -0
- /package/files/{expo → templates/expo[D]/files}/babel.config.js +0 -0
- /package/files/{expo/components/ui → templates/expo[D]/files/components}/.gitkeep +0 -0
- /package/files/{velo/typescript/__mocks__ → templates/expo[D]/files/components/ui}/.gitkeep +0 -0
- /package/files/{expo → templates/expo[D]/files}/constants/theme.ts +0 -0
- /package/files/{expo → templates/expo[D]/files}/eslint.config.mjs +0 -0
- /package/files/{expo → templates/expo[D]/files}/global.css +0 -0
- /package/files/{expo → templates/expo[D]/files}/hooks/useColorScheme.ts +0 -0
- /package/files/{expo → templates/expo[D]/files}/index.ts +0 -0
- /package/files/{expo → templates/expo[D]/files}/lib/utils/index.ts +0 -0
- /package/files/{expo → templates/expo[D]/files}/lib/utils/polyfills.ts +0 -0
- /package/files/{expo → templates/expo[D]/files}/lib/wix/client.ts +0 -0
- /package/files/{expo → templates/expo[D]/files}/lib/wix/error.ts +0 -0
- /package/files/{expo → templates/expo[D]/files}/lib/wix/index.ts +0 -0
- /package/files/{expo → templates/expo[D]/files}/nativewind-env.d.ts +0 -0
- /package/files/{expo → templates/expo[D]/files}/scripts/reset-project.ts +0 -0
- /package/files/{expo → templates/expo[D]/files}/tailwind.config.js +0 -0
- /package/files/{expo → templates/expo[D]/files}/tsconfig.json +0 -0
- /package/files/{expo → templates/expo[D]/files}/types/reset.d.ts +0 -0
- /package/files/{velo → templates/velo[D]/files}/.gitmodules +0 -0
- /package/files/{velo → templates/velo[D]/files}/.madgerc +0 -0
- /package/files/{velo → templates/velo[D]/files}/.nvmrc +0 -0
- /package/files/{velo → templates/velo[D]/files}/.stylelintrc.js +0 -0
- /package/files/{velo → templates/velo[D]/files}/.yarnrc.yml +0 -0
- /package/files/{velo → templates/velo[D]/files}/currents.config.js +0 -0
- /package/files/{velo → templates/velo[D]/files}/cypress/e2e/base/base.cy.ts +0 -0
- /package/files/{velo → templates/velo[D]/files}/cypress/fixtures/example.json +0 -0
- /package/files/{velo → templates/velo[D]/files}/cypress/support/commands.ts +0 -0
- /package/files/{velo → templates/velo[D]/files}/cypress/support/e2e.ts +0 -0
- /package/files/{velo → templates/velo[D]/files}/cypress/tsconfig.json +0 -0
- /package/files/{velo → templates/velo[D]/files}/cypress.config.mjs +0 -0
- /package/files/{velo → templates/velo[D]/files}/eslint.config.mjs +0 -0
- /package/files/{velo → templates/velo[D]/files}/local.tsconfig.json +0 -0
- /package/files/{velo → templates/velo[D]/files}/typedoc.json +0 -0
- /package/files/{velo/typescript/pages → templates/velo[D]/files/typescript/__mocks__}/.gitkeep +0 -0
- /package/files/{velo → templates/velo[D]/files}/typescript/backend/data.ts +0 -0
- /package/files/{velo → templates/velo[D]/files}/typescript/backend/events.ts +0 -0
- /package/files/{velo → templates/velo[D]/files}/typescript/backend/http-functions.ts +0 -0
- /package/files/{velo → templates/velo[D]/files}/typescript/backend/lib/http-functions/sync.ts +0 -0
- /package/files/{velo → templates/velo[D]/files}/typescript/backend/permissions.json +0 -0
- /package/files/{velo/typescript/public → templates/velo[D]/files/typescript/pages}/.gitkeep +0 -0
- /package/files/{velo/typescript/styles → templates/velo[D]/files/typescript/public}/.gitkeep +0 -0
- /package/files/{velo → templates/velo[D]/files}/typescript/public/scss/app.scss +0 -0
- /package/files/{velo/typescript/styles/global.scss → templates/velo[D]/files/typescript/styles/.gitkeep} +0 -0
- /package/{src copy/schemas/index.ts → files/templates/velo[D]/files/typescript/styles/global.scss} +0 -0
- /package/files/{velo → templates/velo[D]/files}/typescript/tsconfig.json +0 -0
- /package/files/{velo → templates/velo[D]/files}/vitest.config.ts +0 -0
- /package/{src copy → old}/Gulpfile.ts +0 -0
- /package/{src copy → old}/gulp/backend.ts +0 -0
- /package/{src copy → old}/gulp/checks.ts +0 -0
- /package/{src copy → old}/gulp/clean.ts +0 -0
- /package/{src copy → old}/gulp/copy.ts +0 -0
- /package/{src copy → old}/gulp/helpers.ts +0 -0
- /package/{src copy → old}/gulp/pages.ts +0 -0
- /package/{src copy → old}/gulp/pipeline.ts +0 -0
- /package/{src copy → old}/gulp/public.ts +0 -0
- /package/{src copy → old}/gulp/styles.ts +0 -0
- /package/{src copy → old}/gulp/templates.ts +0 -0
- /package/{src copy → old}/gulp/types.ts +0 -0
- /package/{src copy → old}/gulp/watchers.ts +0 -0
- /package/{src copy → old}/index.ts +0 -0
- /package/{src copy → old}/init.ts +0 -0
- /package/{src copy → old}/models.ts +0 -0
- /package/{src copy → old}/prepare.ts +0 -0
- /package/{src copy/schemas/types.ts → old/schemas/index.d.ts} +0 -0
- /package/{src copy → old}/settings.json +0 -0
- /package/{src copy → old}/sync.ts +0 -0
- /package/{src copy → old}/types.d.ts +0 -0
- /package/src/{models.ts → schemas/tsconfig.ts} +0 -0
@@ -0,0 +1,249 @@
|
|
1
|
+
import { Command } from "@effect/platform/index";
|
2
|
+
import { Effect, Schedule } from "effect/index";
|
3
|
+
import { Config } from "../config.js";
|
4
|
+
import { logger } from "../utils/logger.js";
|
5
|
+
import { CommandExecutor, ExitCode } from "@effect/platform/CommandExecutor";
|
6
|
+
import { PlatformError } from "@effect/platform/Error";
|
7
|
+
|
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
|
+
}
|
28
|
+
|
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"];
|
38
|
+
}
|
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"];
|
47
|
+
}
|
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");
|
56
|
+
|
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.stderr("inherit"), // Stream stderr to process.stderr
|
65
|
+
Command.exitCode // Get the exit code
|
66
|
+
)
|
67
|
+
|
68
|
+
logger.info("Installing dev dependencies");
|
69
|
+
const installDev = Command.make(
|
70
|
+
manager,
|
71
|
+
...pkgMgrParamsInstallDev(),
|
72
|
+
...workspaceEnabled(),
|
73
|
+
...devPkgs,
|
74
|
+
).pipe(
|
75
|
+
Command.stdout("inherit"), // Stream stdout to process.stdout
|
76
|
+
Command.stderr("inherit"), // Stream stderr to process.stderr
|
77
|
+
Command.exitCode // Get the exit code
|
78
|
+
)
|
79
|
+
|
80
|
+
if(Object.keys(config.config.lucySettings.dependencies).length > 0) {
|
81
|
+
if ((yield* install) !== 0) {
|
82
|
+
return logger.error("Failed to install dependencies. Please check the error message above.");
|
83
|
+
}
|
84
|
+
}
|
85
|
+
if(Object.keys(config.config.lucySettings.devDependencies).length > 0) {
|
86
|
+
if ((yield* installDev) !== 0) {
|
87
|
+
return logger.error("Failed to install dev dependencies. Please check the error message above.");
|
88
|
+
}
|
89
|
+
}
|
90
|
+
})
|
91
|
+
}
|
92
|
+
|
93
|
+
export const runInstall = Effect.gen(function*() {
|
94
|
+
const config = yield* Config;
|
95
|
+
|
96
|
+
const manager = config.config.lucySettings.packageManager;
|
97
|
+
const install = Command.make(
|
98
|
+
manager,
|
99
|
+
"install",
|
100
|
+
).pipe(
|
101
|
+
Command.stdout("inherit"), // Stream stdout to process.stdout
|
102
|
+
Command.stderr("inherit"), // Stream stderr to process.stderr
|
103
|
+
Command.exitCode // Get the exit code
|
104
|
+
)
|
105
|
+
yield* install;
|
106
|
+
})
|
107
|
+
|
108
|
+
// export const yarnSetVersion = Effect.gen(function*() {
|
109
|
+
// const yarnDev = Command.make(
|
110
|
+
// "yarn",
|
111
|
+
// "set",
|
112
|
+
// "version",
|
113
|
+
// "berry",
|
114
|
+
// ).pipe(
|
115
|
+
// Command.stdout("inherit"), // Stream stdout to process.stdout
|
116
|
+
// Command.exitCode // Get the exit code
|
117
|
+
// )
|
118
|
+
// yield* yarnDev;
|
119
|
+
// })
|
120
|
+
export const installVeloPackages = Effect.gen(function*() {
|
121
|
+
const config = yield* Config;
|
122
|
+
const simpleSchedule = Schedule.tapOutput(
|
123
|
+
Schedule.fromDelays(50, 100, 200, 400, 800, 1600, 3200),
|
124
|
+
(n, ) => Effect.succeed(logger.warning(`Failed to install WIX package. Retrying...`))
|
125
|
+
);
|
126
|
+
|
127
|
+
const pkgs: string[] = []
|
128
|
+
for (const [key, value] of Object.entries(config.config.lucySettings.dependencies)) {
|
129
|
+
if (value.length > 0) {
|
130
|
+
pkgs.push(`${key}@${value}`);
|
131
|
+
continue
|
132
|
+
}
|
133
|
+
pkgs.push(key);
|
134
|
+
}
|
135
|
+
|
136
|
+
const wixPkgs: Effect.Effect<ExitCode, PlatformError, CommandExecutor>[] = []
|
137
|
+
const wixInstall = (cmd: Effect.Effect<ExitCode, PlatformError, CommandExecutor>) => Effect.gen(function*() {
|
138
|
+
const code = yield* Effect.retryOrElse(
|
139
|
+
Effect.gen(function*() {
|
140
|
+
const code = yield* cmd;
|
141
|
+
if (code !== 0) {
|
142
|
+
return yield* Effect.fail(code);
|
143
|
+
}
|
144
|
+
return yield* Effect.succeed(code);
|
145
|
+
}),
|
146
|
+
simpleSchedule,
|
147
|
+
() => Effect.succeed(0 as ExitCode)
|
148
|
+
)
|
149
|
+
if (code !== 0) {
|
150
|
+
logger.error("Failed to install WIX package.");
|
151
|
+
}
|
152
|
+
return code;
|
153
|
+
})
|
154
|
+
|
155
|
+
for (const [key, value] of Object.entries(config.config.lucySettings.dependencies)) {
|
156
|
+
if (value.length > 0) {
|
157
|
+
wixPkgs.push(
|
158
|
+
wixInstall(
|
159
|
+
Command.make(
|
160
|
+
"wix",
|
161
|
+
"install",
|
162
|
+
`${key}@${value}`
|
163
|
+
).pipe(
|
164
|
+
Command.stdout("inherit"),
|
165
|
+
Command.stderr("inherit"),
|
166
|
+
Command.exitCode
|
167
|
+
)
|
168
|
+
)
|
169
|
+
)
|
170
|
+
continue
|
171
|
+
}
|
172
|
+
wixPkgs.push(
|
173
|
+
wixInstall(
|
174
|
+
Command.make(
|
175
|
+
"wix",
|
176
|
+
"install",
|
177
|
+
`${key}`
|
178
|
+
).pipe(
|
179
|
+
Command.stdout("inherit"),
|
180
|
+
Command.stderr("inherit"),
|
181
|
+
Command.exitCode
|
182
|
+
),
|
183
|
+
))
|
184
|
+
}
|
185
|
+
|
186
|
+
const devPkgs: string[] = []
|
187
|
+
for (const [key, value] of Object.entries(config.config.lucySettings.devDependencies)) {
|
188
|
+
if (value.length > 0) {
|
189
|
+
devPkgs.push(`${key}@${value}`);
|
190
|
+
continue
|
191
|
+
}
|
192
|
+
devPkgs.push(key);
|
193
|
+
}
|
194
|
+
|
195
|
+
const yarn = Command.make(
|
196
|
+
"yarn",
|
197
|
+
"add",
|
198
|
+
...pkgs,
|
199
|
+
).pipe(
|
200
|
+
Command.stdout("inherit"), // Stream stdout to process.stdout
|
201
|
+
Command.exitCode // Get the exit code
|
202
|
+
)
|
203
|
+
const yarnDev = Command.make(
|
204
|
+
"yarn",
|
205
|
+
"add",
|
206
|
+
"-D",
|
207
|
+
...devPkgs,
|
208
|
+
).pipe(
|
209
|
+
Command.stdout("inherit"), // Stream stdout to process.stdout
|
210
|
+
Command.exitCode // Get the exit code
|
211
|
+
)
|
212
|
+
|
213
|
+
logger.info("Installing dependencies with wix...");
|
214
|
+
const status = yield* Effect.all([...wixPkgs], { concurrency: 15});
|
215
|
+
if(status.every((s) => s !== 0)) {
|
216
|
+
return logger.error("Failed to install WIX dependencies. Please check the error message above.");
|
217
|
+
}
|
218
|
+
|
219
|
+
logger.info("Installing dependencies");
|
220
|
+
if ((yield* yarn) !== 0) {
|
221
|
+
return logger.error("Failed to install dependencies. Please check the error message above.");
|
222
|
+
}
|
223
|
+
|
224
|
+
logger.info("Installing dev dependencies");
|
225
|
+
if ((yield* yarnDev) !== 0) {
|
226
|
+
return logger.error("Failed to install dev dependencies. Please check the error message above.");
|
227
|
+
}
|
228
|
+
|
229
|
+
})
|
230
|
+
|
231
|
+
export const approveBuilds = Effect.gen(function*() {
|
232
|
+
const config = yield* Config;
|
233
|
+
|
234
|
+
const manager = config.config.lucySettings.packageManager;
|
235
|
+
const approve = Command.make(
|
236
|
+
"pnpm",
|
237
|
+
"approve-builds",
|
238
|
+
).pipe(
|
239
|
+
Command.stdout("inherit"), // Stream stdout to process.stdout
|
240
|
+
Command.stderr("inherit"), // Stream stderr to process.stderr
|
241
|
+
Command.stdin("inherit"),
|
242
|
+
Command.exitCode // Get the exit code
|
243
|
+
)
|
244
|
+
if (manager !== "pnpm") {
|
245
|
+
logger.warning("The 'approve-build' command is only available for pnpm. Skipping...");
|
246
|
+
return;
|
247
|
+
}
|
248
|
+
yield* approve;
|
249
|
+
})
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { Effect, Schema } from "effect/index";
|
2
|
+
import { FileSystem, Path } from "@effect/platform"
|
3
|
+
import { Config, lucyJsonName, packageJsonPath, veloSyncJsonPath } from "../config.js";
|
4
|
+
import { JsonSchema, veloSyncSettings } from "../schemas/index.js";
|
5
|
+
import { lucySettings } from "../schemas/lucy.js";
|
6
|
+
import { logger } from "../utils/logger.js";
|
7
|
+
|
8
|
+
export const readPackageJson = Effect.gen(function* () {
|
9
|
+
const config = yield* Config;
|
10
|
+
const fs = yield* FileSystem.FileSystem;
|
11
|
+
const path = yield* Path.Path;
|
12
|
+
|
13
|
+
const packageJsonRaw = yield* fs.readFile(packageJsonPath)
|
14
|
+
config.config.packageJson = yield* Schema.decodeUnknown(JsonSchema)(packageJsonRaw.toString());
|
15
|
+
})
|
16
|
+
|
17
|
+
export const readLucyJsonFromTemplate = Effect.gen(function* () {
|
18
|
+
const config = yield* Config;
|
19
|
+
const fs = yield* FileSystem.FileSystem;
|
20
|
+
const path = yield* Path.Path;
|
21
|
+
|
22
|
+
const lucyRaw = yield* fs.readFileString(path.join(config.config.templateDir, lucyJsonName));
|
23
|
+
const lucySettingsJSON = yield* Schema.decodeUnknown(JsonSchema)(lucyRaw);
|
24
|
+
const lucySetting = yield* Schema.decodeUnknown(lucySettings)(lucySettingsJSON)
|
25
|
+
|
26
|
+
if(config.config.lucySettings.initialized) {
|
27
|
+
if(config.config.force) {
|
28
|
+
logger.warning(`${lucyJsonName} already exists in the target directory, but 'force' is set. Overwriting...`);
|
29
|
+
config.config.lucySettings = lucySetting;
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
logger.warning(`${lucyJsonName} already exists in the target directory. Skipping reading ${lucyJsonName} from template.`);
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
config.config.lucySettings = lucySetting;
|
36
|
+
})
|
37
|
+
|
38
|
+
export const readVeloSyncSettings = Effect.gen(function* () {
|
39
|
+
const config = yield* Config;
|
40
|
+
const fs = yield* FileSystem.FileSystem;
|
41
|
+
if (yield* fs.exists(veloSyncJsonPath)) {
|
42
|
+
const snyConfigRaw = yield* fs.readFileString(veloSyncJsonPath)
|
43
|
+
config.config.veloSyncSettings = yield* Schema.decodeUnknown(veloSyncSettings)(snyConfigRaw);
|
44
|
+
}
|
45
|
+
});
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { Effect } from "effect/index";
|
2
|
+
import { Command, FileSystem, Path } from "@effect/platform"
|
3
|
+
import { Config, lucyJsonPath, packageJsonPath, veloSyncJsonPath, wixSDKSettingsJsonPath } from "../config.js";
|
4
|
+
|
5
|
+
export const writeLucySettings = Effect.gen(function* (_) {
|
6
|
+
const fs = yield* FileSystem.FileSystem;
|
7
|
+
const path = yield* Path.Path;
|
8
|
+
const config = yield* Config;
|
9
|
+
|
10
|
+
yield* fs.writeFileString(
|
11
|
+
lucyJsonPath,
|
12
|
+
JSON.stringify(config.config.lucySettings, null, 2)
|
13
|
+
);
|
14
|
+
})
|
15
|
+
|
16
|
+
export const writePackageJson = Effect.gen(function* (_) {
|
17
|
+
const fs = yield* FileSystem.FileSystem;
|
18
|
+
const path = yield* Path.Path;
|
19
|
+
const config = yield* Config;
|
20
|
+
yield* fs.writeFileString(
|
21
|
+
packageJsonPath,
|
22
|
+
JSON.stringify(config.config.packageJson, null, 2)
|
23
|
+
);
|
24
|
+
})
|
25
|
+
|
26
|
+
export const writeVeloSyncSettings = Effect.gen(function* () {
|
27
|
+
const config = yield* Config;
|
28
|
+
const fs = yield* FileSystem.FileSystem;
|
29
|
+
const path = yield* Path.Path;
|
30
|
+
yield* fs.writeFileString(
|
31
|
+
veloSyncJsonPath,
|
32
|
+
JSON.stringify(config.config.veloSyncSettings, null, 2)
|
33
|
+
);
|
34
|
+
});
|
35
|
+
|
36
|
+
export const writeWixSDKSettings = Effect.gen(function* () {
|
37
|
+
const config = yield* Config;
|
38
|
+
const fs = yield* FileSystem.FileSystem;
|
39
|
+
const path = yield* Path.Path;
|
40
|
+
yield* fs.writeFileString(
|
41
|
+
wixSDKSettingsJsonPath,
|
42
|
+
JSON.stringify(config.config.wixSDKSettings, null, 2)
|
43
|
+
);
|
44
|
+
});
|
45
|
+
|
package/src/config.ts
CHANGED
@@ -1,23 +1,37 @@
|
|
1
|
-
import { Context, Layer } from "effect"
|
1
|
+
import { Context, Effect, Layer, Schema } from "effect"
|
2
2
|
import { get_args } from "./args.js";
|
3
3
|
import { dirname, join } from "path";
|
4
4
|
import { fileURLToPath } from "url";
|
5
|
-
import {
|
6
|
-
|
5
|
+
import { lucySettings, LucySettings } from "./schemas/lucy.js";
|
6
|
+
import os from 'os';
|
7
|
+
import { Actions } from "./schemas/types.js";
|
8
|
+
import { JsonSchema, veloSyncSettings, VeloSyncSettings, WixSDKSettings, wixSDKSettings } from "./schemas/index.js";
|
9
|
+
import { FileSystem, Path } from "@effect/platform"
|
10
|
+
import { NodeContext } from "@effect/platform-node/index";
|
7
11
|
|
8
|
-
type Actions = {
|
9
|
-
action: Action;
|
10
|
-
type: 'velo' | 'expo' | 'blocks' | undefined;
|
11
|
-
}
|
12
12
|
export class Config extends Context.Tag("Config")<
|
13
13
|
Config,
|
14
14
|
{
|
15
15
|
readonly config: {
|
16
16
|
readonly action: Actions;
|
17
|
+
readonly force: boolean;
|
17
18
|
readonly cwd: string;
|
18
19
|
readonly packageRoot: string;
|
19
20
|
readonly filesFolder: string;
|
20
|
-
readonly
|
21
|
+
readonly veloSyncArguments?:{
|
22
|
+
data?: string;
|
23
|
+
collection?: string;
|
24
|
+
schema?: string;
|
25
|
+
dry: boolean;
|
26
|
+
}
|
27
|
+
packageJson: any;
|
28
|
+
lucySettings: LucySettings;
|
29
|
+
readonly lucyHome: string;
|
30
|
+
templateDir: string;
|
31
|
+
templateFiles: string;
|
32
|
+
projectName: string;
|
33
|
+
veloSyncSettings?: VeloSyncSettings;
|
34
|
+
wixSDKSettings?: WixSDKSettings;
|
21
35
|
}
|
22
36
|
}
|
23
37
|
>() {}
|
@@ -26,36 +40,103 @@ export class Config extends Context.Tag("Config")<
|
|
26
40
|
// We can replicate it using `import.meta.url`.
|
27
41
|
const __filename = fileURLToPath(import.meta.url);
|
28
42
|
const __dirname = dirname(__filename);
|
29
|
-
|
30
|
-
// Assuming your compiled output is in a 'dist' folder at the project root,
|
31
|
-
// and your source `config.ts` is in `src`, the running `config.js` will be
|
32
|
-
// in something like `dist/src`. To get to the package root, we go up two levels.
|
33
43
|
const packageRoot = join(__dirname, "..");
|
34
44
|
|
45
|
+
export const packageJsonName = "package.json";
|
46
|
+
export const lucyJsonName = "lucy.json";
|
47
|
+
export const wixSyncJsonName = "wix-sync.json";
|
48
|
+
export const wixSDKSettingsJsonName = "wix-sdk-settings.json";
|
49
|
+
export const syncDataName = 'sync-data';
|
50
|
+
export const packageJsonPath = join(process.cwd(), packageJsonName);
|
51
|
+
export const lucyJsonPath = join(process.cwd(), lucyJsonName);
|
52
|
+
export const veloSyncJsonPath = join(process.cwd(), wixSyncJsonName);
|
53
|
+
export const wixSDKSettingsJsonPath = join(process.cwd(), wixSDKSettingsJsonName);
|
54
|
+
export const syncFilesSource= join(packageRoot, 'files', syncDataName);
|
55
|
+
|
56
|
+
|
35
57
|
export const ConfigLayer = (args: Awaited<ReturnType<typeof get_args>>) => {
|
36
|
-
|
37
|
-
const packageJsonPath = join(process.cwd(), 'package.json');
|
38
|
-
try {
|
39
|
-
if (existsSync(packageJsonPath)) {
|
40
|
-
const raw = readFileSync(packageJsonPath, 'utf-8');
|
41
|
-
packageJson = JSON.parse(raw);
|
42
|
-
}
|
43
|
-
} catch (error) {
|
44
|
-
console.error("Error reading package.json:", error);
|
45
|
-
}
|
46
|
-
return Layer.succeed(
|
58
|
+
return Layer.effect(
|
47
59
|
Config,
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
60
|
+
Effect.gen(function* () {
|
61
|
+
const fs = yield* FileSystem.FileSystem;
|
62
|
+
const path = yield* Path.Path;
|
63
|
+
|
64
|
+
let packageJson: any = {};
|
65
|
+
let lucyJson: LucySettings | undefined = undefined;
|
66
|
+
let veloSyncJson: VeloSyncSettings | undefined = undefined;
|
67
|
+
let wixSDKSettingsJson: WixSDKSettings | undefined = undefined;
|
68
|
+
// Read package.json
|
69
|
+
if (yield* fs.exists(packageJsonPath)) {
|
70
|
+
const raw = yield* fs.readFileString(packageJsonPath, 'utf-8');
|
71
|
+
packageJson = yield* Schema.decodeUnknown(JsonSchema)(raw);
|
72
|
+
}
|
73
|
+
|
74
|
+
// Read lucy.json
|
75
|
+
if (yield* fs.exists(lucyJsonPath)) {
|
76
|
+
const raw = yield* fs.readFileString(lucyJsonPath, 'utf-8');
|
77
|
+
const lucyJsonRaw = yield* Schema.decodeUnknown(JsonSchema)(raw);
|
78
|
+
lucyJson = yield* Schema.decodeUnknown(lucySettings)(lucyJsonRaw);
|
79
|
+
}
|
80
|
+
|
81
|
+
// Read wix-sync.json
|
82
|
+
if (yield* fs.exists(veloSyncJsonPath)) {
|
83
|
+
const raw = yield* fs.readFileString(veloSyncJsonPath, 'utf-8');
|
84
|
+
const veloSyncSettingsRaw = yield* Schema.decodeUnknown(JsonSchema)(raw);
|
85
|
+
veloSyncJson = yield* Schema.decodeUnknown(veloSyncSettings)(veloSyncSettingsRaw);
|
58
86
|
}
|
59
|
-
|
87
|
+
|
88
|
+
// Read wix-sdk-settings.json
|
89
|
+
if (yield* fs.exists(wixSDKSettingsJsonPath)) {
|
90
|
+
const raw = yield* fs.readFileString(wixSDKSettingsJsonPath, 'utf-8');
|
91
|
+
const wixSDKSettingsRaw = yield* Schema.decodeUnknown(JsonSchema)(raw);
|
92
|
+
wixSDKSettingsJson = yield* Schema.decodeUnknown(wixSDKSettings)(wixSDKSettingsRaw);
|
93
|
+
}
|
94
|
+
|
95
|
+
const defaultModulePath = () => {
|
96
|
+
if (args.type === 'monorepo') {
|
97
|
+
return 'packages';
|
98
|
+
}
|
99
|
+
return '';
|
100
|
+
};
|
101
|
+
|
102
|
+
return Config.of({
|
103
|
+
config: {
|
104
|
+
action: {
|
105
|
+
initType: args.initType,
|
106
|
+
action: args._[0],
|
107
|
+
tasksName: args.tasksName,
|
108
|
+
syncAction: args.syncAction,
|
109
|
+
wixSDKAction: args.wixSDKAction,
|
110
|
+
},
|
111
|
+
force: args.force === true ? true : false,
|
112
|
+
cwd: process.cwd(),
|
113
|
+
projectName: process.cwd().split('/').pop() || 'lucy-project',
|
114
|
+
packageRoot,
|
115
|
+
filesFolder: join(packageRoot, 'files'),
|
116
|
+
packageJson,
|
117
|
+
lucyHome: join(os.homedir(), '.lucy-cli'),
|
118
|
+
veloSyncSettings: veloSyncJson,
|
119
|
+
veloSyncArguments: {
|
120
|
+
data: path.join(process.cwd(), args.input || ''),
|
121
|
+
collection: args.collection,
|
122
|
+
schema: path.join(process.cwd(), args.schema || ''),
|
123
|
+
dry: args.d || false,
|
124
|
+
},
|
125
|
+
wixSDKSettings: wixSDKSettingsJson,
|
126
|
+
lucySettings: lucyJson || {
|
127
|
+
modules: {},
|
128
|
+
devDependencies: {},
|
129
|
+
dependencies: {},
|
130
|
+
scripts: {},
|
131
|
+
initialized: false,
|
132
|
+
type: args.initType || 'velo',
|
133
|
+
packageManager: 'npm',
|
134
|
+
defaultModulePath: ''
|
135
|
+
},
|
136
|
+
templateFiles: '',
|
137
|
+
templateDir: '',
|
138
|
+
}
|
139
|
+
});
|
140
|
+
}).pipe(Effect.provide(NodeContext.layer))
|
60
141
|
);
|
61
|
-
}
|
142
|
+
}
|
package/src/error.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
1
|
import { Data } from "effect";
|
2
2
|
|
3
|
-
export class AppError extends Data.TaggedError('AppError')<{cause:
|
4
|
-
export class ScaleError extends Data.TaggedError('ScaleError')<{cause: Error, message: string}> {}
|
3
|
+
export class AppError extends Data.TaggedError('AppError')<{cause: unknown, message: string}> {}
|
package/src/helpers.ts
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
import os from 'os';
|
2
|
+
import { spawnSync, exec } from 'child_process';
|
3
|
+
import { logger } from './utils/logger.js';
|
4
|
+
|
1
5
|
export function parse_error(error: unknown): Error {
|
2
6
|
if (error instanceof Error) {
|
3
7
|
return error;
|
@@ -6,4 +10,92 @@ export function parse_error(error: unknown): Error {
|
|
6
10
|
} else {
|
7
11
|
return new Error('Unknown error');
|
8
12
|
}
|
13
|
+
}
|
14
|
+
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Kill all processes matching a specific substring in their command, with a fallback for Windows.
|
18
|
+
* @param {string} processPattern - The substring to match (e.g., "wix:dev" or "@wix/cli/bin/wix.cjs").
|
19
|
+
*/
|
20
|
+
export function killAllProcesses(processPattern: string) {
|
21
|
+
const isWindows = os.platform() === 'win32';
|
22
|
+
const command = isWindows
|
23
|
+
? `tasklist /FI "IMAGENAME eq node.exe" /FO CSV | findstr "${processPattern}"`
|
24
|
+
: `ps -eo pid,command | grep "${processPattern}" | grep -v grep`;
|
25
|
+
|
26
|
+
logger.action(`Cleaning up processes...`);
|
27
|
+
|
28
|
+
const result = spawnSync(command, { shell: true, encoding: 'utf-8' });
|
29
|
+
|
30
|
+
if (result.error) {
|
31
|
+
logger.error(`spawnSync error: ${result.error.message}`);
|
32
|
+
return;
|
33
|
+
}
|
34
|
+
// if (!result.stdout.trim()) {
|
35
|
+
// logger.info(`No processes found matching pattern: ${processPattern}`);
|
36
|
+
// return;
|
37
|
+
// }
|
38
|
+
|
39
|
+
const lines = result.stdout.trim().split('\n');
|
40
|
+
const pids = isWindows
|
41
|
+
? lines.map(line => line.match(/"(\d+)"/)?.[1])
|
42
|
+
: lines.map(line => line.trim().split(/\s+/)[0]).filter(pid => !isNaN(Number(pid)));
|
43
|
+
|
44
|
+
logger.action(`Extracted PIDs: ${JSON.stringify(pids)}`);
|
45
|
+
|
46
|
+
pids.forEach(pid => {
|
47
|
+
if (!pid) return;
|
48
|
+
try {
|
49
|
+
const killCommand = isWindows
|
50
|
+
? `taskkill /PID ${pid} /T /F`
|
51
|
+
: `kill -9 ${pid}`;
|
52
|
+
|
53
|
+
logger.info(`Running kill command: ${killCommand}`);
|
54
|
+
|
55
|
+
const killResult = spawnSync(killCommand, { shell: true, encoding: 'utf-8' });
|
56
|
+
if (killResult.error) {
|
57
|
+
logger.error(`Failed to kill process with PID ${pid}: ${killResult.error.message}`);
|
58
|
+
} else {
|
59
|
+
logger.success(`Killed process with PID: ${pid}`);
|
60
|
+
}
|
61
|
+
|
62
|
+
if (!isWindows) {
|
63
|
+
setTimeout(() => {
|
64
|
+
try {
|
65
|
+
process.kill(parseInt(pid, 10), 'SIGKILL');
|
66
|
+
logger.info(`Sent SIGKILL to process with PID: ${pid}`);
|
67
|
+
} catch (killError: any) {
|
68
|
+
if (killError.code === 'ESRCH') {
|
69
|
+
logger.info(`Process with PID ${pid} already terminated.`);
|
70
|
+
} else {
|
71
|
+
logger.error(`Failed to send SIGKILL to process with PID ${pid}: ${killError.message}`);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}, 10000);
|
75
|
+
}
|
76
|
+
} catch (err: any) {
|
77
|
+
logger.error(`Failed to kill process with PID ${pid}: ${err.message}`);
|
78
|
+
}
|
79
|
+
});
|
80
|
+
}
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Clean up and run a command before exiting the process.
|
84
|
+
*/
|
85
|
+
export function cleanupWatchers() {
|
86
|
+
logger.info(`🧹 Cleaning up Watchman watchers...`);
|
87
|
+
const cwd = process.cwd();
|
88
|
+
const command = `watchman watch-del "${cwd}"`; // Adjust for Windows paths
|
89
|
+
|
90
|
+
logger.info(`Cleaning watchers for directory: ${cwd}`);
|
91
|
+
const result = spawnSync(command, { shell: true, encoding: 'utf-8' });
|
92
|
+
|
93
|
+
// if (result.stderr) {
|
94
|
+
// logger.error(`spawnSync error: ${result.stderr}`);
|
95
|
+
// return;
|
96
|
+
// }
|
97
|
+
// if (!result.stdout.trim()) {
|
98
|
+
// logger.info(`No watchers found to clean up.`);
|
99
|
+
// return;
|
100
|
+
// }
|
9
101
|
}
|