-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from cnpm/ignore-scripts
feat: support ignore-scripts
- Loading branch information
Showing
8 changed files
with
92 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "ignore-scripts", | ||
"dependencies": { | ||
"kpg": "./pkg" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('hello') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "pkg", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"preinstall": "echo \"preinstall\" > ./preinstall", | ||
"install": "echo \"install\" > ./install", | ||
"postinstall": "echo \"postinstall\" > ./postinstall" | ||
}, | ||
"author": "", | ||
"license": "ISC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* Copyright(c) cnpm and other contributors. | ||
* MIT Licensed | ||
* | ||
* Authors: | ||
* dead_horse <[email protected]> | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
const assert = require('assert'); | ||
const path = require('path'); | ||
const rimraf = require('rimraf'); | ||
const fs = require('mz/fs'); | ||
const npminstall = require('./npminstall'); | ||
|
||
describe('test/ignoreScripts.test.js', function() { | ||
const root = path.join(__dirname, 'fixtures', 'ignore-scripts'); | ||
|
||
function cleanup() { | ||
rimraf.sync(path.join(root, 'node_modules')); | ||
} | ||
|
||
beforeEach(cleanup); | ||
afterEach(cleanup); | ||
|
||
it('should ignore scripts', function*() { | ||
yield npminstall({ | ||
root: root, | ||
ignoreScripts: true, | ||
}); | ||
|
||
const dirs = yield fs.readdir(path.join(root, 'node_modules')); | ||
assert.deepEqual(dirs, [ '.npminstall', 'pkg' ]); | ||
const files = yield fs.readdir(path.join(root, 'node_modules/pkg')); | ||
assert.deepEqual(files, [ '.npminstall.done', 'index.js', 'package.json' ]); | ||
}); | ||
}); |