stacks 0.37.8 → 0.38.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 (60) hide show
  1. package/README.md +2 -2
  2. package/package.json +69 -118
  3. package/dist/cli/actions/build.d.ts +0 -7
  4. package/dist/cli/actions/build.mjs +0 -117
  5. package/dist/cli/actions/commit.d.ts +0 -1
  6. package/dist/cli/actions/commit.mjs +0 -8
  7. package/dist/cli/actions/dev.d.ts +0 -1
  8. package/dist/cli/actions/dev.mjs +0 -34
  9. package/dist/cli/actions/examples.d.ts +0 -3
  10. package/dist/cli/actions/examples.mjs +0 -57
  11. package/dist/cli/actions/fresh.d.ts +0 -1
  12. package/dist/cli/actions/fresh.mjs +0 -8
  13. package/dist/cli/actions/generate.d.ts +0 -7
  14. package/dist/cli/actions/generate.mjs +0 -117
  15. package/dist/cli/actions/index.d.ts +0 -12
  16. package/dist/cli/actions/index.mjs +0 -12
  17. package/dist/cli/actions/key.d.ts +0 -2
  18. package/dist/cli/actions/key.mjs +0 -22
  19. package/dist/cli/actions/lint.d.ts +0 -2
  20. package/dist/cli/actions/lint.mjs +0 -15
  21. package/dist/cli/actions/make.d.ts +0 -5
  22. package/dist/cli/actions/make.mjs +0 -97
  23. package/dist/cli/actions/release.d.ts +0 -1
  24. package/dist/cli/actions/release.mjs +0 -8
  25. package/dist/cli/actions/test.d.ts +0 -3
  26. package/dist/cli/actions/test.mjs +0 -30
  27. package/dist/cli/actions/types.d.ts +0 -9
  28. package/dist/cli/actions/types.mjs +0 -134
  29. package/dist/cli/actions/update.d.ts +0 -1
  30. package/dist/cli/actions/update.mjs +0 -59
  31. package/dist/cli/build.d.ts +0 -3
  32. package/dist/cli/build.mjs +0 -22
  33. package/dist/cli/create.d.ts +0 -3
  34. package/dist/cli/create.mjs +0 -46
  35. package/dist/cli/dev.d.ts +0 -3
  36. package/dist/cli/dev.mjs +0 -13
  37. package/dist/cli/example.d.ts +0 -3
  38. package/dist/cli/example.mjs +0 -13
  39. package/dist/cli/generate.d.ts +0 -3
  40. package/dist/cli/generate.mjs +0 -29
  41. package/dist/cli/index.d.ts +0 -12
  42. package/dist/cli/index.mjs +0 -12
  43. package/dist/cli/key.d.ts +0 -3
  44. package/dist/cli/key.mjs +0 -7
  45. package/dist/cli/make.d.ts +0 -3
  46. package/dist/cli/make.mjs +0 -22
  47. package/dist/cli/test.d.ts +0 -3
  48. package/dist/cli/test.mjs +0 -13
  49. package/dist/cli/types.d.ts +0 -3
  50. package/dist/cli/types.mjs +0 -9
  51. package/dist/cli/update.d.ts +0 -3
  52. package/dist/cli/update.mjs +0 -7
  53. package/dist/cli/utility.d.ts +0 -3
  54. package/dist/cli/utility.mjs +0 -22
  55. package/dist/cli.d.ts +0 -2
  56. package/dist/cli.mjs +0 -13970
  57. package/dist/docs.d.ts +0 -2
  58. package/dist/docs.mjs +0 -3
  59. package/dist/index.d.ts +0 -20
  60. package/dist/index.mjs +0 -20
@@ -1,117 +0,0 @@
1
- import consola from "consola";
2
- import Prompts from "prompts";
3
- import { runNpmScript } from "@stacksjs/helpers";
4
- import { ExitCode, NpmScript } from "@stacksjs/types";
5
- import { lintFix } from "./lint.mjs";
6
- import { generateTypes } from "./types.mjs";
7
- const { prompts } = Prompts;
8
- export async function generateLibEntries() {
9
- try {
10
- await runNpmScript(NpmScript.GenerateEntries, "ignore");
11
- consola.success("Library entry points were generated successfully.");
12
- } catch (error) {
13
- consola.error("There was an error generating your library entry points.");
14
- consola.error(error);
15
- }
16
- }
17
- export async function generateVueCompat() {
18
- try {
19
- await runNpmScript(NpmScript.GenerateVueCompat, "ignore");
20
- consola.success("Vue 2 & 3 compatibility was generated successfully.");
21
- } catch (error) {
22
- consola.error("There was an error generating Vue compatibility.");
23
- consola.error(error);
24
- }
25
- }
26
- export async function generateWebTypes() {
27
- try {
28
- await runNpmScript(NpmScript.GenerateWebTypes, "ignore");
29
- consola.success("Successfully generated the web-types.json file.");
30
- } catch (error) {
31
- consola.error("There was an error generating the web-types.json file");
32
- consola.error(error);
33
- process.exit(ExitCode.FatalError);
34
- }
35
- }
36
- export async function generateVsCodeCustomData() {
37
- try {
38
- await runNpmScript(NpmScript.GenerateVsCodeCustomData, "ignore");
39
- await lintFix("ignore");
40
- consola.success("Successfully generated the custom-elements.json file.");
41
- } catch (error) {
42
- consola.error("There was an error generating the custom-elements.json file");
43
- consola.error(error);
44
- process.exit(ExitCode.FatalError);
45
- }
46
- }
47
- export async function generateIdeHelpers() {
48
- try {
49
- await runNpmScript(NpmScript.GenerateIdeHelpers, "ignore");
50
- await lintFix("ignore");
51
- consola.success("Successfully generated IDE helpers.");
52
- } catch (error) {
53
- consola.error("There was an error generating IDE helpers.");
54
- consola.error(error);
55
- process.exit(ExitCode.FatalError);
56
- }
57
- }
58
- export async function generateComponentMeta() {
59
- try {
60
- await runNpmScript(NpmScript.GenerateComponentMeta, "ignore");
61
- await lintFix("ignore");
62
- consola.success("Successfully generated component meta.");
63
- } catch (error) {
64
- consola.error("There was an error generating your component meta information.");
65
- consola.error(error);
66
- process.exit(ExitCode.FatalError);
67
- }
68
- }
69
- export async function startGenerationProcess(options) {
70
- if (options.types || options === "types") {
71
- await generateTypes();
72
- } else if (options.entries || options === "entries") {
73
- await generateLibEntries();
74
- } else if (options.webTypes || options === "web-types") {
75
- await generateWebTypes();
76
- } else if (options.customData || options === "custom-data") {
77
- await generateVsCodeCustomData();
78
- } else if (options.ideHelpers || options === "ide-helpers") {
79
- await generateIdeHelpers();
80
- } else if (options.vueCompatibility || options === "vue-compatibility") {
81
- await generateVueCompat();
82
- } else if (options.componentMeta || options === "component-meta") {
83
- await generateComponentMeta();
84
- } else {
85
- const answer = await prompts.select({
86
- type: "select",
87
- name: "generate",
88
- message: "What are you trying to generate?",
89
- choices: [
90
- { title: "1.) TypeScript Types", value: "types" },
91
- { title: "2.) Library Entry Points", value: "entries" },
92
- { title: "3.) Web Types", value: "web-types" },
93
- { title: "4.) VS Code Custom Data", value: "custom-data" },
94
- { title: "5.) IDE Helpers", value: "ide-helpers" },
95
- { title: "6.) Vue 2 & 3 Compatibility", value: "vue-compatibility" },
96
- { title: "7.) Component Meta", value: "component-meta" }
97
- ],
98
- initial: 0
99
- });
100
- if (answer === "types")
101
- await generateTypes();
102
- else if (answer === "entries")
103
- await generateLibEntries();
104
- else if (answer === "web-types")
105
- await generateWebTypes();
106
- else if (answer === "custom-data")
107
- await generateVsCodeCustomData();
108
- else if (answer === "ide-helpers")
109
- await generateIdeHelpers();
110
- else if (answer === "vue-compatibility")
111
- await generateVueCompat();
112
- else if (answer === "component-meta")
113
- await generateComponentMeta();
114
- else
115
- process.exit(ExitCode.InvalidArgument);
116
- }
117
- }
@@ -1,12 +0,0 @@
1
- export * from './build';
2
- export * from './commit';
3
- export * from './dev';
4
- export * from './examples';
5
- export * from './fresh';
6
- export * from './generate';
7
- export * from './key';
8
- export * from './lint';
9
- export * from './make';
10
- export * from './release';
11
- export * from './test';
12
- export * from './update';
@@ -1,12 +0,0 @@
1
- export * from "./build.mjs";
2
- export * from "./commit.mjs";
3
- export * from "./dev.mjs";
4
- export * from "./examples.mjs";
5
- export * from "./fresh.mjs";
6
- export * from "./generate.mjs";
7
- export * from "./key.mjs";
8
- export * from "./lint.mjs";
9
- export * from "./make.mjs";
10
- export * from "./release.mjs";
11
- export * from "./test.mjs";
12
- export * from "./update.mjs";
@@ -1,2 +0,0 @@
1
- export declare function generateAppKey(): Promise<string>;
2
- export declare function generate(): Promise<boolean>;
@@ -1,22 +0,0 @@
1
- import { getRandomValues } from "node:crypto";
2
- import consola from "consola";
3
- import ezSpawn from "@jsdevtools/ez-spawn";
4
- import { projectPath } from "@stacksjs/paths";
5
- import { setEnvValue } from "@stacksjs/helpers";
6
- import { isFile } from "@stacksjs/fs";
7
- import utf8 from "crypto-js/enc-utf8";
8
- import base64 from "crypto-js/enc-base64";
9
- export async function generateAppKey() {
10
- const random = getRandomValues(new Uint8Array(32));
11
- const encodedWord = utf8.parse(random.toString());
12
- const key = base64.stringify(encodedWord);
13
- return `base64:${key}`;
14
- }
15
- export async function generate() {
16
- consola.info("Setting random application key.");
17
- if (!isFile(".env"))
18
- await ezSpawn.async("cp .env.example .env", { stdio: "inherit", cwd: projectPath() });
19
- await setEnvValue("APP_KEY", await generateAppKey());
20
- consola.success("Application key set.");
21
- return true;
22
- }
@@ -1,2 +0,0 @@
1
- export declare function lint(debug?: 'ignore' | 'inherit'): Promise<void>;
2
- export declare function lintFix(debug?: 'ignore' | 'inherit'): Promise<void>;
@@ -1,15 +0,0 @@
1
- import consola from "consola";
2
- import { runNpmScript } from "@stacksjs/helpers";
3
- import { NpmScript } from "@stacksjs/types";
4
- export async function lint(debug = "inherit") {
5
- consola.info("Linting your codebase...");
6
- await runNpmScript(NpmScript.Lint, debug);
7
- consola.success("Successfully linted your codebase.");
8
- }
9
- export async function lintFix(debug = "inherit") {
10
- if (debug !== "ignore")
11
- consola.info("Fixing lint errors...");
12
- await runNpmScript(NpmScript.LintFix, debug);
13
- if (debug !== "ignore")
14
- consola.success("Fixed lint errors.");
15
- }
@@ -1,5 +0,0 @@
1
- export declare function component(name: string): Promise<void>;
2
- export declare function page(name: string): Promise<void>;
3
- export declare function fx(name: string): Promise<void>;
4
- export declare function language(language: string): Promise<void>;
5
- export declare function stack(name: string): Promise<void>;
@@ -1,97 +0,0 @@
1
- import consola from "consola";
2
- import * as ezSpawn from "@jsdevtools/ez-spawn";
3
- import { writeTextFile } from "@stacksjs/fs";
4
- import { resolve } from "@stacksjs/paths";
5
- export async function component(name) {
6
- consola.info("Creating your component...");
7
- try {
8
- await writeTextFile({
9
- path: `./components/${name}.vue`,
10
- data: `<script setup lang="ts">
11
- // eslint-disable-next-line no-console
12
- console.log('Hello World component created')
13
- <\/script>
14
-
15
- <template>
16
- <div>
17
- Some HTML block
18
- </div>
19
- </template>
20
- `
21
- });
22
- consola.success(`Created the ${name} component.`);
23
- } catch (err) {
24
- consola.error(err);
25
- }
26
- }
27
- export async function page(name) {
28
- consola.info("Creating your component...");
29
- try {
30
- await writeTextFile({
31
- path: `./pages/${name}.vue`,
32
- data: `<script setup lang="ts">
33
- // eslint-disable-next-line no-console
34
- console.log('Hello World page created')
35
- <\/script>
36
-
37
- <template>
38
- <div>
39
- Visit http://127.0.0.1/${name}
40
- </div>
41
- </template>
42
- `
43
- });
44
- consola.success(`Created the ${name} page.`);
45
- } catch (err) {
46
- consola.error(err);
47
- }
48
- }
49
- export async function fx(name) {
50
- consola.info("Creating your function...");
51
- try {
52
- await writeTextFile({
53
- path: `./functions/${name}.ts`,
54
- data: `// reactive state
55
- const ${name} = ref(0)
56
-
57
- // functions that mutate state and trigger updates
58
- function increment() {
59
- ${name}.value++
60
- }
61
-
62
- export {
63
- ${name},
64
- increment,
65
- }
66
- `
67
- });
68
- consola.success(`Created the ${name} function.`);
69
- } catch (err) {
70
- consola.error(err);
71
- }
72
- }
73
- export async function language(language2) {
74
- consola.info("Creating your translation file...");
75
- try {
76
- await writeTextFile({
77
- path: `./lang/${language2}.yml`,
78
- data: `button:
79
- text: Copy
80
- `
81
- });
82
- consola.success(`Created the ${language2} translation file.`);
83
- } catch (err) {
84
- consola.error(err);
85
- }
86
- }
87
- export async function stack(name) {
88
- consola.info("Creating your stack...");
89
- try {
90
- const path = resolve(process.cwd(), name);
91
- await ezSpawn.async(`giget stacks ${path}`);
92
- consola.success("Successfully scaffolded your project.");
93
- consola.info(`cd ${path} && pnpm install`);
94
- } catch (err) {
95
- consola.error(err);
96
- }
97
- }
@@ -1 +0,0 @@
1
- export declare function release(): Promise<void>;
@@ -1,8 +0,0 @@
1
- import consola from "consola";
2
- import { runNpmScript } from "@stacksjs/helpers";
3
- import { NpmScript } from "@stacksjs/types";
4
- export async function release() {
5
- consola.info("Releasing...");
6
- await runNpmScript(NpmScript.Release);
7
- consola.success("Triggered release workflow");
8
- }
@@ -1,3 +0,0 @@
1
- export declare function typecheck(): Promise<void>;
2
- export declare function runTestSuite(): Promise<void>;
3
- export declare function generateTestCoverageReport(): Promise<void>;
@@ -1,30 +0,0 @@
1
- import consola from "consola";
2
- import { runNpmScript } from "@stacksjs/helpers";
3
- import { NpmScript } from "@stacksjs/types";
4
- export async function typecheck() {
5
- consola.info("Typechecking your codebase...");
6
- try {
7
- await runNpmScript(NpmScript.TestTypes);
8
- consola.success("Finished typechecking your codebase.");
9
- } catch (error) {
10
- consola.error(error);
11
- }
12
- }
13
- export async function runTestSuite() {
14
- consola.info("Running your test suite...");
15
- try {
16
- await runNpmScript(NpmScript.Test);
17
- consola.success("Completed running the test suite.");
18
- } catch (error) {
19
- consola.error(error);
20
- }
21
- }
22
- export async function generateTestCoverageReport() {
23
- consola.info("Generating a test coverage report...");
24
- try {
25
- await runNpmScript(NpmScript.TestCoverage);
26
- consola.success("Generated the test coverage report.");
27
- } catch (error) {
28
- consola.error(error);
29
- }
30
- }
@@ -1,9 +0,0 @@
1
- export declare function generateTypes(): Promise<void>;
2
- export declare function fixTypes(): Promise<void>;
3
- export declare function generateLibEntries(): Promise<void>;
4
- export declare function generateVueCompat(): Promise<void>;
5
- export declare function generateWebTypes(): Promise<void>;
6
- export declare function generateVsCodeCustomData(): Promise<void>;
7
- export declare function generateIdeHelpers(): Promise<void>;
8
- export declare function generateComponentMeta(): Promise<void>;
9
- export declare function startGenerationProcess(options: any): Promise<void>;
@@ -1,134 +0,0 @@
1
- import consola from "consola";
2
- import Prompts from "prompts";
3
- import { runNpmScript } from "@stacksjs/helpers";
4
- import { ExitCode, NpmScript } from "@stacksjs/types";
5
- import { lintFix } from "./lint.mjs";
6
- const { prompts } = Prompts;
7
- export async function generateTypes() {
8
- try {
9
- await runNpmScript(NpmScript.TypesGenerate, "ignore");
10
- consola.success("Types were generated successfully.");
11
- } catch (error) {
12
- consola.error("There was an error generating your types.");
13
- consola.error(error);
14
- }
15
- }
16
- export async function fixTypes() {
17
- try {
18
- await runNpmScript(NpmScript.TypesFix, "ignore");
19
- consola.success("Types were generated successfully.");
20
- } catch (error) {
21
- consola.error("There was an error generating your types.");
22
- consola.error(error);
23
- }
24
- }
25
- export async function generateLibEntries() {
26
- try {
27
- await runNpmScript(NpmScript.GenerateEntries, "ignore");
28
- consola.success("Library entry points were generated successfully.");
29
- } catch (error) {
30
- consola.error("There was an error generating your library entry points.");
31
- consola.error(error);
32
- }
33
- }
34
- export async function generateVueCompat() {
35
- try {
36
- await runNpmScript(NpmScript.GenerateVueCompat, "ignore");
37
- consola.success("Vue 2 & 3 compatibility was generated successfully.");
38
- } catch (error) {
39
- consola.error("There was an error generating Vue compatibility.");
40
- consola.error(error);
41
- }
42
- }
43
- export async function generateWebTypes() {
44
- try {
45
- await runNpmScript(NpmScript.GenerateWebTypes, "ignore");
46
- consola.success("Successfully generated the web-types.json file.");
47
- } catch (error) {
48
- consola.error("There was an error generating the web-types.json file");
49
- consola.error(error);
50
- process.exit(ExitCode.FatalError);
51
- }
52
- }
53
- export async function generateVsCodeCustomData() {
54
- try {
55
- await runNpmScript(NpmScript.GenerateVsCodeCustomData, "ignore");
56
- await lintFix("ignore");
57
- consola.success("Successfully generated the custom-elements.json file.");
58
- } catch (error) {
59
- consola.error("There was an error generating the custom-elements.json file");
60
- consola.error(error);
61
- process.exit(ExitCode.FatalError);
62
- }
63
- }
64
- export async function generateIdeHelpers() {
65
- try {
66
- await runNpmScript(NpmScript.GenerateIdeHelpers, "ignore");
67
- await lintFix("ignore");
68
- consola.success("Successfully generated IDE helpers.");
69
- } catch (error) {
70
- consola.error("There was an error generating IDE helpers.");
71
- consola.error(error);
72
- process.exit(ExitCode.FatalError);
73
- }
74
- }
75
- export async function generateComponentMeta() {
76
- try {
77
- await runNpmScript(NpmScript.GenerateComponentMeta, "ignore");
78
- await lintFix("ignore");
79
- consola.success("Successfully generated component meta.");
80
- } catch (error) {
81
- consola.error("There was an error generating your component meta information.");
82
- consola.error(error);
83
- process.exit(ExitCode.FatalError);
84
- }
85
- }
86
- export async function startGenerationProcess(options) {
87
- if (options.types || options === "types") {
88
- await generateTypes();
89
- } else if (options.entries || options === "entries") {
90
- await generateLibEntries();
91
- } else if (options.webTypes || options === "web-types") {
92
- await generateWebTypes();
93
- } else if (options.customData || options === "custom-data") {
94
- await generateVsCodeCustomData();
95
- } else if (options.ideHelpers || options === "ide-helpers") {
96
- await generateIdeHelpers();
97
- } else if (options.vueCompatibility || options === "vue-compatibility") {
98
- await generateVueCompat();
99
- } else if (options.componentMeta || options === "component-meta") {
100
- await generateComponentMeta();
101
- } else {
102
- const answer = await prompts.select({
103
- type: "select",
104
- name: "generate",
105
- message: "What are you trying to generate?",
106
- choices: [
107
- { title: "1.) TypeScript Types", value: "types" },
108
- { title: "2.) Library Entry Points", value: "entries" },
109
- { title: "3.) Web Types", value: "web-types" },
110
- { title: "4.) VS Code Custom Data", value: "custom-data" },
111
- { title: "5.) IDE Helpers", value: "ide-helpers" },
112
- { title: "6.) Vue 2 & 3 Compatibility", value: "vue-compatibility" },
113
- { title: "7.) Component Meta", value: "component-meta" }
114
- ],
115
- initial: 0
116
- });
117
- if (answer === "types")
118
- await generateTypes();
119
- else if (answer === "entries")
120
- await generateLibEntries();
121
- else if (answer === "web-types")
122
- await generateWebTypes();
123
- else if (answer === "custom-data")
124
- await generateVsCodeCustomData();
125
- else if (answer === "ide-helpers")
126
- await generateIdeHelpers();
127
- else if (answer === "vue-compatibility")
128
- await generateVueCompat();
129
- else if (answer === "component-meta")
130
- await generateComponentMeta();
131
- else
132
- process.exit(ExitCode.InvalidArgument);
133
- }
134
- }
@@ -1 +0,0 @@
1
- export declare function stacks(options: any): Promise<void>;
@@ -1,59 +0,0 @@
1
- import * as ezSpawn from "@jsdevtools/ez-spawn";
2
- import consola from "consola";
3
- import Prompts from "prompts";
4
- import { copyFolder, deleteEmptyFolders, deleteFiles, deleteFolder, doesFolderExist } from "@stacksjs/fs";
5
- import { resolve } from "@stacksjs/paths";
6
- import { runNpmScript } from "@stacksjs/helpers";
7
- import { ExitCode, NpmScript } from "@stacksjs/types";
8
- const { prompts } = Prompts;
9
- export async function stacks(options) {
10
- if (options.framework) {
11
- try {
12
- await ezSpawn.async("git diff --quiet HEAD -- ./.stacks", { stdio: "inherit", cwd: process.cwd() });
13
- } catch (error) {
14
- if (error.status === 1) {
15
- if (!options.force) {
16
- const answer = await prompts.confirm({
17
- type: "select",
18
- name: "framework-update",
19
- message: "Would you like to overwrite your ./stacks changes in favor of the Stacks update?"
20
- });
21
- if (!answer) {
22
- consola.info("The framework was not updated.");
23
- consola.info("Note: if you commit your changes and replay the update, you will see what has changed.");
24
- process.exit(ExitCode.Success);
25
- }
26
- }
27
- }
28
- }
29
- consola.info("Downloading framework updates...");
30
- const tempFolderName = "updates";
31
- const tempUpdatePath = resolve(process.cwd(), tempFolderName);
32
- if (doesFolderExist(tempUpdatePath))
33
- await deleteFolder(tempUpdatePath);
34
- await ezSpawn.async(`giget stacks ${tempFolderName}`, { stdio: options.debug ? "inherit" : "ignore" });
35
- consola.success("Downloaded framework updates.");
36
- consola.info("Updating framework...");
37
- const frameworkPath = resolve(process.cwd(), ".stacks");
38
- const exclude = ["functions/package.json", "vue-components/package.json", "web-components/package.json", "auto-imports.d.ts", "components.d.ts", "dist"];
39
- await deleteFiles(frameworkPath, exclude);
40
- for (let i = 0; i < 5; i++)
41
- await deleteEmptyFolders(frameworkPath);
42
- const from = resolve(process.cwd(), "./updates/.stacks");
43
- const to = frameworkPath;
44
- await copyFolder(from, to, exclude);
45
- consola.info("Cleanup...");
46
- await deleteFolder(tempUpdatePath);
47
- consola.success("Framework updated.");
48
- }
49
- if (options.dependencies) {
50
- consola.info("Updating dependencies...");
51
- await runNpmScript(NpmScript.Update);
52
- consola.success("Updated dependencies.");
53
- }
54
- if (options.packageManager) {
55
- consola.info("Updating pnpm...");
56
- const version = await runNpmScript(NpmScript.UpdatePackageManager);
57
- consola.success("Successfully updated pnpm to: ", version);
58
- }
59
- }
@@ -1,3 +0,0 @@
1
- import type { CAC } from 'cac';
2
- declare function build(stacks: CAC): Promise<void>;
3
- export { build };
@@ -1,22 +0,0 @@
1
- import { startBuildProcess } from "./actions/build.mjs";
2
- async function build(stacks) {
3
- stacks.command("build", "Automagically build any of your libraries/packages for production use. Select any of the following packages").option("-c, --components", "Build your component library").option("-w, --web-components", "Build your framework agnostic web component library").option("-e, --elements", "An alias to the -w flag").option("-f, --functions", "Build your function library").option("-d, --docs", "Build your documentation site").option("--debug", "Add additional debug logs", { default: false }).action(async (options) => {
4
- await startBuildProcess(options);
5
- });
6
- stacks.command("build:components", "Automagically build your component libraries for production use & npm/CDN distribution.").action(async () => {
7
- await startBuildProcess("components");
8
- });
9
- stacks.command("build:functions", "Automagically build your function library for production use & npm/CDN distribution.").action(async () => {
10
- await startBuildProcess("functions");
11
- });
12
- stacks.command("build:web-components", "Automagically build web component library for production use & npm/CDN distribution.").action(async () => {
13
- await startBuildProcess("web-components");
14
- });
15
- stacks.command("build:docs", "Automagically build your documentation site.").action(async () => {
16
- await startBuildProcess("docs");
17
- });
18
- stacks.command("build:stacks", "Build the core Stacks framework.").action(async () => {
19
- await startBuildProcess("stacks");
20
- });
21
- }
22
- export { build };
@@ -1,3 +0,0 @@
1
- import type { CAC } from 'cac';
2
- declare function create(stack: CAC): Promise<void>;
3
- export { create };
@@ -1,46 +0,0 @@
1
- import consola from "consola";
2
- import * as ezSpawn from "@jsdevtools/ez-spawn";
3
- import { resolve } from "pathe";
4
- import { bold, cyan, dim, link } from "kolorist";
5
- import { useOnline } from "@vueuse/core";
6
- import { isFolder } from "@stacksjs/fs";
7
- import { ExitCode } from "@stacksjs/types";
8
- import { version } from "../../package.json";
9
- import { generate as generateAppKey } from "./actions/key.mjs";
10
- async function create(stack) {
11
- stack.option("-n, --name <name>", "Name of the stack").option("-u, --ui", "Are you building a UI?", { default: true }).option("-c, --components", "Are you building UI components?", { default: true }).option("-w, --web-components", "Automagically built optimized custom elements/web components?", { default: true }).option("-v, --vue", "Automagically built a Vue component library?", { default: true }).option("-p, --pages", "How about pages?", { default: true }).option("-f, --functions", "Are you developing functions/composables?", { default: true }).option("-a, --api", "Are you building an API?", { default: true }).option("-d, --database", "Do you need a database?", { default: true }).option("--debug", "Add additional debug logs", { default: false });
12
- stack.command("").action(async (args) => {
13
- const name = stack.args[0] || args.name || ".";
14
- const path = resolve(process.cwd(), name);
15
- console.log();
16
- console.log(cyan(bold("Stacks CLI")) + dim(` v${version}`));
17
- console.log();
18
- if (await isFolder(path)) {
19
- consola.error(`Path ${path} already exists`);
20
- process.exit(ExitCode.FatalError);
21
- }
22
- const online = useOnline();
23
- if (!online) {
24
- consola.info("It appears you are disconnected from the internet. The Stacks setup requires a brief internet connection for setup.");
25
- process.exit(ExitCode.FatalError);
26
- }
27
- consola.info("Setting up your stack.");
28
- await ezSpawn.async(`giget stacks ${name}`, { stdio: args.debug ? "inherit" : "ignore" });
29
- consola.success(`Successfully scaffolded your project at ${cyan(path)}`);
30
- consola.info("Ensuring your environment is ready...");
31
- await ezSpawn.async("fnm use", { stdio: args.debug ? "inherit" : "ignore", cwd: path });
32
- consola.success("Environment is ready.");
33
- consola.info("Installing & setting up Stacks.");
34
- await ezSpawn.async("pnpm install", { stdio: args.debug ? "inherit" : "ignore", cwd: path });
35
- await ezSpawn.async("cp .env.example .env", { stdio: args.debug ? "inherit" : "ignore", cwd: path });
36
- await generateAppKey();
37
- await ezSpawn.async("git init", { stdio: args.debug ? "inherit" : "ignore", cwd: path });
38
- consola.success("Installed & set-up \u{1F680}");
39
- console.log();
40
- consola.info(bold("Welcome to the Stacks Framework! \u269B\uFE0F"));
41
- console.log(`cd ${link(path, `vscode://file/${path}:1`)} && code .`);
42
- console.log();
43
- consola.log("To learn more, visit https://stacksjs.dev");
44
- });
45
- }
46
- export { create };
package/dist/cli/dev.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { CAC } from 'cac';
2
- declare function dev(stacks: CAC): Promise<void>;
3
- export { dev };
package/dist/cli/dev.mjs DELETED
@@ -1,13 +0,0 @@
1
- import { startDevelopmentServer } from "./actions/dev.mjs";
2
- async function dev(stacks) {
3
- stacks.command("dev", "Start the development server for any of the following packages").option("-c, --components", "Start the Components development server").option("-f, --functions", "Start the Functions development server").option("-d, --docs", "Start the Documentation development server").action(async (options) => {
4
- await startDevelopmentServer(options);
5
- });
6
- stacks.command("dev:components", "Start the development server for your component library").action(async () => {
7
- await startDevelopmentServer("components");
8
- });
9
- stacks.command("dev:docs", "Start the development server for your documentation").action(async () => {
10
- await startDevelopmentServer("docs");
11
- });
12
- }
13
- export { dev };
@@ -1,3 +0,0 @@
1
- import type { CAC } from 'cac';
2
- declare function example(stacks: CAC): Promise<void>;
3
- export { example };