Skip to content

Commit e8bb8fb

Browse files
robhoganfacebook-github-bot
authored andcommittedMay 23, 2022
Add missing .npmignore files
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
1 parent 94e79e0 commit e8bb8fb

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed
 

‎packages/metro-cache-key/.npmignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**/__mocks__/**
2+
**/__tests__/**
3+
build
4+
src.real
5+
yarn.lock

‎packages/metro-symbolicate/.npmignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**/__mocks__/**
2+
**/__tests__/**
3+
build
4+
src.real
5+
yarn.lock
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**/__mocks__/**
2+
**/__tests__/**
3+
build
4+
src.real
5+
yarn.lock

‎scripts/__tests__/subpackages-test.js

+17
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,20 @@ it('forces all packages to have a src/ folder', () => {
8181
);
8282
});
8383
});
84+
85+
it('forces all packages to have an .npmignore with expected entries', () => {
86+
checkAssertionInPackages(getPackages(), packagePath => {
87+
const npmIgnorePath = path.join(packagePath, '.npmignore');
88+
expect(fs.existsSync(npmIgnorePath)).toBe(true);
89+
const lines = fs.readFileSync(npmIgnorePath, 'utf-8').split('\n');
90+
expect(lines).toEqual(
91+
expect.arrayContaining([
92+
'**/__mocks__/**',
93+
'**/__tests__/**',
94+
'build',
95+
'src.real',
96+
'yarn.lock',
97+
]),
98+
);
99+
});
100+
});

0 commit comments

Comments
 (0)
Please sign in to comment.