1 | const repo = 'https://github.com/bahmutov/generator-node-bahmutov'
|
2 |
|
3 | function lastMessage (msg) {
|
4 | console.error(msg)
|
5 | process.exit(-1)
|
6 | }
|
7 |
|
8 | function onGitOriginError (err) {
|
9 | const gitOriginErrorMessage = `
|
10 | 🔥 This generator assumes there is already a remote Git
|
11 | (probably GitHub or GitLab) repository where all code will live.
|
12 | Please set it up before running generator
|
13 |
|
14 | git init
|
15 | git remote add origin <remote git>
|
16 |
|
17 | See more details at ${repo}#remote
|
18 | `
|
19 | console.error(err)
|
20 | lastMessage(gitOriginErrorMessage)
|
21 | }
|
22 |
|
23 | function onMissingDescription () {
|
24 | const msg = `
|
25 | 🔥 Please provide a meaningful module description.
|
26 | A project without description is of no use to anyone.
|
27 | `
|
28 | lastMessage(msg)
|
29 | }
|
30 |
|
31 | function onMissingKeywords () {
|
32 | const msg = `
|
33 | 🔥 Please provide a few comma-separated keywords.
|
34 | Good keywords make finding your module so much easier.
|
35 | `
|
36 | lastMessage(msg)
|
37 | }
|
38 |
|
39 | module.exports = { onGitOriginError, onMissingDescription, onMissingKeywords }
|