Skip to content

feat: Automatically remove top-level MV2-only or MV3-only keys - #518

Merged
aklinker1 merged 3 commits into
mainfrom
strip-manifest-keys
Mar 3, 2024
Merged

aklinker1 merged 3 commits into
mainfrom
strip-manifest-keys

Conversation

@aklinker1

@aklinker1 aklinker1 commented Mar 3, 2024 •

Copy link
Copy Markdown
Member

This closes #517.

Instead of having to use a function to change the keys between manifest versions, you can just include both the MV2 and MV3 keys in a single object. When targetting MV2, all MV3 keys will be removed. When targetting MV3, all MV2 keys will be removed.

Before
export default defineConfig({
  manifest: ({ manifestVersion }) => {
    const manifest = {
      // ...
    };
    if (manifestVersion === 2) manifest.browser_action = {};
    else manifest.action = {};
    return manifest;
  };
});
After
export default defineConfig({
  manifest: {
    // ...,
    action: {},
    browser_action: {},
  },
});

@aklinker1 aklinker1 changed the title feat: Automatically strip keys from manifest not present in target version feat: Automatically strip top-level keys from manifest not present in target version Mar 3, 2024
@codecov

codecov Bot commented Mar 3, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.53%. Comparing base (8a6acba) to head (d6432b0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #518      +/-   ##
==========================================
+ Coverage   86.50%   86.53%   +0.02%     
==========================================
  Files         111      111              
  Lines        8798     8847      +49     
  Branches      867      871       +4     
==========================================
+ Hits         7611     7656      +45     
- Misses       1173     1177       +4     
  Partials       14       14              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@netlify

netlify Bot commented Mar 3, 2024 •

Copy link
Copy Markdown

✅ Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit d6432b0
🔍 Latest deploy log https://app.netlify.com/sites/creative-fairy-df92c4/deploys/65e4949c98969600081fcb13
😎 Deploy Preview https://deploy-preview-518--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@aklinker1
aklinker1 marked this pull request as ready for review March 3, 2024 15:17
@aklinker1 aklinker1 changed the title feat: Automatically strip top-level keys from manifest not present in target version feat: Automatically remove top-level MV2/MV3-only keys Mar 3, 2024
@aklinker1 aklinker1 changed the title feat: Automatically remove top-level MV2/MV3-only keys feat: Automatically remove top-level MV2-only or MV3-only keys Mar 3, 2024
@aklinker1
aklinker1 merged commit 5f651cc into main Mar 3, 2024
@aklinker1
aklinker1 deleted the strip-manifest-keys branch March 3, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatically strip MV2 keys from manifest when targetting MV3, and vise-versa.

1 participant