-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·185 lines (180 loc) · 5.43 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/usr/bin/env node
const inquirer = require("inquirer");
const argv = require("yargs").argv;
const stepInit = require("./src/stepInit");
const stepContao = require("./src/stepContao");
const stepNode = require("./src/stepNode");
const stepCopy = require("./src/stepCopy");
const stepFinish = require("./src/stepFinish");
const printLn = require("./src/printLn");
const contaoQuestions = [
{
type: "input",
name: "contaoVersion",
message: "What version of Contao shall we use?",
default: "4.9",
},
{
type: "checkbox",
message: "Setup",
name: "localDev",
choices: [
{
value: "enableDebug",
name: "Enable debug mode in .env",
checked: true,
},
{
value: "contaoDevServer",
name: "Install local development server",
checked: true,
},
{
value: "contaoManager",
name: "Install Contao Manager",
checked: true,
},
{
value: "prependLocale",
name: "Enable prepend_locale in config",
checked: true,
},
{
value: "removeSuffix",
name: "Set empty url_suffix in config",
checked: true,
},
],
},
{
type: "confirm",
message: "Install DPLOY for deployment?",
name: "dploy",
default: false,
},
{
type: "checkbox",
message: "Which Contao Core Bundles should be installed?",
name: "contaoCoreBundles",
choices: [
{ name: "News", checked: true, value: "contao/news-bundle" },
{
name: "Calendar",
checked: false,
value: "contao/calendar-bundle",
},
{
name: "Comments",
checked: false,
value: "contao/comments-bundle",
},
{ name: "FAQ", checked: false, value: "contao/faq-bundle" },
{
name: "Newsletter",
checked: false,
value: "contao/newsletter-bundle",
},
],
},
{
type: "checkbox",
message: "Which Contao Plugin Bundles should be installed?",
name: "contaoPluginBundles",
choices: [
{
name: "haste extension for Contao Open Source CMS (codefog)",
checked: true,
value: "codefog/contao-haste",
},
{
name: "News Categories bundle for Contao Open Source CMS (codefog)",
checked: false,
value: "codefog/contao-news_categories",
},
{
name: "Content API (Die Schittigs)",
checked: false,
value: "dieschittigs/contao-content-api",
},
{
name: "Leads (terminal42)",
checked: false,
value: "terminal42/contao-leads",
},
{
name: "ChangeLanguage (terminal42)",
checked: false,
value: "terminal42/contao-changelanguage",
},
{
name: "MultiColumWizard (MEN AT WORK)",
checked: false,
value: "menatwork/contao-multicolumnwizard",
},
{
name: "Notification Center (terminal42)",
checked: false,
value: "terminal42/notification_center",
},
{
name: "DC_Multilingual extension for Contao Open Source CMS (terminal42)",
checked: false,
value: "terminal42/dc_multilingual",
},
],
},
{
type: "confirm",
message: "Install Webpack and boilerplate code?",
name: "webpack",
default: true,
},
];
const jsQuestions = [
{
type: "checkbox",
message: "Additional JS libraries",
name: "jsPackages",
choices: [
{
value: "jquery",
title: "jQuery - Still kickin'",
checked: false
},
{
value: "lodash",
name: "Lodash - A JavaScript utility library",
checked: false,
},
{
value: "axios",
name: "Axios - Promise based HTTP client",
checked: false,
},
{
value: "vue",
name: "Vue.js - The Progressive JavaScript Framework",
checked: false,
},
],
},
];
async function main() {
console.log("\n 👋 Hi, welcome to Create Contao App!\n");
let dir = "./";
if (argv._ && argv._.length) dir = argv._[0];
if (!(await stepInit(dir))) return;
let answers = await inquirer.prompt(contaoQuestions);
if (answers.webpack) {
answers = { ...answers, ...(await inquirer.prompt(jsQuestions)) };
}
printLn.nfo("🚩 Setting up your Contao Installation");
await stepContao(answers);
printLn.nfo("🚩 Adding JavaScript packages");
await stepNode(answers);
printLn.nfo("🚩 Copying template files");
await stepCopy(answers);
await stepFinish(answers);
printLn.nfo("🚩 All done 🥳");
}
main();