@openeuropa/bcl-builder 1.0.2 → 1.1.0
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.
- package/package.json +14 -14
- package/scripts/rename.js +5 -5
- package/scripts/sprite.js +19 -5
- package/scripts/styles.js +20 -0
- package/yarn-error.log +18881 -0
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@openeuropa/bcl-builder",
|
|
3
3
|
"author": "European Commission",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
|
-
"version": "1.0
|
|
5
|
+
"version": "1.1.0",
|
|
6
6
|
"description": "Bootstrap Component Library builder",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
@@ -11,31 +11,31 @@
|
|
|
11
11
|
"bcl-builder": "./bin/build.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@babel/core": "7.
|
|
15
|
-
"@babel/preset-env": "7.
|
|
16
|
-
"@babel/runtime": "7.
|
|
17
|
-
"@popperjs/core": "2.11.
|
|
14
|
+
"@babel/core": "7.21.4",
|
|
15
|
+
"@babel/preset-env": "7.21.4",
|
|
16
|
+
"@babel/runtime": "7.21.0",
|
|
17
|
+
"@popperjs/core": "2.11.7",
|
|
18
18
|
"@rollup/plugin-babel": "6.0.3",
|
|
19
|
-
"@rollup/plugin-commonjs": "24.
|
|
20
|
-
"@rollup/plugin-node-resolve": "15.0.
|
|
19
|
+
"@rollup/plugin-commonjs": "24.1.0",
|
|
20
|
+
"@rollup/plugin-node-resolve": "15.0.2",
|
|
21
21
|
"@rollup/plugin-replace": "5.0.2",
|
|
22
|
-
"autoprefixer": "10.4.
|
|
22
|
+
"autoprefixer": "10.4.14",
|
|
23
23
|
"babel-eslint": "10.1.0",
|
|
24
|
-
"browser-sync": "2.
|
|
25
|
-
"commander": "
|
|
24
|
+
"browser-sync": "2.29.1",
|
|
25
|
+
"commander": "10.0.0",
|
|
26
26
|
"copyfiles": "2.4.1",
|
|
27
27
|
"cross-env": "7.0.3",
|
|
28
|
-
"cssnano": "
|
|
28
|
+
"cssnano": "6.0.0",
|
|
29
29
|
"postcss": "8.4.21",
|
|
30
|
-
"rollup": "3.
|
|
30
|
+
"rollup": "3.20.2",
|
|
31
31
|
"rollup-plugin-istanbul": "4.0.0",
|
|
32
32
|
"rollup-plugin-terser": "7.0.2",
|
|
33
|
-
"sass": "1.
|
|
33
|
+
"sass": "1.62.0",
|
|
34
34
|
"svg-sprite": "2.0.2",
|
|
35
35
|
"svgo": "3.0.2"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=14.0.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "d15fa3688c97c643617257d8ded6bfb6c2e73fee"
|
|
41
41
|
}
|
package/scripts/rename.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
const path = require("path");
|
|
26
|
-
const
|
|
26
|
+
const { globSync } = require("glob");
|
|
27
27
|
const { rename } = require("fs");
|
|
28
28
|
|
|
29
29
|
module.exports = (from, to, options) => {
|
|
@@ -32,15 +32,15 @@ module.exports = (from, to, options) => {
|
|
|
32
32
|
|
|
33
33
|
if (options.glob) {
|
|
34
34
|
if (options.search) {
|
|
35
|
-
files =
|
|
35
|
+
files = globSync(path.join(from, options.glob, options.search));
|
|
36
36
|
} else {
|
|
37
|
-
files =
|
|
37
|
+
files = globSync(path.join(from, options.glob));
|
|
38
38
|
}
|
|
39
39
|
} else {
|
|
40
40
|
if (options.search) {
|
|
41
|
-
files =
|
|
41
|
+
files = globSync(path.join(from, options.search));
|
|
42
42
|
} else {
|
|
43
|
-
files =
|
|
43
|
+
files = globSync(from);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
package/scripts/sprite.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generate svg sprites.
|
|
3
3
|
*
|
|
4
|
-
* @param {string} entry -
|
|
4
|
+
* @param {string} entry - array of paths to a folder or file.
|
|
5
5
|
* @param {string} dest - Output folder path
|
|
6
6
|
* @param {object} options - Object
|
|
7
7
|
*
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
*
|
|
10
10
|
* sprite: [
|
|
11
11
|
* {
|
|
12
|
-
* entry:
|
|
12
|
+
* entry: [
|
|
13
|
+
* path.resolve(nodeModules, "bootstrap-icons/icons/"),
|
|
14
|
+
* path.resolve(__dirname, "src/icons/custom-icons")
|
|
15
|
+
* ],
|
|
13
16
|
* dest: path.resolve(outputFolder, "icons/"),
|
|
14
17
|
* options: {
|
|
15
18
|
* file: "bcl-default-icons.svg",
|
|
@@ -21,17 +24,20 @@
|
|
|
21
24
|
*/
|
|
22
25
|
|
|
23
26
|
const fs = require("fs");
|
|
24
|
-
const
|
|
27
|
+
const { globSync } = require("glob");
|
|
25
28
|
const mkdirp = require("mkdirp");
|
|
26
29
|
const path = require("path");
|
|
27
30
|
const defaultPlugins = require("../conf/svgoDefaultPlugins");
|
|
28
31
|
const SVGSpriter = require("svg-sprite");
|
|
29
32
|
|
|
30
33
|
module.exports = (entry, dest, options) => {
|
|
34
|
+
const iconList = Array.isArray(options.list)
|
|
35
|
+
? options.list.flat(1)
|
|
36
|
+
: options.list;
|
|
31
37
|
const outputFile = options.file
|
|
32
38
|
? `${dest}/${options.file}`
|
|
33
39
|
: `${dest}/bcl-default-icons.svg`;
|
|
34
|
-
const files =
|
|
40
|
+
const files = iconList || globSync("*.svg", { cwd: entry });
|
|
35
41
|
|
|
36
42
|
const plugins = options.transformPlugins || defaultPlugins;
|
|
37
43
|
|
|
@@ -60,7 +66,15 @@ module.exports = (entry, dest, options) => {
|
|
|
60
66
|
});
|
|
61
67
|
|
|
62
68
|
files.forEach((file) => {
|
|
63
|
-
|
|
69
|
+
let filePath;
|
|
70
|
+
if (Array.isArray(entry)) {
|
|
71
|
+
filePath = path.resolve(entry[0], file);
|
|
72
|
+
if (!fs.existsSync(filePath)) {
|
|
73
|
+
filePath = path.resolve(entry[1], file);
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
filePath = path.resolve(entry, file);
|
|
77
|
+
}
|
|
64
78
|
spriter.add(
|
|
65
79
|
filePath,
|
|
66
80
|
file,
|
package/scripts/styles.js
CHANGED
|
@@ -24,6 +24,7 @@ const path = require("path");
|
|
|
24
24
|
const fs = require("fs");
|
|
25
25
|
const postcss = require("postcss");
|
|
26
26
|
const cssnano = require("cssnano");
|
|
27
|
+
const prefixer = require("postcss-prefix-selector");
|
|
27
28
|
const autoprefixer = require("autoprefixer");
|
|
28
29
|
|
|
29
30
|
const getPlugins = (options) => {
|
|
@@ -63,6 +64,25 @@ const buildStyles = (entry, dest, options) => {
|
|
|
63
64
|
});
|
|
64
65
|
|
|
65
66
|
postcss(plugins)
|
|
67
|
+
.use(
|
|
68
|
+
prefixer({
|
|
69
|
+
prefix: options.prefix ? options.prefix : "",
|
|
70
|
+
|
|
71
|
+
transform: function (
|
|
72
|
+
prefix,
|
|
73
|
+
selector,
|
|
74
|
+
prefixedSelector,
|
|
75
|
+
filePath,
|
|
76
|
+
rule
|
|
77
|
+
) {
|
|
78
|
+
if (prefix) {
|
|
79
|
+
return prefixedSelector;
|
|
80
|
+
} else {
|
|
81
|
+
return selector;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
})
|
|
85
|
+
)
|
|
66
86
|
.process(sassResult.css, {
|
|
67
87
|
map:
|
|
68
88
|
postcssSourceMap === "file"
|