everything-dev 1.19.0 → 1.21.0

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 (66) hide show
  1. package/dist/cli/init.cjs +138 -74
  2. package/dist/cli/init.cjs.map +1 -1
  3. package/dist/cli/init.d.cts +9 -5
  4. package/dist/cli/init.d.cts.map +1 -1
  5. package/dist/cli/init.d.mts +9 -5
  6. package/dist/cli/init.d.mts.map +1 -1
  7. package/dist/cli/init.mjs +138 -75
  8. package/dist/cli/init.mjs.map +1 -1
  9. package/dist/cli/parse.cjs +9 -0
  10. package/dist/cli/parse.cjs.map +1 -1
  11. package/dist/cli/parse.mjs +9 -0
  12. package/dist/cli/parse.mjs.map +1 -1
  13. package/dist/cli/prompts.cjs +44 -13
  14. package/dist/cli/prompts.cjs.map +1 -1
  15. package/dist/cli/prompts.mjs +44 -13
  16. package/dist/cli/prompts.mjs.map +1 -1
  17. package/dist/cli/sync.cjs +6 -0
  18. package/dist/cli/sync.cjs.map +1 -1
  19. package/dist/cli/sync.mjs +6 -0
  20. package/dist/cli/sync.mjs.map +1 -1
  21. package/dist/cli/timing.cjs +21 -1
  22. package/dist/cli/timing.cjs.map +1 -1
  23. package/dist/cli/timing.mjs +21 -1
  24. package/dist/cli/timing.mjs.map +1 -1
  25. package/dist/cli.cjs +3 -1
  26. package/dist/cli.cjs.map +1 -1
  27. package/dist/cli.mjs +3 -1
  28. package/dist/cli.mjs.map +1 -1
  29. package/dist/contract.cjs +9 -1
  30. package/dist/contract.cjs.map +1 -1
  31. package/dist/contract.d.cts +43 -14
  32. package/dist/contract.d.cts.map +1 -1
  33. package/dist/contract.d.mts +43 -14
  34. package/dist/contract.d.mts.map +1 -1
  35. package/dist/contract.meta.cjs +2 -2
  36. package/dist/contract.meta.cjs.map +1 -1
  37. package/dist/contract.meta.d.cts +3 -3
  38. package/dist/contract.meta.d.mts +3 -3
  39. package/dist/contract.meta.mjs +2 -2
  40. package/dist/contract.meta.mjs.map +1 -1
  41. package/dist/contract.mjs +9 -2
  42. package/dist/contract.mjs.map +1 -1
  43. package/dist/index.cjs +1 -0
  44. package/dist/index.d.cts +2 -2
  45. package/dist/index.d.mts +2 -2
  46. package/dist/index.mjs +2 -2
  47. package/dist/plugin.cjs +56 -38
  48. package/dist/plugin.cjs.map +1 -1
  49. package/dist/plugin.d.cts +20 -9
  50. package/dist/plugin.d.cts.map +1 -1
  51. package/dist/plugin.d.mts +20 -9
  52. package/dist/plugin.d.mts.map +1 -1
  53. package/dist/plugin.mjs +57 -39
  54. package/dist/plugin.mjs.map +1 -1
  55. package/dist/types.d.cts +4 -4
  56. package/dist/types.d.mts +4 -4
  57. package/package.json +5 -5
  58. package/src/cli/init.ts +215 -89
  59. package/src/cli/parse.ts +17 -0
  60. package/src/cli/prompts.ts +45 -28
  61. package/src/cli/sync.ts +1 -0
  62. package/src/cli/timing.ts +27 -0
  63. package/src/cli.ts +8 -1
  64. package/src/contract.meta.ts +6 -2
  65. package/src/contract.ts +5 -1
  66. package/src/plugin.ts +145 -73
package/dist/plugin.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { z } from "./sdk.cjs";
2
1
  import { ContractProcedure, MergedErrorMap, Schema } from "./node_modules/@orpc/contract/dist/shared/contract.TuRtB1Ca.cjs";
2
+ import { z } from "./sdk.cjs";
3
3
  import * as _$every_plugin0 from "every-plugin";
4
4
 
5
5
  //#region src/plugin.d.ts
@@ -56,8 +56,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
56
56
  deploy: z.ZodDefault<z.ZodBoolean>;
57
57
  }, z.core.$strip>, z.ZodObject<{
58
58
  status: z.ZodEnum<{
59
- success: "success";
60
59
  error: "error";
60
+ success: "success";
61
61
  }>;
62
62
  built: z.ZodArray<z.ZodString>;
63
63
  skipped: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -259,8 +259,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
259
259
  dryRun: z.ZodDefault<z.ZodBoolean>;
260
260
  packages: z.ZodDefault<z.ZodString>;
261
261
  network: z.ZodOptional<z.ZodEnum<{
262
- mainnet: "mainnet";
263
262
  testnet: "testnet";
263
+ mainnet: "mainnet";
264
264
  }>>;
265
265
  privateKey: z.ZodOptional<z.ZodString>;
266
266
  }, z.core.$strip>, z.ZodObject<{
@@ -284,8 +284,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
284
284
  }>;
285
285
  account: z.ZodString;
286
286
  network: z.ZodEnum<{
287
- mainnet: "mainnet";
288
287
  testnet: "testnet";
288
+ mainnet: "mainnet";
289
289
  }>;
290
290
  contract: z.ZodString;
291
291
  allowance: z.ZodString;
@@ -301,7 +301,12 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
301
301
  domain: z.ZodOptional<z.ZodString>;
302
302
  source: z.ZodOptional<z.ZodString>;
303
303
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
304
- withHost: z.ZodDefault<z.ZodBoolean>;
304
+ overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
305
+ plugins: "plugins";
306
+ host: "host";
307
+ ui: "ui";
308
+ api: "api";
309
+ }>>>;
305
310
  noInteractive: z.ZodDefault<z.ZodBoolean>;
306
311
  noInstall: z.ZodDefault<z.ZodBoolean>;
307
312
  }, z.core.$strip>, z.ZodObject<{
@@ -315,6 +320,12 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
315
320
  domain: z.ZodOptional<z.ZodString>;
316
321
  extends: z.ZodString;
317
322
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
323
+ overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
324
+ plugins: "plugins";
325
+ host: "host";
326
+ ui: "ui";
327
+ api: "api";
328
+ }>>>;
318
329
  filesCopied: z.ZodNumber;
319
330
  timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
320
331
  name: z.ZodString;
@@ -398,14 +409,14 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
398
409
  }, z.core.$strip>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
399
410
  typesGen: ContractProcedure<z.ZodObject<{
400
411
  env: z.ZodOptional<z.ZodEnum<{
401
- development: "development";
402
412
  production: "production";
413
+ development: "development";
403
414
  }>>;
404
415
  dryRun: z.ZodDefault<z.ZodBoolean>;
405
416
  }, z.core.$strip>, z.ZodObject<{
406
417
  status: z.ZodEnum<{
407
- success: "success";
408
418
  error: "error";
419
+ success: "success";
409
420
  }>;
410
421
  generated: z.ZodArray<z.ZodString>;
411
422
  fetched: z.ZodArray<z.ZodString>;
@@ -535,9 +546,9 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
535
546
  }> | undefined;
536
547
  } | null;
537
548
  runtimeConfig: {
538
- env: "development" | "production" | "staging";
549
+ env: "production" | "staging" | "development";
539
550
  account: string;
540
- networkId: "mainnet" | "testnet";
551
+ networkId: "testnet" | "mainnet";
541
552
  host: {
542
553
  name: string;
543
554
  url: string;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;cAqDwC,QAAA"}
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;cAuDwC,QAAA"}
package/dist/plugin.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { z } from "./sdk.mjs";
2
1
  import { ContractProcedure, MergedErrorMap, Schema } from "./node_modules/@orpc/contract/dist/shared/contract.TuRtB1Ca.mjs";
2
+ import { z } from "./sdk.mjs";
3
3
  import * as _$every_plugin0 from "every-plugin";
4
4
 
5
5
  //#region src/plugin.d.ts
@@ -56,8 +56,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
56
56
  deploy: z.ZodDefault<z.ZodBoolean>;
57
57
  }, z.core.$strip>, z.ZodObject<{
58
58
  status: z.ZodEnum<{
59
- success: "success";
60
59
  error: "error";
60
+ success: "success";
61
61
  }>;
62
62
  built: z.ZodArray<z.ZodString>;
63
63
  skipped: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -259,8 +259,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
259
259
  dryRun: z.ZodDefault<z.ZodBoolean>;
260
260
  packages: z.ZodDefault<z.ZodString>;
261
261
  network: z.ZodOptional<z.ZodEnum<{
262
- mainnet: "mainnet";
263
262
  testnet: "testnet";
263
+ mainnet: "mainnet";
264
264
  }>>;
265
265
  privateKey: z.ZodOptional<z.ZodString>;
266
266
  }, z.core.$strip>, z.ZodObject<{
@@ -284,8 +284,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
284
284
  }>;
285
285
  account: z.ZodString;
286
286
  network: z.ZodEnum<{
287
- mainnet: "mainnet";
288
287
  testnet: "testnet";
288
+ mainnet: "mainnet";
289
289
  }>;
290
290
  contract: z.ZodString;
291
291
  allowance: z.ZodString;
@@ -301,7 +301,12 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
301
301
  domain: z.ZodOptional<z.ZodString>;
302
302
  source: z.ZodOptional<z.ZodString>;
303
303
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
304
- withHost: z.ZodDefault<z.ZodBoolean>;
304
+ overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
305
+ plugins: "plugins";
306
+ host: "host";
307
+ ui: "ui";
308
+ api: "api";
309
+ }>>>;
305
310
  noInteractive: z.ZodDefault<z.ZodBoolean>;
306
311
  noInstall: z.ZodDefault<z.ZodBoolean>;
307
312
  }, z.core.$strip>, z.ZodObject<{
@@ -315,6 +320,12 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
315
320
  domain: z.ZodOptional<z.ZodString>;
316
321
  extends: z.ZodString;
317
322
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
323
+ overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
324
+ plugins: "plugins";
325
+ host: "host";
326
+ ui: "ui";
327
+ api: "api";
328
+ }>>>;
318
329
  filesCopied: z.ZodNumber;
319
330
  timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
320
331
  name: z.ZodString;
@@ -398,14 +409,14 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
398
409
  }, z.core.$strip>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
399
410
  typesGen: ContractProcedure<z.ZodObject<{
400
411
  env: z.ZodOptional<z.ZodEnum<{
401
- development: "development";
402
412
  production: "production";
413
+ development: "development";
403
414
  }>>;
404
415
  dryRun: z.ZodDefault<z.ZodBoolean>;
405
416
  }, z.core.$strip>, z.ZodObject<{
406
417
  status: z.ZodEnum<{
407
- success: "success";
408
418
  error: "error";
419
+ success: "success";
409
420
  }>;
410
421
  generated: z.ZodArray<z.ZodString>;
411
422
  fetched: z.ZodArray<z.ZodString>;
@@ -535,9 +546,9 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
535
546
  }> | undefined;
536
547
  } | null;
537
548
  runtimeConfig: {
538
- env: "development" | "production" | "staging";
549
+ env: "production" | "staging" | "development";
539
550
  account: string;
540
- networkId: "mainnet" | "testnet";
551
+ networkId: "testnet" | "mainnet";
541
552
  host: {
542
553
  name: string;
543
554
  url: string;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;cAqDwC,QAAA"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;cAuDwC,QAAA"}
package/dist/plugin.mjs CHANGED
@@ -7,7 +7,7 @@ import { syncApiContractBridge } from "./api-contract.mjs";
7
7
  import { buildRuntimeConfig, detectLocalPackages, prepareDevelopmentRuntimeConfig } from "./app.mjs";
8
8
  import { ensureEnvFile, writeGeneratedInfra } from "./cli/infra.mjs";
9
9
  import { saveBosConfig } from "./utils/save-config.mjs";
10
- import { copyFilteredFiles, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, readTemplatekeep, resolveSourceDir, runBunInstall, runDockerComposeUp, runTypesGen, scaffoldMinimalProject, writeInitSnapshot } from "./cli/init.mjs";
10
+ import { copyFilteredFiles, detectGitRemoteUrl, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, readTemplatekeep, resolveSourceDir, runBunInstall, runDockerComposeUp, runTypesGen, scaffoldMinimalProject, writeInitSnapshot } from "./cli/init.mjs";
11
11
  import { promptInitOptions } from "./cli/prompts.mjs";
12
12
  import { getStatus } from "./cli/status.mjs";
13
13
  import { syncTemplate } from "./cli/sync.mjs";
@@ -780,7 +780,7 @@ var plugin_default = createPlugin({
780
780
  let directory = input.directory;
781
781
  let account = input.account;
782
782
  let domain = input.domain;
783
- let withHost = input.withHost;
783
+ let overrides = input.overrides;
784
784
  let plugins = input.plugins;
785
785
  if (input.extends) {
786
786
  const match = (input.extends.startsWith("bos://") ? input.extends : `bos://${input.extends}`).match(/^bos:\/\/([^/]+)\/(.+)$/);
@@ -791,20 +791,23 @@ var plugin_default = createPlugin({
791
791
  }
792
792
  extendsAccount = extendsAccount || "dev.everything.near";
793
793
  extendsGateway = extendsGateway || "everything.dev";
794
+ const s = p.spinner();
795
+ s.start("Initializing project");
794
796
  let parentPluginKeys = [];
795
797
  let parentConfig = null;
796
798
  try {
797
- parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway));
799
+ parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway), s);
798
800
  if (parentConfig?.plugins && typeof parentConfig.plugins === "object") parentPluginKeys = Object.keys(parentConfig.plugins);
799
801
  } catch {}
800
802
  if (!input.noInteractive) {
803
+ s.stop("Config fetched");
801
804
  const prompted = await promptInitOptions({
802
805
  extends: `bos://${extendsAccount}/${extendsGateway}`,
803
806
  directory,
804
807
  account,
805
808
  domain,
806
809
  plugins,
807
- withHost,
810
+ overrides,
808
811
  parentPluginKeys
809
812
  });
810
813
  extendsAccount = prompted.extendsAccount;
@@ -812,16 +815,22 @@ var plugin_default = createPlugin({
812
815
  directory = prompted.directory;
813
816
  account = prompted.account;
814
817
  domain = prompted.domain;
815
- withHost = prompted.withHost;
816
818
  plugins = prompted.plugins;
819
+ overrides = prompted.overrides;
820
+ s.start("Setting up project");
817
821
  }
822
+ overrides = overrides?.length ? overrides : ["ui", "api"];
823
+ if (overrides.includes("plugins") && !plugins?.length) plugins = parentPluginKeys;
824
+ plugins = plugins ?? [];
818
825
  directory = directory || domain || extendsGateway;
819
826
  const targetDir = resolve(directory);
820
- plugins = plugins ?? [];
821
827
  const extendsRef = `bos://${extendsAccount}/${extendsGateway}`;
828
+ if (overrides.includes("plugins") && !plugins.length) {}
829
+ const repository = await detectGitRemoteUrl(process.cwd()).catch(() => void 0) ?? parentConfig?.repository;
822
830
  if (!parentConfig) try {
823
- parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway));
831
+ parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway), s);
824
832
  } catch {
833
+ s.stop("Failed");
825
834
  return {
826
835
  status: "error",
827
836
  directory,
@@ -829,7 +838,8 @@ var plugin_default = createPlugin({
829
838
  account,
830
839
  domain,
831
840
  extends: extendsRef,
832
- plugins: plugins ?? [],
841
+ plugins,
842
+ overrides,
833
843
  filesCopied: 0,
834
844
  timings,
835
845
  error: `No config found at ${extendsRef} — are you sure this is the right parent?`
@@ -839,12 +849,10 @@ var plugin_default = createPlugin({
839
849
  extendsAccount,
840
850
  extendsGateway,
841
851
  source: input.source
842
- }));
852
+ }), s);
843
853
  parentConfig = resolvedParentConfig;
844
854
  const isMinimalScaffold = sourceDir === "";
845
855
  try {
846
- const s = p.spinner();
847
- s.start("Setting up project");
848
856
  let filesCopied;
849
857
  if (isMinimalScaffold) filesCopied = await timePhase(timings, "scaffold project", () => scaffoldMinimalProject(targetDir, parentConfig, {
850
858
  extendsAccount,
@@ -852,58 +860,66 @@ var plugin_default = createPlugin({
852
860
  account: account || extendsAccount,
853
861
  domain,
854
862
  plugins,
855
- withHost
856
- }));
863
+ overrides,
864
+ repository
865
+ }), s);
857
866
  else {
858
867
  const patterns = await readTemplatekeep(sourceDir);
859
- if (patterns.length === 0) return {
860
- status: "error",
861
- directory,
862
- extendsRef,
863
- account,
864
- domain,
865
- extends: extendsRef,
866
- plugins: plugins ?? [],
867
- filesCopied: 0,
868
- error: "No .templatekeep found in template source"
869
- };
868
+ if (patterns.length === 0) {
869
+ s.stop("Failed");
870
+ return {
871
+ status: "error",
872
+ directory,
873
+ extendsRef,
874
+ account,
875
+ domain,
876
+ extends: extendsRef,
877
+ plugins,
878
+ overrides,
879
+ filesCopied: 0,
880
+ error: "No .templatekeep found in template source"
881
+ };
882
+ }
870
883
  const pluginRoutes = {};
871
- const parentRuntimePlugins = await buildRuntimePluginsForConfig(parentConfig, sourceDir, "production");
872
- for (const [key, plugin] of Object.entries(parentRuntimePlugins ?? {})) if (plugin.routes && plugin.routes.length > 0) pluginRoutes[key] = plugin.routes;
884
+ if (overrides.includes("plugins")) {
885
+ const parentRuntimePlugins = await buildRuntimePluginsForConfig(parentConfig, sourceDir, "production");
886
+ for (const [key, plugin] of Object.entries(parentRuntimePlugins ?? {})) if (plugin.routes && plugin.routes.length > 0) pluginRoutes[key] = plugin.routes;
887
+ }
873
888
  filesCopied = await timePhase(timings, "copy files", () => copyFilteredFiles(sourceDir, targetDir, patterns, {
874
- withHost,
889
+ overrides,
875
890
  plugins,
876
891
  pluginRoutes
877
- }));
892
+ }), s);
878
893
  await timePhase(timings, "personalize config", () => personalizeConfig(targetDir, {
879
894
  extendsAccount,
880
895
  extendsGateway,
881
896
  account: account || extendsAccount,
882
897
  domain: domain || extendsGateway,
883
898
  plugins,
899
+ overrides,
884
900
  pluginRoutes,
885
901
  workspaceOpts: { sourceDir },
886
- withHost
887
- }));
902
+ repository
903
+ }), s);
888
904
  await timePhase(timings, "write snapshot", () => writeInitSnapshot(targetDir, extendsAccount, extendsGateway, sourceDir, patterns, {
889
- withHost,
905
+ overrides,
890
906
  plugins,
891
907
  pluginRoutes
892
- }));
908
+ }), s);
893
909
  }
894
- const initConfig = await timePhase(timings, "resolve config", () => loadConfig({ cwd: targetDir }));
910
+ const initConfig = await timePhase(timings, "resolve config", () => loadConfig({ cwd: targetDir }), s);
895
911
  if (initConfig?.runtime) await timePhase(timings, "generate env/docker", async () => {
896
912
  writeGeneratedInfra(targetDir, initConfig.runtime);
897
- });
913
+ }, s);
898
914
  await timePhase(timings, "create env file", async () => {
899
915
  ensureEnvFile(targetDir);
900
- });
916
+ }, s);
901
917
  if (!input.noInstall) {
902
- await timePhase(timings, "install dependencies", () => runBunInstall(targetDir));
903
- await timePhase(timings, "generate types", () => runTypesGen(targetDir));
904
- await timePhase(timings, "generate migrations", () => generateDatabaseMigrations(targetDir));
918
+ await timePhase(timings, "install dependencies", () => runBunInstall(targetDir), s);
919
+ await timePhase(timings, "generate types", () => runTypesGen(targetDir), s);
920
+ await timePhase(timings, "generate migrations", () => generateDatabaseMigrations(targetDir), s);
905
921
  }
906
- if (input.noInstall && initConfig?.config) await timePhase(timings, "generate code artifacts", () => generateCodeArtifacts(targetDir, initConfig.config));
922
+ if (input.noInstall && initConfig?.config) await timePhase(timings, "generate code artifacts", () => generateCodeArtifacts(targetDir, initConfig.config), s);
907
923
  s.stop("Project initialized");
908
924
  if (!input.noInteractive) {
909
925
  if (await p.confirm({
@@ -929,6 +945,7 @@ var plugin_default = createPlugin({
929
945
  domain,
930
946
  extends: extendsRef,
931
947
  plugins,
948
+ overrides,
932
949
  filesCopied,
933
950
  timings
934
951
  };
@@ -945,6 +962,7 @@ var plugin_default = createPlugin({
945
962
  domain: input.domain,
946
963
  extends: extendsRef,
947
964
  plugins: input.plugins ?? [],
965
+ overrides: input.overrides,
948
966
  filesCopied: 0,
949
967
  timings: [],
950
968
  error: error instanceof Error ? error.message : "Unknown error"