From 7ab59047dfc63661fb1314f608c3cefc5543bfc0 Mon Sep 17 00:00:00 2001 From: Pansmith <70342772+ThePansmith@users.noreply.github.com> Date: Thu, 12 Sep 2024 12:54:26 -0500 Subject: [PATCH] temp revert 607 This reverts commit 82e674c102e0c61e4425f1c0d2464a6232c849ec. --- .github/workflows/build_pr.yml | 5 +---- .github/workflows/release.yml | 1 - tools/build/build.js | 36 +++++++++------------------------- 3 files changed, 10 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build_pr.yml b/.github/workflows/build_pr.yml index cf56fb717..a4e4e5e2a 100644 --- a/.github/workflows/build_pr.yml +++ b/.github/workflows/build_pr.yml @@ -17,9 +17,6 @@ on: required: true default: "build-all" type: string - version: - required: false - type: string secrets: API_TOKEN: required: true @@ -61,7 +58,7 @@ jobs: - name: Pack Modpack env: CFCORE_API_TOKEN: ${{ secrets.API_TOKEN }} - run: bash tools/build/build -c ${{ inputs.target }} --version ${{ inputs.version }} + run: bash tools/build/build -c ${{ inputs.target }} - name: Upload build artifact uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 057b442b5..eaa3461a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,7 +63,6 @@ jobs: uses: ./.github/workflows/build_pr.yml with: target: build-all - version: ${{needs.pre-build.outputs.version}} secrets: inherit release: diff --git a/tools/build/build.js b/tools/build/build.js index 1fa17b87f..3f5a16d60 100755 --- a/tools/build/build.js +++ b/tools/build/build.js @@ -52,27 +52,18 @@ const symlinkSync = (ourDir, newDir) => { * @param {(file: string) => boolean} filter */ const cpSyncFiltered = (ourDir, newDir, filter) => { - for (const file of fs.readdirSync(ourDir, { recursive: false })) { + for (const file of fs.readdirSync(ourDir, { recursive:false })) { if (!filter(file)) continue; fs.copyFileSync(path.join(ourDir, file), path.join(newDir, file)) } } -function updateManifest(group, version) { - const jsonData = JSON.parse(fs.readFileSync(`dist/.tmp/${group}/manifest.json`, 'utf-8')) - if (version) { - jsonData.version = version - } - fs.writeFileSync(`dist/.tmp/${group}/manifest.json`, JSON.stringify(jsonData, null, 2)) -} - -async function packMod(group, version) { +async function packMod(group) { Juke.rm(`dist/.tmp/${group}`, { recursive: true }); // copy dir to dist/.tmp fs.mkdirSync(`dist/.tmp/${group}`, { recursive: true }) fs.cpSync(`dist/${group}`, `dist/.tmp/${group}/overrides`, { recursive: true, force: true }) fs.copyFileSync('manifest.json', `dist/.tmp/${group}/manifest.json`) - updateManifest(group, version) fs.copyFileSync('dist/modlist.html', `dist/.tmp/${group}/modlist.html`) fs.copyFileSync('LICENSE.md', `dist/.tmp/${group}/LICENSE.md`) // Turns out you cant package bat files in CF releases anymore. @@ -127,11 +118,6 @@ export const KeyParameter = new Juke.Parameter({ type: 'string' }) -// for --version=1.0.0 -export const VersionParameter = new Juke.Parameter({ - type: 'string' -}); - export const BuildModlistTarget = new Juke.Target({ parameters: [KeyParameter], inputs: ['manifest.json'], @@ -185,7 +171,7 @@ export const DownloadModsTarget = new Juke.Target({ // filter returns changed mods, lets see now who owns them for (const pid of oldDataKeys.filter(pid => !newDataKeys.includes(pid)) - .concat(newDataKeys.filter(x => !oldDataKeys.includes(x)))) { + .concat(newDataKeys.filter(x => !oldDataKeys.includes(x)))) { const fromOldData = oldData[`${pid}`]; if (fromOldData) { // from old, which means this is removed @@ -197,13 +183,13 @@ export const DownloadModsTarget = new Juke.Target({ if (newData[`${pid}`] && !mIdToDownload.includes(`${pid}`)) { // new mod added mIdToDownload.push(`${pid}`); Juke.logger.info(`Mod was added from modpack: ${pid}`) - oldData[`${pid}`] = { ...newData[`${pid}`] } // copy + oldData[`${pid}`] = {...newData[`${pid}`]} // copy } } // now filter changed *fileids*, could prolly b optimized and use 1 loop instead of 2 for (const pid of oldDataKeys.filter(pid => ( - newData[pid] && oldData[pid]['fileID'] !== newData[pid]['fileID']))) { + newData[pid] && oldData[pid]['fileID'] !== newData[pid]['fileID']))) { const fromOldData = oldData[`${pid}`]; // from old, which means this is updated if (fromOldData) { @@ -242,7 +228,6 @@ export const DownloadModsTarget = new Juke.Target({ export const BuildClientTarget = new Juke.Target({ dependsOn: [BuildModlistTarget], - parameters: [VersionParameter], inputs: [ ...includeList, "dist/modlist.html" @@ -252,20 +237,18 @@ export const BuildClientTarget = new Juke.Target({ "dist/client.zip", ...includeList.map(v => `dist/client/${v}`) ]), - executes: async ({ get }) => { - const version = get(VersionParameter) + executes: async () => { fs.mkdirSync("dist/client", { recursive: true }) for (const folders of includeList) { fs.cpSync(folders, `dist/client/${folders}`, { recursive: true }) } - await packMod("client", version) + await packMod("client"); } }) export const BuildServerTarget = new Juke.Target({ dependsOn: [BuildModlistTarget, DownloadModsTarget], - parameters: [VersionParameter], inputs: [ ...includeList, "dist/modlist.html" @@ -275,8 +258,7 @@ export const BuildServerTarget = new Juke.Target({ "dist/server.zip", ...includeList.map(v => `dist/server/${v}`) ]), - executes: async ({ get }) => { - const version = get(VersionParameter) + executes: async () => { fs.mkdirSync("dist/server", { recursive: true }) for (const folders of includeList) { fs.cpSync(folders, `dist/server/${folders}`, { recursive: true }) @@ -296,7 +278,7 @@ export const BuildServerTarget = new Juke.Target({ ) }) - await packMod("server", version); + await packMod("server"); } })