-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
124 lines (98 loc) · 4.1 KB
/
index.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// Require prompts, for user prompts
const prompts = require('prompts');
// Require chalk, for colorful cmd line output
const chalk = require('chalk');
// Get info from package.json
const package = require('./package.json');
(async() => {
// Get start time to measure total operating time
let start_time = new Date();
// Welcome users to Beautiful FOSS
console.log('\n');
console.log(chalk.bold.underline.magenta('Welcome to Beautiful FOSS!'));
console.log(chalk.dim.gray('Current version: ', package.version));
console.log(chalk.dim.gray('Built by Neutron Creative - on a mission to make the world open-source'));
console.log(chalk.dim.gray('Want to support the development of this project?'));
console.log(chalk.dim.gray('Sposor us on Github: '),chalk.cyan.underline('https://github.com/sponsors/Neutron-Creative'));
console.log('\n');
// Prompt user for generic project information
const project_info = await prompts([
{
type: 'text',
name: 'name',
message: 'What is the project name?'
},
{
type: 'text',
name: 'description',
message: 'What is the project description?'
},
{
type: 'text',
name: 'logo',
message: 'Where is the project logo located?'
},
{
type: 'multiselect',
name: 'assets',
message: 'What assets do you want to generate?',
choices: [
'Readme',
'Landing page',
'Open-graph images'
]
}
]);
console.log('\n');
// If readme is requested
if(project_info.assets.includes(0)) {
// Generate readme
console.log(chalk.yellow('Beautiful FOSS: Beginning readme generation'));
// Get start time to compare with end for total operating time
let start_date_r = new Date();
// Get end time to compare with start for total operating time
let end_date_r = new Date();
// Compare start & end times
let seconds = (end_date_r.getTime() - start_date_r.getTime()) / 1000;
console.log(chalk.yellow('Beautiful FOSS: Finished generating readme in ' + seconds + 's'));
console.log('\n');
}
// If landing page is requested
if(project_info.assets.includes(1)) {
// Generate landing page
console.log(chalk.yellow('Beautiful FOSS: Beginning landing-page generation'));
// Get start time to compare with end for total operating time
let start_date_lp = new Date();
// Get end time to compare with start for total operating time
let end_date_lp = new Date();
// Compare start & end times
let seconds = (end_date_lp.getTime() - start_date_lp.getTime()) / 1000;
console.log(chalk.yellow('Beautiful FOSS: Finished generating landing-page in ' + seconds + 's'));
console.log('\n');
}
// If open-graph images are requested
if(project_info.assets.includes(2)) {
// Generate open-graph images
console.log(chalk.yellow('Beautiful FOSS: Beginning copying of open-graph images'));
// Get start time to compare with end for total operating time
let start_date_og = new Date();
// Get end time to compare with start for total operating time
let end_date_og = new Date();
// Compare start & end times
let seconds = (end_date_og.getTime() - start_date_og.getTime()) / 1000;
console.log(chalk.yellow('Beautiful FOSS: Finished copying open-graph images in ' + seconds + 's'));
console.log('\n');
console.log('Unfortunately, open-graph images can\'t be autogenerated at this time.');
console.log('For more information, view components/open-graph/readme.md');
console.log('\n');
}
// Get end time to compare with start for total operating time
let end_date = new Date();
// Compare start & end times
let seconds = (end_date.getTime() - start_time.getTime()) / 1000;
console.log(chalk.green('\nBeautiful FOSS: Done!\nBeautiful FOSS: Assets generated in '), chalk.green.italic(seconds + 's'));
console.log('\n');
console.log(chalk.dim.gray('Did Beautiful FOSS help you today?\nWe\'re on a mission to make the world open-source, and we can\'t do it without your support.\nIf you have the means, please consider making a donation.'));
console.log(chalk.dim.gray('Sposor us on Github: '), chalk.cyan.underline('https://github.com/sponsors/Neutron-Creative'))
console.log('\n');
})();