@stacksjs/actions 0.70.137 → 0.70.138

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.
@@ -1,5 +1,6 @@
1
1
  import type { ActionOptions, CommandError, Subprocess } from '@stacksjs/types';
2
2
  import type { Result } from '@stacksjs/error-handling';
3
+ export declare function publishedActionCandidates(action: string, packageRoot?: string): string[];
3
4
  export declare function developmentConditionForProject(projectRoot: string): string;
4
5
  /**
5
6
  * Run an Action the Stacks way.
@@ -6,21 +6,33 @@ import { buddyOptions, runCommand, runCommands } from "@stacksjs/cli";
6
6
  import { err } from "@stacksjs/error-handling";
7
7
  import { log } from "@stacksjs/logging";
8
8
  import * as p from "@stacksjs/path";
9
+ export function publishedActionCandidates(action, packageRoot) {
10
+ let root = packageRoot;
11
+ if (!root)
12
+ try {
13
+ const pkgUrl = import.meta.resolve("@stacksjs/actions/package.json");
14
+ if (pkgUrl) {
15
+ const pkgPath = new URL(pkgUrl).pathname;
16
+ root = pkgPath.slice(0, pkgPath.lastIndexOf("/"));
17
+ }
18
+ } catch {
19
+ return [];
20
+ }
21
+ if (!root)
22
+ return [];
23
+ return [
24
+ `${root}/dist/${action}.js`,
25
+ `${root}/dist/src/${action}.js`,
26
+ `${root}/src/${action}.ts`
27
+ ];
28
+ }
9
29
  export function developmentConditionForProject(projectRoot) {
10
30
  return existsSync(join(projectRoot, "storage/framework/core")) && existsSync(join(projectRoot, "node_modules/@stacksjs/env/src/index.ts")) ? "--conditions development" : "";
11
31
  }
12
32
  async function resolveActionFile(action) {
13
33
  const candidates = [];
14
34
  candidates.push(p.actionsPath(`src/${action}.ts`));
15
- try {
16
- const pkgUrl = import.meta.resolve("@stacksjs/actions/package.json");
17
- if (pkgUrl) {
18
- const pkgPath = new URL(pkgUrl).pathname, pkgRoot = pkgPath.slice(0, pkgPath.lastIndexOf("/"));
19
- candidates.push(`${pkgRoot}/dist/${action}.js`);
20
- candidates.push(`${pkgRoot}/dist/src/${action}.js`);
21
- candidates.push(`${pkgRoot}/src/${action}.ts`);
22
- }
23
- } catch {}
35
+ candidates.push(...publishedActionCandidates(action));
24
36
  for (const candidate of candidates)
25
37
  if (await Bun.file(candidate).exists())
26
38
  return candidate;
@@ -103,6 +115,7 @@ export function hasAction(action) {
103
115
  ], actionPatterns = [`src/${action}.ts`, `src/${action}`, `${action}.ts`, `${action}`];
104
116
  return [
105
117
  ...userActionPatterns.map((pattern) => p.userActionsPath(pattern)),
106
- ...actionPatterns.map((pattern) => p.actionsPath(pattern))
118
+ ...actionPatterns.map((pattern) => p.actionsPath(pattern)),
119
+ ...publishedActionCandidates(action)
107
120
  ].some((candidate) => existsSync(candidate));
108
121
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/actions",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.70.137",
5
+ "version": "0.70.138",
6
6
  "description": "The Stacks actions.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -62,7 +62,7 @@
62
62
  "prepublishOnly": "bun run build"
63
63
  },
64
64
  "dependencies": {
65
- "@stacksjs/config": "0.70.137",
65
+ "@stacksjs/config": "0.70.138",
66
66
  "@stacksjs/bumpx": "^0.2.6",
67
67
  "@stacksjs/bunpress": "^0.1.12",
68
68
  "@stacksjs/logsmith": "^0.2.3",
@@ -70,23 +70,23 @@
70
70
  "@stacksjs/ts-md": "^0.1.1"
71
71
  },
72
72
  "devDependencies": {
73
- "@stacksjs/api": "0.70.137",
74
- "@stacksjs/cli": "0.70.137",
75
- "@stacksjs/config": "0.70.137",
76
- "@stacksjs/database": "0.70.137",
73
+ "@stacksjs/api": "0.70.138",
74
+ "@stacksjs/cli": "0.70.138",
75
+ "@stacksjs/config": "0.70.138",
76
+ "@stacksjs/database": "0.70.138",
77
77
  "@stacksjs/tlsx": "^0.13.2",
78
78
  "better-dx": "^0.2.17",
79
- "@stacksjs/dns": "0.70.137",
80
- "@stacksjs/enums": "0.70.137",
81
- "@stacksjs/env": "0.70.137",
82
- "@stacksjs/error-handling": "0.70.137",
83
- "@stacksjs/logging": "0.70.137",
84
- "@stacksjs/path": "0.70.137",
85
- "@stacksjs/security": "0.70.137",
86
- "@stacksjs/storage": "0.70.137",
87
- "@stacksjs/strings": "0.70.137",
88
- "@stacksjs/utils": "0.70.137",
89
- "@stacksjs/validation": "0.70.137"
79
+ "@stacksjs/dns": "0.70.138",
80
+ "@stacksjs/enums": "0.70.138",
81
+ "@stacksjs/env": "0.70.138",
82
+ "@stacksjs/error-handling": "0.70.138",
83
+ "@stacksjs/logging": "0.70.138",
84
+ "@stacksjs/path": "0.70.138",
85
+ "@stacksjs/security": "0.70.138",
86
+ "@stacksjs/storage": "0.70.138",
87
+ "@stacksjs/strings": "0.70.138",
88
+ "@stacksjs/utils": "0.70.138",
89
+ "@stacksjs/validation": "0.70.138"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "pickier": "^0.1.35"