@stacksjs/actions 0.44.11 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { log } from "@stacksjs/logging";
2
+ import { frameworkPath } from "@stacksjs/path";
3
+ import { runCommand } from "@stacksjs/cli";
4
+ log.info("Building Component Libraries...");
5
+ const result = await runCommand("npx mkdist -d", { debug: true, cwd: frameworkPath() });
6
+ if (result.isErr()) {
7
+ log.error("There was an error running `npx mkdist -d`.", result.error);
8
+ process.exit();
9
+ }
10
+ log.success("Building Stacks was successful.");
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { frameworkPath } from "@stacksjs/path";
2
+ import { runCommands } from "@stacksjs/cli";
3
+ await runCommands([
4
+ "pnpm --filter './core/**' --filter='!./core/config' --filter='!./core/x-ray' build",
5
+ "pnpm --filter '../core/config' build"
6
+ ], { debug: true, cwd: frameworkPath() });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { frameworkPath } from "@stacksjs/path";
2
+ import { runCommands } from "@stacksjs/cli";
3
+ await runCommands([
4
+ "npx mkdist -d",
5
+ "pnpm build:cli",
6
+ "pnpm build:core",
7
+ "cp -a ./core/. ./"
8
+ ], { debug: true, cwd: frameworkPath() });
package/dist/bump.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/bump.mjs ADDED
@@ -0,0 +1,8 @@
1
+ import { runCommand } from "@stacksjs/cli";
2
+ import { frameworkPath } from "@stacksjs/path";
3
+ const result = await runCommand(
4
+ "npx bumpp ./package.json ./buddy/package.json ./core/**/package.json ./vscode/package.json --execute 'pnpm run changelog' --all",
5
+ { debug: true, cwd: frameworkPath(), shell: true }
6
+ );
7
+ if (result.isErr())
8
+ console.error(result.error);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { runCommand } from "@stacksjs/cli";
2
+ import { projectPath } from "@stacksjs/path";
3
+ await runCommand("npx eslint . --fix", { debug: true, cwd: projectPath() });
package/dist/fresh.d.ts CHANGED
@@ -1,8 +1 @@
1
- import type { CliOptions as FreshOptions } from '@stacksjs/types';
2
- export declare function invoke(options?: FreshOptions): Promise<void>;
3
- /**
4
- * An alias of the invoke method.
5
- * @param options
6
- * @returns
7
- */
8
- export declare function fresh(options: FreshOptions): Promise<void>;
1
+ export {};
package/dist/fresh.mjs CHANGED
@@ -1,17 +1,6 @@
1
- import { intro, outro, runCommands } from "@stacksjs/cli";
2
- import { ExitCode } from "@stacksjs/types";
3
- export async function invoke(options) {
4
- const perf = intro("buddy fresh");
5
- const results = await runCommands(["pnpm run clean", "pnpm install"], options);
6
- for (const result of results) {
7
- if (result.isErr()) {
8
- outro("While running the fresh command, there was an issue", { startTime: perf, useSeconds: true, isError: true }, result.error);
9
- process.exit(ExitCode.FatalError);
10
- }
11
- }
12
- outro("Freshly reinstalled your dependencies.", { startTime: perf, useSeconds: true });
13
- process.exit(ExitCode.Success);
14
- }
15
- export async function fresh(options) {
16
- return invoke(options);
17
- }
1
+ import { runCommands } from "@stacksjs/cli";
2
+ import { frameworkPath } from "@stacksjs/path";
3
+ await runCommands([
4
+ "pnpm run clean",
5
+ "pnpm install"
6
+ ], { cwd: frameworkPath(), debug: true });
package/dist/generate.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { log } from "@stacksjs/logging";
2
- import { NpmScript } from "@stacksjs/types";
2
+ import { Action, NpmScript } from "@stacksjs/types";
3
3
  import { runNpmScript } from "@stacksjs/utils";
4
4
  import { projectPath } from "@stacksjs/path";
5
5
  import { runCommand } from "@stacksjs/cli";
6
- import { lintFix } from "./lint.mjs";
6
+ import { runAction } from "./helpers/index.mjs";
7
7
  export async function invoke(options) {
8
8
  if (options?.types)
9
9
  await types(options);
@@ -53,7 +53,7 @@ export async function vsCodeCustomData(options) {
53
53
  log.error("There was an error generating the custom-elements.json file.", result.error);
54
54
  process.exit();
55
55
  }
56
- await lintFix({ fix: true });
56
+ await runAction(Action.LintFix, { debug: true });
57
57
  log.success("Successfully generated the custom-elements.json file");
58
58
  }
59
59
  export async function ideHelpers(options) {
@@ -62,7 +62,7 @@ export async function ideHelpers(options) {
62
62
  log.error("There was an error generating IDE helpers.", result.error);
63
63
  process.exit();
64
64
  }
65
- await lintFix({ fix: true });
65
+ await runAction(Action.LintFix, { debug: true });
66
66
  log.success("Successfully generated IDE helpers");
67
67
  }
68
68
  export async function componentMeta(options) {
@@ -71,7 +71,7 @@ export async function componentMeta(options) {
71
71
  log.error("There was an error generating your component meta information.", result.error);
72
72
  process.exit();
73
73
  }
74
- await lintFix({ fix: true });
74
+ await runAction(Action.LintFix, { debug: true });
75
75
  log.success("Successfully generated component meta information");
76
76
  }
77
77
  export async function types(options) {
@@ -22,7 +22,7 @@ export async function createVueLibraryEntryPoint() {
22
22
  path: libraryEntryPath("vue-components"),
23
23
  data: generateEntryPointData("vue-components")
24
24
  });
25
- log.success("Created Vue component library entry point.");
25
+ log.success("Created the Vue component library entry point.");
26
26
  }
27
27
  export async function createWebComponentLibraryEntryPoint() {
28
28
  log.info("Creating the Web Component library entry point...");
@@ -76,7 +76,7 @@ export async function generatePackageJson(type) {
76
76
  prettyName = "Web Component library";
77
77
  else if (type === "functions")
78
78
  prettyName = "Function Library";
79
- log.success(`Created ${prettyName} package.json`);
79
+ log.success(`Created the ${prettyName} package.json file.`);
80
80
  } catch (err) {
81
81
  log.error(`There was an error creating the ${prettyName} package.json.`, err);
82
82
  }
@@ -1,10 +1,19 @@
1
- import type { CliOptions } from '@stacksjs/types';
1
+ import type { CliOptions, CommandResult } from '@stacksjs/types';
2
+ import type { Err, Result } from '@stacksjs/error-handling';
2
3
  /**
3
- * Run a command the Stacks way.
4
+ * Run an Action the Stacks way.
4
5
  *
5
6
  * @param command The action to invoke.
6
7
  * @param options The options to pass to the command.
7
8
  * @returns The result of the command.
8
9
  */
9
- export declare function runAction(action: string, options?: CliOptions): Promise<any>;
10
+ export declare function runAction(action: string, options?: CliOptions): Promise<Result<CommandResult<string>, Error> | Err<CommandResult<string>, string>>;
11
+ /**
12
+ * Run Actions the Stacks way.
13
+ *
14
+ * @param command The action 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?: CliOptions): Promise<Result<CommandResult<string>, Error>[] | Result<CommandResult<string>, Error> | Err<CommandResult<string>, string>>;
10
19
  export declare function hasAction(action: string): boolean;
@@ -1,12 +1,22 @@
1
1
  import storage from "@stacksjs/storage";
2
- import { runCommand } from "@stacksjs/cli";
2
+ import { runCommand, runCommands } from "@stacksjs/cli";
3
3
  import { actionsPath, functionsPath } from "@stacksjs/path";
4
4
  import { err } from "@stacksjs/error-handling";
5
5
  export async function runAction(action, options) {
6
6
  if (!hasAction(action))
7
7
  return err(`The specified action "${action}" does not exist`);
8
- const cmd = `esno ${actionsPath(`${action}.ts`)}`;
9
- return await runCommand(cmd, options);
8
+ const cmd = `npx esno ${actionsPath(`${action}.ts`)}`;
9
+ return options?.shouldShowSpinner ? await runCommands([cmd], options) : await runCommand(cmd, options);
10
+ }
11
+ export async function runActions(actions, options) {
12
+ if (!actions.length)
13
+ return err("No actions were specified");
14
+ for (const action of actions) {
15
+ if (!hasAction(action))
16
+ return err(`The specified action "${action}" does not exist`);
17
+ }
18
+ const commands = actions.map((action) => `npx esno ${actionsPath(`${action}.ts`)}`);
19
+ return await runCommands(commands, options);
10
20
  }
11
21
  export function hasAction(action) {
12
22
  if (storage.isFile(functionsPath(`actions/${action}.ts`)))
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { runAction } from "@stacksjs/actions";
2
+ import { log } from "@stacksjs/cli";
3
+ import { projectPath } from "@stacksjs/path";
4
+ import { Action } from "@stacksjs/types";
5
+ log.info("Linting your project.");
6
+ await runAction(Action.FixLintIssues, { debug: true, cwd: projectPath(), shouldShowSpinner: true });
7
+ log.success("Linted your project.");
package/dist/lint.d.ts CHANGED
@@ -1,4 +1 @@
1
- import type { LintOptions } from '@stacksjs/types';
2
- export declare function invoke(options: LintOptions): Promise<void>;
3
- export declare function lint(options: LintOptions): Promise<void>;
4
- export declare function lintFix(options?: LintOptions): Promise<void>;
1
+ export {};
package/dist/lint.mjs CHANGED
@@ -1,28 +1,9 @@
1
- import { log } from "@stacksjs/logging";
2
1
  import { intro, outro, runCommand } from "@stacksjs/cli";
3
- import { runNpmScript } from "@stacksjs/utils";
4
2
  import { ExitCode, NpmScript } from "@stacksjs/types";
5
- export async function invoke(options) {
6
- if (options?.fix)
7
- await lintFix(options);
8
- else
9
- await lint(options);
10
- }
11
- export async function lint(options) {
12
- const perf = intro("buddy lint");
13
- const result = await runCommand(NpmScript.Lint, { ...options, debug: true });
14
- if (result.isErr()) {
15
- outro("While running `buddy lint`, there was an issue", { startTime: perf, useSeconds: true, isError: true });
16
- process.exit(ExitCode.FatalError);
17
- }
18
- outro("Linted", { startTime: perf, useSeconds: true });
19
- }
20
- export async function lintFix(options) {
21
- log.info("Fixing lint errors...");
22
- const result = await runNpmScript(NpmScript.LintFix, options);
23
- if (result.isErr()) {
24
- log.error("There was an error lint fixing your code.", result.error);
25
- process.exit();
26
- }
27
- log.success("Fixed lint errors");
3
+ const perf = intro("buddy lint");
4
+ const result = await runCommand(NpmScript.Lint, { cwd: frameworkPath(), debug: true });
5
+ if (result.isErr()) {
6
+ outro("While running `buddy lint`, there was an issue", { startTime: perf, useSeconds: true, isError: true });
7
+ process.exit(ExitCode.FatalError);
28
8
  }
9
+ outro("Linted", { startTime: perf, useSeconds: true });
package/dist/make.mjs CHANGED
@@ -29,7 +29,7 @@ export async function component(options) {
29
29
  const name = options.name;
30
30
  log.info("Creating your component...");
31
31
  await createComponent(options);
32
- log.success(`Created ${italic(name)} component`);
32
+ log.success(`Created the ${italic(name)} component.`);
33
33
  } catch (error) {
34
34
  log.error("There was an error creating your component.", error);
35
35
  process.exit();
@@ -57,7 +57,7 @@ export async function database(options) {
57
57
  const name = options.name;
58
58
  log.info(`Creating your ${italic(name)} database...`);
59
59
  await createDatabase(options);
60
- log.success(`Created ${italic(name)} database`);
60
+ log.success(`Created the ${italic(name)} database.`);
61
61
  } catch (error) {
62
62
  log.error("There was an error creating your database.", error);
63
63
  process.exit();
@@ -71,7 +71,7 @@ export async function factory(options) {
71
71
  const name = options.name;
72
72
  log.info(`Creating your ${italic(name)} factory...`);
73
73
  await createDatabase(options);
74
- log.success(`Created ${italic(name)} factory`);
74
+ log.success(`Created the ${italic(name)} factory.`);
75
75
  } catch (error) {
76
76
  log.error("There was an error creating your factory.", error);
77
77
  process.exit();
@@ -85,7 +85,7 @@ export async function migration(options) {
85
85
  const name = options.name;
86
86
  log.info(`Creating your ${italic(name)} migration...`);
87
87
  await createMigration(options);
88
- log.success(`Created ${italic(name)} migration`);
88
+ log.success(`Created the ${italic(name)} migration.`);
89
89
  } catch (error) {
90
90
  log.error("There was an error creating your migration.", error);
91
91
  process.exit();
@@ -99,7 +99,7 @@ export async function notification(options) {
99
99
  const name = options.name;
100
100
  log.info(`Creating your ${italic(name)} notification...`);
101
101
  await createNotification(options);
102
- log.success(`Created ${italic(name)} notification`);
102
+ log.success(`Created the ${italic(name)} notification.`);
103
103
  } catch (error) {
104
104
  log.error("There was an error creating your notification.", error);
105
105
  process.exit();
@@ -113,7 +113,7 @@ export async function page(options) {
113
113
  const name = options.name;
114
114
  log.info("Creating your page...");
115
115
  createPage(options);
116
- log.success(`Created ${name} page`);
116
+ log.success(`Created the ${name} page.`);
117
117
  } catch (error) {
118
118
  log.error("There was an error creating your page.", error);
119
119
  process.exit();
@@ -141,7 +141,7 @@ export async function fx(options) {
141
141
  const name = options.name;
142
142
  log.info("Creating your function...");
143
143
  await createFunction(options);
144
- log.success(`Created ${name} function`);
144
+ log.success(`Created the ${name} function.`);
145
145
  } catch (error) {
146
146
  log.error("There was an error creating your function.", error);
147
147
  process.exit();
@@ -171,7 +171,7 @@ export async function language(options) {
171
171
  const name = options.name;
172
172
  log.info("Creating your translation file...");
173
173
  createLanguage(options);
174
- log.success(`Created ${name} translation file`);
174
+ log.success(`Created the ${name} translation file.`);
175
175
  } catch (error) {
176
176
  log.error("There was an error creating your language.", error);
177
177
  process.exit();
package/dist/release.mjs CHANGED
@@ -1,21 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { frameworkPath } from "@stacksjs/path";
3
- import { runAction } from "@stacksjs/actions";
4
- import { runNpmScript } from "@stacksjs/utils";
5
- import { NpmScript } from "@stacksjs/types";
6
- import { log } from "@stacksjs/cli";
7
- let result = await runAction("generate-package-json");
8
- if (result.isErr()) {
9
- log.error("There was an error while releasing your stack, during the process of fixing your lint errors.", result.error);
10
- process.exit();
11
- }
12
- result = await runNpmScript(NpmScript.LintFix, { debug: true, cwd: frameworkPath() });
13
- if (result.isErr()) {
14
- log.error("There was an error while releasing your stack, during the process of fixing your lint errors.", result.error);
15
- process.exit();
16
- }
17
- result = await runNpmScript(NpmScript.Release, { debug: true, cwd: frameworkPath() });
18
- if (result.isErr()) {
19
- log.error("There was an error while releasing your stack.", result.error);
20
- process.exit();
21
- }
3
+ import { runActions } from "@stacksjs/actions";
4
+ import { Action } from "@stacksjs/types";
5
+ await runActions([
6
+ Action.GeneratePackageJsons,
7
+ Action.LintFix,
8
+ Action.Bump
9
+ ], { debug: true, cwd: frameworkPath() });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/actions",
3
3
  "type": "module",
4
- "version": "0.44.11",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks actions.",
7
7
  "author": "Chris Breuer",
@@ -41,23 +41,23 @@
41
41
  },
42
42
  "peerDependencies": {
43
43
  "markdown-it": "^13.0.1",
44
- "vue-component-meta": "^1.0.13",
45
- "@stacksjs/cli": "0.44.11",
46
- "@stacksjs/config": "0.44.11",
47
- "@stacksjs/logging": "0.44.11",
48
- "@stacksjs/path": "0.44.11",
49
- "@stacksjs/storage": "0.44.11",
50
- "@stacksjs/types": "0.44.11",
51
- "@stacksjs/utils": "0.44.11"
44
+ "vue-component-meta": "^1.0.16",
45
+ "@stacksjs/cli": "0.45.0",
46
+ "@stacksjs/config": "0.45.0",
47
+ "@stacksjs/logging": "0.45.0",
48
+ "@stacksjs/path": "0.45.0",
49
+ "@stacksjs/storage": "0.45.0",
50
+ "@stacksjs/types": "0.45.0",
51
+ "@stacksjs/utils": "0.45.0"
52
52
  },
53
53
  "dependencies": {
54
54
  "esno": "^0.16.3",
55
- "@stacksjs/strings": "0.44.11"
55
+ "@stacksjs/strings": "0.45.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "mkdist": "^1.0.0",
59
59
  "typescript": "^4.9.4",
60
- "@stacksjs/testing": "0.44.11"
60
+ "@stacksjs/testing": "0.45.0"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "mkdist -d",