uikit 3.8.1 → 3.9.2-dev.836238c9b
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/{.eslintrc.js → .eslintrc.json} +5 -5
- package/CHANGELOG.md +13 -1
- package/build/.eslintrc.json +15 -0
- package/build/build.js +55 -82
- package/build/icons.js +12 -13
- package/build/less.js +23 -38
- package/build/package.json +4 -0
- package/build/prefix.js +38 -94
- package/build/publishDev.js +12 -17
- package/build/release.js +31 -60
- package/build/scope.js +49 -84
- package/build/scss.js +19 -21
- package/build/util.js +166 -95
- package/dist/css/uikit-core-rtl.css +7 -7
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +7 -7
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +7 -7
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +7 -7
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +1 -1
- package/dist/js/components/countdown.min.js +2 -2
- package/dist/js/components/filter.js +1 -1
- package/dist/js/components/filter.min.js +2 -2
- package/dist/js/components/lightbox-panel.js +1 -1
- package/dist/js/components/lightbox-panel.min.js +2 -2
- package/dist/js/components/lightbox.js +1 -1
- package/dist/js/components/lightbox.min.js +2 -2
- package/dist/js/components/notification.js +1 -1
- package/dist/js/components/notification.min.js +2 -2
- package/dist/js/components/parallax.js +1 -1
- package/dist/js/components/parallax.min.js +2 -2
- package/dist/js/components/slider-parallax.js +1 -1
- package/dist/js/components/slider-parallax.min.js +2 -2
- package/dist/js/components/slider.js +1 -1
- package/dist/js/components/slider.min.js +2 -2
- package/dist/js/components/slideshow-parallax.js +1 -1
- package/dist/js/components/slideshow-parallax.min.js +2 -2
- package/dist/js/components/slideshow.js +1 -1
- package/dist/js/components/slideshow.min.js +2 -2
- package/dist/js/components/sortable.js +1 -1
- package/dist/js/components/sortable.min.js +2 -2
- package/dist/js/components/tooltip.js +1 -1
- package/dist/js/components/tooltip.min.js +2 -2
- package/dist/js/components/upload.js +1 -1
- package/dist/js/components/upload.min.js +2 -2
- package/dist/js/uikit-core.js +8 -8
- package/dist/js/uikit-core.min.js +2 -2
- package/dist/js/uikit-icons.js +1 -1
- package/dist/js/uikit-icons.min.js +2 -2
- package/dist/js/uikit.js +8 -8
- package/dist/js/uikit.min.js +2 -2
- package/package.json +17 -19
- package/src/js/uikit-core.js +1 -1
- package/src/js/uikit.js +1 -1
- package/src/js/util/event.js +7 -7
- package/src/less/components/accordion.less +10 -10
- package/src/less/components/alert.less +9 -9
- package/src/less/components/align.less +2 -2
- package/src/less/components/animation.less +2 -2
- package/src/less/components/article.less +8 -8
- package/src/less/components/background.less +1 -1
- package/src/less/components/badge.less +6 -6
- package/src/less/components/base.less +30 -30
- package/src/less/components/breadcrumb.less +12 -12
- package/src/less/components/button.less +36 -36
- package/src/less/components/card.less +32 -32
- package/src/less/components/close.less +5 -5
- package/src/less/components/column.less +2 -2
- package/src/less/components/comment.less +12 -12
- package/src/less/components/container.less +2 -2
- package/src/less/components/countdown.less +10 -10
- package/src/less/components/cover.less +2 -2
- package/src/less/components/description-list.less +5 -5
- package/src/less/components/divider.less +11 -11
- package/src/less/components/dotnav.less +11 -11
- package/src/less/components/drop.less +1 -1
- package/src/less/components/dropdown.less +7 -7
- package/src/less/components/flex.less +2 -2
- package/src/less/components/form-range.less +12 -12
- package/src/less/components/form.less +27 -27
- package/src/less/components/grid.less +6 -6
- package/src/less/components/heading.less +21 -21
- package/src/less/components/height.less +1 -1
- package/src/less/components/icon.less +13 -13
- package/src/less/components/iconnav.less +9 -9
- package/src/less/components/inverse.less +3 -3
- package/src/less/components/label.less +7 -7
- package/src/less/components/leader.less +3 -3
- package/src/less/components/lightbox.less +9 -9
- package/src/less/components/link.less +12 -12
- package/src/less/components/list.less +5 -5
- package/src/less/components/margin.less +3 -3
- package/src/less/components/marker.less +5 -5
- package/src/less/components/modal.less +16 -16
- package/src/less/components/nav.less +31 -31
- package/src/less/components/navbar.less +33 -33
- package/src/less/components/notification.less +8 -8
- package/src/less/components/offcanvas.less +4 -4
- package/src/less/components/overlay.less +5 -5
- package/src/less/components/padding.less +1 -1
- package/src/less/components/pagination.less +10 -10
- package/src/less/components/placeholder.less +3 -3
- package/src/less/components/position.less +1 -1
- package/src/less/components/print.less +1 -1
- package/src/less/components/progress.less +6 -6
- package/src/less/components/search.less +15 -15
- package/src/less/components/section.less +8 -8
- package/src/less/components/slidenav.less +11 -11
- package/src/less/components/slider.less +2 -2
- package/src/less/components/slideshow.less +2 -2
- package/src/less/components/sortable.less +5 -5
- package/src/less/components/spinner.less +4 -4
- package/src/less/components/sticky.less +1 -1
- package/src/less/components/subnav.less +21 -21
- package/src/less/components/svg.less +1 -1
- package/src/less/components/switcher.less +2 -2
- package/src/less/components/tab.less +18 -18
- package/src/less/components/table.less +21 -21
- package/src/less/components/text.less +11 -11
- package/src/less/components/thumbnav.less +9 -9
- package/src/less/components/tile.less +10 -10
- package/src/less/components/tooltip.less +2 -2
- package/src/less/components/totop.less +7 -7
- package/src/less/components/transition.less +5 -5
- package/src/less/components/utility.less +10 -10
- package/src/less/components/visibility.less +1 -1
- package/src/less/components/width.less +1 -1
- package/src/scss/components/accordion.scss +1 -1
- package/src/scss/components/alert.scss +1 -1
- package/src/scss/components/align.scss +1 -1
- package/src/scss/components/animation.scss +1 -1
- package/src/scss/components/article.scss +1 -1
- package/src/scss/components/badge.scss +1 -1
- package/src/scss/components/base.scss +1 -1
- package/src/scss/components/card.scss +7 -7
- package/src/scss/components/column.scss +1 -0
- package/src/scss/components/comment.scss +1 -1
- package/src/scss/components/container.scss +1 -1
- package/src/scss/components/cover.scss +1 -1
- package/src/scss/components/description-list.scss +1 -1
- package/src/scss/components/dotnav.scss +1 -1
- package/src/scss/components/flex.scss +1 -1
- package/src/scss/components/form-range.scss +1 -1
- package/src/scss/components/grid.scss +1 -1
- package/src/scss/components/iconnav.scss +1 -1
- package/src/scss/components/inverse.scss +1 -1
- package/src/scss/components/label.scss +1 -1
- package/src/scss/components/margin.scss +2 -2
- package/src/scss/components/nav.scss +1 -1
- package/src/scss/components/placeholder.scss +1 -1
- package/src/scss/components/section.scss +1 -1
- package/src/scss/components/spinner.scss +2 -2
- package/src/scss/components/subnav.scss +1 -1
- package/src/scss/components/switcher.scss +1 -1
- package/src/scss/components/tab.scss +1 -1
- package/src/scss/components/table.scss +3 -3
- package/src/scss/components/text.scss +3 -3
- package/src/scss/components/thumbnav.scss +1 -1
- package/src/scss/components/transition.scss +4 -4
- package/src/scss/components/utility.scss +1 -1
- package/src/scss/mixins-theme.scss +1 -1
- package/src/scss/mixins.scss +1 -1
- package/src/scss/variables-theme.scss +8 -8
- package/src/scss/variables.scss +8 -8
- package/build/.eslintrc.js +0 -13
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
{
|
|
2
2
|
"root":true,
|
|
3
3
|
"env": {
|
|
4
4
|
"es6": true,
|
|
5
5
|
"browser": true,
|
|
6
|
-
"commonjs": true
|
|
6
|
+
"commonjs": true
|
|
7
7
|
},
|
|
8
8
|
"extends": [
|
|
9
|
-
"eslint:recommended"
|
|
9
|
+
"eslint:recommended"
|
|
10
10
|
],
|
|
11
11
|
"parserOptions": {
|
|
12
12
|
"sourceType": "module"
|
|
@@ -59,6 +59,6 @@ module.exports = {
|
|
|
59
59
|
"space-infix-ops": "error",
|
|
60
60
|
"space-unary-ops": "error",
|
|
61
61
|
"spaced-comment": "error",
|
|
62
|
-
"template-curly-spacing": "error"
|
|
62
|
+
"template-curly-spacing": "error"
|
|
63
63
|
}
|
|
64
|
-
}
|
|
64
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.9.1 (November 10, 2021)
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Update Less mixin calls to use parentheses
|
|
8
|
+
|
|
9
|
+
## 3.9.0 (November 10, 2021)
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Upgrade LESS to version 4
|
|
14
|
+
|
|
3
15
|
## 3.8.1 (November 5, 2021)
|
|
4
16
|
|
|
5
17
|
### Added
|
|
@@ -13,7 +25,7 @@
|
|
|
13
25
|
|
|
14
26
|
### Fixed
|
|
15
27
|
|
|
16
|
-
- Fix scrollIntoView
|
|
28
|
+
- Fix scrollIntoView function with offset argument provided
|
|
17
29
|
|
|
18
30
|
## 3.8.0 (October 28, 2021)
|
|
19
31
|
|
package/build/build.js
CHANGED
|
@@ -1,63 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const camelize = require('camelcase');
|
|
5
|
-
const argv = require('minimist')(process.argv.slice(2));
|
|
1
|
+
import camelize from 'camelcase';
|
|
2
|
+
import {basename, resolve} from 'path';
|
|
3
|
+
import {__dirname, args, compile, glob, icons} from './util.js';
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
argv[tokens[0]] = tokens[1] || true;
|
|
10
|
-
});
|
|
5
|
+
const bundles = getBundleTasks();
|
|
6
|
+
const components = await getComponentTasks();
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
argv.all = argv.all || numArgs <= 1; // no arguments passed, so compile all
|
|
14
|
-
|
|
15
|
-
const minify = !(argv.debug || argv.nominify || argv.d);
|
|
16
|
-
|
|
17
|
-
// -----
|
|
18
|
-
|
|
19
|
-
// map component build jobs
|
|
20
|
-
const components = glob.sync('src/js/components/!(index).js').reduce((components, file) => {
|
|
21
|
-
|
|
22
|
-
const name = path.basename(file, '.js');
|
|
23
|
-
|
|
24
|
-
components[name] = () =>
|
|
25
|
-
util.compile(`${__dirname}/wrapper/component.js`, `dist/js/components/${name}`, {
|
|
26
|
-
name,
|
|
27
|
-
minify,
|
|
28
|
-
external: ['uikit', 'uikit-util'],
|
|
29
|
-
globals: {uikit: 'UIkit', 'uikit-util': 'UIkit.util'},
|
|
30
|
-
aliases: {component: path.resolve(__dirname, '../src/js/components', name)},
|
|
31
|
-
replaces: {NAME: `'${camelize(name)}'`}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return components;
|
|
35
|
-
|
|
36
|
-
}, {});
|
|
37
|
-
|
|
38
|
-
const steps = {
|
|
39
|
-
|
|
40
|
-
core: () => util.compile('src/js/uikit-core.js', 'dist/js/uikit-core', {minify}),
|
|
41
|
-
uikit: () => util.compile('src/js/uikit.js', 'dist/js/uikit', {minify}),
|
|
42
|
-
icons: async () => util.compile('build/wrapper/icons.js', 'dist/js/uikit-icons', {
|
|
43
|
-
minify,
|
|
44
|
-
name: 'icons',
|
|
45
|
-
replaces: {ICONS: await util.icons('{src/images,custom}/icons/*.svg')}}
|
|
46
|
-
),
|
|
47
|
-
tests: async () => util.compile('tests/js/index.js', 'tests/js/test', {
|
|
48
|
-
minify,
|
|
49
|
-
name: 'test',
|
|
50
|
-
replaces: {TESTS: await getTestFiles()}}
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
if (argv.h || argv.help) {
|
|
8
|
+
if (args.h || args.help) {
|
|
56
9
|
|
|
57
10
|
console.log(`
|
|
58
11
|
usage:
|
|
59
12
|
|
|
60
|
-
build.js [componentA, componentB, ...] [-d|debug|nominify|
|
|
13
|
+
build.js [componentA, componentB, ...] [-d|debug|nominify|watch]
|
|
61
14
|
|
|
62
15
|
examples:
|
|
63
16
|
|
|
@@ -67,50 +20,70 @@ if (argv.h || argv.help) {
|
|
|
67
20
|
|
|
68
21
|
available components:
|
|
69
22
|
|
|
70
|
-
bundles: ${Object.keys(
|
|
23
|
+
bundles: ${Object.keys(bundles).join(', ')}
|
|
71
24
|
components: ${Object.keys(components).join(', ')}
|
|
72
25
|
|
|
73
26
|
`);
|
|
27
|
+
process.exit(0);
|
|
28
|
+
}
|
|
74
29
|
|
|
30
|
+
let tasks;
|
|
31
|
+
const allTasks = {...bundles, ...components};
|
|
32
|
+
if (args.all || Object.keys(args).length <= 1) {
|
|
33
|
+
tasks = allTasks;
|
|
34
|
+
} else if (args.components) {
|
|
35
|
+
tasks = components;
|
|
75
36
|
} else {
|
|
37
|
+
tasks = Object.keys(args)
|
|
38
|
+
.map(step => allTasks[step])
|
|
39
|
+
.filter(t => t);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
await Promise.all(Object.values(tasks).map(task => task()));
|
|
76
43
|
|
|
77
|
-
|
|
44
|
+
function getBundleTasks() {
|
|
45
|
+
return {
|
|
78
46
|
|
|
79
|
-
|
|
80
|
-
argv.all = true;
|
|
81
|
-
jobs = collectJobs();
|
|
82
|
-
}
|
|
47
|
+
core: () => compile('src/js/uikit-core.js', 'dist/js/uikit-core'),
|
|
83
48
|
|
|
49
|
+
uikit: () => compile('src/js/uikit.js', 'dist/js/uikit'),
|
|
50
|
+
|
|
51
|
+
icons: async () => compile('build/wrapper/icons.js', 'dist/js/uikit-icons', {
|
|
52
|
+
name: 'icons',
|
|
53
|
+
replaces: {ICONS: await icons('{src/images,custom}/icons/*.svg')}
|
|
54
|
+
}),
|
|
55
|
+
|
|
56
|
+
tests: async () => compile('tests/js/index.js', 'tests/js/test', {
|
|
57
|
+
name: 'test',
|
|
58
|
+
replaces: {TESTS: await getTestFiles()}
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
};
|
|
84
62
|
}
|
|
85
63
|
|
|
86
|
-
function
|
|
64
|
+
async function getComponentTasks() {
|
|
65
|
+
|
|
66
|
+
const components = await glob('src/js/components/!(index).js');
|
|
87
67
|
|
|
88
|
-
|
|
89
|
-
if (argv.components || argv.all) {
|
|
90
|
-
Object.assign(argv, components);
|
|
91
|
-
}
|
|
68
|
+
return components.reduce((components, file) => {
|
|
92
69
|
|
|
93
|
-
|
|
94
|
-
if (argv.all) {
|
|
95
|
-
Object.assign(argv, steps);
|
|
96
|
-
}
|
|
70
|
+
const name = basename(file, '.js');
|
|
97
71
|
|
|
98
|
-
|
|
72
|
+
components[name] = () =>
|
|
73
|
+
compile('build/wrapper/component.js', `dist/js/components/${name}`, {
|
|
74
|
+
name,
|
|
75
|
+
external: ['uikit', 'uikit-util'],
|
|
76
|
+
globals: {uikit: 'UIkit', 'uikit-util': 'UIkit.util'},
|
|
77
|
+
aliases: {component: resolve(__dirname, '../src/js/components', name)},
|
|
78
|
+
replaces: {NAME: `'${camelize(name)}'`}
|
|
79
|
+
});
|
|
99
80
|
|
|
100
|
-
|
|
101
|
-
return Object.keys(argv)
|
|
102
|
-
.filter(step => steps[step])
|
|
103
|
-
.map(step =>
|
|
104
|
-
steps[step]()
|
|
105
|
-
.catch(({message}) => {
|
|
106
|
-
console.error(message);
|
|
107
|
-
process.exitCode = 1;
|
|
108
|
-
})
|
|
109
|
-
);
|
|
81
|
+
return components;
|
|
110
82
|
|
|
83
|
+
}, {});
|
|
111
84
|
}
|
|
112
85
|
|
|
113
86
|
async function getTestFiles() {
|
|
114
|
-
const files = await
|
|
115
|
-
return JSON.stringify(files.map(file =>
|
|
87
|
+
const files = await glob('tests/!(index).html', {nosort: true});
|
|
88
|
+
return JSON.stringify(files.map(file => basename(file, '.html')));
|
|
116
89
|
}
|
package/build/icons.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
const args = require('minimist')(process.argv);
|
|
1
|
+
import {args, compile, glob, icons} from './util.js';
|
|
3
2
|
|
|
4
3
|
const path = args.c || args.custom || 'custom/*/icons';
|
|
5
4
|
const match = args.n || args.name || '([a-z]+)/icons$';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
console.error(message);
|
|
9
|
-
process.exitCode = 1;
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
async function run() {
|
|
13
|
-
const folders = await glob(path);
|
|
14
|
-
return Promise.all(folders.map(compileIcons));
|
|
15
|
-
}
|
|
6
|
+
await Promise.all((await glob(path)).map(compileIcons));
|
|
16
7
|
|
|
17
8
|
async function compileIcons(folder) {
|
|
18
9
|
const [, name] = folder.toString().match(new RegExp(match, 'i'));
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
return compile(
|
|
11
|
+
'build/wrapper/icons.js',
|
|
12
|
+
`dist/js/uikit-icons-${name}`,
|
|
13
|
+
{
|
|
14
|
+
name,
|
|
15
|
+
replaces: {
|
|
16
|
+
ICONS: await icons(`{src/images/icons,${folder}}/*.svg`)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
);
|
|
21
20
|
}
|
package/build/less.js
CHANGED
|
@@ -1,56 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const rtl = ~args.indexOf('rtl');
|
|
10
|
-
|
|
11
|
-
argv._.forEach(arg => {
|
|
12
|
-
const tokens = arg.split('=');
|
|
13
|
-
argv[tokens[0]] = tokens[1] || true;
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const develop = argv.develop || argv.debug || argv.d || argv.nominify;
|
|
17
|
-
|
|
18
|
-
[
|
|
1
|
+
import {basename} from 'path';
|
|
2
|
+
import rtlcss from 'rtlcss';
|
|
3
|
+
import postcss from 'postcss';
|
|
4
|
+
import {args, banner, glob, minify, pathExists, read, readJson, renderLess, write} from './util.js';
|
|
5
|
+
|
|
6
|
+
const {rtl} = args;
|
|
7
|
+
const develop = args.develop || args.debug || args.d || args.nominify;
|
|
8
|
+
const sources = [
|
|
19
9
|
{src: 'src/less/uikit.less', dist: `dist/css/uikit-core${rtl ? '-rtl' : ''}.css`},
|
|
20
10
|
{src: 'src/less/uikit.theme.less', dist: `dist/css/uikit${rtl ? '-rtl' : ''}.css`}
|
|
11
|
+
];
|
|
21
12
|
|
|
22
|
-
|
|
13
|
+
const themes = await pathExists('themes.json') ? await readJson('themes.json') : {};
|
|
23
14
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
glob.sync('custom/*.less').forEach(file => {
|
|
27
|
-
|
|
28
|
-
const theme = path.basename(file, '.less');
|
|
15
|
+
for (const src of await glob('custom/*.less')) {
|
|
16
|
+
const theme = basename(src, '.less');
|
|
29
17
|
const dist = `dist/css/uikit.${theme}${rtl ? '-rtl' : ''}.css`;
|
|
30
18
|
|
|
31
19
|
themes[theme] = {css: `../${dist}`};
|
|
32
20
|
|
|
33
|
-
if (
|
|
21
|
+
if (await pathExists(`dist/js/uikit-icons-${theme}.js`)) {
|
|
34
22
|
themes[theme].icons = `../dist/js/uikit-icons-${theme}.js`;
|
|
35
23
|
}
|
|
36
24
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
console.error(message);
|
|
40
|
-
process.exitCode = 1;
|
|
41
|
-
});
|
|
25
|
+
sources.push({src, dist});
|
|
26
|
+
}
|
|
42
27
|
|
|
43
|
-
});
|
|
28
|
+
await Promise.all(sources.map(({src, dist}) => compile(src, dist, develop, rtl)));
|
|
44
29
|
|
|
45
|
-
if (!rtl && (Object.keys(themes).length || !
|
|
46
|
-
|
|
30
|
+
if (!rtl && (Object.keys(themes).length || !await pathExists('themes.json'))) {
|
|
31
|
+
await write('themes.json', JSON.stringify(themes));
|
|
47
32
|
}
|
|
48
33
|
|
|
49
|
-
async function compile(file, dist) {
|
|
34
|
+
async function compile(file, dist, develop, rtl) {
|
|
50
35
|
|
|
51
|
-
const less = await
|
|
36
|
+
const less = await read(file);
|
|
52
37
|
|
|
53
|
-
let output = (await
|
|
38
|
+
let output = (await renderLess(less, {
|
|
54
39
|
relativeUrls: true,
|
|
55
40
|
rootpath: '../../',
|
|
56
41
|
paths: ['src/less/', 'custom/']
|
|
@@ -79,10 +64,10 @@ async function compile(file, dist) {
|
|
|
79
64
|
output = output.replace(/stroke-dashoffset: (\d+)px/g, 'stroke-dashoffset: -$1px');
|
|
80
65
|
}
|
|
81
66
|
|
|
82
|
-
|
|
67
|
+
await write(dist, banner + output);
|
|
83
68
|
|
|
84
69
|
if (!develop) {
|
|
85
|
-
await
|
|
70
|
+
await minify(dist);
|
|
86
71
|
}
|
|
87
72
|
|
|
88
73
|
}
|
package/build/prefix.js
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const util = require('./util');
|
|
4
|
-
const argv = require('minimist')(process.argv.slice(2));
|
|
5
|
-
const prompt = require('inquirer').createPromptModule();
|
|
1
|
+
import inquirer from 'inquirer';
|
|
2
|
+
import {args, glob, read, replaceInFile, validClassName} from './util.js';
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
const tokens = arg.split('=');
|
|
9
|
-
argv[tokens[0]] = tokens[1] || true;
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const allFiles = [];
|
|
13
|
-
|
|
14
|
-
if (argv.h || argv.help) {
|
|
4
|
+
if (args.h || args.help) {
|
|
15
5
|
console.log(`
|
|
16
6
|
usage:
|
|
17
7
|
|
|
@@ -23,104 +13,58 @@ if (argv.h || argv.help) {
|
|
|
23
13
|
prefix.js -p=xyz // will replace any existing prefix with xyz
|
|
24
14
|
|
|
25
15
|
`);
|
|
26
|
-
|
|
27
|
-
readAllFiles()
|
|
28
|
-
.then(startProcess)
|
|
29
|
-
.catch(({message}) => {
|
|
30
|
-
console.error(message);
|
|
31
|
-
process.exitCode = 1;
|
|
32
|
-
});
|
|
16
|
+
process.exit(0);
|
|
33
17
|
}
|
|
34
18
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const currentPrefix = findExistingPrefix();
|
|
38
|
-
getPrefix().then(prefix => replacePrefix(currentPrefix, prefix));
|
|
19
|
+
const currentPrefix = await findExistingPrefix();
|
|
20
|
+
const prefix = await getPrefix();
|
|
39
21
|
|
|
22
|
+
if (currentPrefix === prefix) {
|
|
23
|
+
throw new Error(`already prefixed with: ${prefix}`);
|
|
40
24
|
}
|
|
41
25
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// find existing prefix
|
|
45
|
-
let currentPrefix;
|
|
26
|
+
await replacePrefix(currentPrefix, prefix);
|
|
46
27
|
|
|
47
|
-
|
|
28
|
+
async function findExistingPrefix() {
|
|
29
|
+
const data = await read('dist/css/uikit.css');
|
|
30
|
+
const res = data.match(new RegExp(`(${validClassName.source})(-[a-z]+)?-grid`));
|
|
31
|
+
return res && res[1];
|
|
32
|
+
}
|
|
48
33
|
|
|
49
|
-
|
|
50
|
-
currentPrefix = res && res[1];
|
|
51
|
-
return currentPrefix;
|
|
34
|
+
async function getPrefix() {
|
|
52
35
|
|
|
53
|
-
|
|
54
|
-
return currentPrefix;
|
|
36
|
+
const prefixFromInput = args.p || args.prefix;
|
|
55
37
|
|
|
56
|
-
|
|
38
|
+
if (!prefixFromInput) {
|
|
57
39
|
|
|
58
|
-
|
|
40
|
+
const prompt = inquirer.createPromptModule();
|
|
59
41
|
|
|
60
|
-
|
|
61
|
-
if (!prefixFromInput) {
|
|
62
|
-
return prompt({
|
|
42
|
+
return (await prompt({
|
|
63
43
|
name: 'prefix',
|
|
64
44
|
message: 'enter a prefix',
|
|
65
|
-
validate: (val, res) => val.length && val.match(
|
|
66
|
-
})
|
|
67
|
-
.then(res => res.prefix);
|
|
68
|
-
} else if (util.validClassName.test(prefixFromInput)) {
|
|
69
|
-
return Promise.resolve(prefixFromInput);
|
|
70
|
-
} else {
|
|
71
|
-
throw 'illegal prefix: ' + prefixFromInput;
|
|
45
|
+
validate: (val, res) => val.length && val.match(validClassName) ? !!(res.prefix = val) : 'invalid prefix'
|
|
46
|
+
})).prefix;
|
|
72
47
|
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function replacePrefix(from, to) {
|
|
76
48
|
|
|
77
|
-
if (
|
|
78
|
-
|
|
49
|
+
if (validClassName.test(prefixFromInput)) {
|
|
50
|
+
return prefixFromInput;
|
|
79
51
|
} else {
|
|
80
|
-
|
|
81
|
-
data = replace(data, from, to);
|
|
82
|
-
fs.writeFileSync(file, data);
|
|
83
|
-
});
|
|
52
|
+
throw `illegal prefix: ${prefixFromInput}`;
|
|
84
53
|
}
|
|
85
54
|
}
|
|
86
55
|
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
))
|
|
102
|
-
);
|
|
103
|
-
Promise.all(reads).then(res);
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
));
|
|
107
|
-
|
|
108
|
-
globs.push(new Promise(res =>
|
|
109
|
-
glob('dist/**/*.js', (err, files) => {
|
|
110
|
-
const reads = [];
|
|
111
|
-
files.forEach(file =>
|
|
112
|
-
reads.push(util.read(file, data =>
|
|
113
|
-
allFiles.push({
|
|
114
|
-
file,
|
|
115
|
-
data,
|
|
116
|
-
replace: (data, needle, replace) => data.replace(new RegExp(`${needle}-`, 'g'), `${replace}-`).replace(new RegExp(`(${needle})?UIkit`, 'g'), `${replace === 'uk' ? '' : replace}UIkit`)
|
|
117
|
-
})
|
|
118
|
-
))
|
|
119
|
-
);
|
|
120
|
-
Promise.all(reads).then(res);
|
|
121
|
-
}
|
|
122
|
-
)
|
|
123
|
-
));
|
|
124
|
-
|
|
125
|
-
return Promise.all(globs);
|
|
56
|
+
async function replacePrefix(from, to) {
|
|
57
|
+
for (const file of await glob('dist/**/*.css')) {
|
|
58
|
+
await replaceInFile(file, data => data.replace(
|
|
59
|
+
new RegExp(`${from}-${/([a-z\d-]+)/.source}`, 'g'),
|
|
60
|
+
`${to}-$1`
|
|
61
|
+
));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
for (const file of await glob('dist/**/*.js')) {
|
|
65
|
+
await replaceInFile(file, data => data
|
|
66
|
+
.replace(new RegExp(`${from}-`, 'g'), `${to}-`)
|
|
67
|
+
.replace(new RegExp(`(${from})?UIkit`, 'g'), `${to === 'uk' ? '' : to}UIkit`)
|
|
68
|
+
);
|
|
69
|
+
}
|
|
126
70
|
}
|
package/build/publishDev.js
CHANGED
|
@@ -1,39 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const argv = require('minimist')(process.argv.slice(2));
|
|
1
|
+
import semver from 'semver';
|
|
2
|
+
import {resolve} from 'path';
|
|
3
|
+
import {__dirname, args, getVersion, run} from './util.js';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
const tokens = arg.split('=');
|
|
8
|
-
argv[tokens[0]] = tokens[1] || true;
|
|
9
|
-
});
|
|
5
|
+
const {inc} = semver;
|
|
10
6
|
|
|
11
7
|
// default exec options
|
|
12
8
|
const options = {cwd: resolve(`${__dirname}/..`), encoding: 'utf8'};
|
|
13
|
-
|
|
14
|
-
if (isDevCommit() || argv.f || argv.force) {
|
|
9
|
+
if (args.f || args.force || await isDevCommit()) {
|
|
15
10
|
|
|
16
11
|
// increase version patch number
|
|
17
|
-
const version = inc(
|
|
12
|
+
const version = inc(await getVersion(), 'patch');
|
|
18
13
|
|
|
19
14
|
// get current git hash
|
|
20
|
-
const hash =
|
|
15
|
+
const hash = (await run('git rev-parse --short HEAD', options)).trim();
|
|
21
16
|
|
|
22
17
|
// set version of package.json
|
|
23
|
-
|
|
18
|
+
await run(`npm version ${version}-dev.${hash} --git-tag-version false`, {...options, stdio: 'inherit'});
|
|
24
19
|
|
|
25
20
|
// create dist files
|
|
26
|
-
|
|
21
|
+
await run('yarn compile && yarn compile-rtl && yarn build-scss', {...options, stdio: 'inherit'});
|
|
27
22
|
|
|
28
23
|
// publish to dev tag
|
|
29
|
-
|
|
24
|
+
await run('npm publish --tag dev', options);
|
|
30
25
|
|
|
31
26
|
}
|
|
32
27
|
|
|
33
|
-
function isDevCommit() {
|
|
28
|
+
async function isDevCommit() {
|
|
34
29
|
|
|
35
30
|
// check for changes to publish (%B: raw body (unwrapped subject and body)
|
|
36
|
-
const message =
|
|
31
|
+
const message = await run('git log -1 --pretty=%B', options);
|
|
37
32
|
|
|
38
33
|
const type = message.match(/^(revert: )?(feat|fix|polish|docs|style|refactor|perf|test|workflow|ci|chore|types)(\(.+\))?: .{1,50}/);
|
|
39
34
|
|