Skip to content

更新 ./dist/manifest.json 使其适配 ncm3,并调整构建脚本 #60

Description

@ESEAbsolute

./manifest.json 里有

    "version": "1.1.2",
    "ncm3-compatible": true,

这两行,但是在 ./dist/manifest.json 里是 "version": "1.1.1",并且没有 "ncm3-compatible": true

因为打包用的是 ./dist/manifest.json 而不是 ./manifest.json,导致 ncm3 无法将其识别为有效的插件。


./build.js 文件中,可以看到面向生产环境的打包流程是:

        await esbuild.build({
            entryPoints: ['./src/main.tsx', './src/startup_script.ts', './src/style.less'],
            bundle: true,
            minify: true,
            outdir: 'dist',
            target: 'chrome91',
            plugins: [lessLoader()],
        });

        const compress = require('compressing');
        await compress.zip.compressDir('./dist/', './RevivedUnblockNeteaseMusic.plugin', { ignoreBase: true });

根据流程,dist/ 里只自动生成了 JS/TS/LESS 打包结果。而在这个过程中,并没有涉及 ./manifest.jsonpreview.png 的拷贝和替换。虽然我不是很确定 preview.png 是否可能会更换,但是在版本迭代过程中同时替换两份 manifest.json 的信息必然会较为麻烦并且可能会带一些问题,所以我个人建议:

  • 不将 dist 文件夹上传到 github 上;
  • preview.pngmanifest.json 放在 resources/ 中;
  • 执行构建脚本时,将这两个文件拷贝到 开发环境的根目录 或 生产环境的 dist/ 中。

这样可以保证每次构建后,插件的 manifest.json 都是最新的,避免手动维护多份 manifest。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions