miriad-viz 0.1.1 → 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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/cli/guided/steps/init-template.ts
|
|
2
2
|
import { cpSync, existsSync, readFileSync, writeFileSync } from "fs";
|
|
3
|
-
import { dirname, resolve } from "path";
|
|
3
|
+
import { dirname, relative, resolve } from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
var VALID_TEMPLATES = ["viewer", "remotion"];
|
|
6
6
|
function scaffoldTemplate(templateName, outDir, packageRoot) {
|
|
@@ -16,13 +16,23 @@ function scaffoldTemplate(templateName, outDir, packageRoot) {
|
|
|
16
16
|
}
|
|
17
17
|
cpSync(templateDir, outDir, {
|
|
18
18
|
recursive: true,
|
|
19
|
-
filter: (src) =>
|
|
19
|
+
filter: (src) => {
|
|
20
|
+
const rel = relative(templateDir, src);
|
|
21
|
+
return rel === "" || !rel.split("/").includes("node_modules");
|
|
22
|
+
}
|
|
20
23
|
});
|
|
21
24
|
const pkgPath = resolve(outDir, "package.json");
|
|
22
25
|
if (existsSync(pkgPath)) {
|
|
23
26
|
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
24
27
|
if (pkg.dependencies?.["miriad-viz"]?.startsWith("file:")) {
|
|
25
|
-
|
|
28
|
+
const parentPkgPath = resolve(packageRoot, "package.json");
|
|
29
|
+
const parentPkg = JSON.parse(readFileSync(parentPkgPath, "utf-8"));
|
|
30
|
+
const version = parentPkg.version;
|
|
31
|
+
if (packageRoot.split("/").includes("node_modules")) {
|
|
32
|
+
pkg.dependencies["miriad-viz"] = `^${version}`;
|
|
33
|
+
} else {
|
|
34
|
+
pkg.dependencies["miriad-viz"] = `file:${packageRoot}`;
|
|
35
|
+
}
|
|
26
36
|
writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
|
|
27
37
|
`);
|
|
28
38
|
}
|
package/dist-cli/index.js
CHANGED
|
@@ -662,7 +662,7 @@ async function runNext(flags) {
|
|
|
662
662
|
break;
|
|
663
663
|
}
|
|
664
664
|
case "preview": {
|
|
665
|
-
const { runPreview } = await import("./preview-
|
|
665
|
+
const { runPreview } = await import("./preview-5JY7W4YI.js");
|
|
666
666
|
await runPreview({
|
|
667
667
|
projectDir,
|
|
668
668
|
progress: result.progress,
|
|
@@ -736,7 +736,7 @@ async function main() {
|
|
|
736
736
|
case "preview": {
|
|
737
737
|
const { projectDir, progress } = requireProject();
|
|
738
738
|
const port = typeof flags.port === "string" ? Number.parseInt(flags.port, 10) : void 0;
|
|
739
|
-
const { runPreview } = await import("./preview-
|
|
739
|
+
const { runPreview } = await import("./preview-5JY7W4YI.js");
|
|
740
740
|
await runPreview({ projectDir, progress, port, noOpen: flags["no-open"] === true });
|
|
741
741
|
break;
|
|
742
742
|
}
|
|
@@ -755,7 +755,7 @@ async function main() {
|
|
|
755
755
|
\u2717 Missing output directory. Usage: npx miriad-viz ${command} <dir>`);
|
|
756
756
|
process.exit(1);
|
|
757
757
|
}
|
|
758
|
-
const { scaffoldTemplate, resolvePackageRoot } = await import("./init-template-
|
|
758
|
+
const { scaffoldTemplate, resolvePackageRoot } = await import("./init-template-F6X3TAAM.js");
|
|
759
759
|
const packageRoot = resolvePackageRoot(import.meta.url);
|
|
760
760
|
const resolvedOutDir = resolve2(process.cwd(), outDir);
|
|
761
761
|
try {
|