@topogram/cli 0.3.68 → 0.3.70
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/package.json +1 -1
- package/src/cli/commands/template/check.js +1 -1
- package/src/generator/runtime/environment/index.js +6 -2
- package/src/new-project/create.js +1 -7
- package/src/new-project/project-files.js +1 -2
- package/src/new-project/template-resolution.js +3 -3
- package/src/workspace-paths.js +2 -6
package/package.json
CHANGED
|
@@ -92,7 +92,7 @@ function diagnosticForTemplateCreateFailure(message, templateSpec, step) {
|
|
|
92
92
|
step
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
if (message.includes("is missing topo/")
|
|
95
|
+
if (message.includes("is missing topo/")) {
|
|
96
96
|
return templateCheckDiagnostic({
|
|
97
97
|
code: "template_topogram_missing",
|
|
98
98
|
message,
|
|
@@ -396,7 +396,7 @@ function renderEnvironmentServerDevScript(plan, component = plan.runtimes.apis[0
|
|
|
396
396
|
const guardPortsScript = options.componentScript ? '"$ROOT_DIR/scripts/guard-ports.mjs"' : '"$SCRIPT_DIR/guard-ports.mjs"';
|
|
397
397
|
const serverPortExpression = runtimePortExpression(plan, plan.runtimes.apis, component, "SERVER_PORT");
|
|
398
398
|
return renderEnvAwareShellScript([
|
|
399
|
-
`node ${guardPortsScript} api`,
|
|
399
|
+
`node ${guardPortsScript} api ${component.id}`,
|
|
400
400
|
"",
|
|
401
401
|
...apiDatabaseExportLines(component),
|
|
402
402
|
`export PORT="${serverPortExpression}"`,
|
|
@@ -417,7 +417,7 @@ function renderEnvironmentWebDevScript(plan, component = plan.runtimes.webs[0],
|
|
|
417
417
|
const guardPortsScript = options.componentScript ? '"$ROOT_DIR/scripts/guard-ports.mjs"' : '"$SCRIPT_DIR/guard-ports.mjs"';
|
|
418
418
|
const webPortExpression = runtimePortExpression(plan, plan.runtimes.webs, component, "WEB_PORT");
|
|
419
419
|
return renderEnvAwareShellScript([
|
|
420
|
-
`node ${guardPortsScript} web`,
|
|
420
|
+
`node ${guardPortsScript} web ${component.id}`,
|
|
421
421
|
"",
|
|
422
422
|
...(apiRuntime ? [`export PUBLIC_TOPOGRAM_API_BASE_URL="\${PUBLIC_TOPOGRAM_API_BASE_URL:-http://localhost:\${${apiRuntime.id.toUpperCase()}_PORT:-\${SERVER_PORT:-${apiRuntime.port}}}}"`] : []),
|
|
423
423
|
`export TOPOGRAM_CORS_ORIGINS="\${TOPOGRAM_CORS_ORIGINS:-http://localhost:${webPortExpression},http://127.0.0.1:${webPortExpression}}"`,
|
|
@@ -478,6 +478,7 @@ function renderEnvironmentGuardPortsScript(plan) {
|
|
|
478
478
|
import net from "node:net";
|
|
479
479
|
|
|
480
480
|
const role = process.argv[2] || "stack";
|
|
481
|
+
const targetId = process.argv[3] || "";
|
|
481
482
|
const ports = ${JSON.stringify(ports, null, 2)};
|
|
482
483
|
const expectedService = ${JSON.stringify(plan.runtimeReference.serviceName || "")};
|
|
483
484
|
|
|
@@ -533,6 +534,9 @@ for (const entry of ports) {
|
|
|
533
534
|
if (role !== "stack" && role !== entry.type) {
|
|
534
535
|
continue;
|
|
535
536
|
}
|
|
537
|
+
if (targetId && entry.id !== targetId) {
|
|
538
|
+
continue;
|
|
539
|
+
}
|
|
536
540
|
const port = effectivePort(entry);
|
|
537
541
|
if (await portInUse(port)) {
|
|
538
542
|
if (entry.type === "api") {
|
|
@@ -53,7 +53,7 @@ export function createNewProject({
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
ensureCreatableProjectRoot(projectRoot);
|
|
56
|
-
|
|
56
|
+
copyTopogramWorkspace(template.root, projectRoot);
|
|
57
57
|
const projectConfig = writeProjectTemplateMetadata(projectRoot, template, templateProvenance);
|
|
58
58
|
writeProjectPackage(projectRoot, engineRoot, template);
|
|
59
59
|
writeExplainScript(projectRoot);
|
|
@@ -64,12 +64,6 @@ export function createNewProject({
|
|
|
64
64
|
writeGeneratorPolicy(projectRoot, defaultGeneratorPolicy());
|
|
65
65
|
|
|
66
66
|
const warnings = [];
|
|
67
|
-
if (workspaceCopy.legacyWorkspace) {
|
|
68
|
-
warnings.push(
|
|
69
|
-
`Template '${template.manifest.id}' still ships legacy topogram/ source. Copied it into this project as ${DEFAULT_TOPO_FOLDER_NAME}/. ` +
|
|
70
|
-
"This one-release package-ingress bridge will be removed after first-party packages migrate."
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
67
|
if (template.manifest.includesExecutableImplementation) {
|
|
74
68
|
writeTemplateTrustRecord(projectRoot, projectConfig);
|
|
75
69
|
warnings.push(
|
|
@@ -55,7 +55,7 @@ export function ensureCreatableProjectRoot(projectRoot) {
|
|
|
55
55
|
/**
|
|
56
56
|
* @param {string} templateRoot
|
|
57
57
|
* @param {string} projectRoot
|
|
58
|
-
* @returns {
|
|
58
|
+
* @returns {void}
|
|
59
59
|
*/
|
|
60
60
|
export function copyTopogramWorkspace(templateRoot, projectRoot) {
|
|
61
61
|
const templateWorkspace = resolvePackageWorkspace(templateRoot);
|
|
@@ -74,7 +74,6 @@ export function copyTopogramWorkspace(templateRoot, projectRoot) {
|
|
|
74
74
|
{ recursive: true }
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
|
-
return { legacyWorkspace: templateWorkspace.legacy };
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
/**
|
|
@@ -6,7 +6,7 @@ import os from "node:os";
|
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
|
|
8
8
|
import { assertSafeNpmSpec, localNpmrcEnv } from "../npm-safety.js";
|
|
9
|
-
import { DEFAULT_TOPO_FOLDER_NAME,
|
|
9
|
+
import { DEFAULT_TOPO_FOLDER_NAME, resolvePackageWorkspace } from "../workspace-paths.js";
|
|
10
10
|
import { GENERATOR_LABELS, SURFACE_ORDER, TEMPLATE_MANIFEST, unsupportedTemplateSymlinkMessage } from "./constants.js";
|
|
11
11
|
import { isLocalTemplateSpec, packageNameFromSpec } from "./package-spec.js";
|
|
12
12
|
|
|
@@ -111,7 +111,7 @@ export function validateTemplateRoot(templateRoot) {
|
|
|
111
111
|
const topogramRoot = workspace.root;
|
|
112
112
|
const projectConfigPath = path.join(templateRoot, "topogram.project.json");
|
|
113
113
|
if (fs.existsSync(topogramRoot) && fs.lstatSync(topogramRoot).isSymbolicLink()) {
|
|
114
|
-
throw new Error(unsupportedTemplateSymlinkMessage(manifest.id,
|
|
114
|
+
throw new Error(unsupportedTemplateSymlinkMessage(manifest.id, DEFAULT_TOPO_FOLDER_NAME));
|
|
115
115
|
}
|
|
116
116
|
if (fs.existsSync(projectConfigPath) && fs.lstatSync(projectConfigPath).isSymbolicLink()) {
|
|
117
117
|
throw new Error(unsupportedTemplateSymlinkMessage(manifest.id, "topogram.project.json"));
|
|
@@ -122,7 +122,7 @@ export function validateTemplateRoot(templateRoot) {
|
|
|
122
122
|
if (!fs.existsSync(projectConfigPath) || !fs.statSync(projectConfigPath).isFile()) {
|
|
123
123
|
throw new Error(`Template '${manifest.id}' is missing topogram.project.json.`);
|
|
124
124
|
}
|
|
125
|
-
assertTemplateTreeHasNoSymlinks(templateRoot, topogramRoot,
|
|
125
|
+
assertTemplateTreeHasNoSymlinks(templateRoot, topogramRoot, DEFAULT_TOPO_FOLDER_NAME, manifest.id);
|
|
126
126
|
if (manifest.includesExecutableImplementation) {
|
|
127
127
|
const implementationRoot = path.join(templateRoot, "implementation");
|
|
128
128
|
if (fs.existsSync(implementationRoot) && fs.lstatSync(implementationRoot).isSymbolicLink()) {
|
package/src/workspace-paths.js
CHANGED
|
@@ -313,16 +313,12 @@ export function resolveTopoRoot(inputPath = ".") {
|
|
|
313
313
|
|
|
314
314
|
/**
|
|
315
315
|
* @param {string} packageRoot
|
|
316
|
-
* @returns {{ root: string
|
|
316
|
+
* @returns {{ root: string }}
|
|
317
317
|
*/
|
|
318
318
|
export function resolvePackageWorkspace(packageRoot) {
|
|
319
319
|
const topoRoot = path.join(packageRoot, DEFAULT_TOPO_FOLDER_NAME);
|
|
320
320
|
if (isDirectory(topoRoot)) {
|
|
321
|
-
return { root: topoRoot
|
|
322
|
-
}
|
|
323
|
-
const legacyRoot = path.join(packageRoot, LEGACY_TOPOGRAM_FOLDER_NAME);
|
|
324
|
-
if (isDirectory(legacyRoot)) {
|
|
325
|
-
return { root: legacyRoot, legacy: true };
|
|
321
|
+
return { root: topoRoot };
|
|
326
322
|
}
|
|
327
323
|
throw new Error(`Package is missing ${DEFAULT_TOPO_FOLDER_NAME}/.`);
|
|
328
324
|
}
|