changed gulpfile.ts to make "npm run package [new version number]" feasible

This commit is contained in:
Ender 2024-03-29 18:07:10 +01:00
parent d62c8c8dbc
commit cd24173796
1 changed files with 4 additions and 4 deletions

View File

@ -375,7 +375,7 @@ async function packageBuild() {
if (!fs.existsSync(distPath)) fs.mkdirSync(distPath); if (!fs.existsSync(distPath)) fs.mkdirSync(distPath);
// Initialize the zip file // Initialize the zip file
const zipName = `${manifest.file.name}-v${manifest.file.version}.zip`; const zipName = `${manifest.file.name}.zip`;
const zipFile = fs.createWriteStream(zipName); const zipFile = fs.createWriteStream(zipName);
const zip = archiver("zip", { zlib: { level: 9 } }); const zip = archiver("zip", { zlib: { level: 9 } });
zipFile.on("close", () => { zipFile.on("close", () => {
@ -473,8 +473,8 @@ const updateManifest = (cb: any) => {
const result = `${repoURL}/releases/download`; const result = `${repoURL}/releases/download`;
manifest.file.url = repoURL; manifest.file.url = repoURL;
manifest.file.manifest = `${result}/v${manifest.file.version}/${manifest.name}`; manifest.file.manifest = `${result}/latest/${manifest.name}`;
manifest.file.download = `${result}/v${manifest.file.version}/${manifest.file.name}-v${manifest.file.version}.zip`; manifest.file.download = `${result}/latest/${manifest.file.name}.zip`;
const prettyProjectJson = stringify(manifest.file, { const prettyProjectJson = stringify(manifest.file, {
maxLength: 35, maxLength: 35,
@ -504,7 +504,7 @@ const gitTaskBuild = (cb: gulp.TaskFunctionCallback) => {
if (!manifest) return cb(Error("could not load manifest.")); if (!manifest) return cb(Error("could not load manifest."));
return gulp return gulp
.src(`${manifest.file.name}-v${manifest.file.version}.zip`) .src(`${manifest.file.name}.zip`)
.pipe(git.checkout(`v${manifest.file.version}`, { args: "-b" })) .pipe(git.checkout(`v${manifest.file.version}`, { args: "-b" }))
.pipe(git.add({ args: "--no-all -f" })) .pipe(git.add({ args: "--no-all -f" }))
.pipe(git.commit(`v${manifest.file.version}`, { args: "-a", disableAppendPaths: true })); .pipe(git.commit(`v${manifest.file.version}`, { args: "-a", disableAppendPaths: true }));