Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbf961fb

Browse files
committed
2 parentsd6084b0 +7335342 commitbf961fb

27 files changed

+6094
-11184
lines changed

‎build/.eslintrc.json‎

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎build/banner.js‎

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎build/banner.mjs‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
importfsfrom'node:fs/promises'
2+
importpathfrom'node:path'
3+
import{fileURLToPath}from'node:url'
4+
5+
const__dirname=path.dirname(fileURLToPath(import.meta.url))
6+
7+
constpkgJson=path.join(__dirname,'../package.json')
8+
constpkg=JSON.parse(awaitfs.readFile(pkgJson,'utf8'))
9+
10+
constyear=newDate().getFullYear()
11+
12+
functiongetBanner(pluginFilename){
13+
return`/*!
14+
* CoreUI${pluginFilename ?`${pluginFilename}` :''} v${pkg.version} (${pkg.homepage})
15+
* Copyright${year}${pkg.author}
16+
* Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)
17+
*/`
18+
}
19+
20+
exportdefaultgetBanner

‎build/change-version.js‎

Lines changed: 0 additions & 84 deletions
This file was deleted.

‎build/change-version.mjs‎

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#!/usr/bin/env node
2+
3+
/*!
4+
* Script to update version number references in the project.
5+
* Copyright 2017-2023 The Bootstrap Authors
6+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
7+
*/
8+
9+
import{execFile}from'node:child_process'
10+
importfsfrom'node:fs/promises'
11+
importprocessfrom'node:process'
12+
13+
constVERBOSE=process.argv.includes('--verbose')
14+
constDRY_RUN=process.argv.includes('--dry')||process.argv.includes('--dry-run')
15+
16+
// These are the files we only care about replacing the version
17+
constFILES=[
18+
'README.md',
19+
'js/src/custom-tooltips.js',
20+
'scss/coreui-chartjs.scss'
21+
]
22+
23+
// Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
24+
functionregExpQuote(string){
25+
returnstring.replace(/[$()*+-.?[\\\]^{|}]/g,'\\$&')
26+
}
27+
28+
functionregExpQuoteReplacement(string){
29+
returnstring.replace(/\$/g,'$$')
30+
}
31+
32+
asyncfunctionreplaceRecursively(file,oldVersion,newVersion){
33+
constoriginalString=awaitfs.readFile(file,'utf8')
34+
constnewString=originalString
35+
.replace(
36+
newRegExp(regExpQuote(oldVersion),'g'),
37+
regExpQuoteReplacement(newVersion)
38+
)
39+
// Also replace the version used by the rubygem,
40+
// which is using periods (`.`) instead of hyphens (`-`)
41+
.replace(
42+
newRegExp(regExpQuote(oldVersion.replace(/-/g,'.')),'g'),
43+
regExpQuoteReplacement(newVersion.replace(/-/g,'.'))
44+
)
45+
46+
// No need to move any further if the strings are identical
47+
if(originalString===newString){
48+
return
49+
}
50+
51+
if(VERBOSE){
52+
console.log(`Found${oldVersion} in${file}`)
53+
}
54+
55+
if(DRY_RUN){
56+
return
57+
}
58+
59+
awaitfs.writeFile(file,newString,'utf8')
60+
}
61+
62+
functionbumpNpmVersion(newVersion){
63+
if(DRY_RUN){
64+
return
65+
}
66+
67+
execFile('npm',['version',newVersion,'--no-git-tag'],{shell:true},error=>{
68+
if(error){
69+
console.error(error)
70+
process.exit(1)
71+
}
72+
})
73+
}
74+
75+
functionshowUsage(args){
76+
console.error('USAGE: change-version old_version new_version [--verbose] [--dry[-run]]')
77+
console.error('Got arguments:',args)
78+
process.exit(1)
79+
}
80+
81+
asyncfunctionmain(args){
82+
let[oldVersion,newVersion]=args
83+
84+
if(!oldVersion||!newVersion){
85+
showUsage(args)
86+
}
87+
88+
// Strip any leading `v` from arguments because
89+
// otherwise we will end up with duplicate `v`s
90+
[oldVersion,newVersion]=[oldVersion,newVersion].map(arg=>{
91+
returnarg.startsWith('v') ?arg.slice(1) :arg
92+
})
93+
94+
if(oldVersion===newVersion){
95+
showUsage(args)
96+
}
97+
98+
bumpNpmVersion(newVersion)
99+
100+
try{
101+
awaitPromise.all(
102+
FILES.map(file=>replaceRecursively(file,oldVersion,newVersion))
103+
)
104+
}catch(error){
105+
console.error(error)
106+
process.exit(1)
107+
}
108+
}
109+
110+
main(process.argv.slice(2))

‎build/postcss.config.js‎renamed to ‎build/postcss.config.mjs‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
'use strict'
2-
31
constmapConfig={
42
inline:false,
53
annotation:true,
64
sourcesContent:true
75
}
86

9-
module.exports=()=>{
7+
exportdefaultcontext=>{
108
return{
11-
map:mapConfig,
9+
map:context.file.dirname.includes('examples') ?false :mapConfig,
1210
plugins:{
1311
autoprefixer:{
1412
cascade:false
Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
'use strict'
1+
importpathfrom'node:path'
2+
importprocessfrom'node:process'
3+
import{fileURLToPath}from'node:url'
4+
import{babel}from'@rollup/plugin-babel'
5+
import{nodeResolve}from'@rollup/plugin-node-resolve'
6+
importreplacefrom'@rollup/plugin-replace'
7+
importbannerfrom'./banner.mjs'
28

3-
constpath=require('path')
4-
const{ babel}=require('@rollup/plugin-babel')
5-
const{ nodeResolve}=require('@rollup/plugin-node-resolve')
6-
constreplace=require('@rollup/plugin-replace')
7-
constbanner=require('./banner.js')
9+
const__dirname=path.dirname(fileURLToPath(import.meta.url))
810

911
constBUNDLE=process.env.BUNDLE==='true'
1012
constESM=process.env.ESM==='true'
1113

12-
letfileDest=`coreui-chartjs${ESM ?'.esm' :''}`
14+
letdestinationFile=`coreui-chartjs${ESM ?'.esm' :''}`
1315
constexternal=['chart.js']
1416
constplugins=[
1517
babel({
1618
// Only transpile our source code
1719
exclude:'node_modules/**',
1820
// Include the helpers in the bundle, at most one copy of each
1921
babelHelpers:'bundled'
20-
}),
21-
replace({
22-
__COREUI_VERSION__:`v${process.env.npm_package_version}`
2322
})
2423
]
2524
constglobals={
@@ -28,13 +27,15 @@ const globals = {
2827
}
2928

3029
if(BUNDLE){
31-
fileDest+='.bundle'
30+
destinationFile+='.bundle'
3231
// Remove last entry in external array to bundle Chart.js
3332
external.pop()
3433
deleteglobals['chart.js']
3534
deleteglobals['chart.js/helpers']
3635
plugins.push(
37-
replace(),
36+
replace({
37+
preventAssignment:true
38+
}),
3839
nodeResolve()
3940
)
4041
}
@@ -43,9 +44,10 @@ const rollupConfig = {
4344
input:path.resolve(__dirname,`../js/index.${ESM ?'esm' :'umd'}.js`),
4445
output:{
4546
banner:banner(),
46-
file:path.resolve(__dirname,`../dist/js/${fileDest}.js`),
47+
file:path.resolve(__dirname,`../dist/js/${destinationFile}.js`),
4748
format:ESM ?'esm' :'umd',
48-
globals
49+
globals,
50+
generatedCode:'es2015'
4951
},
5052
external,
5153
plugins
@@ -55,4 +57,4 @@ if (!ESM) {
5557
rollupConfig.output.name='coreui.ChartJS'
5658
}
5759

58-
module.exports=rollupConfig
60+
exportdefaultrollupConfig

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp