@stacksjs/actions 0.51.0 → 0.52.1
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.
- package/README.md +1 -1
- package/dist/build/core.mjs +6 -0
- package/dist/build.mjs +1 -1
- package/dist/clean.d.ts +1 -8
- package/dist/clean.mjs +10 -15
- package/dist/deploy/domains.mjs +3 -0
- package/dist/deploy.mjs +6 -0
- package/dist/dev/docs.mjs +4 -0
- package/dist/{dev.d.ts → dev/index.d.ts} +1 -3
- package/dist/{dev.mjs → dev/index.mjs} +0 -17
- package/dist/fresh.mjs +1 -1
- package/dist/{generate-component-meta.mjs → generate/component-meta.mjs} +1 -1
- package/dist/{generate-ide-helpers.mjs → generate/ide-helpers.mjs} +1 -1
- package/dist/{generate.d.ts → generate/index.d.ts} +2 -0
- package/dist/{generate.mjs → generate/index.mjs} +12 -3
- package/dist/{generate-lib-entries.mjs → generate/lib-entries.mjs} +1 -1
- package/dist/{generate-package-jsons.mjs → generate/package-jsons.mjs} +1 -1
- package/dist/{generate-vscode-custom-data.mjs → generate/vscode-custom-data.mjs} +1 -1
- package/dist/generate/vue-compat.mjs +3 -0
- package/dist/helpers/lib-entries.mjs +6 -6
- package/dist/helpers/package-json.mjs +10 -11
- package/dist/helpers/utils.d.ts +4 -5
- package/dist/helpers/utils.mjs +13 -10
- package/dist/helpers/vscode-custom-data.mjs +1 -1
- package/dist/key-generate.mjs +2 -2
- package/dist/make.d.ts +2 -2
- package/dist/make.mjs +56 -15
- package/dist/migrate.mjs +2 -0
- package/dist/preinstall.mjs +2 -2
- package/dist/release.mjs +3 -5
- package/dist/seed.mjs +2 -0
- package/dist/test/feature.d.ts +1 -0
- package/dist/test/ui.d.ts +1 -0
- package/dist/test/unit.d.ts +1 -0
- package/dist/tinker.d.ts +1 -0
- package/dist/tinker.mjs +3 -0
- package/dist/upgrade/dependencies.d.ts +0 -0
- package/dist/upgrade/dependencies.mjs +0 -0
- package/dist/upgrade/framework.d.ts +1 -0
- package/dist/upgrade/framework.mjs +18 -0
- package/dist/upgrade/index.d.ts +1 -0
- package/dist/upgrade/index.mjs +11 -0
- package/dist/upgrade/node.d.ts +1 -0
- package/dist/upgrade/node.mjs +3 -0
- package/dist/upgrade/package-manager.d.ts +1 -0
- package/dist/upgrade/package-manager.mjs +3 -0
- package/dist/upgrade.d.ts +5 -0
- package/dist/upgrade.mjs +55 -0
- package/package.json +236 -23
- package/dist/build-core.mjs +0 -8
- package/dist/fix-lint-issues.mjs +0 -3
- package/dist/generate-onboarding.mjs +0 -2
- package/dist/generate-vue-compat.mjs +0 -3
- package/dist/update.d.ts +0 -14
- package/dist/update.mjs +0 -100
- /package/dist/{build-component-libs.d.ts → build/component-libs.d.ts} +0 -0
- /package/dist/{build-component-libs.mjs → build/component-libs.mjs} +0 -0
- /package/dist/{build-core.d.ts → build/core.d.ts} +0 -0
- /package/dist/{build-stacks.d.ts → build/stacks.d.ts} +0 -0
- /package/dist/{build-stacks.mjs → build/stacks.mjs} +0 -0
- /package/dist/{fix-lint-issues.d.ts → deploy/domains.d.ts} +0 -0
- /package/dist/{dev-components.d.ts → deploy.d.ts} +0 -0
- /package/dist/{generate-onboarding.d.ts → dev/components.d.ts} +0 -0
- /package/dist/{dev-components.mjs → dev/components.mjs} +0 -0
- /package/dist/{lint-fix.d.ts → dev/docs.d.ts} +0 -0
- /package/dist/{generate-component-meta.d.ts → generate/component-meta.d.ts} +0 -0
- /package/dist/{generate-ide-helpers.d.ts → generate/ide-helpers.d.ts} +0 -0
- /package/dist/{generate-lib-entries.d.ts → generate/lib-entries.d.ts} +0 -0
- /package/dist/{generate-package-jsons.d.ts → generate/package-jsons.d.ts} +0 -0
- /package/dist/{generate-settings.d.ts → generate/settings.d.ts} +0 -0
- /package/dist/{generate-settings.mjs → generate/settings.mjs} +0 -0
- /package/dist/{generate-vscode-custom-data.d.ts → generate/vscode-custom-data.d.ts} +0 -0
- /package/dist/{generate-vue-compat.d.ts → generate/vue-compat.d.ts} +0 -0
- /package/dist/{lint.d.ts → lint/fix.d.ts} +0 -0
- /package/dist/{lint-fix.mjs → lint/fix.mjs} +0 -0
- /package/dist/{test-coverage.d.ts → lint/index.d.ts} +0 -0
- /package/dist/{lint.mjs → lint/index.mjs} +0 -0
- /package/dist/{test-feature.d.ts → migrate.d.ts} +0 -0
- /package/dist/{test-ui.d.ts → seed.d.ts} +0 -0
- /package/dist/{test-unit.d.ts → test/coverage.d.ts} +0 -0
- /package/dist/{test-coverage.mjs → test/coverage.mjs} +0 -0
- /package/dist/{test-feature.mjs → test/feature.mjs} +0 -0
- /package/dist/{test-ui.mjs → test/ui.mjs} +0 -0
- /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
|
-
##
|
|
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
|
-
|
|
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,10 @@
|
|
|
1
|
-
import { log
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
process.exit(ExitCode.FatalError);
|
|
12
|
-
}
|
|
13
|
-
export async function clean(options) {
|
|
14
|
-
return invoke(options);
|
|
15
|
-
}
|
|
1
|
+
import { log } from "@stacksjs/cli";
|
|
2
|
+
import { projectPath } from "@stacksjs/path";
|
|
3
|
+
import { del } from "@stacksjs/utils";
|
|
4
|
+
log.info("Running clean command...", projectPath());
|
|
5
|
+
await del([
|
|
6
|
+
projectPath("pnpm-lock.yaml"),
|
|
7
|
+
projectPath("node_modules/"),
|
|
8
|
+
projectPath(".stacks/**/dist"),
|
|
9
|
+
projectPath(".stacks/**/node_modules")
|
|
10
|
+
]);
|
package/dist/deploy.mjs
ADDED
|
@@ -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<
|
|
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,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 "
|
|
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 "
|
|
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 {
|
|
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("
|
|
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 "
|
|
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 "
|
|
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 "
|
|
4
|
+
import { generateVsCodeCustomData } from "../helpers/vscode-custom-data.mjs";
|
|
5
5
|
if (hasComponents())
|
|
6
6
|
await generateVsCodeCustomData();
|
|
7
7
|
else
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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]})`);
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { log } from "@stacksjs/logging";
|
|
2
2
|
import { writeTextFile } from "@stacksjs/storage";
|
|
3
3
|
import { packageJsonPath } from "@stacksjs/path";
|
|
4
|
-
import { library } from "@stacksjs/config";
|
|
5
|
-
import { packageManager } from "../../package.json" assert { type: "json" };
|
|
4
|
+
import { library, packageManager } from "@stacksjs/config";
|
|
6
5
|
export async function generatePackageJson(type) {
|
|
7
6
|
let name, description, directory, keywords, config, prettyName;
|
|
8
7
|
if (type === "vue-components") {
|
|
9
|
-
name = library.vueComponents
|
|
10
|
-
description = library.vueComponents
|
|
8
|
+
name = library.vueComponents?.name;
|
|
9
|
+
description = library.vueComponents?.description;
|
|
11
10
|
directory = "components";
|
|
12
|
-
keywords = library.vueComponents
|
|
11
|
+
keywords = library.vueComponents?.keywords;
|
|
13
12
|
config = "vue-components";
|
|
14
13
|
} else if (type === "web-components") {
|
|
15
|
-
name = library.webComponents
|
|
16
|
-
description = library.webComponents
|
|
14
|
+
name = library.webComponents?.name;
|
|
15
|
+
description = library.webComponents?.description;
|
|
17
16
|
directory = "components";
|
|
18
|
-
keywords = library.webComponents
|
|
17
|
+
keywords = library.webComponents?.keywords;
|
|
19
18
|
config = "web-components";
|
|
20
19
|
} else if (type === "functions") {
|
|
21
|
-
name = library.functions
|
|
22
|
-
description = library.functions
|
|
20
|
+
name = library.functions?.name;
|
|
21
|
+
description = library.functions?.description;
|
|
23
22
|
directory = "functions";
|
|
24
|
-
keywords = library.functions
|
|
23
|
+
keywords = library.functions?.keywords;
|
|
25
24
|
config = "functions";
|
|
26
25
|
}
|
|
27
26
|
try {
|
package/dist/helpers/utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
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?:
|
|
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?:
|
|
18
|
+
export declare function runActions(actions: string[], options?: ActionOptions): Promise<CommandResult | CommandResult[]>;
|
|
20
19
|
export declare function hasAction(action: string): boolean;
|
package/dist/helpers/utils.mjs
CHANGED
|
@@ -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
|
-
|
|
5
|
+
function parseOptions(options) {
|
|
6
6
|
if (!options)
|
|
7
7
|
return "";
|
|
8
8
|
const parsedOptions = Object.entries(options).map(([key, value]) => {
|
|
9
|
-
if (
|
|
9
|
+
if (key.length === 1)
|
|
10
|
+
return `-${key}=${value}`;
|
|
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
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
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
|
|
16
|
+
const componentsData = JSON.stringify(library.vueComponents?.tags);
|
|
17
17
|
return `{
|
|
18
18
|
"version": 1.1,
|
|
19
19
|
"tags": ${componentsData}
|
package/dist/key-generate.mjs
CHANGED
|
@@ -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 {
|
|
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", {
|
|
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
|
+
}
|
package/dist/migrate.mjs
ADDED
package/dist/preinstall.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { log, spawn } from "@stacksjs/cli";
|
|
2
2
|
import { projectPath } from "@stacksjs/path";
|
|
3
|
-
import {
|
|
3
|
+
import { determineDebugLevel } from "@stacksjs/utils";
|
|
4
4
|
export async function invoke(options) {
|
|
5
5
|
try {
|
|
6
|
-
const stdio =
|
|
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
|
-
//
|
|
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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/tinker.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/tinker.mjs
ADDED
|
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 @@
|
|
|
1
|
+
export {};
|