alepha 0.19.2 → 0.19.3

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 (61) hide show
  1. package/dist/api/jobs/index.d.ts +24 -24
  2. package/dist/api/jobs/index.d.ts.map +1 -1
  3. package/dist/api/jobs/index.js +10 -4
  4. package/dist/api/jobs/index.js.map +1 -1
  5. package/dist/api/keys/index.d.ts +5 -5
  6. package/dist/api/users/index.d.ts +9 -19
  7. package/dist/api/users/index.d.ts.map +1 -1
  8. package/dist/api/verifications/index.d.ts +13 -13
  9. package/dist/cli/config/index.d.ts +6 -28
  10. package/dist/cli/config/index.d.ts.map +1 -1
  11. package/dist/cli/config/index.js +5 -10
  12. package/dist/cli/config/index.js.map +1 -1
  13. package/dist/cli/core/index.d.ts +11653 -208
  14. package/dist/cli/core/index.d.ts.map +1 -1
  15. package/dist/cli/core/index.js +48 -12
  16. package/dist/cli/core/index.js.map +1 -1
  17. package/dist/cli/devtools/index.d.ts +5 -0
  18. package/dist/cli/devtools/index.d.ts.map +1 -1
  19. package/dist/cli/devtools/index.js +4 -0
  20. package/dist/cli/devtools/index.js.map +1 -1
  21. package/dist/cli/platform/index.d.ts +69 -64
  22. package/dist/cli/platform/index.d.ts.map +1 -1
  23. package/dist/cli/platform/index.js +6 -2
  24. package/dist/cli/platform/index.js.map +1 -1
  25. package/dist/cli/vendor/index.d.ts +7 -2
  26. package/dist/cli/vendor/index.d.ts.map +1 -1
  27. package/dist/cli/vendor/index.js +6 -2
  28. package/dist/cli/vendor/index.js.map +1 -1
  29. package/dist/core/index.browser.js.map +1 -1
  30. package/dist/core/index.d.ts.map +1 -1
  31. package/dist/core/index.js +4 -0
  32. package/dist/core/index.js.map +1 -1
  33. package/dist/core/index.native.js +4 -0
  34. package/dist/core/index.native.js.map +1 -1
  35. package/dist/core/index.workerd.js +4 -0
  36. package/dist/core/index.workerd.js.map +1 -1
  37. package/dist/logger/index.d.ts.map +1 -1
  38. package/dist/logger/index.js +1 -1
  39. package/dist/logger/index.js.map +1 -1
  40. package/dist/orm/core/index.bun.js +25 -56
  41. package/dist/orm/core/index.bun.js.map +1 -1
  42. package/dist/orm/core/index.d.ts +9 -19
  43. package/dist/orm/core/index.d.ts.map +1 -1
  44. package/dist/orm/core/index.js +25 -56
  45. package/dist/orm/core/index.js.map +1 -1
  46. package/dist/orm/postgres/index.d.ts +2 -1
  47. package/dist/orm/postgres/index.d.ts.map +1 -1
  48. package/package.json +6 -6
  49. package/src/api/jobs/providers/JobProvider.ts +10 -6
  50. package/src/cli/config/defineConfig.ts +17 -46
  51. package/src/cli/core/providers/ViteDevServerProvider.ts +45 -3
  52. package/src/cli/core/services/PackageManagerUtils.ts +3 -1
  53. package/src/cli/core/services/ProjectScaffolder.ts +5 -5
  54. package/src/cli/core/templates/agentMd.ts +14 -5
  55. package/src/cli/devtools/index.ts +21 -1
  56. package/src/cli/platform/index.ts +23 -2
  57. package/src/cli/vendor/index.ts +20 -3
  58. package/src/core/Alepha.ts +10 -0
  59. package/src/logger/index.ts +6 -1
  60. package/src/orm/core/providers/DrizzleKitProvider.ts +56 -105
  61. package/tsconfig.base.json +0 -1
@@ -12,7 +12,7 @@ declare const verifications: _$alepha_orm0.EntityPrimitive<_$alepha.TObject<{
12
12
  createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
13
13
  updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
14
14
  version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
15
- type: _$alepha.TUnsafe<"link" | "code">;
15
+ type: _$alepha.TUnsafe<"code" | "link">;
16
16
  target: _$alepha.TString;
17
17
  code: _$alepha.TString;
18
18
  verifiedAt: _$alepha.TOptional<_$alepha.TString>;
@@ -23,7 +23,7 @@ declare const verificationEntitySchema: _$alepha.TObject<{
23
23
  createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
24
24
  updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
25
25
  version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
26
- type: _$alepha.TUnsafe<"link" | "code">;
26
+ type: _$alepha.TUnsafe<"code" | "link">;
27
27
  target: _$alepha.TString;
28
28
  code: _$alepha.TString;
29
29
  verifiedAt: _$alepha.TOptional<_$alepha.TString>;
@@ -34,7 +34,7 @@ declare const verificationEntityInsertSchema: _$alepha_orm0.TObjectInsert<_$alep
34
34
  createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
35
35
  updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
36
36
  version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
37
- type: _$alepha.TUnsafe<"link" | "code">;
37
+ type: _$alepha.TUnsafe<"code" | "link">;
38
38
  target: _$alepha.TString;
39
39
  code: _$alepha.TString;
40
40
  verifiedAt: _$alepha.TOptional<_$alepha.TString>;
@@ -89,17 +89,17 @@ declare module "alepha" {
89
89
  }
90
90
  declare class VerificationParameters {
91
91
  protected readonly options: Readonly<{
92
- link: {
92
+ code: {
93
93
  codeExpiration: number;
94
94
  verificationCooldown: number;
95
95
  maxAttempts: number;
96
+ codeLength: number;
96
97
  limitPerDay: number;
97
98
  };
98
- code: {
99
+ link: {
99
100
  codeExpiration: number;
100
101
  verificationCooldown: number;
101
102
  maxAttempts: number;
102
- codeLength: number;
103
103
  limitPerDay: number;
104
104
  };
105
105
  purgeDays: number;
@@ -124,7 +124,7 @@ declare const validateVerificationCodeResponseSchema: _$alepha.TObject<{
124
124
  type ValidateVerificationCodeResponse = Static<typeof validateVerificationCodeResponseSchema>;
125
125
  //#endregion
126
126
  //#region ../../src/api/verifications/schemas/verificationTypeEnumSchema.d.ts
127
- declare const verificationTypeEnumSchema: _$alepha.TUnsafe<"link" | "code">;
127
+ declare const verificationTypeEnumSchema: _$alepha.TUnsafe<"code" | "link">;
128
128
  type VerificationTypeEnum = Static<typeof verificationTypeEnumSchema>;
129
129
  //#endregion
130
130
  //#region ../../src/api/verifications/services/VerificationService.d.ts
@@ -137,7 +137,7 @@ declare class VerificationService {
137
137
  createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
138
138
  updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
139
139
  version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
140
- type: _$alepha.TUnsafe<"link" | "code">;
140
+ type: _$alepha.TUnsafe<"code" | "link">;
141
141
  target: _$alepha.TString;
142
142
  code: _$alepha.TString;
143
143
  verifiedAt: _$alepha.TOptional<_$alepha.TString>;
@@ -149,7 +149,7 @@ declare class VerificationService {
149
149
  createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
150
150
  updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
151
151
  version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
152
- type: _$alepha.TUnsafe<"link" | "code">;
152
+ type: _$alepha.TUnsafe<"code" | "link">;
153
153
  target: _$alepha.TString;
154
154
  code: _$alepha.TString;
155
155
  verifiedAt: _$alepha.TOptional<_$alepha.TString>;
@@ -159,7 +159,7 @@ declare class VerificationService {
159
159
  createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
160
160
  updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
161
161
  version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
162
- type: _$alepha.TUnsafe<"link" | "code">;
162
+ type: _$alepha.TUnsafe<"code" | "link">;
163
163
  target: _$alepha.TString;
164
164
  code: _$alepha.TString;
165
165
  verifiedAt: _$alepha.TOptional<_$alepha.TString>;
@@ -187,7 +187,7 @@ declare class VerificationController {
187
187
  readonly group = "verifications";
188
188
  readonly requestVerificationCode: _$alepha_server0.ActionPrimitiveFn<{
189
189
  params: _$alepha.TObject<{
190
- type: _$alepha.TUnsafe<"link" | "code">;
190
+ type: _$alepha.TUnsafe<"code" | "link">;
191
191
  }>;
192
192
  body: _$alepha.TObject<{
193
193
  target: _$alepha.TString;
@@ -201,7 +201,7 @@ declare class VerificationController {
201
201
  }>;
202
202
  readonly validateVerificationCode: _$alepha_server0.ActionPrimitiveFn<{
203
203
  params: _$alepha.TObject<{
204
- type: _$alepha.TUnsafe<"link" | "code">;
204
+ type: _$alepha.TUnsafe<"code" | "link">;
205
205
  }>;
206
206
  body: _$alepha.TObject<{
207
207
  target: _$alepha.TString;
@@ -221,7 +221,7 @@ declare class VerificationJobs {
221
221
  createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
222
222
  updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
223
223
  version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
224
- type: _$alepha.TUnsafe<"link" | "code">;
224
+ type: _$alepha.TUnsafe<"code" | "link">;
225
225
  target: _$alepha.TString;
226
226
  code: _$alepha.TString;
227
227
  verifiedAt: _$alepha.TOptional<_$alepha.TString>;
@@ -1,21 +1,14 @@
1
1
  import { AppEntryOptions, BuildOptions, DevOptions } from "alepha/cli";
2
- import { DevtoolsOptions } from "alepha/cli/devtools";
3
- import { PlatformOptions } from "alepha/cli/platform";
4
- import { VendorOptions } from "alepha/cli/vendor";
5
- import * as _$alepha from "alepha";
6
2
  import { Alepha } from "alepha";
7
- import { CommandPrimitive } from "alepha/command";
8
3
 
9
4
  //#region ../../src/cli/config/defineConfig.d.ts
5
+ type AlephaCliConfigPlugin = (config: AlephaCliConfig, alepha: Alepha) => void;
6
+ declare const cliConfigPlugins: AlephaCliConfigPlugin[];
10
7
  interface AlephaCliConfig {
11
- entry?: AppEntryOptions;
12
8
  /**
13
- * Add custom commands to the Alepha CLI.
14
- *
15
- * You can override 'deploy', 'build', 'dev', 'start' commands this way.
16
- * But you can also add your own commands and run them via `alepha <command>`.
9
+ * Override entry paths.
17
10
  */
18
- commands?: Record<string, CommandPrimitive>;
11
+ entry?: AppEntryOptions;
19
12
  /**
20
13
  * Register more services to the Alepha CLI (enhancements, commands, etc.).
21
14
  */
@@ -28,29 +21,14 @@ interface AlephaCliConfig {
28
21
  * Configure Alepha dev command.
29
22
  */
30
23
  dev?: DevOptions;
31
- /**
32
- * Configure devtools plugin.
33
- */
34
- devtools?: DevtoolsOptions;
35
24
  /**
36
25
  * Environment variables to set before running commands.
37
26
  *
38
27
  * Always use .env files by default, this is only for dynamic values.
39
28
  */
40
29
  env?: Record<string, unknown>;
41
- /**
42
- * Platform deployment configuration.
43
- */
44
- platform?: PlatformOptions;
45
- /**
46
- * Vendor synchronization configuration.
47
- */
48
- vendor?: VendorOptions;
49
30
  }
50
- type AlephaCliConfigFn = (alepha: Alepha) => AlephaCliConfig;
51
- declare const defineConfig: (runConfig: AlephaCliConfig | AlephaCliConfigFn) => (alepha: Alepha) => {
52
- [x: string]: CommandPrimitive<_$alepha.TObject<_$alepha.TProperties>, _$alepha.TSchema, _$alepha.TObject<_$alepha.TProperties>>;
53
- };
31
+ declare const defineConfig: (config: AlephaCliConfig) => (alepha: Alepha) => {};
54
32
  //#endregion
55
- export { AlephaCliConfig, AlephaCliConfigFn, defineConfig };
33
+ export { AlephaCliConfig, AlephaCliConfigPlugin, cliConfigPlugins, defineConfig };
56
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/cli/config/defineConfig.ts"],"mappings":";;;;;;;;;UAciB,eAAA;EACf,KAAA,GAAQ,eAAA;;AADV;;;;;EAQE,QAAA,GAAW,MAAA,SAAe,gBAAA;EAKf;;;EAAX,QAAA,GAAW,KAAA;EAsBL;;;EAjBN,KAAA,GAAQ,YAAA;EA2Bc;;;EAtBtB,GAAA,GAAM,UAAA;EAfK;;;EAoBX,QAAA,GAAW,eAAA;EAVX;;;;;EAiBA,GAAA,GAAM,MAAA;EAAN;;;EAKA,QAAA,GAAW,eAAA;EAKX;;;EAAA,MAAA,GAAS,aAAA;AAAA;AAAA,KAGC,iBAAA,IAAqB,MAAA,EAAQ,MAAA,KAAW,eAAA;AAAA,cAIvC,YAAA,GACX,SAAA,EAAW,eAAA,GAAkB,iBAAA,MAErB,MAAA,EAAQ,MAAA;EAAA,+CAAM,QAAA,CAAA,WAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/cli/config/defineConfig.ts"],"mappings":";;;;KAYY,qBAAA,IACV,MAAA,EAAQ,eAAA,EACR,MAAA,EAAQ,MAAA;AAAA,cAGG,gBAAA,EAAkB,qBAAA;AAAA,UAId,eAAA;EATgB;;;EAa/B,KAAA,GAAQ,eAAA;EAZR;;;EAiBA,QAAA,GAAW,KAAA;EAhBG;AAGhB;;EAkBE,KAAA,GAAQ,YAAA;EAlBqB;;AAI/B;EAmBE,GAAA,GAAM,UAAA;;;;;;EAON,GAAA,GAAM,MAAA;AAAA;AAAA,cAKK,YAAA,GAAgB,MAAA,EAAQ,eAAA,MAC3B,MAAA,EAAQ,MAAA"}
@@ -1,23 +1,18 @@
1
1
  import { appEntryOptions, buildOptions, devOptions } from "alepha/cli";
2
- import { devtoolsOptions } from "alepha/cli/devtools";
3
- import { platformOptions } from "alepha/cli/platform";
4
- import { vendorOptions } from "alepha/cli/vendor";
5
2
  //#region ../../src/cli/config/defineConfig.ts
6
- const defineConfig = (runConfig) => {
3
+ const cliConfigPlugins = [];
4
+ const defineConfig = (config) => {
7
5
  return (alepha) => {
8
- const config = typeof runConfig === "function" ? runConfig(alepha) : runConfig;
9
6
  if (config.services) for (const it of config.services) alepha.with(it);
10
7
  if (config.env) for (const [key, value] of Object.entries(config.env)) process.env[key] = String(value);
11
8
  if (config.build) alepha.set(buildOptions, config.build);
12
9
  if (config.dev) alepha.set(devOptions, config.dev);
13
10
  if (config.entry) alepha.set(appEntryOptions, config.entry);
14
- if (config.platform) alepha.set(platformOptions, config.platform);
15
- if (config.devtools) alepha.set(devtoolsOptions, config.devtools);
16
- if (config.vendor) alepha.set(vendorOptions, config.vendor);
17
- return { ...config.commands };
11
+ for (const plugin of cliConfigPlugins) plugin(config, alepha);
12
+ return {};
18
13
  };
19
14
  };
20
15
  //#endregion
21
- export { defineConfig };
16
+ export { cliConfigPlugins, defineConfig };
22
17
 
23
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/cli/config/defineConfig.ts"],"sourcesContent":["import type { Alepha } from \"alepha\";\nimport {\n type AppEntryOptions,\n appEntryOptions,\n type BuildOptions,\n buildOptions,\n type DevOptions,\n devOptions,\n} from \"alepha/cli\";\nimport { type DevtoolsOptions, devtoolsOptions } from \"alepha/cli/devtools\";\nimport { type PlatformOptions, platformOptions } from \"alepha/cli/platform\";\nimport { type VendorOptions, vendorOptions } from \"alepha/cli/vendor\";\nimport type { CommandPrimitive } from \"alepha/command\";\n\nexport interface AlephaCliConfig {\n entry?: AppEntryOptions;\n /**\n * Add custom commands to the Alepha CLI.\n *\n * You can override 'deploy', 'build', 'dev', 'start' commands this way.\n * But you can also add your own commands and run them via `alepha <command>`.\n */\n commands?: Record<string, CommandPrimitive>;\n\n /**\n * Register more services to the Alepha CLI (enhancements, commands, etc.).\n */\n services?: Array<any>;\n\n /**\n * Configure Alepha build command.\n */\n build?: BuildOptions;\n\n /**\n * Configure Alepha dev command.\n */\n dev?: DevOptions;\n\n /**\n * Configure devtools plugin.\n */\n devtools?: DevtoolsOptions;\n\n /**\n * Environment variables to set before running commands.\n *\n * Always use .env files by default, this is only for dynamic values.\n */\n env?: Record<string, unknown>;\n\n /**\n * Platform deployment configuration.\n */\n platform?: PlatformOptions;\n\n /**\n * Vendor synchronization configuration.\n */\n vendor?: VendorOptions;\n}\n\nexport type AlephaCliConfigFn = (alepha: Alepha) => AlephaCliConfig;\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport const defineConfig = (\n runConfig: AlephaCliConfig | AlephaCliConfigFn,\n) => {\n return (alepha: Alepha) => {\n const config =\n typeof runConfig === \"function\" ? runConfig(alepha) : runConfig;\n\n if (config.services) {\n for (const it of config.services) {\n alepha.with(it);\n }\n }\n\n if (config.env) {\n for (const [key, value] of Object.entries(config.env)) {\n process.env[key] = String(value);\n }\n }\n\n if (config.build) {\n alepha.set(buildOptions, config.build);\n }\n\n if (config.dev) {\n alepha.set(devOptions, config.dev);\n }\n\n if (config.entry) {\n alepha.set(appEntryOptions, config.entry);\n }\n\n if (config.platform) {\n alepha.set(platformOptions, config.platform);\n }\n\n if (config.devtools) {\n alepha.set(devtoolsOptions, config.devtools);\n }\n\n if (config.vendor) {\n alepha.set(vendorOptions, config.vendor);\n }\n\n return {\n ...config.commands,\n };\n };\n};\n"],"mappings":";;;;;AAkEA,MAAa,gBACX,cACG;AACH,SAAQ,WAAmB;EACzB,MAAM,SACJ,OAAO,cAAc,aAAa,UAAU,OAAO,GAAG;AAExD,MAAI,OAAO,SACT,MAAK,MAAM,MAAM,OAAO,SACtB,QAAO,KAAK,GAAG;AAInB,MAAI,OAAO,IACT,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,IAAI,CACnD,SAAQ,IAAI,OAAO,OAAO,MAAM;AAIpC,MAAI,OAAO,MACT,QAAO,IAAI,cAAc,OAAO,MAAM;AAGxC,MAAI,OAAO,IACT,QAAO,IAAI,YAAY,OAAO,IAAI;AAGpC,MAAI,OAAO,MACT,QAAO,IAAI,iBAAiB,OAAO,MAAM;AAG3C,MAAI,OAAO,SACT,QAAO,IAAI,iBAAiB,OAAO,SAAS;AAG9C,MAAI,OAAO,SACT,QAAO,IAAI,iBAAiB,OAAO,SAAS;AAG9C,MAAI,OAAO,OACT,QAAO,IAAI,eAAe,OAAO,OAAO;AAG1C,SAAO,EACL,GAAG,OAAO,UACX"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/cli/config/defineConfig.ts"],"sourcesContent":["import type { Alepha } from \"alepha\";\nimport {\n type AppEntryOptions,\n appEntryOptions,\n type BuildOptions,\n buildOptions,\n type DevOptions,\n devOptions,\n} from \"alepha/cli\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport type AlephaCliConfigPlugin = (\n config: AlephaCliConfig,\n alepha: Alepha,\n) => void;\n\nexport const cliConfigPlugins: AlephaCliConfigPlugin[] = [];\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface AlephaCliConfig {\n /**\n * Override entry paths.\n */\n entry?: AppEntryOptions;\n\n /**\n * Register more services to the Alepha CLI (enhancements, commands, etc.).\n */\n services?: Array<any>;\n\n /**\n * Configure Alepha build command.\n */\n build?: BuildOptions;\n\n /**\n * Configure Alepha dev command.\n */\n dev?: DevOptions;\n\n /**\n * Environment variables to set before running commands.\n *\n * Always use .env files by default, this is only for dynamic values.\n */\n env?: Record<string, unknown>;\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport const defineConfig = (config: AlephaCliConfig) => {\n return (alepha: Alepha) => {\n if (config.services) {\n for (const it of config.services) {\n alepha.with(it);\n }\n }\n\n if (config.env) {\n for (const [key, value] of Object.entries(config.env)) {\n process.env[key] = String(value);\n }\n }\n\n if (config.build) {\n alepha.set(buildOptions, config.build);\n }\n\n if (config.dev) {\n alepha.set(devOptions, config.dev);\n }\n\n if (config.entry) {\n alepha.set(appEntryOptions, config.entry);\n }\n\n for (const plugin of cliConfigPlugins) {\n plugin(config, alepha);\n }\n\n return {};\n };\n};\n"],"mappings":";;AAiBA,MAAa,mBAA4C,EAAE;AAmC3D,MAAa,gBAAgB,WAA4B;AACvD,SAAQ,WAAmB;AACzB,MAAI,OAAO,SACT,MAAK,MAAM,MAAM,OAAO,SACtB,QAAO,KAAK,GAAG;AAInB,MAAI,OAAO,IACT,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,IAAI,CACnD,SAAQ,IAAI,OAAO,OAAO,MAAM;AAIpC,MAAI,OAAO,MACT,QAAO,IAAI,cAAc,OAAO,MAAM;AAGxC,MAAI,OAAO,IACT,QAAO,IAAI,YAAY,OAAO,IAAI;AAGpC,MAAI,OAAO,MACT,QAAO,IAAI,iBAAiB,OAAO,MAAM;AAG3C,OAAK,MAAM,UAAU,iBACnB,QAAO,QAAQ,OAAO;AAGxB,SAAO,EAAE"}