-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerateCliMjsVersions.mjs
66 lines (52 loc) · 1.96 KB
/
generateCliMjsVersions.mjs
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
// ./scripts/generateCliMjsVersions.mjs
import fs from 'fs-extra'
import chalk from 'chalk'
// TODO: this needs to dynamically read the dir's and then generate this files array... because it's too easy to forget to add new configs/palettes to this array manually!
const files = [
'configs/palettes/AnchorDefault',
'configs/palettes/BorderDefault',
'configs/palettes/ButtonOutline',
'configs/palettes/ButtonSolid',
'configs/palettes/CheckboxDefault',
'configs/palettes/FillDefault',
'configs/palettes/GroundConsole',
'configs/palettes/GroundDefault',
'configs/palettes/GroundMonochromatic',
'configs/palettes/GroundPastel',
'configs/palettes/InputDefault',
'configs/palettes/InputUnderlined',
'configs/palettes/ListboxButtonDefault',
'configs/palettes/ListboxButtonUnderlined',
'configs/palettes/ListboxOptionDefault',
'configs/palettes/ListboxOptionUnderlined',
'configs/palettes/ListDefault',
'configs/palettes/RadioDefault',
'configs/palettes/ScrollbarDefault',
'configs/palettes/TextDefault',
'configs/Anchors',
'configs/Buttons',
'configs/Checkboxes',
'configs/ColorModes',
'configs/Inputs',
'configs/Listboxes',
'configs/Lists',
'configs/Radios',
'configs/Selects',
'configs/Text',
'configs/Textareas',
'configs/Transitions',
'configs/VvComponentDefaults',
'configs/VvConfig',
]
function processFileForMjsUseSync(filePath) {
let srcFile = './dist/' + filePath + '.js'
let destFile = './dist/' + filePath + '.mjs'
var fileData = fs.readFileSync(srcFile, 'utf-8')
var updatedData = fileData.replace(/\.js';/gm, ".mjs';")
fs.writeFileSync(destFile, updatedData, 'utf-8')
console.log(chalk.green.bold(chalk.white('*\\o/*') + ' The VueVentus CLI ' + destFile + ' file was created successfully! ' + chalk.white('*\\o/*')))
}
for (let i=0; i < files.length; i++) {
processFileForMjsUseSync(files[i])
}
console.log(' ')