mulmocast 1.2.54 → 1.2.55
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/lib/actions/audio.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveAssetFile(relFromPkgRoot: string, npmRoot?: string): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
export function resolveAssetFile(relFromPkgRoot, npmRoot) {
|
|
7
|
+
const rel = relFromPkgRoot.replace(/^\.\//, "");
|
|
8
|
+
try {
|
|
9
|
+
return require.resolve(`mulmocast/${rel}`);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
if (npmRoot) {
|
|
13
|
+
const maybe = path.resolve(npmRoot, relFromPkgRoot);
|
|
14
|
+
if (fs.existsSync(maybe)) {
|
|
15
|
+
return maybe;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
+
const __dirname = path.dirname(__filename);
|
|
20
|
+
return path.join(__dirname, relFromPkgRoot);
|
|
21
|
+
}
|
|
22
|
+
}
|
package/lib/utils/file.js
CHANGED
|
@@ -7,6 +7,7 @@ import { GraphAILogger } from "graphai";
|
|
|
7
7
|
import { MulmoStudioContextMethods } from "../methods/index.js";
|
|
8
8
|
import { mulmoPromptTemplateSchema } from "../types/schema.js";
|
|
9
9
|
import { getMulmoScriptTemplateSystemPrompt } from "./prompt.js";
|
|
10
|
+
import { resolveAssetFile } from "./asset_import.js";
|
|
10
11
|
const promptTemplateDirName = "./assets/templates";
|
|
11
12
|
const scriptTemplateDirName = "./scripts/templates";
|
|
12
13
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -120,7 +121,7 @@ export const getOutputPdfFilePath = (outDirPath, fileName, pdfMode, lang) => {
|
|
|
120
121
|
return path.resolve(outDirPath, `${fileName}_${pdfMode}.pdf`);
|
|
121
122
|
};
|
|
122
123
|
export const getPromptTemplateFilePath = (promptTemplateName) => {
|
|
123
|
-
return path.
|
|
124
|
+
return resolveAssetFile(path.join(promptTemplateDirName, promptTemplateName + ".json"), npmRoot);
|
|
124
125
|
};
|
|
125
126
|
export const mkdir = (dirPath) => {
|
|
126
127
|
if (!fs.existsSync(dirPath)) {
|
|
@@ -134,14 +135,14 @@ export const resolveAssetPath = (context, relativePath) => {
|
|
|
134
135
|
};
|
|
135
136
|
// export const silentPath = path.resolve(npmRoot, "./assets/audio/silent300.mp3");
|
|
136
137
|
// export const silentLastPath = path.resolve(npmRoot, "./assets/audio/silent800.mp3");
|
|
137
|
-
export const silent60secPath = () =>
|
|
138
|
+
export const silent60secPath = () => resolveAssetFile("./assets/audio/silent60sec.mp3", npmRoot);
|
|
138
139
|
export const defaultBGMPath = () => "https://github.com/receptron/mulmocast-media/raw/refs/heads/main/bgms/story002.mp3";
|
|
139
|
-
export const mulmoCreditPath = () =>
|
|
140
|
-
export const blankImagePath = () =>
|
|
141
|
-
export const blankVerticalImagePath = () =>
|
|
142
|
-
export const blankSquareImagePath = () =>
|
|
140
|
+
export const mulmoCreditPath = () => resolveAssetFile("./assets/images/mulmocast_credit.png", npmRoot);
|
|
141
|
+
export const blankImagePath = () => resolveAssetFile("./assets/images/blank.png", npmRoot);
|
|
142
|
+
export const blankVerticalImagePath = () => resolveAssetFile("./assets/images/blank_v.png", npmRoot);
|
|
143
|
+
export const blankSquareImagePath = () => resolveAssetFile("./assets/images/blank_sq.png", npmRoot);
|
|
143
144
|
export const getHTMLFile = (filename) => {
|
|
144
|
-
const htmlPath =
|
|
145
|
+
const htmlPath = resolveAssetFile(`./assets/html/${filename}.html`, npmRoot);
|
|
145
146
|
return fs.readFileSync(htmlPath, "utf-8");
|
|
146
147
|
};
|
|
147
148
|
// for cli
|
|
@@ -165,7 +166,7 @@ export const getFullPath = (baseDirPath, file) => {
|
|
|
165
166
|
};
|
|
166
167
|
// script and prompt template
|
|
167
168
|
export const readScriptTemplateFile = (scriptTemplateFileName) => {
|
|
168
|
-
const scriptTemplatePath = path.
|
|
169
|
+
const scriptTemplatePath = resolveAssetFile(path.join(scriptTemplateDirName, scriptTemplateFileName), npmRoot);
|
|
169
170
|
const scriptTemplateData = fs.readFileSync(scriptTemplatePath, "utf-8");
|
|
170
171
|
// NOTE: We don't want to schema parse the script here to eliminate default values.
|
|
171
172
|
return JSON.parse(scriptTemplateData);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mulmocast",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.55",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.node.js",
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
},
|
|
16
16
|
"./data": {
|
|
17
17
|
"default": "./lib/data/index.js"
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
|
+
"./assets/*": "./assets/*",
|
|
20
|
+
"./scripts/*": "./scripts/*"
|
|
19
21
|
},
|
|
20
22
|
"bin": {
|
|
21
23
|
"mulmo": "lib/cli/bin.js",
|