-
Notifications
You must be signed in to change notification settings - Fork 2
/
messages.js
69 lines (49 loc) · 1.99 KB
/
messages.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const chalk = require('chalk');
const log = require('./log');
const { stripIndent } = require('common-tags');
const authRequired = () => {
log.error('Deploy key is required');
console.error('');
// prettier-ignore
console.error(stripIndent`
Your deploy key can be found under "Settings" in the UI.
There are couple ways to use your key:
- Use the ${log.variable('-k')} flag, or
- Set the ${log.variable('STATICKIT_DEPLOY_KEY')} env variable
${chalk.yellow.bold('-- Examples -----------------------------------------------')}
The inline method looks like this:
${chalk.gray('$')} statickit deploy ${chalk.cyan('-k')} ${chalk.yellow('<your-deploy-key>')}
For convenience, you can add it to a ${log.variable('.env')} file.
That way, you don't have to copy/paste it every time
you run a command:
${chalk.gray('$')} echo "STATICKIT_DEPLOY_KEY=${chalk.yellow('<your-deploy-key>')}" >> .env
${chalk.gray('$')} statickit deploy
Just be sure to add ${log.variable('.env')} to your ${log.variable('.gitignore')} file,
so your deploy key does not end up in version control.
`);
console.error('');
};
const secretAlreadyExists = (name, value, key) => {
log.error('Secret already exists');
console.error('');
// prettier-ignore
console.error(stripIndent`
If you'd like to update it, run the following command instead:
${chalk.gray('$')} statickit secrets update ${name} ${value} -k ${key}
`);
console.error('');
};
const secretKeyInvalid = () => {
log.error('Secret name is invalid');
console.error('');
// prettier-ignore
console.error(stripIndent`
Secret names can contain letters, numbers, and dashes.
You should typically use kebab-case.
${chalk.yellow.bold('-- Examples -----------------------------------------------')}
${chalk.gray('mailchimp-api-key')}
${chalk.gray('stripe-secret-key')}
`);
console.error('');
};
module.exports = { authRequired, secretAlreadyExists, secretKeyInvalid };