@stacksjs/actions 0.47.4 → 0.49.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.
@@ -2,5 +2,7 @@ import { frameworkPath } from "@stacksjs/path";
2
2
  import { runCommands } from "@stacksjs/cli";
3
3
  await runCommands([
4
4
  "pnpm --filter './core/**' --filter='!./core/config' --filter='!./core/x-ray' build",
5
- "pnpm --filter '../core/config' build"
5
+ // command to build the core packages, excluding the config & x-ray package
6
+ "pnpm --filter './core/config' build"
7
+ // command to build the config package
6
8
  ], { debug: true, cwd: frameworkPath(), shell: true });
@@ -2,7 +2,11 @@ import { frameworkPath } from "@stacksjs/path";
2
2
  import { runCommands } from "@stacksjs/cli";
3
3
  await runCommands([
4
4
  "npx mkdist -d",
5
+ // command to build the dist folder
5
6
  "pnpm build:cli",
7
+ // command to build the Buddy CLI
6
8
  "pnpm build:core",
9
+ // command to build the Stacks Core
7
10
  "cp -a ./core/. ./"
11
+ // copy the core stacks to the famework's root
8
12
  ], { debug: true, cwd: frameworkPath() });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { runCommand } from "@stacksjs/cli";
2
+ import { frameworkPath } from "@stacksjs/path";
3
+ import { NpmScript } from "@stacksjs/types";
4
+ await runCommand(NpmScript.DevComponents, { cwd: frameworkPath(), debug: true });
package/dist/dev.mjs CHANGED
@@ -2,6 +2,7 @@ import { log } from "@stacksjs/logging";
2
2
  import { runNpmScript } from "@stacksjs/utils";
3
3
  import { NpmScript } from "@stacksjs/types";
4
4
  export async function invoke(options) {
5
+ console.log("options are: ", options);
5
6
  if (options.components || options.all)
6
7
  await components(options);
7
8
  else if (options.docs || options.all)
@@ -17,6 +18,7 @@ export async function dev(options) {
17
18
  return invoke(options);
18
19
  }
19
20
  export async function components(options) {
21
+ console.log("here?");
20
22
  log.info("Starting your components dev server...");
21
23
  await runNpmScript(NpmScript.DevComponents, options);
22
24
  }
@@ -23,6 +23,7 @@ export async function generateComponentMeta() {
23
23
  props.push({
24
24
  name: `${name}${required ? "" : "?"}`,
25
25
  description: md.render(description),
26
+ // required,
26
27
  type,
27
28
  default: defaultValue || "unknown"
28
29
  });
@@ -2,7 +2,7 @@ import { log } from "@stacksjs/logging";
2
2
  import { writeTextFile } from "@stacksjs/storage";
3
3
  import { packageJsonPath } from "@stacksjs/path";
4
4
  import { library } from "@stacksjs/config";
5
- import { packageManager } from "../../package.json";
5
+ import { packageManager } from "../../package.json" assert { type: "json" };
6
6
  export async function generatePackageJson(type) {
7
7
  let name, description, directory, keywords, config, prettyName;
8
8
  if (type === "vue-components") {
@@ -1,5 +1,6 @@
1
1
  import type { CliOptions, CommandResult } from '@stacksjs/types';
2
2
  import type { Err, Result } from '@stacksjs/error-handling';
3
+ export type ActionResult = Promise<Result<CommandResult<string>, Error> | Result<CommandResult<string>, Error>[] | Err<CommandResult<string>, string>>;
3
4
  /**
4
5
  * Run an Action the Stacks way.
5
6
  *
@@ -1,11 +1,25 @@
1
1
  import storage from "@stacksjs/storage";
2
- import { runCommand, runCommands } from "@stacksjs/cli";
2
+ import { log, runCommand, runCommands } from "@stacksjs/cli";
3
3
  import { actionsPath, functionsPath } from "@stacksjs/path";
4
4
  import { err } from "@stacksjs/error-handling";
5
+ const parseOptions = (options) => {
6
+ if (!options)
7
+ return "";
8
+ const parsedOptions = Object.entries(options).map(([key, value]) => {
9
+ if (typeof value === "boolean")
10
+ return `--${key}`;
11
+ else
12
+ return `--${key}=${value}`;
13
+ });
14
+ return parsedOptions.join(" ").replace("----=", "");
15
+ };
5
16
  export async function runAction(action, options) {
6
17
  if (!hasAction(action))
7
18
  return err(`The specified action "${action}" does not exist.`);
8
- const cmd = `npx esno ${actionsPath(`${action}.ts`)}`;
19
+ const opts = parseOptions(options);
20
+ const cmd = `npx esno ${actionsPath(`${action}.ts ${opts}`)}`;
21
+ if (options?.debug)
22
+ log.info("Running command:", cmd, options);
9
23
  return options?.shouldShowSpinner ? await runCommands([cmd], options) : await runCommand(cmd, options);
10
24
  }
11
25
  export async function runActions(actions, options) {
package/dist/make.d.ts CHANGED
@@ -15,7 +15,6 @@ export declare function createFactory(options: MakeOptions): Promise<void>;
15
15
  export declare function migration(options: MakeOptions): Promise<void>;
16
16
  export declare function createMigration(options: MakeOptions): Promise<void>;
17
17
  export declare function notification(options: MakeOptions): Promise<void>;
18
- export declare function createNotification(options: MakeOptions): Promise<void>;
19
18
  export declare function page(options: MakeOptions): Promise<void>;
20
19
  export declare function createPage(options: MakeOptions): Promise<void>;
21
20
  export declare function fx(options: MakeOptions): Promise<void>;
@@ -23,3 +22,4 @@ export declare function createFunction(options: MakeOptions): Promise<void>;
23
22
  export declare function language(options: MakeOptions): Promise<void>;
24
23
  export declare function createLanguage(options: MakeOptions): Promise<void>;
25
24
  export declare function stack(options: MakeOptions): Promise<void>;
25
+ export declare function createNotification(options: MakeOptions): Promise<boolean>;
package/dist/make.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { italic, log, spawn } from "@stacksjs/cli";
2
- import { writeTextFile } from "@stacksjs/storage";
2
+ import { createFolder, doesFolderExist, writeTextFile } from "@stacksjs/storage";
3
3
  import { resolve } from "@stacksjs/path";
4
4
  export async function invoke(options) {
5
5
  if (options.component)
@@ -105,9 +105,6 @@ export async function notification(options) {
105
105
  process.exit();
106
106
  }
107
107
  }
108
- export async function createNotification(options) {
109
- console.log("options", options);
110
- }
111
108
  export async function page(options) {
112
109
  try {
113
110
  const name = options.name;
@@ -199,3 +196,32 @@ export async function stack(options) {
199
196
  process.exit();
200
197
  }
201
198
  }
199
+ export async function createNotification(options) {
200
+ const name = options.name;
201
+ try {
202
+ let importOption = "EmailOptions";
203
+ if (!doesFolderExist("notifications"))
204
+ await createFolder("./notifications");
205
+ if (options.chat)
206
+ importOption = "ChatOptions";
207
+ if (options.sms)
208
+ importOption = "SMSOptions";
209
+ await writeTextFile({
210
+ path: `./notifications/${name}.ts`,
211
+ data: `import type { ${importOption} } from '@stacksjs/types'
212
+
213
+ function content(): string {
214
+ return 'example'
215
+ }
216
+
217
+ function send(): ${importOption} {
218
+ return {
219
+ content: content(),
220
+ }
221
+ }`
222
+ });
223
+ return true;
224
+ } catch (error) {
225
+ return false;
226
+ }
227
+ }
package/dist/release.mjs CHANGED
@@ -4,6 +4,10 @@ import { runActions } from "@stacksjs/actions";
4
4
  import { Action } from "@stacksjs/types";
5
5
  await runActions([
6
6
  Action.GeneratePackageJsons,
7
+ // generate the package.json's for each package
7
8
  Action.LintFix,
9
+ // ensure there are no lint errors
10
+ // Action.Test, // run the tests
8
11
  Action.Bump
12
+ // bump the versions, create the git (version) tag, generate the changelog, commit & push the changes
9
13
  ], { debug: true, cwd: frameworkPath() });
@@ -1,4 +1,4 @@
1
1
  import { NpmScript } from "@stacksjs/types";
2
2
  import { runCommand } from "@stacksjs/cli";
3
3
  import { frameworkPath } from "@stacksjs/path";
4
- await runCommand(NpmScript.TestCoverage, { debug: true, cwd: frameworkPath() });
4
+ await runCommand(NpmScript.TestCoverage, { cwd: frameworkPath(), debug: true });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { NpmScript } from "@stacksjs/types";
2
+ import { runCommand } from "@stacksjs/cli";
3
+ import { frameworkPath } from "@stacksjs/path";
4
+ await runCommand(NpmScript.TestFeature, { debug: true, cwd: frameworkPath() });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { NpmScript } from "@stacksjs/types";
2
+ import { runCommand } from "@stacksjs/cli";
3
+ import { frameworkPath } from "@stacksjs/path";
4
+ await runCommand(NpmScript.TestUnit, { debug: true, cwd: frameworkPath() });
package/dist/update.mjs CHANGED
@@ -41,7 +41,7 @@ export async function checkForUncommittedChanges(path = "./.stacks", options) {
41
41
  }
42
42
  }
43
43
  export async function updateFramework(options) {
44
- const perf = intro("buddy update:framework");
44
+ const perf = await intro("buddy update:framework");
45
45
  await checkForUncommittedChanges("./.stacks", options);
46
46
  await downloadFrameworkUpdate(options);
47
47
  log.info("Updating framework...");
@@ -68,7 +68,7 @@ export async function downloadFrameworkUpdate(options) {
68
68
  log.success("Your framework updated correctly to version: ", version);
69
69
  }
70
70
  export async function updateDependencies(options) {
71
- const perf = intro("buddy update:dependencies");
71
+ const perf = await intro("buddy update:dependencies");
72
72
  const result = await runCommand(NpmScript.UpdateDependencies, options);
73
73
  if (result.isErr()) {
74
74
  outro("While running the update:dependencies command, there was an issue", { startTime: perf, useSeconds: true, isError: true }, result.error);
@@ -78,7 +78,7 @@ export async function updateDependencies(options) {
78
78
  process.exit();
79
79
  }
80
80
  export async function updatePackageManager(options) {
81
- const perf = intro("buddy update:package-manager");
81
+ const perf = await intro("buddy update:package-manager");
82
82
  const version = options?.version || "latest";
83
83
  const result = await runCommand(`corepack prepare pnpm@${version} --activate`, options);
84
84
  if (result.isErr()) {
@@ -89,7 +89,7 @@ export async function updatePackageManager(options) {
89
89
  process.exit();
90
90
  }
91
91
  export async function updateNode(options) {
92
- const perf = intro("buddy update:node");
92
+ const perf = await intro("buddy update:node");
93
93
  const result = await runCommand(NpmScript.UpdateNode, options);
94
94
  if (result.isErr()) {
95
95
  outro("While running the update:node command, there was an issue", { startTime: perf, useSeconds: true, isError: true }, result.error);
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@stacksjs/actions",
3
3
  "type": "module",
4
- "version": "0.47.4",
5
- "packageManager": "pnpm@7.21.0",
4
+ "version": "0.49.0",
5
+ "packageManager": "pnpm@7.25.0",
6
6
  "description": "The Stacks actions.",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",
@@ -36,29 +36,29 @@
36
36
  "README.md"
37
37
  ],
38
38
  "engines": {
39
- "node": ">=v18.12.1",
40
- "pnpm": ">=7.21.0"
39
+ "node": ">=v18.13.0",
40
+ "pnpm": ">=7.25.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "markdown-it": "^13.0.1",
44
- "vue-component-meta": "^1.0.18",
45
- "@stacksjs/cli": "0.47.4",
46
- "@stacksjs/config": "0.47.4",
47
- "@stacksjs/logging": "0.47.4",
48
- "@stacksjs/path": "0.47.4",
49
- "@stacksjs/security": "0.47.4",
50
- "@stacksjs/storage": "0.47.4",
51
- "@stacksjs/types": "0.47.4",
52
- "@stacksjs/utils": "0.47.4"
44
+ "vue-component-meta": "^1.0.24",
45
+ "@stacksjs/cli": "0.49.0",
46
+ "@stacksjs/config": "0.49.0",
47
+ "@stacksjs/logging": "0.49.0",
48
+ "@stacksjs/path": "0.49.0",
49
+ "@stacksjs/security": "0.49.0",
50
+ "@stacksjs/storage": "0.49.0",
51
+ "@stacksjs/types": "0.49.0",
52
+ "@stacksjs/utils": "0.49.0"
53
53
  },
54
54
  "dependencies": {
55
55
  "esno": "^0.16.3",
56
- "@stacksjs/strings": "0.47.4"
56
+ "@stacksjs/strings": "0.49.0"
57
57
  },
58
58
  "devDependencies": {
59
- "mkdist": "^1.0.0",
59
+ "mkdist": "^1.1.0",
60
60
  "typescript": "^4.9.4",
61
- "@stacksjs/testing": "0.47.4"
61
+ "@stacksjs/testing": "0.49.0"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "mkdist -d",