add LICENSE file to babel-plugin
This commit is contained in:
parent
502eab6f1c
commit
d2dc5e7149
@ -32,7 +32,7 @@ function spawnMultiple(cmds) {
|
||||
next();
|
||||
}
|
||||
|
||||
function template(name, data) {
|
||||
function template(name, data = {}) {
|
||||
var source = fs.readFileSync(path.join(__dirname, "templates", name), "utf8");
|
||||
source = source.replace(/[A-Z_]+/g, function (key) {
|
||||
return data[key] === undefined ? key : data[key];
|
||||
@ -61,48 +61,63 @@ var cmds = {
|
||||
}
|
||||
|
||||
rl.question("Description (optional): ", function (description) {
|
||||
rl.question("GitHub Repository (eg. sebmck/babel-plugin-foobar) (optional): ", function (repo) {
|
||||
rl.close();
|
||||
|
||||
var templateData = {
|
||||
DESCRIPTION: description,
|
||||
FULL_NAME: BABEL_PLUGIN_PREFIX + name,
|
||||
NAME: name
|
||||
};
|
||||
|
||||
write("package.json", JSON.stringify({
|
||||
name: templateData.FULL_NAME,
|
||||
version: "1.0.0",
|
||||
description: templateData.DESCRIPTION,
|
||||
repository: repo || undefined,
|
||||
license: "MIT",
|
||||
main: "lib/index.js",
|
||||
|
||||
devDependencies: {
|
||||
babel: "^5.6.0"
|
||||
},
|
||||
|
||||
scripts: {
|
||||
build: "babel-plugin build",
|
||||
push: "babel-plugin publish",
|
||||
test: "babel-plugin test"
|
||||
},
|
||||
|
||||
keywords: ["babel-plugin"]
|
||||
}, null, " ") + "\n");
|
||||
|
||||
write(".npmignore", "node_modules\n*.log\nsrc\n");
|
||||
|
||||
write(".gitignore", "node_modules\n*.log\nlib\n");
|
||||
|
||||
write("README.md", template("README.md", templateData));
|
||||
|
||||
if (!pathExists.sync("src")) {
|
||||
fs.mkdirSync("src");
|
||||
write("src/index.js", template("index.js", templateData));
|
||||
}
|
||||
});
|
||||
var remote = child.execSync("git config --get remote.origin.url").trim().match(/git@github.com:(.*?).git/);
|
||||
if (remote) {
|
||||
build(description, remote[1]);
|
||||
} else {
|
||||
rl.question("GitHub Repository (eg. sebmck/babel-plugin-foobar) (optional): ", function (repo) {
|
||||
build(description, repo);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function build(description, repo) {
|
||||
rl.close();
|
||||
|
||||
var templateData = {
|
||||
DESCRIPTION: description,
|
||||
FULL_NAME: BABEL_PLUGIN_PREFIX + name,
|
||||
NAME: name
|
||||
};
|
||||
|
||||
write("package.json", JSON.stringify({
|
||||
name: templateData.FULL_NAME,
|
||||
version: "1.0.0",
|
||||
description: templateData.DESCRIPTION,
|
||||
repository: repo || undefined,
|
||||
license: "MIT",
|
||||
main: "lib/index.js",
|
||||
|
||||
devDependencies: {
|
||||
babel: "^5.6.0"
|
||||
},
|
||||
|
||||
scripts: {
|
||||
publish: "babel-plugin publish",
|
||||
build: "babel-plugin build",
|
||||
test: "babel-plugin test"
|
||||
},
|
||||
|
||||
keywords: ["babel-plugin"]
|
||||
}, null, " ") + "\n");
|
||||
|
||||
write(".npmignore", "node_modules\n*.log\nsrc\n");
|
||||
|
||||
write(".gitignore", "node_modules\n*.log\nlib\n");
|
||||
|
||||
write("README.md", template("README.md", templateData));
|
||||
|
||||
write("LICENSE", template("LICENSE", {
|
||||
AUTHOR_EMAIL: child.execSync("git config --get user.email").trim(),
|
||||
AUTHOR_NAME: child.execSync("git config --get user.name").trim(),
|
||||
YEAR: new Date().getFullYear()
|
||||
}));
|
||||
|
||||
if (!pathExists.sync("src")) {
|
||||
fs.mkdirSync("src");
|
||||
write("src/index.js", template("index.js", templateData));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
build: function () {
|
||||
|
||||
22
packages/babel-cli/src/babel-plugin/templates/LICENSE
Normal file
22
packages/babel-cli/src/babel-plugin/templates/LICENSE
Normal file
@ -0,0 +1,22 @@
|
||||
Copyright (c) YEAR AUTHOR_NAME <AUTHOR_EMAIL>
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
Loading…
x
Reference in New Issue
Block a user