@stacksjs/actions 0.51.0 → 0.52.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 (84) hide show
  1. package/README.md +1 -1
  2. package/dist/build/core.mjs +6 -0
  3. package/dist/build.mjs +1 -1
  4. package/dist/clean.d.ts +1 -8
  5. package/dist/clean.mjs +8 -12
  6. package/dist/deploy/domains.mjs +3 -0
  7. package/dist/deploy.mjs +6 -0
  8. package/dist/dev/docs.mjs +4 -0
  9. package/dist/{dev.d.ts → dev/index.d.ts} +1 -3
  10. package/dist/{dev.mjs → dev/index.mjs} +0 -17
  11. package/dist/fresh.mjs +1 -1
  12. package/dist/{generate-component-meta.mjs → generate/component-meta.mjs} +1 -1
  13. package/dist/{generate-ide-helpers.mjs → generate/ide-helpers.mjs} +1 -1
  14. package/dist/{generate.d.ts → generate/index.d.ts} +2 -0
  15. package/dist/{generate.mjs → generate/index.mjs} +12 -3
  16. package/dist/{generate-lib-entries.mjs → generate/lib-entries.mjs} +1 -1
  17. package/dist/{generate-package-jsons.mjs → generate/package-jsons.mjs} +1 -1
  18. package/dist/{generate-vscode-custom-data.mjs → generate/vscode-custom-data.mjs} +1 -1
  19. package/dist/generate/vue-compat.mjs +3 -0
  20. package/dist/helpers/lib-entries.mjs +6 -6
  21. package/dist/helpers/package-json.mjs +9 -9
  22. package/dist/helpers/utils.d.ts +4 -5
  23. package/dist/helpers/utils.mjs +13 -10
  24. package/dist/helpers/vscode-custom-data.mjs +1 -1
  25. package/dist/key-generate.mjs +2 -2
  26. package/dist/make.d.ts +2 -2
  27. package/dist/make.mjs +56 -15
  28. package/dist/migrate.mjs +2 -0
  29. package/dist/preinstall.mjs +2 -2
  30. package/dist/release.mjs +3 -5
  31. package/dist/seed.mjs +2 -0
  32. package/dist/test/feature.d.ts +1 -0
  33. package/dist/test/ui.d.ts +1 -0
  34. package/dist/test/unit.d.ts +1 -0
  35. package/dist/tinker.d.ts +1 -0
  36. package/dist/tinker.mjs +3 -0
  37. package/dist/upgrade/dependencies.d.ts +0 -0
  38. package/dist/upgrade/dependencies.mjs +0 -0
  39. package/dist/upgrade/framework.d.ts +1 -0
  40. package/dist/upgrade/framework.mjs +18 -0
  41. package/dist/upgrade/index.d.ts +1 -0
  42. package/dist/upgrade/index.mjs +11 -0
  43. package/dist/upgrade/node.d.ts +1 -0
  44. package/dist/upgrade/node.mjs +3 -0
  45. package/dist/upgrade/package-manager.d.ts +1 -0
  46. package/dist/upgrade/package-manager.mjs +3 -0
  47. package/dist/upgrade.d.ts +5 -0
  48. package/dist/upgrade.mjs +55 -0
  49. package/package.json +224 -23
  50. package/dist/build-core.mjs +0 -8
  51. package/dist/fix-lint-issues.mjs +0 -3
  52. package/dist/generate-onboarding.mjs +0 -2
  53. package/dist/generate-vue-compat.mjs +0 -3
  54. package/dist/update.d.ts +0 -14
  55. package/dist/update.mjs +0 -100
  56. /package/dist/{build-component-libs.d.ts → build/component-libs.d.ts} +0 -0
  57. /package/dist/{build-component-libs.mjs → build/component-libs.mjs} +0 -0
  58. /package/dist/{build-core.d.ts → build/core.d.ts} +0 -0
  59. /package/dist/{build-stacks.d.ts → build/stacks.d.ts} +0 -0
  60. /package/dist/{build-stacks.mjs → build/stacks.mjs} +0 -0
  61. /package/dist/{fix-lint-issues.d.ts → deploy/domains.d.ts} +0 -0
  62. /package/dist/{dev-components.d.ts → deploy.d.ts} +0 -0
  63. /package/dist/{generate-onboarding.d.ts → dev/components.d.ts} +0 -0
  64. /package/dist/{dev-components.mjs → dev/components.mjs} +0 -0
  65. /package/dist/{lint-fix.d.ts → dev/docs.d.ts} +0 -0
  66. /package/dist/{generate-component-meta.d.ts → generate/component-meta.d.ts} +0 -0
  67. /package/dist/{generate-ide-helpers.d.ts → generate/ide-helpers.d.ts} +0 -0
  68. /package/dist/{generate-lib-entries.d.ts → generate/lib-entries.d.ts} +0 -0
  69. /package/dist/{generate-package-jsons.d.ts → generate/package-jsons.d.ts} +0 -0
  70. /package/dist/{generate-settings.d.ts → generate/settings.d.ts} +0 -0
  71. /package/dist/{generate-settings.mjs → generate/settings.mjs} +0 -0
  72. /package/dist/{generate-vscode-custom-data.d.ts → generate/vscode-custom-data.d.ts} +0 -0
  73. /package/dist/{generate-vue-compat.d.ts → generate/vue-compat.d.ts} +0 -0
  74. /package/dist/{lint.d.ts → lint/fix.d.ts} +0 -0
  75. /package/dist/{lint-fix.mjs → lint/fix.mjs} +0 -0
  76. /package/dist/{test-coverage.d.ts → lint/index.d.ts} +0 -0
  77. /package/dist/{lint.mjs → lint/index.mjs} +0 -0
  78. /package/dist/{test-feature.d.ts → migrate.d.ts} +0 -0
  79. /package/dist/{test-ui.d.ts → seed.d.ts} +0 -0
  80. /package/dist/{test-unit.d.ts → test/coverage.d.ts} +0 -0
  81. /package/dist/{test-coverage.mjs → test/coverage.mjs} +0 -0
  82. /package/dist/{test-feature.mjs → test/feature.mjs} +0 -0
  83. /package/dist/{test-ui.mjs → test/ui.mjs} +0 -0
  84. /package/dist/{test-unit.mjs → test/unit.mjs} +0 -0
package/README.md CHANGED
@@ -37,7 +37,7 @@ pnpm test
37
37
 
38
38
  Please see our [releases](https://github.com/stacksjs/stacks/releases) page for more information on what has changed recently.
39
39
 
40
- ## 💪🏼 Contributing
40
+ ## 🚜 Contributing
41
41
 
42
42
  Please review the [Contributing Guide](https://github.com/stacksjs/contributing) for details.
43
43
 
@@ -0,0 +1,6 @@
1
+ import { frameworkPath } from "@stacksjs/path";
2
+ import { runCommands } from "@stacksjs/cli";
3
+ await runCommands([
4
+ 'pnpm -r --filter "./core/*" --filter "!./core/x-ray" build'
5
+ // build all packages except x-ray (which is a dev tool/app)
6
+ ], { verbose: true, cwd: frameworkPath(), shell: true });
package/dist/build.mjs CHANGED
@@ -2,7 +2,7 @@ import { log } from "@stacksjs/logging";
2
2
  import { hasComponents, hasFunctions } from "@stacksjs/storage";
3
3
  import { runNpmScript } from "@stacksjs/utils";
4
4
  import { NpmScript } from "@stacksjs/types";
5
- import { types as generateTypes } from "./generate.mjs";
5
+ import { types as generateTypes } from "./generate/index.mjs";
6
6
  export async function invoke(options) {
7
7
  if (options.components)
8
8
  await componentLibraries(options);
package/dist/clean.d.ts CHANGED
@@ -1,8 +1 @@
1
- import { type CleanOptions } from '@stacksjs/types';
2
- export declare function invoke(options?: CleanOptions): Promise<void>;
3
- /**
4
- * An alias of the invoke method.
5
- * @param options
6
- * @returns
7
- */
8
- export declare function clean(options: CleanOptions): Promise<void>;
1
+ export {};
package/dist/clean.mjs CHANGED
@@ -1,15 +1,11 @@
1
1
  import { log, runCommand } from "@stacksjs/cli";
2
+ import { projectPath } from "@stacksjs/path";
2
3
  import { ExitCode, NpmScript } from "@stacksjs/types";
3
- export async function invoke(options) {
4
- log.info("Running clean command...");
5
- const result = await runCommand(NpmScript.Clean, options);
6
- if (result.isOk()) {
7
- log.success("Cleaned up");
8
- process.exit(ExitCode.Success);
9
- }
10
- log.error(result.error);
11
- process.exit(ExitCode.FatalError);
12
- }
13
- export async function clean(options) {
14
- return invoke(options);
4
+ log.info("Running clean command...");
5
+ const result = await runCommand(NpmScript.Clean, { cwd: projectPath() });
6
+ if (result.isOk()) {
7
+ log.success("Cleaned up");
8
+ process.exit(ExitCode.Success);
15
9
  }
10
+ log.error(result.error);
11
+ process.exit(ExitCode.FatalError);
@@ -0,0 +1,3 @@
1
+ import { parseOptions } from "@stacksjs/cli";
2
+ const options = parseOptions();
3
+ console.log("options", options);
@@ -0,0 +1,6 @@
1
+ import { runCommands } from "@stacksjs/cli";
2
+ import { frameworkPath } from "@stacksjs/path";
3
+ await runCommands([
4
+ "pnpm buddy clean",
5
+ "pnpm install"
6
+ ], { cwd: frameworkPath(), verbose: true });
@@ -0,0 +1,4 @@
1
+ import { runCommand } from "@stacksjs/cli";
2
+ import { frameworkPath } from "@stacksjs/path";
3
+ import { NpmScript } from "@stacksjs/types";
4
+ await runCommand(NpmScript.DevDocs, { cwd: frameworkPath(), verbose: true });
@@ -1,13 +1,11 @@
1
1
  import type { DevOptions } from '@stacksjs/types';
2
- export declare function invoke(options: DevOptions): Promise<void>;
3
2
  /**
4
3
  * An alias of the invoke method.
5
4
  * @param options
6
5
  * @returns
7
6
  */
8
- export declare function dev(options: DevOptions): Promise<void>;
7
+ export declare function dev(options: DevOptions): Promise<any>;
9
8
  export declare function components(options: DevOptions): Promise<void>;
10
- export declare function docs(options: DevOptions): Promise<void>;
11
9
  export declare function desktop(options: DevOptions): Promise<void>;
12
10
  export declare function pages(options: DevOptions): Promise<void>;
13
11
  export declare function functions(options: DevOptions): Promise<void>;
@@ -1,19 +1,6 @@
1
1
  import { log } from "@stacksjs/logging";
2
2
  import { runNpmScript } from "@stacksjs/utils";
3
3
  import { NpmScript } from "@stacksjs/types";
4
- export async function invoke(options) {
5
- console.log("options are: ", options);
6
- if (options.components || options.all)
7
- await components(options);
8
- else if (options.docs || options.all)
9
- await docs(options);
10
- else if (options.pages || options.all)
11
- await pages(options);
12
- else if (options.functions || options.all)
13
- await functions(options);
14
- else if (options.desktop || options.all)
15
- await desktop(options);
16
- }
17
4
  export async function dev(options) {
18
5
  return invoke(options);
19
6
  }
@@ -21,10 +8,6 @@ export async function components(options) {
21
8
  log.info("Starting your components dev server...");
22
9
  await runNpmScript(NpmScript.DevComponents, options);
23
10
  }
24
- export async function docs(options) {
25
- log.info("Starting your docs dev server...");
26
- await runNpmScript(NpmScript.DevDocs, options);
27
- }
28
11
  export async function desktop(options) {
29
12
  log.info("Starting your Desktop engine...");
30
13
  await runNpmScript(NpmScript.DevDesktop, options);
package/dist/fresh.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { runCommands } from "@stacksjs/cli";
2
2
  import { frameworkPath } from "@stacksjs/path";
3
3
  await runCommands([
4
- "pnpm run clean",
4
+ "buddy clean",
5
5
  "pnpm install"
6
6
  ], { cwd: frameworkPath(), verbose: true });
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { log } from "@stacksjs/logging";
3
3
  import { hasComponents } from "@stacksjs/storage";
4
- import { generateComponentMeta } from "./helpers/component-meta.mjs";
4
+ import { generateComponentMeta } from "../helpers/component-meta.mjs";
5
5
  if (hasComponents())
6
6
  await generateComponentMeta();
7
7
  else
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { log } from "@stacksjs/logging";
3
3
  import { hasComponents } from "@stacksjs/storage";
4
- import { generateVsCodeCustomData } from "./helpers/vscode-custom-data.mjs";
4
+ import { generateVsCodeCustomData } from "../helpers/vscode-custom-data.mjs";
5
5
  if (hasComponents()) {
6
6
  await generateVsCodeCustomData();
7
7
  } else {
@@ -13,3 +13,5 @@ export declare function vsCodeCustomData(options?: GeneratorOptions): Promise<vo
13
13
  export declare function ideHelpers(options?: GeneratorOptions): Promise<void>;
14
14
  export declare function componentMeta(options?: GeneratorOptions): Promise<void>;
15
15
  export declare function types(options?: GeneratorOptions): Promise<void>;
16
+ export declare function migrations(): Promise<void>;
17
+ export declare function seeder(): Promise<void>;
@@ -1,9 +1,10 @@
1
1
  import { log } from "@stacksjs/logging";
2
+ import { seed } from "@stacksjs/database";
2
3
  import { Action, NpmScript } from "@stacksjs/types";
3
4
  import { runNpmScript } from "@stacksjs/utils";
4
- import { projectPath } from "@stacksjs/path";
5
5
  import { runCommand } from "@stacksjs/cli";
6
- import { runAction } from "./helpers/index.mjs";
6
+ import { frameworkPath } from "@stacksjs/path";
7
+ import { runAction } from "../helpers/index.mjs";
7
8
  export async function invoke(options) {
8
9
  if (options?.types)
9
10
  await types(options);
@@ -24,7 +25,7 @@ export async function generate(options) {
24
25
  return invoke(options);
25
26
  }
26
27
  export async function libEntries(options) {
27
- const result = await runCommand("esno .stacks/core/actions/src/generate-package-json.ts", { ...options, verbose: true, cwd: projectPath() });
28
+ const result = await runCommand("tsx .stacks/core/actions/src/generate-package-json.ts", { ...options, verbose: true, cwd: projectPath() });
28
29
  if (result.isErr()) {
29
30
  log.error("There was an error generating your library entry points.", result.error);
30
31
  process.exit();
@@ -82,3 +83,11 @@ export async function types(options) {
82
83
  }
83
84
  log.success("Types were generated successfully");
84
85
  }
86
+ export async function migrations() {
87
+ const path = frameworkPath("database/schema.prisma");
88
+ await runCommand(`npx prisma migrate dev --schema=${path}`);
89
+ log.success("Successfully updated migrations");
90
+ }
91
+ export async function seeder() {
92
+ await seed();
93
+ }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { log } from "@stacksjs/logging";
3
3
  import { hasComponents, hasFunctions } from "@stacksjs/storage";
4
- import { generateLibEntry } from "./helpers/lib-entries.mjs";
4
+ import { generateLibEntry } from "../helpers/lib-entries.mjs";
5
5
  if (hasComponents()) {
6
6
  await generateLibEntry("vue-components");
7
7
  await generateLibEntry("web-components");
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { hasComponents, hasFunctions } from "@stacksjs/storage";
3
- import { generatePackageJson } from "./helpers/package-json.mjs";
3
+ import { generatePackageJson } from "../helpers/package-json.mjs";
4
4
  if (hasComponents()) {
5
5
  await generatePackageJson("vue-components");
6
6
  await generatePackageJson("web-components");
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { log } from "@stacksjs/logging";
3
3
  import { hasComponents } from "@stacksjs/storage";
4
- import { generateVsCodeCustomData } from "./helpers/vscode-custom-data.mjs";
4
+ import { generateVsCodeCustomData } from "../helpers/vscode-custom-data.mjs";
5
5
  if (hasComponents())
6
6
  await generateVsCodeCustomData();
7
7
  else
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { generateVueCompat } from "../helpers/vue-compat.mjs";
3
+ await generateVueCompat(["wip"]);
@@ -43,11 +43,11 @@ export async function createFunctionLibraryEntryPoint() {
43
43
  export function generateEntryPointData(type) {
44
44
  let arr = [];
45
45
  if (type === "functions") {
46
- if (!library.functions.functions) {
46
+ if (!library.functions?.functions) {
47
47
  log.error("There are no functions defined to be built. Please check your config/library.ts file for potential adjustments.");
48
48
  process.exit();
49
49
  }
50
- for (const fx of library.functions.functions) {
50
+ for (const fx of library.functions?.functions) {
51
51
  if (Array.isArray(fx))
52
52
  arr.push(`export * as ${fx[1]} from '../../../functions/${fx[0]}'`);
53
53
  else
@@ -56,12 +56,12 @@ export function generateEntryPointData(type) {
56
56
  return arr.join("\r\n");
57
57
  }
58
58
  if (type === "vue-components") {
59
- if (!library.vueComponents.tags) {
59
+ if (!library.vueComponents?.tags) {
60
60
  log.error("There are no components defined to be built. Please check your config/library.ts file for potential adjustments.");
61
61
  process.exit();
62
62
  }
63
63
  arr = determineResetPreset();
64
- for (const component of library.vueComponents.tags.map((tag) => tag.name)) {
64
+ for (const component of library.vueComponents?.tags.map((tag) => tag.name)) {
65
65
  if (Array.isArray(component))
66
66
  arr.push(`export { default as ${component[1]} } from '../../../components/${component[0]}.vue'`);
67
67
  else
@@ -73,11 +73,11 @@ export function generateEntryPointData(type) {
73
73
  const imports = [...arr, "import { defineCustomElement } from 'vue'"];
74
74
  const declarations = [];
75
75
  const definitions = [];
76
- if (!library.webComponents.tags) {
76
+ if (!library.webComponents?.tags) {
77
77
  log.error("There are no components defined to be built. Please check your config/library.ts file for potential adjustments.");
78
78
  process.exit();
79
79
  }
80
- for (const component of library.webComponents.tags.map((tag) => tag.name)) {
80
+ for (const component of library.webComponents?.tags.map((tag) => tag.name)) {
81
81
  if (Array.isArray(component)) {
82
82
  imports.push(`import ${component[1]} from '../../../components/${component[0]}.vue'`);
83
83
  declarations.push(`const ${component[1]}CustomElement = defineCustomElement(${component[1]})`);
@@ -6,22 +6,22 @@ import { packageManager } from "../../package.json" assert { type: "json" };
6
6
  export async function generatePackageJson(type) {
7
7
  let name, description, directory, keywords, config, prettyName;
8
8
  if (type === "vue-components") {
9
- name = library.vueComponents.name;
10
- description = library.vueComponents.description;
9
+ name = library.vueComponents?.name;
10
+ description = library.vueComponents?.description;
11
11
  directory = "components";
12
- keywords = library.vueComponents.keywords;
12
+ keywords = library.vueComponents?.keywords;
13
13
  config = "vue-components";
14
14
  } else if (type === "web-components") {
15
- name = library.webComponents.name;
16
- description = library.webComponents.description;
15
+ name = library.webComponents?.name;
16
+ description = library.webComponents?.description;
17
17
  directory = "components";
18
- keywords = library.webComponents.keywords;
18
+ keywords = library.webComponents?.keywords;
19
19
  config = "web-components";
20
20
  } else if (type === "functions") {
21
- name = library.functions.name;
22
- description = library.functions.description;
21
+ name = library.functions?.name;
22
+ description = library.functions?.description;
23
23
  directory = "functions";
24
- keywords = library.functions.keywords;
24
+ keywords = library.functions?.keywords;
25
25
  config = "functions";
26
26
  }
27
27
  try {
@@ -1,6 +1,5 @@
1
- import type { CliOptions, CommandResult } from '@stacksjs/types';
2
- import type { Err, Result } from '@stacksjs/error-handling';
3
- export type ActionResult = Promise<Result<CommandResult<string>, Error> | Result<CommandResult<string>, Error>[] | Err<CommandResult<string>, string>>;
1
+ import type { ActionOptions, CommandResult } from '@stacksjs/types';
2
+ export type ActionResult = CommandResult;
4
3
  /**
5
4
  * Run an Action the Stacks way.
6
5
  *
@@ -8,7 +7,7 @@ export type ActionResult = Promise<Result<CommandResult<string>, Error> | Result
8
7
  * @param options The options to pass to the command.
9
8
  * @returns The result of the command.
10
9
  */
11
- export declare function runAction(action: string, options?: CliOptions): Promise<Result<CommandResult<string>, Error> | Result<CommandResult<string>, Error>[] | Err<CommandResult<string>, string>>;
10
+ export declare function runAction(action: string, options?: ActionOptions): Promise<CommandResult>;
12
11
  /**
13
12
  * Run Actions the Stacks way.
14
13
  *
@@ -16,5 +15,5 @@ export declare function runAction(action: string, options?: CliOptions): Promise
16
15
  * @param options The options to pass to the command.
17
16
  * @returns The result of the command.
18
17
  */
19
- export declare function runActions(actions: string[], options?: CliOptions): Promise<Result<CommandResult<string>, Error>[] | Result<CommandResult<string>, Error> | Err<CommandResult<string>, string>>;
18
+ export declare function runActions(actions: string[], options?: ActionOptions): Promise<CommandResult | CommandResult[]>;
20
19
  export declare function hasAction(action: string): boolean;
@@ -1,25 +1,28 @@
1
1
  import storage from "@stacksjs/storage";
2
- import { log, runCommand, runCommands } from "@stacksjs/cli";
2
+ import { italic, log, runCommand, runCommands } from "@stacksjs/cli";
3
3
  import { actionsPath, functionsPath } from "@stacksjs/path";
4
4
  import { err } from "@stacksjs/error-handling";
5
- const parseOptions = (options) => {
5
+ function parseOptions(options) {
6
6
  if (!options)
7
7
  return "";
8
8
  const parsedOptions = Object.entries(options).map(([key, value]) => {
9
- if (typeof value === "boolean")
9
+ if (key.length === 1)
10
+ return;
11
+ if (typeof value === "boolean" && value)
10
12
  return `--${key}`;
11
13
  else
12
14
  return `--${key}=${value}`;
13
15
  });
14
- return parsedOptions.join(" ").replace("----=", "");
15
- };
16
+ return parsedOptions.filter(Boolean).join(" ").replace("----=", "");
17
+ }
16
18
  export async function runAction(action, options) {
17
19
  if (!hasAction(action))
18
- return err(`The specified action "${action}" does not exist.`);
20
+ return err(`The specified action "${action}" does not exist`);
19
21
  const opts = parseOptions(options);
20
- const cmd = `npx esno ${actionsPath(`${action}.ts ${opts}`)}`;
21
- if (options?.debug)
22
- log.info("Running command:", cmd, options);
22
+ const cmd = `npx tsx ${actionsPath(`${action}.ts ${opts}`)}`;
23
+ console.log("cmd", cmd);
24
+ if (options?.verbose)
25
+ log.debug("running command:", italic(cmd));
23
26
  return options?.showSpinner ? await runCommands([cmd], options) : await runCommand(cmd, options);
24
27
  }
25
28
  export async function runActions(actions, options) {
@@ -29,7 +32,7 @@ export async function runActions(actions, options) {
29
32
  if (!hasAction(action))
30
33
  return err(`The specified action "${action}" does not exist`);
31
34
  }
32
- const commands = actions.map((action) => `npx esno ${actionsPath(`${action}.ts`)}`);
35
+ const commands = actions.map((action) => `npx tsx ${actionsPath(`${action}.ts`)}`);
33
36
  return await runCommands(commands, options);
34
37
  }
35
38
  export function hasAction(action) {
@@ -13,7 +13,7 @@ export async function generateVsCodeCustomData() {
13
13
  }
14
14
  }
15
15
  function generateComponentInfoData() {
16
- const componentsData = JSON.stringify(library.vueComponents.tags);
16
+ const componentsData = JSON.stringify(library.vueComponents?.tags);
17
17
  return `{
18
18
  "version": 1.1,
19
19
  "tags": ${componentsData}
@@ -1,8 +1,8 @@
1
1
  import { runCommand } from "@stacksjs/cli";
2
2
  import { isFile } from "@stacksjs/storage";
3
3
  import { setEnvValue } from "@stacksjs/utils";
4
- import { options } from "kolorist";
4
+ import { projectPath } from "@stacksjs/path";
5
5
  import { generateAppKey } from "@stacksjs/security";
6
6
  if (!isFile(".env"))
7
- await runCommand("cp .env.example .env", { ...options, cwd: projectPath() });
7
+ await runCommand("cp .env.example .env", { cwd: projectPath() });
8
8
  await setEnvValue("APP_KEY", await generateAppKey());
package/dist/make.d.ts CHANGED
@@ -12,8 +12,6 @@ export declare function database(options: MakeOptions): Promise<void>;
12
12
  export declare function createDatabase(options: MakeOptions): Promise<void>;
13
13
  export declare function factory(options: MakeOptions): Promise<void>;
14
14
  export declare function createFactory(options: MakeOptions): Promise<void>;
15
- export declare function migration(options: MakeOptions): Promise<void>;
16
- export declare function createMigration(options: MakeOptions): Promise<void>;
17
15
  export declare function notification(options: MakeOptions): Promise<void>;
18
16
  export declare function page(options: MakeOptions): Promise<void>;
19
17
  export declare function createPage(options: MakeOptions): Promise<void>;
@@ -23,3 +21,5 @@ export declare function language(options: MakeOptions): Promise<void>;
23
21
  export declare function createLanguage(options: MakeOptions): Promise<void>;
24
22
  export declare function stack(options: MakeOptions): Promise<void>;
25
23
  export declare function createNotification(options: MakeOptions): Promise<boolean>;
24
+ export declare function createMigration(options: MakeOptions): Promise<void>;
25
+ export declare function createModel(options: MakeOptions): Promise<void>;
package/dist/make.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { italic, log, spawn } from "@stacksjs/cli";
2
2
  import { createFolder, doesFolderExist, writeTextFile } from "@stacksjs/storage";
3
- import { resolve } from "@stacksjs/path";
3
+ import { frameworkPath, projectPath, resolve } from "@stacksjs/path";
4
4
  export async function invoke(options) {
5
5
  if (options.component)
6
6
  await component(options);
@@ -80,20 +80,6 @@ export async function factory(options) {
80
80
  export async function createFactory(options) {
81
81
  console.log("options", options);
82
82
  }
83
- export async function migration(options) {
84
- try {
85
- const name = options.name;
86
- log.info(`Creating your ${italic(name)} migration...`);
87
- await createMigration(options);
88
- log.success(`Created the ${italic(name)} migration.`);
89
- } catch (error) {
90
- log.error("There was an error creating your migration.", error);
91
- process.exit();
92
- }
93
- }
94
- export async function createMigration(options) {
95
- console.log("options", options);
96
- }
97
83
  export async function notification(options) {
98
84
  try {
99
85
  const name = options.name;
@@ -225,3 +211,58 @@ function send(): ${importOption} {
225
211
  return false;
226
212
  }
227
213
  }
214
+ export async function createMigration(options) {
215
+ const optionName = options.name;
216
+ const table = options.tableName;
217
+ const name = optionName[0].toUpperCase() + optionName.slice(1);
218
+ const path = frameworkPath(`database/migrations/${name}.ts`);
219
+ try {
220
+ await writeTextFile({
221
+ path: `${path}`,
222
+ data: `import { Kysely } from 'kysely'
223
+
224
+ export async function up(db: Kysely<any>): Promise<void> {
225
+ await db.schema
226
+ .createTable('${table}')
227
+ .addColumn('id', 'integer', (col) => col.autoIncrement().primaryKey())
228
+ .execute()
229
+ }`
230
+ });
231
+ log.success(`Successfully created your migration file at .stacks/database/migrations/${name}.ts`);
232
+ } catch (error) {
233
+ log.error(error);
234
+ }
235
+ }
236
+ export async function createModel(options) {
237
+ const optionName = options.name;
238
+ const name = optionName[0].toUpperCase() + optionName.slice(1);
239
+ const path = projectPath(`app/models/${name}.ts`);
240
+ try {
241
+ await writeTextFile({
242
+ path: `${path}`,
243
+ data: `import { faker } from '../../.stacks/core/faker/src' // stacks/faker or @stacksjs/faker
244
+ import { validate } from '../../.stacks/core/validation/src' // stacks/validate or @stacksjs/validate
245
+ import type { Model } from '../../.stacks/core/types/src' // stacks/types or @stacksjs/types
246
+
247
+ export default <Model> {
248
+ name: '${name}',
249
+ searchable: true, // boolean | IndexSettings,
250
+ authenticatable: true, // boolean | AuthSettings,
251
+ seeder: {
252
+ count: 10,
253
+ },
254
+ fields: {
255
+ name: {
256
+ type: 'String',
257
+ validation: validate.string().min(3).max(255),
258
+ factory: () => faker.name,
259
+ },
260
+ // more fields here
261
+ },
262
+ }`
263
+ });
264
+ log.success(`Successfully created your model at app/models/${name}.ts`);
265
+ } catch (error) {
266
+ log.error(error);
267
+ }
268
+ }
@@ -0,0 +1,2 @@
1
+ import { migrations } from "@stacksjs/actions/generate";
2
+ await migrations();
@@ -1,9 +1,9 @@
1
1
  import { log, spawn } from "@stacksjs/cli";
2
2
  import { projectPath } from "@stacksjs/path";
3
- import { determineDebugMode } from "@stacksjs/config";
3
+ import { determineDebugLevel } from "@stacksjs/utils";
4
4
  export async function invoke(options) {
5
5
  try {
6
- const stdio = determineDebugMode(options) ? "inherit" : "ignore";
6
+ const stdio = determineDebugLevel(options) ? "inherit" : "ignore";
7
7
  log.info("Preinstall check...");
8
8
  await spawn("npx only-allow pnpm", { stdio, cwd: projectPath() });
9
9
  log.success("Environment ready");
package/dist/release.mjs CHANGED
@@ -3,11 +3,9 @@ import { frameworkPath } from "@stacksjs/path";
3
3
  import { runActions } from "@stacksjs/actions";
4
4
  import { Action } from "@stacksjs/types";
5
5
  await runActions([
6
- Action.GeneratePackageJsons,
7
- // generate the package.json's for each package
8
- Action.LintFix,
9
- // ensure there are no lint errors
6
+ // Action.GeneratePackageJsons, // generate the package.json's for each package
7
+ // Action.LintFix, // ensure there are no lint errors
10
8
  // Action.Test, // run the tests
11
9
  Action.Bump
12
10
  // bump the versions, create the git (version) tag, generate the changelog, commit & push the changes
13
- ], { verbose: true, cwd: frameworkPath() });
11
+ ], { verbose: true, cwd: frameworkPath(), shell: true });
package/dist/seed.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { seeder } from "@stacksjs/actions/generate";
2
+ await seeder();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { parseArgs } from "@stacksjs/cli";
2
+ const options = parseArgs();
3
+ console.log("options are:", options);
File without changes
File without changes
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import { log, outro } from "@stacksjs/cli";
2
+ import storage from "@stacksjs/storage";
3
+ import { determineDebugLevel, loop } from "@stacksjs/utils";
4
+ import { frameworkPath, projectPath } from "@stacksjs/path";
5
+ await checkForUncommittedChanges("./.stacks", options);
6
+ await downloadFrameworkUpdate(options);
7
+ log.info("Updating framework...");
8
+ const exclude = ["functions/package.json", "components/vue/package.json", "components/web/package.json", "auto-imports.d.ts", "components.d.ts", "dist"];
9
+ await storage.deleteFiles(frameworkPath(), exclude);
10
+ loop(5, async () => {
11
+ await storage.deleteEmptyFolders(frameworkPath());
12
+ });
13
+ await storage.copyFolder(frameworkPath(), projectPath("./updates/.stacks"), exclude);
14
+ if (determineDebugLevel(options))
15
+ log.info("Cleanup...");
16
+ await storage.deleteFolder(projectPath("updates"));
17
+ outro("Framework updated", { startTime: perf, useSeconds: true });
18
+ process.exit();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { ExitCode, parseArgs } from "@stacksjs/cli";
2
+ import { Action } from "@stacksjs/types";
3
+ import { runAction } from "../helpers/index.mjs";
4
+ const options = parseArgs();
5
+ console.log("here is opt", options);
6
+ if (options?.packageManager || options?.all)
7
+ await runAction(Action.UpgradePackageManager, options);
8
+ if (options?.node || options?.all)
9
+ await runAction(Action.UpgradeNode, options);
10
+ else
11
+ process.exit(ExitCode.InvalidArgument);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { parseArgs, runCommand } from "@stacksjs/cli";
2
+ import { NpmScript } from "@stacksjs/types";
3
+ await runCommand(NpmScript.UpgradeNode, parseArgs());
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { parseArgs, runCommand } from "@stacksjs/cli";
2
+ import { NpmScript } from "@stacksjs/types";
3
+ await runCommand(NpmScript.UpgradePackageManager, parseArgs());
@@ -0,0 +1,5 @@
1
+ import type { UpgradeOptions } from '@stacksjs/types';
2
+ export declare function checkForUncommittedChanges(path: string | undefined, options: UpgradeOptions): Promise<void>;
3
+ export declare function downloadFrameworkUpdate(options: UpgradeOptions): Promise<void>;
4
+ export declare function updateDependencies(options: UpgradeOptions): Promise<void>;
5
+ export declare function updatePackageManager(options: UpgradeOptions): Promise<void>;