builder-support
Advanced tools
Comparing version 0.0.1 to 0.1.0
History | ||
======= | ||
## 0.1.0 | ||
* Allow empty `dev/*` directory and no `dependencies` field in | ||
`dev/package.json`. ( [@zachhale][] ) | ||
## 0.0.1 | ||
@@ -10,1 +15,2 @@ | ||
[@ryan-roemer]: https://github.com/ryan-roemer | ||
[@zachhale]: https://github.com/zachhale |
@@ -31,4 +31,4 @@ "use strict"; | ||
// Validation | ||
["name", "description", "dependencies"].forEach(function (name) { | ||
// Validation of source package. | ||
["name", "description"].forEach(function (name) { | ||
if (!pkg[name]) { | ||
@@ -39,6 +39,2 @@ throw new Error("Source object missing field: " + name); | ||
if (!target.dependencies) { | ||
throw new Error("Target object missing field: dependencies"); | ||
} | ||
// Update with "development" names | ||
@@ -48,4 +44,4 @@ pkg.name += "-dev"; | ||
// Patch `devDependencies` into `dependencies` | ||
pkg.dependencies = target.dependencies; | ||
// Copy back in `dependencies` from dev package | ||
pkg.dependencies = (target || {}).dependencies || {}; | ||
@@ -63,10 +59,23 @@ // Remove scripts, dev deps, etc. | ||
var devPath = path.resolve("dev/package.json"); | ||
var devPkg = tryRequire(devPath); | ||
var updatedDevPkg = updatePkg(prodPkg, devPkg); | ||
async.parallel({ | ||
package: function (cb) { | ||
async.auto({ | ||
ensureDevDirectory: fs.ensureDir.bind(fs, path.resolve("dev")), | ||
readDevPackage: function (cb) { | ||
var devPkg = {}; | ||
try { | ||
devPkg = tryRequire(devPath); | ||
} catch (err) { | ||
// Ignore error and use default values. | ||
} | ||
cb(null, devPkg); | ||
}, | ||
writeDevPackage: ["ensureDevDirectory", "readDevPackage", function (cb, results) { | ||
var updatedDevPkg = updatePkg(prodPkg, results.readDevPackage); | ||
fs.writeFile(devPath, JSON.stringify(updatedDevPkg, null, 2), cb); | ||
}, | ||
gitignore: function (cb) { | ||
}], | ||
writeGitignore: ["ensureDevDirectory", function (cb) { | ||
fs.copy( | ||
@@ -77,4 +86,5 @@ path.resolve(".gitignore"), | ||
); | ||
}, | ||
readme: function (cb) { | ||
}], | ||
writeReadme: ["ensureDevDirectory", function (cb) { | ||
fs.copy( | ||
@@ -85,4 +95,4 @@ path.resolve("README.md"), | ||
); | ||
} | ||
}] | ||
}, callback); | ||
}; |
{ | ||
"name": "builder-support", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Builder support libraries", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -28,5 +28,4 @@ [![Travis Status][trav_img]][trav_site] | ||
that has tasks for both production and development. Must have `name`, | ||
`description`, `dependencies` fields. | ||
`description` fields. | ||
* `dev/package.json` - Dependencies for development tasks only. | ||
Must have a `dependencies` field. | ||
@@ -59,13 +58,4 @@ Assuming those exist, then the tool: | ||
If you are _bootstrapping_ a new archetype, this should get you going: | ||
If you are _bootstrapping_ a new archetype, a new file at `dev/package.json` will be generated for you automatically. | ||
```sh | ||
$ mkdir dev | ||
$ touch dev/package.json | ||
$ vim dev/package.json | ||
{ | ||
"dependencies: {} | ||
} | ||
``` | ||
And you should be good to run `builder-support gen-dev` in the project root. | ||
@@ -72,0 +62,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7671
94
64