Make Camino examples and scaffolds complete Yarn and Nix packages
This commit is contained in:
+13
-8
@@ -1,3 +1,4 @@
|
||||
import { installDependencies } from "./install-dependencies.mjs";
|
||||
import { buildService } from "./build-service.mjs";
|
||||
import { buildComponents } from "./build-components.mjs";
|
||||
/** Trusted Nix build driver. No package-defined build hooks run between generation and witnessing. */
|
||||
@@ -69,14 +70,18 @@ for (const { target, mode, settings } of builds) {
|
||||
await writable(work);
|
||||
const modules = path.join(work, "node_modules");
|
||||
await fs.mkdir(path.join(modules, "@quixos"), { recursive: true });
|
||||
if (config.nodeModules) {
|
||||
for (const item of await fs.readdir(config.nodeModules, { withFileTypes: true })) {
|
||||
if (item.name === "@quixos") throw Error("Application dependencies cannot substitute the checked SDK");
|
||||
await fs.symlink(path.join(config.nodeModules, item.name), path.join(modules, item.name));
|
||||
}
|
||||
}
|
||||
await fs.symlink(config.core, path.join(modules, "@quixos/camino-replica-core"));
|
||||
await fs.writeFile(path.join(work, "package.json"), JSON.stringify({ type: "module" }));
|
||||
await installDependencies({
|
||||
destination: modules,
|
||||
application: config.nodeModules,
|
||||
selected: { "@quixos/camino-replica-core": config.core },
|
||||
reserved: ["@quixos/camino-replica-core", "@quixos/camino-replica-client", "@quixos/camino-replica-engine"],
|
||||
});
|
||||
const packageFile = path.join(work, "package.json");
|
||||
const packageMetadata = await fs.readFile(packageFile, "utf8").then(JSON.parse, (error) => {
|
||||
if (error.code === "ENOENT") return {};
|
||||
throw error;
|
||||
});
|
||||
await fs.writeFile(packageFile, JSON.stringify({ ...packageMetadata, type: "module" }));
|
||||
const bindingPath = relative(settings.bindingOutput);
|
||||
const source =
|
||||
mode === "remote"
|
||||
|
||||
Reference in New Issue
Block a user