fix: 统一模板包版本与校验
This commit is contained in:
1 parent
1918dae36b
commit
b6713ea34c
4 files changed
+40
-15
No files matched your search
@@ -28,10 +28,27 @@ async function main() {
|
||||
errors.push(`${entry.name}: invalid template.json (${error.message})`);
|
||||
continue;
|
||||
}
|
||||
let packageJson;
|
||||
try {
|
||||
packageJson = JSON.parse(fs.readFileSync(path.join(packageDir, "package.json"), "utf8"));
|
||||
} catch (error) {
|
||||
errors.push(entry.name + ": invalid package.json (" + error.message + ")");
|
||||
continue;
|
||||
}
|
||||
for (const error of validateTemplatePackageManifest(manifest))
|
||||
errors.push(`${entry.name}: ${error}`);
|
||||
if (![entry.name, entry.name.replace(/^template-/, "")].includes(manifest.packageKey))
|
||||
errors.push(`${entry.name}: packageKey must match directory name or template key`);
|
||||
if (packageJson.name !== "@personal-brand/template-" + manifest.packageKey)
|
||||
errors.push(entry.name + ": package name must match manifest packageKey");
|
||||
if (packageJson.version !== manifest.version)
|
||||
errors.push(
|
||||
entry.name +
|
||||
": package version " +
|
||||
packageJson.version +
|
||||
" != manifest " +
|
||||
manifest.version,
|
||||
);
|
||||
for (const page of manifest.pages || []) {
|
||||
if (!fs.existsSync(path.join(packageDir, "miniapp", page + ".js")))
|
||||
errors.push(`${entry.name}: declared page is missing: ${page}`);
|
||||
|
||||
Reference in new issue
Block a user