Skip to content

Commit

Permalink
Add missing .npmignore files
Browse files Browse the repository at this point in the history
Summary:
I noticed some of our packages publish `src.real` to NPM, which is an intermediate build artefact that shouldn't published. It turns out this is because a few of them are missing the standard `.npmignore`, and so also publishing test code and lock files.

This adds the missing `.npmignore` files, and adds a check to our `subpackages-test.js` for existence and minimal content.

Reviewed By: motiz88

Differential Revision: D36592818

fbshipit-source-id: adac01c5c9d632e3388290a46c3cbc3308b4e239
  • Loading branch information
robhogan authored and facebook-github-bot committed May 23, 2022
1 parent 94e79e0 commit e8bb8fb
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/metro-cache-key/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/__mocks__/**
**/__tests__/**
build
src.real
yarn.lock
5 changes: 5 additions & 0 deletions packages/metro-symbolicate/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/__mocks__/**
**/__tests__/**
build
src.real
yarn.lock
5 changes: 5 additions & 0 deletions packages/metro-transform-worker/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/__mocks__/**
**/__tests__/**
build
src.real
yarn.lock
17 changes: 17 additions & 0 deletions scripts/__tests__/subpackages-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,20 @@ it('forces all packages to have a src/ folder', () => {
);
});
});

it('forces all packages to have an .npmignore with expected entries', () => {
checkAssertionInPackages(getPackages(), packagePath => {
const npmIgnorePath = path.join(packagePath, '.npmignore');
expect(fs.existsSync(npmIgnorePath)).toBe(true);
const lines = fs.readFileSync(npmIgnorePath, 'utf-8').split('\n');
expect(lines).toEqual(
expect.arrayContaining([
'**/__mocks__/**',
'**/__tests__/**',
'build',
'src.real',
'yarn.lock',
]),
);
});
});

0 comments on commit e8bb8fb

Please sign in to comment.