From 6d968a1fe3694e162fa9691ba57b53e43b8de880 Mon Sep 17 00:00:00 2001 From: EGOIST <0x142857@gmail.com> Date: Sun, 1 Jan 2017 19:17:47 +0800 Subject: [PATCH] improve --- .gitattributes | 1 + LICENSE | 21 +++++++++++++++++++++ sao.js | 15 ++++++++++++--- template/.gitattributes | 1 + template/LICENSE | 21 +++++++++++++++++++++ template/README.md | 2 +- template/package.json | 2 +- template/sao.js | 21 ++++++++++++++------- template/template/.editorconfig | 12 ++++++++++++ template/template/.gitattributes | 1 + template/template/LICENSE | 21 +++++++++++++++++++++ 11 files changed, 106 insertions(+), 12 deletions(-) create mode 100644 .gitattributes create mode 100644 LICENSE create mode 100644 template/.gitattributes create mode 100644 template/LICENSE create mode 100644 template/template/.editorconfig create mode 100644 template/template/.gitattributes create mode 100644 template/template/LICENSE diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8cae841 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) EGOIST <0x142857@gmail.com> (github.com/egoist) + +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. diff --git a/sao.js b/sao.js index 3a158e0..4d42f91 100644 --- a/sao.js +++ b/sao.js @@ -3,7 +3,7 @@ const superb = require('superb') module.exports = { prompts: { name: { - message: 'What is the name of the new template?', + message: 'What is the name of the new template (better be template-*)?', role: 'folder:name', filter: val => val.toLowerCase() }, @@ -14,11 +14,20 @@ module.exports = { username: { message: 'What is your GitHub username?', role: 'git:name', - filter: val => val.toLowerCase() + filter: val => val.toLowerCase(), + store: true }, email: { message: 'What is your GitHub email?', - role: 'git:email' + role: 'git:email', + store: true + }, + website: { + message: 'The URL of your website?', + default({username}) { + return `github.com/${username}` + }, + store: true } }, skipInterpolation: [ diff --git a/template/.gitattributes b/template/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/template/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/template/LICENSE b/template/LICENSE new file mode 100644 index 0000000..fd65787 --- /dev/null +++ b/template/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) <%= username %> <<%= email %>> (<%= website %>) + +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. diff --git a/template/README.md b/template/README.md index f5fd0ac..08f5e31 100644 --- a/template/README.md +++ b/template/README.md @@ -20,4 +20,4 @@ sao <%= name.replace('template-', '') %> ## License -MIT © <%= username %> +MIT © [<%= username %>](<%= website %>) diff --git a/template/package.json b/template/package.json index 46055ed..7e33d64 100644 --- a/template/package.json +++ b/template/package.json @@ -6,7 +6,7 @@ "url": "<%= username %>/<%= name %>", "type": "git" }, - "author": "<%= username %> <<%= email %>>", + "author": "<%= username %> <<%= email %>> (<%= website %>)", "license": "MIT", "files": [ "sao.js", diff --git a/template/sao.js b/template/sao.js index 805acd8..2c31612 100644 --- a/template/sao.js +++ b/template/sao.js @@ -12,19 +12,26 @@ module.exports = { }, username: { message: 'What is your GitHub username?', - role: 'git:name' + role: 'git:name', + store: true }, email: { message: 'What is your GitHub email?', - role: 'git:email' + role: 'git:email', + store: true + }, + website: { + message: 'The URL of your website?', + default({username}) { + return `github.com/${username}` + }, + store: true } }, - post({chalk, isNewFolder, folderName}) { - console.log(`\n ${chalk.green('done!')}`) + post({log, chalk, isNewFolder, folderName}) { + log.success('Done!') if (isNewFolder) { - console.log(` cd ${chalk.yellow(folderName)} to get started!\n`) - } else { - console.log() + log.info(`cd ${chalk.yellow(folderName)} to get started!`) } } } diff --git a/template/template/.editorconfig b/template/template/.editorconfig new file mode 100644 index 0000000..4a7ea30 --- /dev/null +++ b/template/template/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/template/template/.gitattributes b/template/template/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/template/template/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/template/template/LICENSE b/template/template/LICENSE new file mode 100644 index 0000000..fd65787 --- /dev/null +++ b/template/template/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) <%= username %> <<%= email %>> (<%= website %>) + +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.