@stacksjs/actions 0.57.4 → 0.58.20

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 (158) hide show
  1. package/README.md +4 -4
  2. package/dist/src/add.js +29 -0
  3. package/dist/src/build/component-libs.js +6 -0
  4. package/dist/src/build/core.js +25 -0
  5. package/dist/src/build/stacks.js +8 -0
  6. package/dist/src/build.js +226 -0
  7. package/dist/src/bump.js +8 -0
  8. package/dist/src/changelog.js +9 -0
  9. package/dist/src/clean.js +6 -0
  10. package/dist/src/commit.js +17 -0
  11. package/dist/{copy-types.mjs → src/copy-types.js} +7 -4
  12. package/dist/src/database/seed.js +4 -0
  13. package/dist/src/deploy/index.js +31 -0
  14. package/dist/src/dev/components.js +11 -0
  15. package/dist/src/dev/docs.js +7 -0
  16. package/dist/src/dev/index.js +90 -0
  17. package/dist/{examples.mjs → src/examples.js} +18 -8
  18. package/dist/src/fresh.js +18 -0
  19. package/dist/src/generate/component-meta.js +57 -0
  20. package/dist/src/generate/ide-helpers.js +83 -0
  21. package/dist/src/generate/index.js +161 -0
  22. package/dist/src/generate/lib-entries.js +168 -0
  23. package/dist/src/generate/vscode-custom-data.js +82 -0
  24. package/dist/src/generate/vue-compat.js +18 -0
  25. package/dist/{helpers/component-meta.mjs → src/helpers/component-meta.js} +13 -13
  26. package/dist/src/helpers/index.js +56 -0
  27. package/dist/src/helpers/lib-entries.js +160 -0
  28. package/dist/src/helpers/package-json.js +135 -0
  29. package/dist/src/helpers/utils.js +56 -0
  30. package/dist/src/helpers/vscode-custom-data.js +75 -0
  31. package/dist/src/helpers/vue-compat.js +16 -0
  32. package/dist/src/index.js +577 -0
  33. package/dist/src/key-generate.js +10 -0
  34. package/dist/src/lint/fix.js +8 -0
  35. package/dist/src/lint/index.js +21 -0
  36. package/dist/{make.mjs → src/make.js} +71 -49
  37. package/dist/src/prepublish.js +14 -0
  38. package/dist/src/release.js +545 -0
  39. package/dist/src/test/coverage.js +6 -0
  40. package/dist/src/test/feature.js +6 -0
  41. package/dist/src/test/ui.js +6 -0
  42. package/dist/src/test/unit.js +6 -0
  43. package/dist/src/test.js +6 -0
  44. package/dist/src/tinker.js +5 -0
  45. package/dist/src/typecheck.js +6 -0
  46. package/dist/src/types.js +21 -0
  47. package/dist/src/upgrade/dependencies.js +6 -0
  48. package/dist/src/upgrade/framework.js +1 -0
  49. package/dist/src/upgrade/index.js +1 -0
  50. package/dist/src/upgrade.js +39 -0
  51. package/package.json +53 -239
  52. package/LICENSE.md +0 -21
  53. package/dist/add.d.ts +0 -11
  54. package/dist/add.mjs +0 -20
  55. package/dist/build/component-libs.d.ts +0 -1
  56. package/dist/build/component-libs.mjs +0 -4
  57. package/dist/build/core.d.ts +0 -1
  58. package/dist/build/core.mjs +0 -6
  59. package/dist/build/stacks.d.ts +0 -1
  60. package/dist/build/stacks.mjs +0 -12
  61. package/dist/build.d.ts +0 -14
  62. package/dist/build.mjs +0 -68
  63. package/dist/bump.d.ts +0 -1
  64. package/dist/bump.mjs +0 -6
  65. package/dist/changelog.d.ts +0 -1
  66. package/dist/changelog.mjs +0 -6
  67. package/dist/clean.d.ts +0 -1
  68. package/dist/clean.mjs +0 -10
  69. package/dist/commit.d.ts +0 -8
  70. package/dist/commit.mjs +0 -11
  71. package/dist/copy-types.d.ts +0 -5
  72. package/dist/deploy/domains.d.ts +0 -1
  73. package/dist/deploy/domains.mjs +0 -7
  74. package/dist/deploy/index.d.ts +0 -1
  75. package/dist/deploy/index.mjs +0 -3
  76. package/dist/dev/components.d.ts +0 -1
  77. package/dist/dev/components.mjs +0 -4
  78. package/dist/dev/docs.d.ts +0 -1
  79. package/dist/dev/docs.mjs +0 -4
  80. package/dist/dev/index.d.ts +0 -5
  81. package/dist/dev/index.mjs +0 -20
  82. package/dist/examples.d.ts +0 -10
  83. package/dist/fresh.d.ts +0 -1
  84. package/dist/fresh.mjs +0 -6
  85. package/dist/generate/component-meta.d.ts +0 -5
  86. package/dist/generate/component-meta.mjs +0 -8
  87. package/dist/generate/ide-helpers.d.ts +0 -6
  88. package/dist/generate/ide-helpers.mjs +0 -9
  89. package/dist/generate/index.d.ts +0 -17
  90. package/dist/generate/index.mjs +0 -93
  91. package/dist/generate/lib-entries.d.ts +0 -2
  92. package/dist/generate/lib-entries.mjs +0 -14
  93. package/dist/generate/settings.d.ts +0 -1
  94. package/dist/generate/settings.mjs +0 -1
  95. package/dist/generate/vscode-custom-data.d.ts +0 -6
  96. package/dist/generate/vscode-custom-data.mjs +0 -8
  97. package/dist/generate/vue-compat.d.ts +0 -6
  98. package/dist/generate/vue-compat.mjs +0 -3
  99. package/dist/helpers/component-meta.d.ts +0 -22
  100. package/dist/helpers/index.d.ts +0 -6
  101. package/dist/helpers/index.mjs +0 -6
  102. package/dist/helpers/lib-entries.d.ts +0 -13
  103. package/dist/helpers/lib-entries.mjs +0 -101
  104. package/dist/helpers/package-json.d.ts +0 -3
  105. package/dist/helpers/package-json.mjs +0 -82
  106. package/dist/helpers/utils.d.ts +0 -19
  107. package/dist/helpers/utils.mjs +0 -40
  108. package/dist/helpers/vscode-custom-data.d.ts +0 -1
  109. package/dist/helpers/vscode-custom-data.mjs +0 -22
  110. package/dist/helpers/vue-compat.d.ts +0 -1
  111. package/dist/helpers/vue-compat.mjs +0 -12
  112. package/dist/index.d.ts +0 -1
  113. package/dist/index.mjs +0 -1
  114. package/dist/key-generate.d.ts +0 -1
  115. package/dist/key-generate.mjs +0 -8
  116. package/dist/lint/fix.d.ts +0 -1
  117. package/dist/lint/fix.mjs +0 -4
  118. package/dist/lint/index.d.ts +0 -1
  119. package/dist/lint/index.mjs +0 -14
  120. package/dist/make.d.ts +0 -25
  121. package/dist/migrate.d.ts +0 -1
  122. package/dist/migrate.mjs +0 -2
  123. package/dist/preinstall.d.ts +0 -8
  124. package/dist/preinstall.mjs +0 -17
  125. package/dist/prepublish.d.ts +0 -1
  126. package/dist/prepublish.mjs +0 -11
  127. package/dist/release.d.ts +0 -2
  128. package/dist/release.mjs +0 -16
  129. package/dist/seed.d.ts +0 -1
  130. package/dist/seed.mjs +0 -2
  131. package/dist/test/coverage.d.ts +0 -1
  132. package/dist/test/coverage.mjs +0 -4
  133. package/dist/test/feature.d.ts +0 -1
  134. package/dist/test/feature.mjs +0 -4
  135. package/dist/test/ui.d.ts +0 -1
  136. package/dist/test/ui.mjs +0 -4
  137. package/dist/test/unit.d.ts +0 -1
  138. package/dist/test/unit.mjs +0 -4
  139. package/dist/test.d.ts +0 -1
  140. package/dist/test.mjs +0 -4
  141. package/dist/tinker.d.ts +0 -1
  142. package/dist/tinker.mjs +0 -3
  143. package/dist/typecheck.d.ts +0 -1
  144. package/dist/typecheck.mjs +0 -4
  145. package/dist/types.d.ts +0 -8
  146. package/dist/types.mjs +0 -14
  147. package/dist/upgrade/dependencies.d.ts +0 -0
  148. package/dist/upgrade/dependencies.mjs +0 -0
  149. package/dist/upgrade/framework.d.ts +0 -0
  150. package/dist/upgrade/framework.mjs +0 -0
  151. package/dist/upgrade/index.d.ts +0 -0
  152. package/dist/upgrade/index.mjs +0 -0
  153. package/dist/upgrade/node.d.ts +0 -0
  154. package/dist/upgrade/node.mjs +0 -0
  155. package/dist/upgrade/package-manager.d.ts +0 -0
  156. package/dist/upgrade/package-manager.mjs +0 -0
  157. package/dist/upgrade.d.ts +0 -5
  158. package/dist/upgrade.mjs +0 -55
package/dist/fresh.mjs DELETED
@@ -1,6 +0,0 @@
1
- import { runCommands } from "@stacksjs/cli";
2
- import { frameworkPath } from "@stacksjs/path";
3
- await runCommands([
4
- "buddy clean",
5
- "pnpm install"
6
- ], { cwd: frameworkPath(), verbose: true });
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * This action generates the component meta.
4
- */
5
- export {};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import { log } from "@stacksjs/logging";
3
- import { hasComponents } from "@stacksjs/storage";
4
- import { generateComponentMeta } from "../helpers/component-meta.mjs";
5
- if (hasComponents())
6
- await generateComponentMeta();
7
- else
8
- log.info("No components found. Skipping component meta generation.");
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * This action generates the web-types.json & custom-elements.json
4
- * files for the components.
5
- */
6
- export {};
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import { log } from "@stacksjs/logging";
3
- import { hasComponents } from "@stacksjs/storage";
4
- import { generateVsCodeCustomData } from "../helpers/vscode-custom-data.mjs";
5
- if (hasComponents()) {
6
- await generateVsCodeCustomData();
7
- } else {
8
- log.info("No components found. Skipping IDE helper generation.");
9
- }
@@ -1,17 +0,0 @@
1
- import type { GeneratorOptions } from '@stacksjs/types';
2
- export declare function invoke(options?: GeneratorOptions): Promise<void>;
3
- /**
4
- * An alias of the invoke method.
5
- * @param options
6
- * @returns
7
- */
8
- export declare function generate(options: GeneratorOptions): Promise<void>;
9
- export declare function libEntries(options: GeneratorOptions): Promise<void>;
10
- export declare function vueCompat(options?: GeneratorOptions): Promise<void>;
11
- export declare function webTypes(options?: GeneratorOptions): Promise<void>;
12
- export declare function vsCodeCustomData(options?: GeneratorOptions): Promise<void>;
13
- export declare function ideHelpers(options?: GeneratorOptions): Promise<void>;
14
- export declare function componentMeta(options?: GeneratorOptions): Promise<void>;
15
- export declare function types(options?: GeneratorOptions): Promise<void>;
16
- export declare function migrations(): Promise<void>;
17
- export declare function seeder(): Promise<void>;
@@ -1,93 +0,0 @@
1
- import { log } from "@stacksjs/logging";
2
- import { seed } from "@stacksjs/database";
3
- import { Action, NpmScript } from "@stacksjs/types";
4
- import { runNpmScript } from "@stacksjs/utils";
5
- import { runCommand } from "@stacksjs/cli";
6
- import { frameworkPath, projectPath } from "@stacksjs/path";
7
- import { runAction } from "../helpers/index.mjs";
8
- export async function invoke(options) {
9
- if (options?.types)
10
- await types(options);
11
- else if (options?.entries)
12
- await libEntries(options);
13
- else if (options?.webTypes)
14
- await webTypes(options);
15
- else if (options?.customData)
16
- await vsCodeCustomData(options);
17
- else if (options?.ideHelpers)
18
- await ideHelpers(options);
19
- else if (options?.vueCompatibility)
20
- await vueCompat(options);
21
- else if (options?.componentMeta)
22
- await componentMeta(options);
23
- }
24
- export async function generate(options) {
25
- return invoke(options);
26
- }
27
- export async function libEntries(options) {
28
- const result = await runAction(Action.GenerateLibraryEntries, { ...options, verbose: true, cwd: projectPath() });
29
- if (result.isErr()) {
30
- log.error("There was an error generating your library entry points", result.error);
31
- process.exit();
32
- }
33
- log.success("Library entry points generated successfully");
34
- }
35
- export async function vueCompat(options) {
36
- const result = await runNpmScript(NpmScript.GenerateVueCompat, options);
37
- if (result.isErr()) {
38
- log.error("There was an error generating Vue 2 compatibility.", result.error);
39
- process.exit();
40
- }
41
- log.success("Libraries are now Vue 2 & 3 compatible");
42
- }
43
- export async function webTypes(options) {
44
- const result = await runNpmScript(NpmScript.GenerateWebTypes, options);
45
- if (result.isErr()) {
46
- log.error("There was an error generating the web-types.json file.", result.error);
47
- process.exit();
48
- }
49
- log.success("Successfully generated the web-types.json file");
50
- }
51
- export async function vsCodeCustomData(options) {
52
- const result = await runNpmScript(NpmScript.GenerateVsCodeCustomData, options);
53
- if (result.isErr()) {
54
- log.error("There was an error generating the custom-elements.json file.", result.error);
55
- process.exit();
56
- }
57
- await runAction(Action.LintFix, { verbose: true });
58
- log.success("Successfully generated the custom-elements.json file");
59
- }
60
- export async function ideHelpers(options) {
61
- const result = await runNpmScript(NpmScript.GenerateIdeHelpers, options);
62
- if (result.isErr()) {
63
- log.error("There was an error generating IDE helpers.", result.error);
64
- process.exit();
65
- }
66
- await runAction(Action.LintFix, { verbose: true });
67
- log.success("Successfully generated IDE helpers");
68
- }
69
- export async function componentMeta(options) {
70
- const result = await runNpmScript(NpmScript.GenerateComponentMeta, options);
71
- if (result.isErr()) {
72
- log.error("There was an error generating your component meta information.", result.error);
73
- process.exit();
74
- }
75
- await runAction(Action.LintFix, { verbose: true });
76
- log.success("Successfully generated component meta information");
77
- }
78
- export async function types(options) {
79
- const result = await runNpmScript(NpmScript.GenerateTypes, options);
80
- if (result.isErr()) {
81
- log.error("There was an error generating your types.", result.error);
82
- process.exit();
83
- }
84
- log.success("Types were generated successfully");
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,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env node
2
- import { log } from "@stacksjs/logging";
3
- import { hasComponents, hasFunctions } from "@stacksjs/storage";
4
- import { generateLibEntry } from "../helpers/lib-entries.mjs";
5
- if (hasComponents()) {
6
- await generateLibEntry("vue-components");
7
- await generateLibEntry("web-components");
8
- } else {
9
- log.info("No components found. Skipping building component entry points.");
10
- }
11
- if (hasFunctions())
12
- await generateLibEntry("functions");
13
- else
14
- log.info("No functions found. Skipping building function entry point.");
@@ -1 +0,0 @@
1
- #!/usr/bin/env node
@@ -1 +0,0 @@
1
- #!/usr/bin/env node
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * This action generates the web-types.json & custom-elements.json
4
- * files for the components.
5
- */
6
- export {};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import { log } from "@stacksjs/logging";
3
- import { hasComponents } from "@stacksjs/storage";
4
- import { generateVsCodeCustomData } from "../helpers/vscode-custom-data.mjs";
5
- if (hasComponents())
6
- await generateVsCodeCustomData();
7
- else
8
- log.info("No components found. Skipping VS Code custom data generation.");
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Thanks for inspiration:
4
- * https://github.com/vueuse/vueuse/blob/main/scripts/fix-types.ts
5
- */
6
- export {};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { generateVueCompat } from "../helpers/vue-compat.mjs";
3
- await generateVueCompat(["wip"]);
@@ -1,22 +0,0 @@
1
- import { type ComponentMeta } from 'vue-component-meta';
2
- /**
3
- * ℹ️ Useful Links
4
- *
5
- * vue-component-meta tests: https://github.com/johnsoncodehk/volar/blob/master/vue-language-tools/vue-component-meta/tests/index.spec.ts
6
- * Discord thread about improving vue-component-meta: https://discord.com/channels/793943652350427136/1027819645677350912
7
- * GitHub issue for improving vue-component-meta based on runtime/dynamic props: https://github.com/johnsoncodehk/volar/issues/1854
8
- * Discord chat: https://discord.com/channels/793943652350427136/1027819645677350912
9
- * original script: https://raw.githubusercontent.com/jd-solanki/anu/main/scripts/gen-component-meta.ts
10
- */
11
- export declare function generateComponentMeta(): Promise<void>;
12
- export interface ComponentApiProps {
13
- name: ComponentMeta['props'][number]['name'];
14
- description: ComponentMeta['props'][number]['description'];
15
- type: ComponentMeta['props'][number]['type'];
16
- default: ComponentMeta['props'][number]['default'];
17
- }
18
- export interface ComponentApi {
19
- props: ComponentApiProps[];
20
- events: ComponentMeta['events'];
21
- slots: ComponentMeta['slots'];
22
- }
@@ -1,6 +0,0 @@
1
- export * from './component-meta';
2
- export * from './lib-entries';
3
- export * from './package-json';
4
- export * from './utils';
5
- export * from './vscode-custom-data';
6
- export * from './vue-compat';
@@ -1,6 +0,0 @@
1
- export * from "./component-meta.mjs";
2
- export * from "./lib-entries.mjs";
3
- export * from "./package-json.mjs";
4
- export * from "./utils.mjs";
5
- export * from "./vscode-custom-data.mjs";
6
- export * from "./vue-compat.mjs";
@@ -1,13 +0,0 @@
1
- import type { LibraryType } from '@stacksjs/path';
2
- /**
3
- * Based on the config values, this method
4
- * will generate the library entry points.
5
- *
6
- * @param type LibraryType
7
- */
8
- export declare function generateLibEntry(type: LibraryType): Promise<void>;
9
- export declare function createLibraryEntryPoint(type: LibraryType): Promise<void>;
10
- export declare function createVueLibraryEntryPoint(type?: LibraryType): Promise<void>;
11
- export declare function createWebComponentLibraryEntryPoint(type?: LibraryType): Promise<void>;
12
- export declare function createFunctionLibraryEntryPoint(type?: LibraryType): Promise<void>;
13
- export declare function generateEntryPointData(type: LibraryType): string;
@@ -1,101 +0,0 @@
1
- import { log } from "@stacksjs/logging";
2
- import { kebabCase } from "@stacksjs/strings";
3
- import { componentsPath, functionsPath, libraryEntryPath } from "@stacksjs/path";
4
- import { writeTextFile } from "@stacksjs/storage";
5
- import { determineResetPreset } from "@stacksjs/utils";
6
- import { library } from "@stacksjs/config";
7
- import { ExitCode } from "@stacksjs/types";
8
- export async function generateLibEntry(type) {
9
- await createLibraryEntryPoint(type);
10
- }
11
- export async function createLibraryEntryPoint(type) {
12
- if (type === "vue-components")
13
- await createVueLibraryEntryPoint();
14
- if (type === "web-components")
15
- await createWebComponentLibraryEntryPoint();
16
- if (type === "functions")
17
- await createFunctionLibraryEntryPoint();
18
- }
19
- export async function createVueLibraryEntryPoint(type = "vue-components") {
20
- log.info("Creating the Vue component library entry point...");
21
- await writeTextFile({
22
- path: libraryEntryPath(type),
23
- data: generateEntryPointData(type)
24
- }).catch((err) => {
25
- log.error(new Error("There was an error generating the Vue component library entry point.", err));
26
- process.exit(ExitCode.FatalError);
27
- });
28
- log.success("Created the Vue component library entry point");
29
- }
30
- export async function createWebComponentLibraryEntryPoint(type = "web-components") {
31
- log.info("Creating the Web Component library entry point...");
32
- await writeTextFile({
33
- path: libraryEntryPath(type),
34
- data: generateEntryPointData(type)
35
- }).catch((err) => {
36
- log.error(new Error("There was an error generating the Web Component library entry point", err));
37
- process.exit(ExitCode.FatalError);
38
- });
39
- log.success("Created Web Component library entry point");
40
- }
41
- export async function createFunctionLibraryEntryPoint(type = "functions") {
42
- log.info("Creating the Function library entry point...");
43
- await writeTextFile({
44
- path: libraryEntryPath(type),
45
- data: generateEntryPointData(type)
46
- }).catch((err) => {
47
- log.error(new Error("There was an error generating Function library entry point", err));
48
- process.exit(ExitCode.FatalError);
49
- });
50
- log.success("Created Functions library entry point");
51
- }
52
- export function generateEntryPointData(type) {
53
- let arr = [];
54
- if (type === "functions") {
55
- if (!library.functions?.functions) {
56
- log.error(new Error("There are no functions defined to be built. Please check your config/library.ts file for potential adjustments"));
57
- process.exit();
58
- }
59
- for (const fx of library.functions?.functions) {
60
- if (Array.isArray(fx))
61
- arr.push(`export * as ${fx[1]} from '${functionsPath(fx[0])}'`);
62
- else
63
- arr.push(`export * from '${functionsPath(fx)}'`);
64
- }
65
- return arr.join("\r\n");
66
- }
67
- if (type === "vue-components") {
68
- if (!library.vueComponents?.tags) {
69
- log.error(new Error("There are no components defined to be built. Please check your config/library.ts file for potential adjustments"));
70
- process.exit();
71
- }
72
- arr = determineResetPreset();
73
- for (const component of library.vueComponents?.tags.map((tag) => tag.name)) {
74
- if (Array.isArray(component))
75
- arr.push(`export { default as ${component[1]} } from '${componentsPath(component[0])}.vue'`);
76
- else
77
- arr.push(`export { default as ${component} } from '${componentsPath(component)}.vue'`);
78
- }
79
- return arr.join("\r\n");
80
- }
81
- arr = determineResetPreset();
82
- const imports = [...arr, "import { defineCustomElement } from 'vue'"];
83
- const declarations = [];
84
- const definitions = [];
85
- if (!library.webComponents?.tags) {
86
- log.error(new Error("There are no components defined to be built. Please check your config/library.ts file for potential adjustments"));
87
- process.exit();
88
- }
89
- for (const component of library.webComponents?.tags.map((tag) => tag.name)) {
90
- if (Array.isArray(component)) {
91
- imports.push(`import ${component[1]} from '${componentsPath(component[0])}.vue'`);
92
- declarations.push(`const ${component[1]}CustomElement = defineCustomElement(${component[1]})`);
93
- definitions.push(`customElements.define('${kebabCase(component[1])}', ${component[1]}CustomElement)`);
94
- } else {
95
- imports.push(`import ${component} from '${componentsPath(component)}.vue'`);
96
- declarations.push(`const ${component}CustomElement = defineCustomElement(${component})`);
97
- definitions.push(`customElements.define('${kebabCase(component)}', ${component}CustomElement)`);
98
- }
99
- }
100
- return [...imports, ...declarations, ...definitions].join("\r\n");
101
- }
@@ -1,3 +0,0 @@
1
- type PackageJsonType = 'vue-components' | 'web-components' | 'functions';
2
- export declare function generatePackageJson(type: PackageJsonType): Promise<void>;
3
- export {};
@@ -1,82 +0,0 @@
1
- import { log } from "@stacksjs/logging";
2
- import { writeTextFile } from "@stacksjs/storage";
3
- import { packageJsonPath } from "@stacksjs/path";
4
- import { library, packageManager } from "@stacksjs/config";
5
- export async function generatePackageJson(type) {
6
- let name, description, directory, keywords, config, prettyName;
7
- if (type === "vue-components") {
8
- name = library.vueComponents?.name;
9
- description = library.vueComponents?.description;
10
- directory = "components";
11
- keywords = library.vueComponents?.keywords;
12
- config = "vue-components";
13
- } else if (type === "web-components") {
14
- name = library.webComponents?.name;
15
- description = library.webComponents?.description;
16
- directory = "components";
17
- keywords = library.webComponents?.keywords;
18
- config = "web-components";
19
- } else if (type === "functions") {
20
- name = library.functions?.name;
21
- description = library.functions?.description;
22
- directory = "functions";
23
- keywords = library.functions?.keywords;
24
- config = "functions";
25
- }
26
- try {
27
- await writeTextFile({
28
- path: packageJsonPath(type),
29
- data: `{
30
- "name": "${name}",
31
- "type": "module",
32
- "version": "",
33
- "packageManager": "${await packageManager()}",
34
- "description": "${description}",
35
- "author": "${library.author}",
36
- "license": "MIT",
37
- "homepage": "https://github.com/${library.repository}/tree/main/${directory}#readme",
38
- "repository": {
39
- "type": "git",
40
- "url": "git+https://github.com/${library.repository}.git",
41
- "directory": "${directory}"
42
- },
43
- "bugs": {
44
- "url": "https://github.com/${library.repository}/issues"
45
- },
46
- "keywords": ${JSON.stringify(keywords)},
47
- "contributors": ${JSON.stringify(library.contributors)},
48
- "exports": {
49
- ".": {
50
- "types": "./dist/index.d.ts",
51
- "require": "./dist/index.cjs",
52
- "import": "./dist/index.js"
53
- }
54
- },
55
- "main": "dist/index.cjs",
56
- "module": "dist/index.js",
57
- "types": "dist/index.d.ts",
58
- "files": [
59
- "dist",
60
- "README.md"
61
- ],
62
- "scripts": {
63
- "build": "vite build -c ../build/${config}.ts",
64
- "prepublishOnly": "pnpm run build"
65
- },
66
- "devDependencies": {
67
- "stacks": "workspace:*"
68
- }
69
- }
70
- `
71
- });
72
- if (type === "vue-components")
73
- prettyName = "Vue Component library";
74
- else if (type === "web-components")
75
- prettyName = "Web Component library";
76
- else if (type === "functions")
77
- prettyName = "Function Library";
78
- log.success(`Created the ${prettyName} package.json file`);
79
- } catch (err) {
80
- log.error(`There was an error creating the ${prettyName} package.json`, err);
81
- }
82
- }
@@ -1,19 +0,0 @@
1
- import type { ActionOptions, CommandResult } from '@stacksjs/types';
2
- export type ActionResult = CommandResult;
3
- /**
4
- * Run an Action the Stacks way.
5
- *
6
- * @param action The action to invoke.
7
- * @param options The options to pass to the command.
8
- * @returns The result of the command.
9
- */
10
- export declare function runAction(action: string, options?: ActionOptions): Promise<CommandResult>;
11
- /**
12
- * Run Actions the Stacks way.
13
- *
14
- * @param actions The actions to invoke.
15
- * @param options The options to pass to the command.
16
- * @returns The result of the command.
17
- */
18
- export declare function runActions(actions: string[], options?: ActionOptions): Promise<CommandResult | CommandResult[]>;
19
- export declare function hasAction(action: string): boolean;
@@ -1,40 +0,0 @@
1
- import * as storage from "@stacksjs/storage";
2
- import { italic, log, runCommand, runCommands } from "@stacksjs/cli";
3
- import { actionsPath, functionsPath } from "@stacksjs/path";
4
- import { err } from "@stacksjs/error-handling";
5
- function parseOptions(options) {
6
- if (!options)
7
- return "";
8
- const parsedOptions = Object.entries(options).map(([key, value]) => {
9
- if (key.length === 1)
10
- return `-${key}=${value}`;
11
- if (typeof value === "boolean" && value)
12
- return `--${key}`;
13
- return `--${key}=${value}`;
14
- });
15
- return parsedOptions.filter(Boolean).join(" ").replace("----=", "");
16
- }
17
- export async function runAction(action, options) {
18
- if (!hasAction(action))
19
- return err(`The specified action "${action}" does not exist`);
20
- const opts = parseOptions(options);
21
- const cmd = `npx tsx ${actionsPath(`${action}.ts ${opts}`)}`;
22
- if (options?.verbose)
23
- log.debug("running command:", italic(cmd));
24
- return options?.showSpinner ? await runCommands([cmd], options) : await runCommand(cmd, options);
25
- }
26
- export async function runActions(actions, options) {
27
- if (!actions.length)
28
- return err("No actions were specified");
29
- for (const action of actions) {
30
- if (!hasAction(action))
31
- return err(`The specified action "${action}" does not exist`);
32
- }
33
- const commands = actions.map((action) => `npx tsx ${actionsPath(`${action}.ts`)}`);
34
- return await runCommands(commands, options);
35
- }
36
- export function hasAction(action) {
37
- if (storage.isFile(functionsPath(`actions/${action}.ts`)))
38
- return true;
39
- return storage.isFile(actionsPath(`${action}.ts`));
40
- }
@@ -1 +0,0 @@
1
- export declare function generateVsCodeCustomData(): Promise<void>;
@@ -1,22 +0,0 @@
1
- import { log } from "@stacksjs/logging";
2
- import { customElementsDataPath } from "@stacksjs/path";
3
- import { writeTextFile } from "@stacksjs/storage";
4
- import { library } from "@stacksjs/config";
5
- export async function generateVsCodeCustomData() {
6
- try {
7
- await writeTextFile({
8
- path: customElementsDataPath(),
9
- data: generateComponentInfoData()
10
- });
11
- } catch (err) {
12
- log.error("There was an error generating the VS Code custom data file.", err);
13
- }
14
- }
15
- function generateComponentInfoData() {
16
- const componentsData = JSON.stringify(library.vueComponents?.tags);
17
- return `{
18
- "version": 1.1,
19
- "tags": ${componentsData}
20
- }
21
- `;
22
- }
@@ -1 +0,0 @@
1
- export declare function generateVueCompat(paths: string[]): Promise<void>;
@@ -1,12 +0,0 @@
1
- import fg from "fast-glob";
2
- import fs from "fs-extra";
3
- export async function generateVueCompat(paths) {
4
- const files = await fg(paths, {
5
- onlyFiles: true
6
- });
7
- for (const f of files) {
8
- const raw = await fs.readFile(f, "utf-8");
9
- const changed = raw.replace(/"@vue\/composition-api"/g, "'vue-demi'").replace(/"vue"/g, "'vue-demi'").replace(/'vue'/g, "'vue-demi'");
10
- await fs.writeFile(f, changed, "utf-8");
11
- }
12
- }
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './helpers';
package/dist/index.mjs DELETED
@@ -1 +0,0 @@
1
- export * from "./helpers/index.mjs";
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- import { runCommand } from "@stacksjs/cli";
2
- import { isFile } from "@stacksjs/storage";
3
- import { setEnvValue } from "@stacksjs/utils";
4
- import { projectPath } from "@stacksjs/path";
5
- import { generateAppKey } from "@stacksjs/security";
6
- if (!isFile(".env"))
7
- await runCommand("cp .env.example .env", { cwd: projectPath() });
8
- await setEnvValue("APP_KEY", await generateAppKey());
@@ -1 +0,0 @@
1
- export {};
package/dist/lint/fix.mjs DELETED
@@ -1,4 +0,0 @@
1
- import { runCommands } from "@stacksjs/cli";
2
- import { projectPath } from "@stacksjs/path";
3
- import { NpmScript } from "@stacksjs/types";
4
- await runCommands([NpmScript.LintFix], { cwd: projectPath(), showSpinner: true, spinnerText: "Auto-fixing lint issues..." });
@@ -1 +0,0 @@
1
- export default function lintAction(): Promise<void>;
@@ -1,14 +0,0 @@
1
- import { ExitCode, runCommands } from "@stacksjs/cli";
2
- import { projectPath } from "@stacksjs/path";
3
- import { NpmScript } from "@stacksjs/types";
4
- export default async function lintAction() {
5
- const result = await runCommands([
6
- NpmScript.Lint,
7
- NpmScript.LintPackageJson
8
- ], { cwd: projectPath(), verbose: true });
9
- if (Array.isArray(result)) {
10
- if (result.map((r) => r.isErr()).includes(true))
11
- process.exit(ExitCode.FatalError);
12
- }
13
- process.exit(ExitCode.Success);
14
- }
package/dist/make.d.ts DELETED
@@ -1,25 +0,0 @@
1
- import type { MakeOptions } from '@stacksjs/types';
2
- export declare function invoke(options: MakeOptions): Promise<void>;
3
- /**
4
- * An alias of the invoke method.
5
- * @param options
6
- * @returns
7
- */
8
- export declare function make(options: MakeOptions): Promise<void>;
9
- export declare function component(options: MakeOptions): Promise<void>;
10
- export declare function createComponent(options: MakeOptions): Promise<void>;
11
- export declare function database(options: MakeOptions): Promise<void>;
12
- export declare function createDatabase(options: MakeOptions): Promise<void>;
13
- export declare function factory(options: MakeOptions): Promise<void>;
14
- export declare function createFactory(options: MakeOptions): Promise<void>;
15
- export declare function notification(options: MakeOptions): Promise<void>;
16
- export declare function page(options: MakeOptions): Promise<void>;
17
- export declare function createPage(options: MakeOptions): Promise<void>;
18
- export declare function fx(options: MakeOptions): Promise<void>;
19
- export declare function createFunction(options: MakeOptions): Promise<void>;
20
- export declare function language(options: MakeOptions): Promise<void>;
21
- export declare function createLanguage(options: MakeOptions): Promise<void>;
22
- export declare function stack(options: MakeOptions): Promise<void>;
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/migrate.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/migrate.mjs DELETED
@@ -1,2 +0,0 @@
1
- import { migrations as generateMigrations } from "./generate/index.mjs";
2
- await generateMigrations();
@@ -1,8 +0,0 @@
1
- import type { PreinstallOptions } from '@stacksjs/types';
2
- export declare function invoke(options?: PreinstallOptions): Promise<void>;
3
- /**
4
- * An alias of the invoke method.
5
- * @param options
6
- * @returns
7
- */
8
- export declare function preinstall(options: PreinstallOptions): Promise<void>;