From 2511dae5e1afa2fa78bea50f667b192acfc8f477 Mon Sep 17 00:00:00 2001 From: Joe Bottigliero <694253+jbottigliero@users.noreply.github.com> Date: Fri, 20 Dec 2024 09:40:04 -0600 Subject: [PATCH 1/2] feat: adds support for package.json merging --- .github/workflows/static.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index b682eda..db733d5 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -155,7 +155,14 @@ jobs: if [ -d "./overrides" ]; then rsync -av ./overrides/ ./.static--generator/ fi - # Call the ecosystem's default install and build command. + # [ECOSYSTEM SPECIFIC STEPS] + # + # At the moment, this action only supports `npm` as the ecosystem, but the steps below + # can be modified to support other ecosystems. + # + - name: Merge the package.json, removing the targeted generator from the dependencies. + run: | + jq -s '.[0] * .[1] | del(.dependencies["${{ fromJson(steps.static.outputs.result)._static.generator.name }}"])' ./.static--generator/package.json package.json > ./.static--generator/package.json - name: "Building from ${{ fromJson(steps.static.outputs.result)._static.generator.name }}" run: cd ./.static--generator && npm ci && npm run build - name: Copying Output to Base Directory From f5fa85809e5c4d653459eb3c906f116bf3f59874 Mon Sep 17 00:00:00 2001 From: Joe Bottigliero <694253+jbottigliero@users.noreply.github.com> Date: Fri, 20 Dec 2024 10:53:52 -0600 Subject: [PATCH 2/2] fix: use a temp file for the merged JSON, use npm install instead of npm ci (for now) --- .github/workflows/static.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index db733d5..6cb8b18 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -162,9 +162,9 @@ jobs: # - name: Merge the package.json, removing the targeted generator from the dependencies. run: | - jq -s '.[0] * .[1] | del(.dependencies["${{ fromJson(steps.static.outputs.result)._static.generator.name }}"])' ./.static--generator/package.json package.json > ./.static--generator/package.json + jq -s '.[0] * .[1] | del(.dependencies["${{ fromJson(steps.static.outputs.result)._static.generator.name }}"])' ./.static--generator/package.json package.json > ./merged--package.json && mv ./merged--package.json ./.static--generator/package.json - name: "Building from ${{ fromJson(steps.static.outputs.result)._static.generator.name }}" - run: cd ./.static--generator && npm ci && npm run build + run: cd ./.static--generator && npm install && npm run build - name: Copying Output to Base Directory run: cp -r ./.static--generator/out ./out - name: Upload artifact