@zodmire/cli 0.1.0 → 0.1.2
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/mod.mjs +15 -3
- package/package.json +3 -3
package/mod.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { register } from "node:module";
|
|
1
2
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
3
|
import { fileURLToPath } from "node:url";
|
|
3
4
|
import { dirname, resolve } from "node:path";
|
|
4
|
-
import { VENDORED_FILE_MANIFEST, buildCompositionArtifacts, buildContextNormalizedSpecFromConfig, buildFileArtifactTags, buildNormalizedCompositionSpec, buildNormalizedSpecTags, buildV5ContextArtifacts, filterPerContextArtifactsForComposition, inferReconcileScopes, mergeGeneratedArtifacts, prepareAllVendoredFiles, resolveAbsoluteContextInputs, serializeCompositionSpec, serializeContextSpec } from "@zodmire/core";
|
|
5
|
+
import { VENDORED_FILE_MANIFEST, buildCompositionArtifacts, buildContextNormalizedSpecFromConfig, buildFileArtifactTags, buildNormalizedCompositionSpec, buildNormalizedSpecTags, buildV5ContextArtifacts, filterPerContextArtifactsForComposition, generateContextArtifacts, inferReconcileScopes, mergeGeneratedArtifacts, prepareAllVendoredFiles, resolveAbsoluteContextInputs, serializeCompositionSpec, serializeContextSpec } from "@zodmire/core";
|
|
5
6
|
import { materializeOwnedArtifacts } from "@zodmire/core/materialize";
|
|
6
7
|
import { statSync } from "node:fs";
|
|
7
8
|
import { spawn } from "node:child_process";
|
|
@@ -172,14 +173,14 @@ async function runCompositionGenerate(compositionConfigPath, targetOverride, ver
|
|
|
172
173
|
console.log(`Generating composition from ${compositionConfigPath}`);
|
|
173
174
|
console.log(` contexts: ${resolvedContextConfigs.length}`);
|
|
174
175
|
const contextSpecs = await Promise.all(resolvedContextConfigs.map((cfg) => buildContextNormalizedSpecFromConfig(cfg)));
|
|
175
|
-
const
|
|
176
|
+
const compositionSpec = buildNormalizedCompositionSpec(compositionConfig, contextSpecs);
|
|
177
|
+
const perContextArtifacts = contextSpecs.map((contextSpec) => generateContextArtifacts(contextSpec, { infrastructureStrategy: compositionSpec.infrastructure }));
|
|
176
178
|
const compositionArtifacts = await buildCompositionArtifacts(compositionConfigPath, contextSpecs);
|
|
177
179
|
const allArtifacts = mergeGeneratedArtifacts(...perContextArtifacts.map(filterPerContextArtifactsForComposition), compositionArtifacts).sort((a, b) => a.logicalPath.localeCompare(b.logicalPath));
|
|
178
180
|
console.log(` target: ${resolvedTarget}`);
|
|
179
181
|
const result = await materializeOwnedArtifacts(resolvedTarget, allArtifacts, GENERATOR_VERSION, { reconcileScopes: inferReconcileScopes(allArtifacts) });
|
|
180
182
|
if (versionData) {
|
|
181
183
|
if (!isSwampRepoAvailable()) throw new Error("Swamp repo not initialized. Run `swamp init` or omit --version-data");
|
|
182
|
-
const compositionSpec = buildNormalizedCompositionSpec(compositionConfig, contextSpecs);
|
|
183
184
|
const specJson = serializeCompositionSpec(compositionSpec, GENERATOR_VERSION);
|
|
184
185
|
const generationRunId = `run-${(/* @__PURE__ */ new Date()).toISOString()}-${crypto.randomUUID().slice(0, 8)}`;
|
|
185
186
|
console.log(" mirroring to Swamp data layer...");
|
|
@@ -209,6 +210,17 @@ async function runCompositionGenerate(compositionConfigPath, targetOverride, ver
|
|
|
209
210
|
|
|
210
211
|
//#endregion
|
|
211
212
|
//#region packages/cli/mod.ts
|
|
213
|
+
register(`data:text/javascript,${encodeURIComponent(`
|
|
214
|
+
const NPM_RE = /^npm:(@?[^@\\/]+(?:\\/[^@\\/]+)?)(?:@[^/]*)?(.*)$/;
|
|
215
|
+
export function resolve(specifier, context, nextResolve) {
|
|
216
|
+
const match = NPM_RE.exec(specifier);
|
|
217
|
+
if (match) {
|
|
218
|
+
const bare = match[1] + (match[2] || "");
|
|
219
|
+
return nextResolve(bare, context);
|
|
220
|
+
}
|
|
221
|
+
return nextResolve(specifier, context);
|
|
222
|
+
}
|
|
223
|
+
`)}`, import.meta.url);
|
|
212
224
|
function printUsage() {
|
|
213
225
|
console.log(`zodmire v${GENERATOR_VERSION}
|
|
214
226
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zodmire/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./mod.mjs",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@zodmire/config": "^0.1.
|
|
17
|
-
"@zodmire/core": "^0.1.
|
|
16
|
+
"@zodmire/config": "^0.1.2",
|
|
17
|
+
"@zodmire/core": "^0.1.2"
|
|
18
18
|
},
|
|
19
19
|
"bin": {
|
|
20
20
|
"zodmire": "./bin/zodmire.js"
|