node-asset-studio-mod 1.0.3 → 1.0.4
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/index.js +2 -2
- package/package.json +1 -1
- package/scripts/download-cli.js +11 -10
package/dist/index.js
CHANGED
|
@@ -89,7 +89,7 @@ export class AssetExporter {
|
|
|
89
89
|
fs.mkdirSync(output, { recursive: true });
|
|
90
90
|
let cliPath = cfg.cliPath || this.getDefaultCliPath();
|
|
91
91
|
if (!cliPath)
|
|
92
|
-
throw new Error("Cannot find AssetStudioModCLI,please run `pnpm install` or check the folder /bin");
|
|
92
|
+
throw new Error("Cannot find AssetStudioModCLI,please run `npm/yarn/pnpm install` or check the folder /bin");
|
|
93
93
|
let types = "all";
|
|
94
94
|
if (cfg.assetType) {
|
|
95
95
|
types = Array.isArray(cfg.assetType) ? cfg.assetType.join(",") : cfg.assetType;
|
|
@@ -139,7 +139,7 @@ export class AssetExporter {
|
|
|
139
139
|
const text = d.toString();
|
|
140
140
|
process.stdout.write(text);
|
|
141
141
|
// 检测错误关键字
|
|
142
|
-
if (/
|
|
142
|
+
if (/\[Warning] No Unity file can be loaded/i.test(text)) {
|
|
143
143
|
fail(new Error(`AssetStudio CLI runtime error: ${text}`));
|
|
144
144
|
}
|
|
145
145
|
});
|
package/package.json
CHANGED
package/scripts/download-cli.js
CHANGED
|
@@ -16,12 +16,13 @@ async function checkDotnet() {
|
|
|
16
16
|
try {
|
|
17
17
|
const out = execSync('dotnet --list-runtimes').toString();
|
|
18
18
|
if (out.includes('Microsoft.NETCore.App 9.')) {
|
|
19
|
-
console.log('
|
|
19
|
+
console.log('.NET 9 Runtime Found');
|
|
20
20
|
return true;
|
|
21
21
|
}
|
|
22
22
|
} catch {}
|
|
23
|
-
console.
|
|
24
|
-
|
|
23
|
+
console.error(`
|
|
24
|
+
.NET 9 Runtime Not Found.
|
|
25
|
+
Please install before using this package.
|
|
25
26
|
Windows (.NET Desktop): https://dotnet.microsoft.com/download/dotnet/9.0
|
|
26
27
|
Linux/macOS (.NET Runtime): https://dotnet.microsoft.com/download/dotnet/9.0
|
|
27
28
|
`);
|
|
@@ -81,28 +82,28 @@ async function extract() {
|
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
async function main() {
|
|
84
|
-
await checkDotnet();
|
|
85
|
+
if (!await checkDotnet()) throw new Error('Please install dotnet');
|
|
85
86
|
|
|
86
87
|
const url = getDownloadURL();
|
|
87
88
|
const urls = [...mirrorURLs(url), url];
|
|
88
89
|
|
|
89
90
|
for (const u of urls) {
|
|
90
91
|
try {
|
|
91
|
-
console.log('
|
|
92
|
+
console.log('trying to download:', u);
|
|
92
93
|
await download(u);
|
|
93
|
-
console.log('
|
|
94
|
+
console.log('download successfully:', u);
|
|
94
95
|
await extract();
|
|
95
|
-
console.log('AssetStudioModCLI
|
|
96
|
+
console.log('extract AssetStudioModCLI successfully');
|
|
96
97
|
fs.unlinkSync(zipPath);
|
|
97
|
-
console.log('
|
|
98
|
+
console.log('clean temp file: cli.zip');
|
|
98
99
|
return;
|
|
99
100
|
} catch (err) {
|
|
100
|
-
console.log(`✘
|
|
101
|
+
console.log(`✘ Fail: ${u}`);
|
|
101
102
|
console.log(err.message);
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
console.error('
|
|
106
|
+
console.error('Download AssetStudioModCLI Fail, Please install in another way');
|
|
106
107
|
process.exit(1);
|
|
107
108
|
}
|
|
108
109
|
|