-
-
Notifications
You must be signed in to change notification settings - Fork 308
Show files added since the last release and not part of the package #456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 37 commits
f7473d8
5507f54
7278c44
9f3a1c3
d02e183
5bb7561
c43f900
71d179a
12a16f0
73b86f7
7cef7cb
4a75e6d
2827f81
4a8f2e4
da3f187
5db79e4
76e6a80
786187d
32d0d47
71d410f
3634a96
ddcaebf
d86bf7d
c445ff6
239c61f
fba3ab4
2fa3cf5
22b242a
dd5353b
a082606
f8a5507
bd12ee8
fa5c3c2
aa73b47
3bb2783
546aebb
c0a7b4c
7f383bf
db59d35
d75573f
d784837
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [submodule "integration-test"] | ||
| path = integration-test | ||
| url = https://github.com/bunysae/np_integration_test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -255,6 +255,11 @@ Host * | |
|
|
||
| If you're running into other issues when using SSH, please consult [GitHub's support article](https://help.github.com/articles/connecting-to-github-with-ssh/). | ||
|
|
||
| ### Ignore strategy | ||
| The [ignore strategy](https://docs.npmjs.com/files/package.json#files) either maintained in the `files`-property (`package.json`) or in the `.npmignore`-file should minify your packages. | ||
|
||
| To ensure package consistency `np` reports all new files added to git, which are not published. Test files and other [obvious stuff](https://docs.npmjs.com/files/package.json#files) isn't considered. | ||
|
||
| `np` assumes either a standard directory layout or a customized layout depict in the `directories` property (`package.json`). | ||
|
||
|
|
||
| ## FAQ | ||
|
|
||
| ### I get an error when publishing my package through Yarn | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| should be ignored by default |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| ignore.txt | ||
| test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| File is always included in package. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| File is always included in package. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Ignore this file |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| File is excluded from .npmignore |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ignore this file |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| should be ignored by default |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "files": ["pay_attention.txt"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| File is excluded from package.json |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| File in included in package.json |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| The directory is for the resources | ||
| in the script npmignore.js |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| const test = require('ava'); | ||
| const execa = require('execa'); | ||
|
|
||
| test.after.always(async () => { | ||
| await execa('git', ['submodule', 'update', '--remote']); | ||
| }); | ||
|
|
||
| test('Integration tests', async t => { | ||
| await execa('ava', {cwd: 'integration-test'}); | ||
| t.pass(); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| import path from 'path'; | ||
| import test from 'ava'; | ||
| import proxyquire from 'proxyquire'; | ||
|
|
||
| const newFiles = [ | ||
| 'source/ignore.txt', | ||
| 'source/pay_attention.txt', | ||
| '.hg', | ||
| 'test/file.txt', | ||
| 'readme.md', | ||
| 'README.txt' | ||
| ]; | ||
|
|
||
| test('ignored files using file-attribute in package.json with one file', async t => { | ||
| const testedModule = proxyquire('../source/npm/util', { | ||
| 'pkg-dir': | ||
| { | ||
| sync: () => path.resolve('test', 'fixtures', 'package') | ||
| } | ||
| }); | ||
| t.deepEqual(await testedModule.getNewAndUnpublishedFiles({files: ['pay_attention.txt']}, newFiles), ['source/ignore.txt']); | ||
| }); | ||
|
|
||
| test('ignored file using file-attribute in package.json with directory', async t => { | ||
| const testedModule = proxyquire('../source/npm/util', { | ||
| 'pkg-dir': | ||
| { | ||
| sync: () => path.resolve('test', 'fixtures', 'package') | ||
| } | ||
| }); | ||
| t.deepEqual(await testedModule.getNewAndUnpublishedFiles({files: ['source']}, newFiles), []); | ||
| }); | ||
|
|
||
| test('ignored test files using files attribute and directory structure in package.json', async t => { | ||
| const testedModule = proxyquire('../source/npm/util', { | ||
| 'pkg-dir': | ||
| { | ||
| sync: () => path.resolve('test', 'fixtures', 'package') | ||
| } | ||
| }); | ||
| t.deepEqual(await testedModule.getNewAndUnpublishedFiles({files: ['source'], directories: {test: 'test-tap'}}, newFiles), ['test/file.txt']); | ||
| t.deepEqual(await testedModule.getNewAndUnpublishedFiles({files: ['source'], directories: {test: ['test-tap']}}, newFiles), ['test/file.txt']); | ||
| }); | ||
|
|
||
| test('ignored files using .npmignore', async t => { | ||
| const testedModule = proxyquire('../source/npm/util', { | ||
| 'pkg-dir': | ||
| { | ||
| sync: () => path.resolve('test', 'fixtures', 'npmignore') | ||
| } | ||
| }); | ||
| t.deepEqual(await testedModule.getNewAndUnpublishedFiles({name: 'npmignore'}, newFiles), ['source/ignore.txt']); | ||
| }); | ||
|
|
||
| test('ignored test files using files attribute and .npmignore', async t => { | ||
| const testedModule = proxyquire('../source/npm/util', { | ||
| 'pkg-dir': | ||
| { | ||
| sync: () => path.resolve('test', 'fixtures', 'npmignore') | ||
| } | ||
| }); | ||
| t.deepEqual(await testedModule.getNewAndUnpublishedFiles({directories: {test: 'test-tap'}}, newFiles), ['source/ignore.txt', 'test/file.txt']); | ||
| t.deepEqual(await testedModule.getNewAndUnpublishedFiles({directories: {test: ['test-tap']}}, newFiles), ['source/ignore.txt', 'test/file.txt']); | ||
| }); | ||
|
|
||
| test('dot files using files attribute', async t => { | ||
| const testedModule = proxyquire('../source/npm/util', { | ||
| 'pkg-dir': | ||
| { | ||
| sync: () => path.resolve('test', 'fixtures', 'package') | ||
| } | ||
| }); | ||
| t.deepEqual(await testedModule.getNewAndUnpublishedFiles({files: ['source']}, ['test/.dotfile']), []); | ||
| }); | ||
|
|
||
| test('dot files using .npmignore', async t => { | ||
| const testedModule = proxyquire('../source/npm/util', { | ||
| 'pkg-dir': | ||
| { | ||
| sync: () => path.resolve('test', 'fixtures', 'npmignore') | ||
| } | ||
| }); | ||
| t.deepEqual(await testedModule.getNewAndUnpublishedFiles({}, ['test/.dot']), []); | ||
| }); | ||
|
|
||
| test('ignore strategy is not used', async t => { | ||
| const testedModule = proxyquire('../source/npm/util', { | ||
| 'pkg-dir': | ||
| { | ||
| sync: () => path.resolve('test', 'fixtures') | ||
| } | ||
| }); | ||
| t.is(await testedModule.getNewAndUnpublishedFiles({name: 'no ignore strategy'}, newFiles), undefined); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.