@stjoseph/prumo 0.6.0 → 0.6.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/dist/add.js +9 -4
- package/package.json +1 -1
package/dist/add.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { readFile, rm, writeFile } from 'node:fs/promises';
|
|
3
|
-
import { join, relative } from 'node:path';
|
|
3
|
+
import { join, relative, sep } from 'node:path';
|
|
4
4
|
import { appsOf, appsOfType, PORTS, typesOf, validateApps } from "./apps.js";
|
|
5
5
|
import { adaptAppConfig, CLIENTS, collectCatalog, copyApp, copyTemplate, extractContract, joinContract, rootDevPrefix, takeBuildApprovals, } from "./compose.js";
|
|
6
6
|
import { areasFor, growContext } from "./context.js";
|
|
@@ -85,14 +85,16 @@ export async function addApp({ templates, knowledge, cwd, type, name = type, ins
|
|
|
85
85
|
const result = await write({ templates, knowledge, root, project, apps, app, answers, journal });
|
|
86
86
|
if (install) {
|
|
87
87
|
await journal.keep(join(root, 'pnpm-lock.yaml'));
|
|
88
|
-
|
|
88
|
+
// The new app is a new importer in the lockfile, which pnpm under CI would otherwise refuse to write.
|
|
89
|
+
run('pnpm', ['install', '--no-frozen-lockfile'], root, childOutput);
|
|
89
90
|
// Only what this run wrote: the rest of the workspace is the team's, formatted as they left it.
|
|
90
91
|
run('pnpm', [
|
|
91
92
|
'exec',
|
|
92
93
|
'biome',
|
|
93
94
|
'check',
|
|
94
95
|
'--write',
|
|
95
|
-
|
|
96
|
+
// Written with forward slashes, which every system takes and a Windows shell needs no quotes for.
|
|
97
|
+
...result.written.map((path) => relative(root, path).split(sep).join('/')),
|
|
96
98
|
], root, childOutput);
|
|
97
99
|
if (type === 'web') {
|
|
98
100
|
run('pnpm', ['exec', 'tsr', 'generate'], directory, childOutput);
|
|
@@ -174,7 +176,10 @@ async function write({ templates, knowledge, root, project, apps, app, answers,
|
|
|
174
176
|
if (app.type === 'web' && api !== undefined && existsSync(join(at(api), file))) {
|
|
175
177
|
await rewrite(join(at(api), file), (text) => {
|
|
176
178
|
const list = (envLine(text, 'WEB_ORIGIN') ?? '').split(',').filter((entry) => entry !== '');
|
|
177
|
-
|
|
179
|
+
// An API with no web app yet already names the first web port, which is where this one lands.
|
|
180
|
+
return list.includes(origin)
|
|
181
|
+
? text
|
|
182
|
+
: withEnvLine(text, 'WEB_ORIGIN', [...list, origin].join(','));
|
|
178
183
|
});
|
|
179
184
|
}
|
|
180
185
|
// A new API trusts the web apps there already, on the ports they hold.
|
package/package.json
CHANGED