-
Notifications
You must be signed in to change notification settings - Fork 0
/
meta.js
184 lines (175 loc) · 4.78 KB
/
meta.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
'use strict'
const fs = require('fs');
const path = require('path');
const isCIServer = process.env.CI
const TEST_SUITE = process.env.TEST_SUITE
if (isCIServer && TEST_SUITE === undefined) {
throw new Error('You must provide TEST_SUITE env variable to run test')
}
const scenario = isCIServer && require('./tests/scenarios')[TEST_SUITE]
const CITestsFilters = require('./tests/vue-cli-filters')
const hbsHelpers = require('./hbs-helpers')
module.exports = {
// https://github.com/vuejs-templates/webpack/blob/develop/meta.js
metalsmith: {
before: (metalsmith) => {
Object.assign(
metalsmith.metadata(),
{
isCIServer: isCIServer,
isNotTest: !isCIServer
},
isCIServer ? scenario : {}
)
}
},
prompts: {
name: {
when: 'isNotTest',
type: 'string',
required: true,
message: 'Application Name',
default: 'Electron app'
},
appid: {
when: 'isNotTest',
type: 'string',
required: true,
message: 'Application Id',
default: 'com.example.app'
},
description: {
when: 'isNotTest',
type: 'string',
required: false,
message: 'Project description',
default: 'An electron-nuxt project'
},
author: {
when: 'isNotTest',
type: 'string',
message: 'Author'
},
cssFramework: {
when: 'isNotTest',
type: 'list',
message: 'Select which ui-components framework install',
choices: [
{
name: 'none',
value: 'none',
short: 'none'
},
{
name: 'Vuetify (https://vuetifyjs.com)',
value: 'vuetify',
short: 'Vuetify'
},
{
name: 'Buefy (https://buefy.org)',
value: 'buefy',
short: 'Buefy'
},
{
name: 'Element (https://element.eleme.io)',
value: 'element',
short: 'Element'
}
]
},
cssPreprocessor: {
when: 'isNotTest',
type: 'list',
message: 'Select which css pre-processor install',
choices: [
{
name: 'none',
value: 'none',
short: 'none'
},
{
name: 'Sass (scss)',
value: 'sass',
short: 'Sass'
},
{
name: 'LESS',
value: 'less',
short: 'LESS'
},
{
name: 'Stylus',
value: 'stylus',
short: 'Stylus'
}
]
},
iconSet: {
when: 'isNotTest',
type: 'list',
message: 'Select which icon set install',
choices: [
{
name: 'none',
value: 'none',
short: 'none'
},
{
name: 'Material Design Icon (https://materialdesignicons.com/)',
value: 'mdi',
short: 'Material Design Icon'
},
{
name: 'Font Awesome 5 (https://fontawesome.com/icons)',
value: 'fa5',
short: 'Font Awesome 5'
}
]
},
typescript: {
when: 'isNotTest',
type: 'confirm',
required: true,
message: 'Use typescript?',
default: false,
},
eslint: {
when: 'isNotTest',
type: 'confirm',
required: true,
message: 'Use linting with ESLint?',
default: false
}
},
helpers: hbsHelpers,
filters: {
...CITestsFilters,
'src/renderer/tsconfig.json': 'typescript',
'src/renderer/index.d.ts': 'typescript',
'src/main/tsconfig.json': 'typescript',
'.eslintrc.js': 'eslint',
'src/renderer/plugins/buefy.js': 'cssFramework === \'buefy\' || cssFramework === \'all\'',
'src/renderer/plugins/element.js': 'cssFramework === \'element\' || cssFramework === \'all\'',
'src/renderer/plugins/vuetify.js': 'cssFramework === \'vuetify\' || cssFramework === \'all\'',
'src/renderer/plugins/icons.js': 'iconSet !== \'none\''
},
skipInterpolation: 'node_modules/**/*',
complete (data, { logger, chalk }) {
const log = text => console.log('\t' + text)
try{
const projectDir = data.inPlace ? process.cwd() : path.join(process.cwd(), data.destDirName);
fs.unlinkSync(path.join(projectDir, 'package.json'));
fs.renameSync(path.join(projectDir, 'package-template.hbs'), path.join(projectDir, 'package.json'));
}catch (e) {
logger.log(chalk.red('Error occurred in vue-cli oncomplete function'));
log(e);
}
logger.log(chalk.bold('All set. Welcome to your new electron-nuxt project! \n'))
log(chalk.gray('Make sure to check out the documentation at'))
log(chalk.gray.underline('https://github.com/michalzaq12/electron-nuxt#documentation \n'))
log(chalk.yellow('To get started:'))
if (!data.inPlace) log(`\t cd ${data.destDirName}`)
log('\t yarn install')
log('\t yarn dev')
}
}