Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This also splits the scope-in-config into two, since init() doesn't reload the package.json on each call, so it can really only be done once per process.
- Loading branch information
Showing
9 changed files
with
53 additions
and
25 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
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,30 @@ | ||
var fs = require('fs') | ||
var path = require('path') | ||
|
||
var rimraf = require('rimraf') | ||
var tap = require('tap') | ||
|
||
var init = require('../') | ||
|
||
var json = { | ||
name: '@already/scoped', | ||
version: '1.0.0' | ||
} | ||
|
||
tap.test('with existing package.json', function (t) { | ||
fs.writeFileSync(path.join(__dirname, 'package.json'), JSON.stringify(json, null, 2)) | ||
console.log(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8')) | ||
console.error('wrote json', json) | ||
init(__dirname, __dirname, { yes: 'yes', scope: '@still' }, function (er, data) { | ||
if (er) throw er | ||
|
||
console.log('') | ||
t.equal(data.name, '@still/scoped', 'new scope is added, basic name is kept') | ||
t.end() | ||
}) | ||
}) | ||
|
||
tap.test('teardown', function (t) { | ||
rimraf.sync(path.join(__dirname, 'package.json')) | ||
t.end() | ||
}) |
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
257c414
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between
same()
andhas()
?257c414
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To answer myself,
has()
is synonymous withmatch()
which allows additional fields.