alchemy 0.28.0 → 0.29.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/lib/alchemy.d.ts +15 -1
- package/lib/alchemy.d.ts.map +1 -1
- package/lib/alchemy.js +42 -8
- package/lib/alchemy.js.map +1 -1
- package/lib/apply.js +3 -9
- package/lib/apply.js.map +1 -1
- package/lib/cloudflare/do-state-store/internal.d.ts +1 -1
- package/lib/cloudflare/do-state-store/internal.d.ts.map +1 -1
- package/lib/cloudflare/do-state-store/internal.js +2 -2
- package/lib/cloudflare/do-state-store/internal.js.map +1 -1
- package/lib/cloudflare/do-state-store/store.d.ts.map +1 -1
- package/lib/cloudflare/do-state-store/store.js +19 -4
- package/lib/cloudflare/do-state-store/store.js.map +1 -1
- package/lib/cloudflare/secrets-store.d.ts.map +1 -1
- package/lib/cloudflare/secrets-store.js +21 -17
- package/lib/cloudflare/secrets-store.js.map +1 -1
- package/lib/cloudflare/worker-assets.d.ts.map +1 -1
- package/lib/cloudflare/worker-assets.js +9 -0
- package/lib/cloudflare/worker-assets.js.map +1 -1
- package/lib/destroy.js +3 -3
- package/lib/destroy.js.map +1 -1
- package/lib/github/comment.d.ts +156 -0
- package/lib/github/comment.d.ts.map +1 -0
- package/lib/github/comment.js +192 -0
- package/lib/github/comment.js.map +1 -0
- package/lib/github/index.d.ts +1 -0
- package/lib/github/index.d.ts.map +1 -1
- package/lib/github/index.js +1 -0
- package/lib/github/index.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/scope.d.ts +3 -0
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +2 -1
- package/lib/scope.js.map +1 -1
- package/lib/util/cli.d.ts.map +1 -1
- package/lib/util/cli.js +5 -6
- package/lib/util/cli.js.map +1 -1
- package/lib/util/telemetry/client.js +1 -1
- package/lib/util/telemetry/client.js.map +1 -1
- package/package.json +2 -1
- package/src/alchemy.ts +65 -9
- package/src/apply.ts +3 -9
- package/src/cloudflare/do-state-store/internal.ts +2 -1
- package/src/cloudflare/do-state-store/store.ts +26 -4
- package/src/cloudflare/secrets-store.ts +22 -21
- package/src/cloudflare/worker-assets.ts +16 -0
- package/src/destroy.ts +3 -3
- package/src/github/comment.ts +278 -0
- package/src/github/index.ts +1 -0
- package/src/index.ts +1 -1
- package/src/scope.ts +14 -6
- package/src/util/cli.ts +25 -18
- package/src/util/telemetry/client.ts +1 -1
package/src/util/cli.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { format } from "node:util";
|
|
2
1
|
import packageJson from "../../package.json" with { type: "json" };
|
|
3
2
|
import type { Phase } from "../alchemy.ts";
|
|
4
3
|
import { dedent } from "./dedent.ts";
|
|
@@ -7,7 +6,7 @@ import { dedent } from "./dedent.ts";
|
|
|
7
6
|
const colors = {
|
|
8
7
|
reset: "\x1b[0m",
|
|
9
8
|
cyanBright: "\x1b[96m",
|
|
10
|
-
yellowBright: "\x1b[93m",
|
|
9
|
+
yellowBright: "\x1b[93m",
|
|
11
10
|
magenta: "\x1b[35m",
|
|
12
11
|
greenBright: "\x1b[92m",
|
|
13
12
|
redBright: "\x1b[91m",
|
|
@@ -18,7 +17,9 @@ type ColorName = keyof typeof colors;
|
|
|
18
17
|
|
|
19
18
|
// Check if colors should be disabled
|
|
20
19
|
const shouldDisableColors = (): boolean => {
|
|
21
|
-
return Boolean(
|
|
20
|
+
return Boolean(
|
|
21
|
+
process.env.CI || process.env.NO_COLOR || !process.stdout.isTTY,
|
|
22
|
+
);
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
// Apply color if colors are enabled
|
|
@@ -52,7 +53,10 @@ type AlchemyInfo = {
|
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
let loggerApi: LoggerApi | null = null;
|
|
55
|
-
export const createLoggerInstance = (
|
|
56
|
+
export const createLoggerInstance = (
|
|
57
|
+
alchemyInfo: AlchemyInfo,
|
|
58
|
+
customLogger?: LoggerApi,
|
|
59
|
+
) => {
|
|
56
60
|
if (loggerApi) return loggerApi;
|
|
57
61
|
|
|
58
62
|
// Use custom logger if provided, otherwise use the basic fallback logger
|
|
@@ -81,30 +85,33 @@ export const createFallbackLogger = (alchemyInfo: AlchemyInfo): LoggerApi => {
|
|
|
81
85
|
|
|
82
86
|
return {
|
|
83
87
|
log: console.log,
|
|
84
|
-
error: (...args: unknown[]) =>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
error: (...args: unknown[]) =>
|
|
89
|
+
console.error(colorize("ERROR", "redBright"), ...args),
|
|
90
|
+
warn: (...args: unknown[]) =>
|
|
91
|
+
console.warn(colorize("WARN", "yellowBright"), ...args),
|
|
92
|
+
task: (_id: string, data: Task) => {
|
|
93
|
+
const prefix = data.prefix ? `[${data.prefix}]` : "";
|
|
94
|
+
|
|
95
|
+
// Pad the prefix to ensure consistent alignment (12 characters total including brackets)
|
|
90
96
|
const paddedPrefix = prefix.padEnd(12);
|
|
91
|
-
const prefixWithColor =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
const prefixWithColor =
|
|
98
|
+
data.prefixColor && prefix
|
|
99
|
+
? colorize(paddedPrefix, data.prefixColor as ColorName)
|
|
100
|
+
: paddedPrefix;
|
|
101
|
+
|
|
102
|
+
const resource = data.resource ? colorize(data.resource, "gray") : "";
|
|
96
103
|
const message = data.message;
|
|
97
|
-
|
|
104
|
+
|
|
98
105
|
if (prefixWithColor && resource) {
|
|
99
106
|
console.log(`${prefixWithColor}${resource} ${message}`);
|
|
100
107
|
} else if (prefixWithColor) {
|
|
101
108
|
console.log(`${prefixWithColor}${message}`);
|
|
102
109
|
} else {
|
|
103
|
-
console.log(message);
|
|
110
|
+
console.log(`${message}`);
|
|
104
111
|
}
|
|
105
112
|
},
|
|
106
113
|
exit: () => {},
|
|
107
114
|
};
|
|
108
115
|
};
|
|
109
116
|
|
|
110
|
-
export const formatFQN = (fqn: string) => fqn.split("/").slice(2).join(" > ");
|
|
117
|
+
export const formatFQN = (fqn: string) => fqn.split("/").slice(2).join(" > ");
|