Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

builder-support

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

builder-support - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

.eslintrc-server-test

7

HISTORY.md
History
=======
## 0.2.0
* Add `.npmrc` to list of files copied. All files besides `package.json` are
now optional to exist in archetype root.
* All file i/o is now asynchronous.
* Add unit tests.
## 0.1.0

@@ -5,0 +12,0 @@

77

lib/dev.js

@@ -10,10 +10,22 @@ "use strict";

var tryRequire = function (filePath) {
var resolved = path.resolve(filePath);
try {
/*eslint-disable global-require*/
return require(resolved);
} catch (err) {
throw new Error("Unable to import: " + resolved + " with error:\n" + err.message);
}
// Production files to copy over unmutated to development directory.
// Allowed to not exist (and not copied in that case).
//
// **Note**: Only copies files from root directory. We'll need to add something
// like `ensureFile` if we want to have nested path file copies.
var FILES = [
".gitignore",
".npmrc",
"README.md"
];
// Allow "not found", otherwise pass through errors.
var allowNotFound = function (callback) {
return function (err, data) {
if (err && err.code === "ENOENT") {
return callback(null, null);
}
callback(err, data);
};
};

@@ -55,3 +67,2 @@

module.exports = function (callback) {
var prodPkg = tryRequire("package.json");
var devPath = path.resolve("dev/package.json");

@@ -62,34 +73,36 @@

readProdPackage: function (cb) {
fs.readJson(path.resolve("package.json"), cb);
},
readDevPackage: function (cb) {
var devPkg = {};
try {
devPkg = tryRequire(devPath);
} catch (err) {
// Ignore error and use default values.
}
cb(null, devPkg);
fs.readJson(devPath, allowNotFound(cb));
},
writeDevPackage: ["ensureDevDirectory", "readDevPackage", function (cb, results) {
var updatedDevPkg = updatePkg(prodPkg, results.readDevPackage);
fs.writeFile(devPath, JSON.stringify(updatedDevPkg, null, 2), cb);
}],
updateDevPackage: [
"ensureDevDirectory",
"readDevPackage",
"readProdPackage",
function (cb, results) {
try {
return cb(null, updatePkg(results.readProdPackage, results.readDevPackage));
} catch (err) {
return cb(err);
}
}
],
writeGitignore: ["ensureDevDirectory", function (cb) {
fs.copy(
path.resolve(".gitignore"),
path.resolve("dev/.gitignore"),
cb
);
writeDevPackage: ["updateDevPackage", function (cb, results) {
fs.writeFile(devPath, JSON.stringify(results.updateDevPackage, null, 2), cb);
}],
writeReadme: ["ensureDevDirectory", function (cb) {
// Copy all remaining files straight up.
copyFiles: ["ensureDevDirectory", async.map.bind(async, FILES, function (fileName, cb) {
fs.copy(
path.resolve("README.md"),
path.resolve("dev/README.md"),
cb
path.resolve(fileName),
path.resolve(path.join("dev", fileName)),
allowNotFound(cb)
);
}]
})]
}, callback);
};
{
"name": "builder-support",
"version": "0.1.0",
"version": "0.2.0",
"description": "Builder support libraries",

@@ -20,4 +20,8 @@ "repository": {

"builder:lint-server": "eslint --color -c .eslintrc-server lib bin",
"builder:lint": "npm run builder:lint-server",
"builder:check": "npm run builder:lint"
"builder:lint-server-test": "eslint --color -c .eslintrc-server-test test",
"builder:lint": "npm run builder:lint-server && npm run builder:lint-server-test",
"builder:test": "mocha --opts test/server/mocha.opts test/server/spec",
"builder:test-cov": "istanbul cover --config .istanbul.server.yml _mocha -- --opts test/server/mocha.opts test/server/spec",
"builder:check": "npm run builder:lint && npm run builder:test",
"builder:check-ci": "npm run builder:lint && npm run builder:test-cov"
},

@@ -29,6 +33,12 @@ "dependencies": {

"devDependencies": {
"chai": "^3.4.1",
"coveralls": "^2.11.6",
"eslint": "^1.10.1",
"eslint-config-defaults": "^7.0.1",
"eslint-plugin-filenames": "^0.1.2"
"eslint-plugin-filenames": "^0.1.2",
"istanbul": "^0.4.2",
"mocha": "^2.3.4",
"mock-fs": "^3.6.0",
"sinon": "^1.17.2"
}
}
[![Travis Status][trav_img]][trav_site]
[![Coverage Status][cov_img]][cov_site]

@@ -64,1 +65,4 @@ Builder Support Tools

[trav_site]: https://travis-ci.org/FormidableLabs/builder-support
[cov]: https://coveralls.io
[cov_img]: https://img.shields.io/coveralls/FormidableLabs/builder-support.svg
[cov_site]: https://coveralls.io/r/FormidableLabs/builder-support

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc