@startupjs/cli 0.56.0-alpha.0 → 0.56.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,47 +0,0 @@
1
- const fs = require('fs')
2
- const path = require('./path')
3
- const { errorn, warnn, logn, infon, debugn } = require('./log')
4
-
5
- class StylesLinker {
6
- constructor () {
7
- this.paths = path.styles
8
- }
9
-
10
- link () {
11
- if (!this.paths) {
12
- warnn(' Style linking skipped due to missing style files')
13
- return
14
- } else {
15
- logn(' Linking styles')
16
- }
17
-
18
- try {
19
- for (const path of this.paths) {
20
- let content = fs.readFileSync(path, 'utf8')
21
- if (this._hasColorControlActivated(content)) {
22
- warnn(` ${path} already linked`)
23
- continue
24
- }
25
-
26
- // FIXME: we need to get color from UI ans paste them to link item
27
- debugn(` Linking ${path}`)
28
- content = content
29
- .replace(
30
- '</style>',
31
- ' <item name="colorControlActivated">#2962FF</item>\n' +
32
- ' </style>'
33
- )
34
- fs.writeFileSync(path, content)
35
- }
36
- infon(' Styles linked successfully!')
37
- } catch (e) {
38
- errorn('Styles was not linked. ' + e.message)
39
- }
40
- }
41
-
42
- _hasColorControlActivated (content) {
43
- return /colorControlActivated/.test(content)
44
- }
45
- }
46
-
47
- module.exports = StylesLinker