Skip to content

Commit eeaac2b

Browse files
committed
build: update build tools
1 parent 8903f6e commit eeaac2b

File tree

5 files changed

+23
-98
lines changed

5 files changed

+23
-98
lines changed

Diff for: build/.eslintrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"extends": "../.eslintrc.json",
1010
"rules": {
1111
"no-console": "off",
12-
"strict": "error"
12+
"strict": "error",
13+
"unicorn/prefer-top-level-await": "off"
1314
}
1415
}

Diff for: build/banner.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ const year = new Date().getFullYear()
66

77
function getBanner(pluginFilename) {
88
return `/*!
9-
* CoreUI Plugins - Chart.js for CoreUI 4 ${pluginFilename ? ` ${pluginFilename}` : ''} v${pkg.version} (${pkg.homepage})
9+
* CoreUI Plugins - Chart.js for CoreUI v5${pluginFilename ? ` ${pluginFilename}` : ''} v${pkg.version} (${pkg.homepage})
1010
* Copyright ${year} ${pkg.author.name}
11-
* Licensed under MIT (${pkg.homepage}/license/)
11+
* Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)
1212
*/`
1313
}
1414

Diff for: build/change-version.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
/*!
44
* Script to update version number references in the project.
5-
* Copyright 2017-2021 The Bootstrap Authors
6-
* Copyright 2017-2021 Twitter, Inc.
5+
* Copyright 2017-2022 The Bootstrap Authors
6+
* Copyright 2017-2022 Twitter, Inc.
77
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
88
*/
99

1010
'use strict'
1111

12-
const fs = require('fs').promises
13-
const path = require('path')
12+
const fs = require('node:fs').promises
13+
const path = require('node:path')
1414
const globby = require('globby')
1515

1616
const VERBOSE = process.argv.includes('--verbose')
@@ -60,7 +60,7 @@ async function replaceRecursively(file, oldVersion, newVersion) {
6060
}
6161

6262
async function main(args) {
63-
const [oldVersion, newVersion] = args
63+
let [oldVersion, newVersion] = args
6464

6565
if (!oldVersion || !newVersion) {
6666
console.error('USAGE: change-version old_version new_version [--verbose] [--dry[-run]]')
@@ -69,7 +69,7 @@ async function main(args) {
6969
}
7070

7171
// Strip any leading `v` from arguments because otherwise we will end up with duplicate `v`s
72-
[oldVersion, newVersion].map(arg => arg.startsWith('v') ? arg.slice(1) : arg)
72+
[oldVersion, newVersion] = [oldVersion, newVersion].map(arg => arg.startsWith('v') ? arg.slice(1) : arg)
7373

7474
try {
7575
const files = await globby(GLOB, GLOBBY_OPTIONS, EXCLUDED_FILES)

Diff for: build/postcss.config.js

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
'use strict'
22

3-
module.exports = ctx => {
3+
const mapConfig = {
4+
inline: false,
5+
annotation: true,
6+
sourcesContent: true
7+
}
8+
9+
module.exports = () => {
410
return {
5-
map: ctx.file.dirname.includes('examples') ?
6-
false :
7-
{
8-
inline: false,
9-
annotation: true,
10-
sourcesContent: true
11-
},
11+
map: mapConfig,
1212
plugins: {
1313
autoprefixer: {
1414
cascade: false
15-
},
16-
'postcss-combine-duplicated-selectors': {}
15+
}
1716
}
1817
}
1918
}

Diff for: build/rollup.config.js

+4-79
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ const plugins = [
1717
exclude: 'node_modules/**',
1818
// Include the helpers in the bundle, at most one copy of each
1919
babelHelpers: 'bundled'
20+
}),
21+
replace({
22+
__COREUI_VERSION__: `v${process.env.npm_package_version}`
2023
})
2124
]
2225
const globals = {
@@ -39,7 +42,7 @@ if (BUNDLE) {
3942
const rollupConfig = {
4043
input: path.resolve(__dirname, `../js/index.${ESM ? 'esm' : 'umd'}.js`),
4144
output: {
42-
banner,
45+
banner: banner(),
4346
file: path.resolve(__dirname, `../dist/js/${fileDest}.js`),
4447
format: ESM ? 'esm' : 'umd',
4548
globals
@@ -53,81 +56,3 @@ if (!ESM) {
5356
}
5457

5558
module.exports = rollupConfig
56-
57-
58-
// const path = require('path')
59-
// const babel = require('rollup-plugin-babel')
60-
// const commonjs = require('rollup-plugin-commonjs')
61-
// const resolve = require('rollup-plugin-node-resolve')
62-
// const banner = require('./banner.js')
63-
64-
// const BUNDLE = process.env.BUNDLE === 'true'
65-
// const ESM = process.env.ESM === 'true'
66-
67-
// let fileDest = `coreui-chartjs${ESM ? '.esm' : ''}`
68-
// const external = ['chart.js']
69-
// const plugins = [
70-
// babel(ESM ? {
71-
// // Only transpile our source code
72-
// exclude: 'node_modules/**',
73-
// babelrc: false,
74-
// presets: [
75-
// [
76-
// '@babel/env',
77-
// {
78-
// loose: true,
79-
// modules: false,
80-
// targets: {
81-
// browsers: [
82-
// 'Chrome >= 60',
83-
// 'Safari >= 10.1',
84-
// 'iOS >= 10.3',
85-
// 'Firefox >= 54',
86-
// 'Edge >= 15'
87-
// ]
88-
// }
89-
// }
90-
// ]
91-
// ]
92-
// } : {
93-
// // Only transpile our source code
94-
// exclude: 'node_modules/**',
95-
// // Include only required helpers
96-
// externalHelpersWhitelist: [
97-
// 'defineProperties',
98-
// 'createClass',
99-
// 'inheritsLoose',
100-
// 'defineProperty',
101-
// 'objectSpread'
102-
// ]
103-
// })
104-
// ]
105-
// const globals = {
106-
// 'chart.js': 'Chart'
107-
// }
108-
109-
// if (BUNDLE) {
110-
// fileDest += '.bundle'
111-
// // Remove last entry in external array to bundle Popper and Perfect Scrollbar
112-
// external.pop()
113-
// delete globals['chart.js']
114-
// plugins.push(resolve())
115-
// }
116-
117-
// const rollupConfig = {
118-
// input: path.resolve(__dirname, `../js/index.${ESM ? 'esm' : 'umd'}.js`),
119-
// output: {
120-
// banner,
121-
// file: path.resolve(__dirname, `../dist/js/${fileDest}.js`),
122-
// format: ESM ? 'esm' : 'umd',
123-
// globals
124-
// },
125-
// external,
126-
// plugins
127-
// }
128-
129-
// if (!ESM) {
130-
// rollupConfig.output.name = 'coreui.ChartJS'
131-
// }
132-
133-
// module.exports = rollupConfig

0 commit comments

Comments
 (0)