@rexezuge/tooling 1.15.0 → 1.17.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.
- package/README.md +4 -1
- package/dist/eslint.d.ts.map +1 -1
- package/dist/eslint.js +1 -1
- package/dist/eslint.js.map +2 -2
- package/dist/manifest-validate.d.ts.map +1 -1
- package/dist/manifest-validate.js +1 -1
- package/dist/manifest-validate.js.map +3 -3
- package/dist/manifest.d.ts +16 -0
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js.map +2 -2
- package/dist/scripts/init-secrets.d.ts.map +1 -1
- package/dist/scripts/init-secrets.js +2 -2
- package/dist/scripts/init-secrets.js.map +3 -3
- package/dist/scripts/prepare-wrangler-config.d.ts.map +1 -1
- package/dist/scripts/prepare-wrangler-config.js +1 -1
- package/dist/scripts/prepare-wrangler-config.js.map +3 -3
- package/dist/scripts/wrangler-config/patches.d.ts.map +1 -1
- package/dist/scripts/wrangler-config/patches.js +3 -3
- package/dist/scripts/wrangler-config/patches.js.map +3 -3
- package/dist/scripts/wrangler-config/types.d.ts +13 -3
- package/dist/scripts/wrangler-config/types.d.ts.map +1 -1
- package/dist/scripts/wrangler-config/types.js +1 -1
- package/dist/scripts/wrangler-config/types.js.map +3 -3
- package/package.json +3 -3
- package/schema/manifest.schema.json +18 -0
- package/src/eslint.test.ts +9 -0
- package/src/eslint.ts +13 -6
- package/src/manifest-validate.ts +42 -1
- package/src/manifest.test.ts +12 -0
- package/src/manifest.ts +17 -0
- package/src/scripts/init-secrets.ts +21 -11
- package/src/scripts/prepare-wrangler-config.ts +25 -12
- package/src/scripts/prepare-wrangler.test.ts +50 -0
- package/src/scripts/wrangler-config/patches.ts +7 -7
- package/src/scripts/wrangler-config/types.ts +26 -3
|
@@ -14,15 +14,38 @@
|
|
|
14
14
|
|
|
15
15
|
import path from 'node:path';
|
|
16
16
|
|
|
17
|
+
export const DEFAULT_TEMPLATE = 'apps/api/wrangler.template.jsonc';
|
|
18
|
+
export const DEFAULT_CONFIG = 'wrangler.jsonc';
|
|
19
|
+
|
|
20
|
+
let override: { template?: string; config?: string } = {};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Run `work` with the template and config of one manifest worker (`features.workers`). Resolution order for each
|
|
24
|
+
* path: this override, the `WRANGLER_*_PATH` environment variable, the default.
|
|
25
|
+
*/
|
|
26
|
+
export function withWranglerPaths<T>(paths: { template?: string; config?: string }, work: () => T): T {
|
|
27
|
+
const previous = override;
|
|
28
|
+
override = paths;
|
|
29
|
+
try {
|
|
30
|
+
return work();
|
|
31
|
+
} finally {
|
|
32
|
+
override = previous;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
17
36
|
/**
|
|
18
|
-
The config the deploy targets.
|
|
37
|
+
The config the deploy targets. Resolved on each call, so a manifest worker can change it.
|
|
19
38
|
*/
|
|
20
|
-
export
|
|
39
|
+
export function configPath(): string {
|
|
40
|
+
return path.resolve(process.cwd(), override.config ?? process.env['WRANGLER_CONFIG_PATH'] ?? DEFAULT_CONFIG);
|
|
41
|
+
}
|
|
21
42
|
|
|
22
43
|
/**
|
|
23
44
|
The committed template the config is materialized from.
|
|
24
45
|
*/
|
|
25
|
-
export
|
|
46
|
+
export function templatePath(): string {
|
|
47
|
+
return path.resolve(process.cwd(), override.template ?? process.env['WRANGLER_TEMPLATE_PATH'] ?? DEFAULT_TEMPLATE);
|
|
48
|
+
}
|
|
26
49
|
|
|
27
50
|
/**
|
|
28
51
|
* The id a template carries for a D1 database that does not exist yet.
|