@stacksjs/actions 0.58.73 → 0.59.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/action.d.ts +36 -0
  2. package/dist/add.d.ts +6 -0
  3. package/dist/build/component-libs.d.ts +1 -0
  4. package/dist/build/core.d.ts +1 -0
  5. package/dist/build/stacks.d.ts +1 -0
  6. package/dist/build.d.ts +9 -0
  7. package/dist/bump.d.ts +1 -0
  8. package/dist/changelog.d.ts +1 -0
  9. package/dist/clean.d.ts +1 -0
  10. package/dist/commit.d.ts +3 -0
  11. package/dist/copy-types.d.ts +5 -0
  12. package/dist/database/seed.d.ts +1 -0
  13. package/dist/deploy/index.d.ts +1 -0
  14. package/dist/dev/components.d.ts +1 -0
  15. package/dist/dev/docs.d.ts +1 -0
  16. package/dist/dev/index.d.ts +10 -0
  17. package/dist/examples.d.ts +5 -0
  18. package/dist/fresh.d.ts +1 -0
  19. package/dist/generate/component-meta.d.ts +5 -0
  20. package/dist/generate/ide-helpers.d.ts +6 -0
  21. package/dist/generate/index.d.ts +13 -0
  22. package/dist/generate/lib-entries.d.ts +2 -0
  23. package/dist/generate/vscode-custom-data.d.ts +6 -0
  24. package/dist/helpers/component-meta.d.ts +22 -0
  25. package/dist/helpers/lib-entries.d.ts +13 -0
  26. package/dist/helpers/package-json.d.ts +3 -0
  27. package/dist/helpers/utils.d.ts +18 -0
  28. package/dist/helpers/vscode-custom-data.d.ts +2 -0
  29. package/dist/index.d.ts +7 -0
  30. package/dist/key-generate.d.ts +1 -0
  31. package/dist/lint/fix.d.ts +1 -0
  32. package/dist/lint/index.d.ts +1 -0
  33. package/dist/make.d.ts +20 -0
  34. package/dist/prepublish.d.ts +1 -0
  35. package/dist/release.d.ts +2 -0
  36. package/dist/test/coverage.d.ts +1 -0
  37. package/dist/test/feature.d.ts +1 -0
  38. package/dist/test/ui.d.ts +1 -0
  39. package/dist/test/unit.d.ts +1 -0
  40. package/dist/test.d.ts +1 -0
  41. package/dist/tinker.d.ts +1 -0
  42. package/dist/typecheck.d.ts +1 -0
  43. package/dist/types.d.ts +3 -0
  44. package/dist/upgrade/dependencies.d.ts +1 -0
  45. package/dist/upgrade/framework.d.ts +1 -0
  46. package/dist/upgrade/index.d.ts +1 -0
  47. package/dist/upgrade.d.ts +4 -0
  48. package/package.json +5 -3
  49. package/src/bump.ts +8 -3
  50. package/src/check/ports.ts +11 -8
  51. package/src/deploy/index.ts +2 -6
  52. package/src/dev/index.ts +1 -1
  53. package/src/find-projects.ts +1 -1
  54. package/src/generate/index.ts +1 -1
  55. package/src/helpers/utils.ts +10 -14
  56. package/src/index.ts +1 -2
  57. package/src/lint/fix.ts +1 -0
  58. package/src/upgrade/shell.ts +5 -5
  59. package/dist/src/add.js +0 -29
  60. package/dist/src/build/component-libs.js +0 -6
  61. package/dist/src/build/core.js +0 -21
  62. package/dist/src/build/stacks.js +0 -8
  63. package/dist/src/build.js +0 -219
  64. package/dist/src/bump.js +0 -14
  65. package/dist/src/changelog.js +0 -17
  66. package/dist/src/clean.js +0 -6
  67. package/dist/src/commit.js +0 -17
  68. package/dist/src/copy-types.js +0 -14
  69. package/dist/src/database/seed.js +0 -1
  70. package/dist/src/deploy/index.js +0 -31
  71. package/dist/src/dev/components.js +0 -11
  72. package/dist/src/dev/docs.js +0 -7
  73. package/dist/src/dev/index.js +0 -92
  74. package/dist/src/examples.js +0 -43
  75. package/dist/src/fresh.js +0 -18
  76. package/dist/src/generate/component-meta.js +0 -59
  77. package/dist/src/generate/ide-helpers.js +0 -91
  78. package/dist/src/generate/index.js +0 -154
  79. package/dist/src/generate/lib-entries.js +0 -170
  80. package/dist/src/generate/vscode-custom-data.js +0 -91
  81. package/dist/src/helpers/component-meta.js +0 -50
  82. package/dist/src/helpers/index.js +0 -48
  83. package/dist/src/helpers/lib-entries.js +0 -161
  84. package/dist/src/helpers/package-json.js +0 -136
  85. package/dist/src/helpers/utils.js +0 -48
  86. package/dist/src/helpers/vscode-custom-data.js +0 -83
  87. package/dist/src/index.js +0 -590
  88. package/dist/src/key-generate.js +0 -10
  89. package/dist/src/lint/fix.js +0 -12
  90. package/dist/src/lint/index.js +0 -17
  91. package/dist/src/make.js +0 -291
  92. package/dist/src/prepublish.js +0 -14
  93. package/dist/src/release.js +0 -559
  94. package/dist/src/test/coverage.js +0 -6
  95. package/dist/src/test/feature.js +0 -6
  96. package/dist/src/test/ui.js +0 -6
  97. package/dist/src/test/unit.js +0 -6
  98. package/dist/src/test.js +0 -6
  99. package/dist/src/tinker.js +0 -5
  100. package/dist/src/typecheck.js +0 -6
  101. package/dist/src/types.js +0 -21
  102. package/dist/src/upgrade/dependencies.js +0 -6
  103. package/dist/src/upgrade/framework.js +0 -1
  104. package/dist/src/upgrade/index.js +0 -58
  105. package/dist/src/upgrade.js +0 -47
  106. package/src/generate/caddyfile.ts +0 -44
  107. package/src/helpers/index.ts +0 -1
  108. package/src/start-caddy.ts +0 -13
@@ -1,91 +0,0 @@
1
- #!/usr/bin/env bun
2
- // @bun
3
-
4
- // src/helpers/vscode-custom-data.ts
5
- import {log} from "@stacksjs/logging";
6
- import {customElementsDataPath} from "@stacksjs/path";
7
- import {writeTextFile} from "@stacksjs/storage";
8
-
9
- // ../../../../config/library.ts
10
- var library_default = {
11
- name: "hello-world",
12
- owner: "@stacksjs",
13
- repository: "stacksjs/stacks",
14
- license: "MIT",
15
- author: "Chris Breuer",
16
- contributors: ["Chris Breuer <chris@stacksjs.org>"],
17
- defaultLanguage: "en",
18
- releaseable: true,
19
- vueComponents: {
20
- name: "hello-world-vue",
21
- description: "Your Vue component library description",
22
- keywords: ["component", "library", "vue", "vite", "typescript", "javascript"],
23
- tags: [{
24
- name: ["HelloWorld", "AppHelloWorld"],
25
- description: "The Hello World custom element, built via this framework.",
26
- attributes: [{
27
- name: "greeting",
28
- description: "The greeting."
29
- }]
30
- }]
31
- },
32
- webComponents: {
33
- name: "hello-world-elements",
34
- description: "Your framework agnostic web component library description.",
35
- keywords: ["custom-elements", "web-components", "library", "framework-agnostic", "typescript", "javascript"],
36
- tags: [{
37
- name: ["HelloWorld", "AppHelloWorld"],
38
- description: "The Hello World custom element, built via this framework.",
39
- attributes: [{
40
- name: "greeting",
41
- description: "The greeting."
42
- }]
43
- }]
44
- },
45
- functions: {
46
- name: "hello-world-fx",
47
- description: "Your function library description.",
48
- keywords: ["functions", "composables", "library", "typescript", "javascript"],
49
- shouldGenerateSourcemap: false,
50
- functions: [
51
- "counter",
52
- "dark"
53
- ]
54
- }
55
- };
56
-
57
- // src/helpers/vscode-custom-data.ts
58
- async function generateVsCodeCustomData() {
59
- try {
60
- log.info("Generating custom-elements.json...");
61
- await writeTextFile({
62
- path: customElementsDataPath(),
63
- data: generateComponentInfoData()
64
- });
65
- log.success("Generated custom-elements.json for IDEs.");
66
- } catch (err) {
67
- log.error("There was an error generating the custom-elements.json file.", err);
68
- }
69
- }
70
- async function generateWebTypes() {
71
- log.info("Generating web-types.json...");
72
- log.info("This feature is not yet implemented.");
73
- }
74
- var generateComponentInfoData = function() {
75
- const componentsData = JSON.stringify(library_default.vueComponents?.tags);
76
- return `{
77
- "version": 1.1,
78
- "tags": ${componentsData}
79
- }
80
- `;
81
- };
82
-
83
- // src/generate/ide-helpers.ts
84
- import {log as log2} from "@stacksjs/logging";
85
- import {hasComponents} from "@stacksjs/storage";
86
- if (hasComponents()) {
87
- await generateWebTypes();
88
- await generateVsCodeCustomData();
89
- } else {
90
- log2.info("No components found. Skipping IDE helper generation.");
91
- }
@@ -1,154 +0,0 @@
1
- // @bun
2
- // src/helpers/utils.ts
3
- import * as storage from "@stacksjs/storage";
4
- import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
5
- import {log} from "@stacksjs/logging";
6
- import * as p from "@stacksjs/path";
7
- import {err, handleError} from "@stacksjs/error-handling";
8
- async function runAction(action, options) {
9
- const opts = buddyOptions();
10
- const path = p.relativeActionsPath(`${action}.ts`);
11
- const cmd = `bun --bun ${path} ${opts}`.trimEnd();
12
- const optionsWithCwd = {
13
- cwd: options?.cwd || p.projectPath(),
14
- ...options
15
- };
16
- log.debug("runAction:", cmd);
17
- log.debug("action options:", optionsWithCwd);
18
- if (!hasAction(action))
19
- return err(handleError(`The specified action "${action}" does not exist`));
20
- return await runCommand(cmd, optionsWithCwd);
21
- }
22
- async function runActions(actions, options) {
23
- log.debug("runActions:", actions);
24
- log.debug("actions options:", options);
25
- if (!actions.length)
26
- return err("No actions were specified");
27
- for (const action of actions) {
28
- if (!hasAction(action))
29
- return err(`The specified action "${action}" does not exist`);
30
- }
31
- const opts = buddyOptions();
32
- const o = {
33
- cwd: options?.cwd || p.projectPath(),
34
- ...options
35
- };
36
- const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`);
37
- return await runCommands(commands, o);
38
- }
39
- function hasAction(action) {
40
- if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
41
- return true;
42
- return storage.isFile(p.actionsPath(`${action}.ts`));
43
- }
44
- // src/generate/index.ts
45
- import process from "process";
46
- import {log as log2} from "@stacksjs/logging";
47
- import {Action, NpmScript} from "@stacksjs/enums";
48
- import {runCommand as runCommand2} from "@stacksjs/cli";
49
- import {runNpmScript} from "@stacksjs/utils";
50
- import {frameworkPath, projectPath as projectPath2} from "@stacksjs/path";
51
- async function invoke(options) {
52
- if (options?.types)
53
- await generateTypes(options);
54
- else if (options?.entries)
55
- await generateLibEntries(options);
56
- else if (options?.webTypes)
57
- await generateWebTypes(options);
58
- else if (options?.customData)
59
- await generateVsCodeCustomData(options);
60
- else if (options?.ideHelpers)
61
- await generateIdeHelpers(options);
62
- else if (options?.componentMeta)
63
- await generateComponentMeta(options);
64
- else if (options?.coreSymlink)
65
- await generateCoreSymlink();
66
- }
67
- function generate(options) {
68
- return invoke(options);
69
- }
70
- async function generateLibEntries(options) {
71
- const result = await runAction(Action.GenerateLibraryEntries, {
72
- ...options,
73
- cwd: projectPath2()
74
- });
75
- if (result.isErr()) {
76
- log2.error("There was an error generating your library entry points", result.error);
77
- process.exit();
78
- }
79
- log2.success("Library entry points generated successfully");
80
- }
81
- async function generateWebTypes(options) {
82
- const result = await runNpmScript(NpmScript.GenerateWebTypes, options);
83
- if (result.isErr()) {
84
- log2.error("There was an error generating the web-types.json file.", result.error);
85
- process.exit();
86
- }
87
- log2.success("Successfully generated the web-types.json file");
88
- }
89
- async function generateVsCodeCustomData(options) {
90
- const result = await runNpmScript(NpmScript.GenerateVsCodeCustomData, {
91
- cwd: frameworkPath(),
92
- ...options
93
- });
94
- if (result.isErr()) {
95
- log2.error("There was an error generating the custom-elements.json file.", result.error);
96
- process.exit();
97
- }
98
- await runAction(Action.LintFix, { verbose: true });
99
- log2.success("Successfully generated the custom-elements.json file");
100
- }
101
- async function generateIdeHelpers(options) {
102
- const result = await runNpmScript(NpmScript.GenerateIdeHelpers, options);
103
- if (result.isErr()) {
104
- log2.error("There was an error generating IDE helpers.", result.error);
105
- process.exit();
106
- }
107
- await runAction(Action.LintFix, { verbose: true });
108
- log2.success("Successfully generated IDE helpers");
109
- }
110
- async function generateComponentMeta(options) {
111
- const result = await runNpmScript(NpmScript.GenerateComponentMeta, options);
112
- if (result.isErr()) {
113
- log2.error("There was an error generating your component meta information.", result.error);
114
- process.exit();
115
- }
116
- await runAction(Action.LintFix, { verbose: true });
117
- log2.success("Successfully generated component meta information");
118
- }
119
- async function generateTypes(options) {
120
- const result = await runNpmScript(NpmScript.GenerateTypes, {
121
- cwd: frameworkPath(),
122
- ...options
123
- });
124
- if (result.isErr()) {
125
- log2.error("There was an error generating your types.", result.error);
126
- process.exit();
127
- }
128
- log2.success("Types were generated successfully");
129
- }
130
- function generateMigrations() {
131
- log2.success("Successfully updated migrations");
132
- }
133
- function generatePkgxConfig() {
134
- log2.success("Successfully generated `./pkgx.yaml` based on your config");
135
- }
136
- async function generateSeeder() {
137
- }
138
- async function generateCoreSymlink() {
139
- await runCommand2(`ln -s ${frameworkPath()} ${projectPath2(".stacks")}`);
140
- }
141
- export {
142
- invoke,
143
- generateWebTypes,
144
- generateVsCodeCustomData,
145
- generateTypes,
146
- generateSeeder,
147
- generatePkgxConfig,
148
- generateMigrations,
149
- generateLibEntries,
150
- generateIdeHelpers,
151
- generateCoreSymlink,
152
- generateComponentMeta,
153
- generate
154
- };
@@ -1,170 +0,0 @@
1
- #!/usr/bin/env bun
2
- // @bun
3
-
4
- // src/helpers/lib-entries.ts
5
- import process from "process";
6
- import {log} from "@stacksjs/logging";
7
- import {kebabCase} from "@stacksjs/strings";
8
- import {componentsPath, functionsPath, libraryEntryPath} from "@stacksjs/path";
9
- import {writeTextFile} from "@stacksjs/storage";
10
- import {determineResetPreset} from "@stacksjs/utils";
11
- import {ExitCode} from "@stacksjs/types";
12
-
13
- // ../../../../config/library.ts
14
- var library_default = {
15
- name: "hello-world",
16
- owner: "@stacksjs",
17
- repository: "stacksjs/stacks",
18
- license: "MIT",
19
- author: "Chris Breuer",
20
- contributors: ["Chris Breuer <chris@stacksjs.org>"],
21
- defaultLanguage: "en",
22
- releaseable: true,
23
- vueComponents: {
24
- name: "hello-world-vue",
25
- description: "Your Vue component library description",
26
- keywords: ["component", "library", "vue", "vite", "typescript", "javascript"],
27
- tags: [{
28
- name: ["HelloWorld", "AppHelloWorld"],
29
- description: "The Hello World custom element, built via this framework.",
30
- attributes: [{
31
- name: "greeting",
32
- description: "The greeting."
33
- }]
34
- }]
35
- },
36
- webComponents: {
37
- name: "hello-world-elements",
38
- description: "Your framework agnostic web component library description.",
39
- keywords: ["custom-elements", "web-components", "library", "framework-agnostic", "typescript", "javascript"],
40
- tags: [{
41
- name: ["HelloWorld", "AppHelloWorld"],
42
- description: "The Hello World custom element, built via this framework.",
43
- attributes: [{
44
- name: "greeting",
45
- description: "The greeting."
46
- }]
47
- }]
48
- },
49
- functions: {
50
- name: "hello-world-fx",
51
- description: "Your function library description.",
52
- keywords: ["functions", "composables", "library", "typescript", "javascript"],
53
- shouldGenerateSourcemap: false,
54
- functions: [
55
- "counter",
56
- "dark"
57
- ]
58
- }
59
- };
60
-
61
- // src/helpers/lib-entries.ts
62
- async function generateLibEntry(type) {
63
- await createLibraryEntryPoint(type);
64
- }
65
- async function createLibraryEntryPoint(type) {
66
- if (type === "vue-components")
67
- await createVueLibraryEntryPoint();
68
- if (type === "web-components")
69
- await createWebComponentLibraryEntryPoint();
70
- if (type === "functions")
71
- await createFunctionLibraryEntryPoint();
72
- }
73
- async function createVueLibraryEntryPoint(type = "vue-components") {
74
- log.info("Ensuring Component Library Entry Point...");
75
- await writeTextFile({
76
- path: libraryEntryPath(type),
77
- data: generateEntryPointData(type)
78
- }).catch((err) => {
79
- log.error("There was an error generating the Vue Component Library Entry Point.", err);
80
- process.exit(ExitCode.FatalError);
81
- });
82
- log.success("Created Vue Component Library Entry Point");
83
- }
84
- async function createWebComponentLibraryEntryPoint(type = "web-components") {
85
- log.info("Ensuring Web Component Library Entry Point...");
86
- await writeTextFile({
87
- path: libraryEntryPath(type),
88
- data: generateEntryPointData(type)
89
- }).catch((err) => {
90
- log.error("There was an error generating the Web Component library entry point", err);
91
- process.exit(ExitCode.FatalError);
92
- });
93
- log.success("Created Web Component Library Entry Point");
94
- }
95
- async function createFunctionLibraryEntryPoint(type = "functions") {
96
- log.info("Ensuring Function Library Entry Point...");
97
- await writeTextFile({
98
- path: libraryEntryPath(type),
99
- data: generateEntryPointData(type)
100
- }).catch((err) => {
101
- log.error("There was an error generating Function Library Entry Point", err);
102
- process.exit(ExitCode.FatalError);
103
- });
104
- log.success("Created Functions Library Entry Point");
105
- }
106
- function generateEntryPointData(type) {
107
- let arr = [];
108
- if (type === "functions") {
109
- if (!library_default.functions?.functions) {
110
- log.error(new Error("There are no functions defined to be built. Please check your config/library.ts file for potential adjustments"));
111
- process.exit();
112
- }
113
- for (const fx of library_default.functions?.functions) {
114
- if (Array.isArray(fx))
115
- arr.push(`export * as ${fx[1]} from '${functionsPath(fx[0])}'`);
116
- else
117
- arr.push(`export * from '${functionsPath(fx)}'`);
118
- }
119
- return arr.join("\r\n");
120
- }
121
- if (type === "vue-components") {
122
- if (!library_default.vueComponents?.tags) {
123
- log.error(new Error("There are no components defined to be built. Please check your config/library.ts file for potential adjustments"));
124
- process.exit();
125
- }
126
- arr = determineResetPreset();
127
- for (const component of library_default.vueComponents?.tags.map((tag) => tag.name)) {
128
- if (Array.isArray(component))
129
- arr.push(`export { default as ${component[1]} } from '${componentsPath(component[0])}.stx'`);
130
- else
131
- arr.push(`export { default as ${component} } from '${componentsPath(component)}.stx'`);
132
- }
133
- return arr.join("\r\n");
134
- }
135
- arr = determineResetPreset();
136
- const imports = [...arr, "import { defineCustomElement } from \'vue\'"];
137
- const declarations = [];
138
- const definitions = [];
139
- if (!library_default.webComponents?.tags) {
140
- log.error(new Error("There are no components defined to be built. Please check your config/library.ts file for potential adjustments"));
141
- process.exit();
142
- }
143
- for (const component of library_default.webComponents?.tags.map((tag) => tag.name)) {
144
- if (Array.isArray(component)) {
145
- imports.push(`import ${component[1]} from '${componentsPath(component[0])}.stx'`);
146
- declarations.push(`const ${component[1]}CustomElement = defineCustomElement(${component[1]})`);
147
- definitions.push(`customElements.define('${kebabCase(component[1])}', ${component[1]}CustomElement)`);
148
- } else {
149
- imports.push(`import ${component} from '${componentsPath(component)}.stx'`);
150
- declarations.push(`const ${component}CustomElement = defineCustomElement(${component})`);
151
- definitions.push(`customElements.define('${kebabCase(component)}', ${component}CustomElement)`);
152
- }
153
- }
154
- return [...imports, ...declarations, ...definitions].join("\r\n");
155
- }
156
-
157
- // src/generate/lib-entries.ts
158
- import {log as log2} from "@stacksjs/logging";
159
- import {library as library2} from "@stacksjs/config";
160
- import {hasComponents, hasFunctions} from "@stacksjs/storage";
161
- if (library2.releaseable && hasComponents()) {
162
- await generateLibEntry("vue-components");
163
- await generateLibEntry("web-components");
164
- } else {
165
- log2.info("No components found. Skipping building component entry points.");
166
- }
167
- if (library2.releaseable && hasFunctions())
168
- await generateLibEntry("functions");
169
- else
170
- log2.info("No functions found. Skipping building function entry point.");
@@ -1,91 +0,0 @@
1
- #!/usr/bin/env bun
2
- // @bun
3
-
4
- // src/helpers/vscode-custom-data.ts
5
- import {log} from "@stacksjs/logging";
6
- import {customElementsDataPath} from "@stacksjs/path";
7
- import {writeTextFile} from "@stacksjs/storage";
8
-
9
- // ../../../../config/library.ts
10
- var library_default = {
11
- name: "hello-world",
12
- owner: "@stacksjs",
13
- repository: "stacksjs/stacks",
14
- license: "MIT",
15
- author: "Chris Breuer",
16
- contributors: ["Chris Breuer <chris@stacksjs.org>"],
17
- defaultLanguage: "en",
18
- releaseable: true,
19
- vueComponents: {
20
- name: "hello-world-vue",
21
- description: "Your Vue component library description",
22
- keywords: ["component", "library", "vue", "vite", "typescript", "javascript"],
23
- tags: [{
24
- name: ["HelloWorld", "AppHelloWorld"],
25
- description: "The Hello World custom element, built via this framework.",
26
- attributes: [{
27
- name: "greeting",
28
- description: "The greeting."
29
- }]
30
- }]
31
- },
32
- webComponents: {
33
- name: "hello-world-elements",
34
- description: "Your framework agnostic web component library description.",
35
- keywords: ["custom-elements", "web-components", "library", "framework-agnostic", "typescript", "javascript"],
36
- tags: [{
37
- name: ["HelloWorld", "AppHelloWorld"],
38
- description: "The Hello World custom element, built via this framework.",
39
- attributes: [{
40
- name: "greeting",
41
- description: "The greeting."
42
- }]
43
- }]
44
- },
45
- functions: {
46
- name: "hello-world-fx",
47
- description: "Your function library description.",
48
- keywords: ["functions", "composables", "library", "typescript", "javascript"],
49
- shouldGenerateSourcemap: false,
50
- functions: [
51
- "counter",
52
- "dark"
53
- ]
54
- }
55
- };
56
-
57
- // src/helpers/vscode-custom-data.ts
58
- async function generateVsCodeCustomData() {
59
- try {
60
- log.info("Generating custom-elements.json...");
61
- await writeTextFile({
62
- path: customElementsDataPath(),
63
- data: generateComponentInfoData()
64
- });
65
- log.success("Generated custom-elements.json for IDEs.");
66
- } catch (err) {
67
- log.error("There was an error generating the custom-elements.json file.", err);
68
- }
69
- }
70
- async function generateWebTypes() {
71
- log.info("Generating web-types.json...");
72
- log.info("This feature is not yet implemented.");
73
- }
74
- var generateComponentInfoData = function() {
75
- const componentsData = JSON.stringify(library_default.vueComponents?.tags);
76
- return `{
77
- "version": 1.1,
78
- "tags": ${componentsData}
79
- }
80
- `;
81
- };
82
-
83
- // src/generate/vscode-custom-data.ts
84
- import {log as log2} from "@stacksjs/logging";
85
- import {hasComponents} from "@stacksjs/storage";
86
- log2.info("Generating VS Code custom data...");
87
- if (hasComponents())
88
- await generateVsCodeCustomData();
89
- else
90
- log2.info("No components found. Skipping VS Code custom data generation.");
91
- log2.success("Generated VS Code custom data.");
@@ -1,50 +0,0 @@
1
- // @bun
2
- // src/helpers/component-meta.ts
3
- import {frameworkPath, join, parse, projectPath} from "@stacksjs/path";
4
- import {existsSync, glob, mkdirSync, writeFileSync} from "@stacksjs/storage";
5
- import MarkdownIt from "markdown-it";
6
- import {createComponentMetaChecker} from "vue-component-meta";
7
- function generateComponentMeta() {
8
- const md = new MarkdownIt;
9
- const checkerOptions = {
10
- forceUseTs: true,
11
- schema: { ignore: ["MyIgnoredNestedProps"] },
12
- printer: { newLine: 1 }
13
- };
14
- const tsconfigChecker = createComponentMetaChecker(projectPath("tsconfig.json"), checkerOptions);
15
- const filterMeta = (meta) => {
16
- const props = [];
17
- meta.props.forEach((prop) => {
18
- if (prop?.global)
19
- return;
20
- const { name, description, required, type, default: defaultValue } = prop;
21
- props.push({
22
- name: `${name}${required ? "" : "?"}`,
23
- description: md.render(description),
24
- type,
25
- default: defaultValue || "unknown"
26
- });
27
- });
28
- return {
29
- props,
30
- events: meta.events,
31
- slots: meta.slots
32
- };
33
- };
34
- const components = glob.sync(["components/*.stx", "components/**/*.stx"], {
35
- cwd: projectPath(),
36
- absolute: true
37
- });
38
- components.forEach((componentPath) => {
39
- const componentExportName = parse(componentPath).name;
40
- const meta = filterMeta(tsconfigChecker.getComponentMeta(componentPath, componentExportName));
41
- const metaDirPath = frameworkPath("component-meta");
42
- if (!existsSync(metaDirPath))
43
- mkdirSync(metaDirPath);
44
- const metaJsonFilePath = join(metaDirPath, `${componentExportName}.json`);
45
- writeFileSync(metaJsonFilePath, JSON.stringify(meta, null, 4));
46
- });
47
- }
48
- export {
49
- generateComponentMeta
50
- };
@@ -1,48 +0,0 @@
1
- // @bun
2
- // src/helpers/utils.ts
3
- import * as storage from "@stacksjs/storage";
4
- import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
5
- import {log} from "@stacksjs/logging";
6
- import * as p from "@stacksjs/path";
7
- import {err, handleError} from "@stacksjs/error-handling";
8
- async function runAction(action, options) {
9
- const opts = buddyOptions();
10
- const path = p.relativeActionsPath(`${action}.ts`);
11
- const cmd = `bun --bun ${path} ${opts}`.trimEnd();
12
- const optionsWithCwd = {
13
- cwd: options?.cwd || p.projectPath(),
14
- ...options
15
- };
16
- log.debug("runAction:", cmd);
17
- log.debug("action options:", optionsWithCwd);
18
- if (!hasAction(action))
19
- return err(handleError(`The specified action "${action}" does not exist`));
20
- return await runCommand(cmd, optionsWithCwd);
21
- }
22
- async function runActions(actions, options) {
23
- log.debug("runActions:", actions);
24
- log.debug("actions options:", options);
25
- if (!actions.length)
26
- return err("No actions were specified");
27
- for (const action of actions) {
28
- if (!hasAction(action))
29
- return err(`The specified action "${action}" does not exist`);
30
- }
31
- const opts = buddyOptions();
32
- const o = {
33
- cwd: options?.cwd || p.projectPath(),
34
- ...options
35
- };
36
- const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`);
37
- return await runCommands(commands, o);
38
- }
39
- function hasAction(action) {
40
- if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
41
- return true;
42
- return storage.isFile(p.actionsPath(`${action}.ts`));
43
- }
44
- export {
45
- runActions,
46
- runAction,
47
- hasAction
48
- };