Skip to content

Commit 66d199c

Browse files
committed
release: v4.0.0-beta.0
1 parent 13c08d0 commit 66d199c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+6542
-3830
lines changed

build/change-version.js

100755100644
+60-82
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,84 @@
11
#!/usr/bin/env node
22

3-
'use strict'
4-
53
/*!
64
* Script to update version number references in the project.
7-
* Copyright 2017 The Bootstrap Authors
8-
* Copyright 2017 Twitter, Inc.
9-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5+
* Copyright 2017-2021 The Bootstrap Authors
6+
* Copyright 2017-2021 Twitter, Inc.
7+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
108
*/
119

12-
/* global Set */
10+
'use strict'
1311

14-
const fs = require('fs')
12+
const fs = require('fs').promises
1513
const path = require('path')
16-
const sh = require('shelljs')
17-
sh.config.fatal = true
18-
const sed = sh.sed
14+
const globby = require('globby')
15+
16+
const VERBOSE = process.argv.includes('--verbose')
17+
const DRY_RUN = process.argv.includes('--dry') || process.argv.includes('--dry-run')
18+
19+
// These are the filetypes we only care about replacing the version
20+
const GLOB = [
21+
'**/*.{css,html,js,json,md,scss,txt,yml}'
22+
]
23+
const GLOBBY_OPTIONS = {
24+
cwd: path.join(__dirname, '..'),
25+
gitignore: true
26+
}
27+
const EXCLUDED_FILES = [
28+
'CHANGELOG.md'
29+
]
1930

2031
// Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
21-
RegExp.quote = (string) => string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&')
22-
RegExp.quoteReplacement = (string) => string.replace(/[$]/g, '$$')
32+
function regExpQuote(string) {
33+
return string.replace(/[$()*+-.?[\\\]^{|}]/g, '\\$&')
34+
}
35+
36+
function regExpQuoteReplacement(string) {
37+
return string.replace(/\$/g, '$$')
38+
}
2339

24-
const DRY_RUN = false
40+
async function replaceRecursively(file, oldVersion, newVersion) {
41+
const originalString = await fs.readFile(file, 'utf8')
42+
const newString = originalString.replace(
43+
new RegExp(regExpQuote(oldVersion), 'g'), regExpQuoteReplacement(newVersion)
44+
)
2545

26-
function walkAsync(directory, excludedDirectories, fileCallback, errback) {
27-
if (excludedDirectories.has(path.parse(directory).base)) {
46+
// No need to move any further if the strings are identical
47+
if (originalString === newString) {
2848
return
2949
}
30-
fs.readdir(directory, (err, names) => {
31-
if (err) {
32-
errback(err)
33-
return
34-
}
35-
names.forEach((name) => {
36-
const filepath = path.join(directory, name)
37-
fs.lstat(filepath, (err, stats) => {
38-
if (err) {
39-
process.nextTick(errback, err)
40-
return
41-
}
42-
if (stats.isSymbolicLink()) {
43-
return
44-
}
45-
else if (stats.isDirectory()) {
46-
process.nextTick(walkAsync, filepath, excludedDirectories, fileCallback, errback)
47-
}
48-
else if (stats.isFile()) {
49-
process.nextTick(fileCallback, filepath)
50-
}
51-
})
52-
})
53-
})
54-
}
5550

56-
function replaceRecursively(directory, excludedDirectories, allowedExtensions, original, replacement) {
57-
original = new RegExp(RegExp.quote(original), 'g')
58-
replacement = RegExp.quoteReplacement(replacement)
59-
const updateFile = !DRY_RUN ? (filepath) => {
60-
if (allowedExtensions.has(path.parse(filepath).ext)) {
61-
sed('-i', original, replacement, filepath)
62-
}
63-
} : (filepath) => {
64-
if (allowedExtensions.has(path.parse(filepath).ext)) {
65-
console.log(`FILE: ${filepath}`)
66-
}
67-
else {
68-
console.log(`EXCLUDED:${filepath}`)
69-
}
51+
if (VERBOSE) {
52+
console.log(`FILE: ${file}`)
7053
}
71-
walkAsync(directory, excludedDirectories, updateFile, (err) => {
72-
console.error('ERROR while traversing directory!:')
73-
console.error(err)
74-
process.exit(1)
75-
})
54+
55+
if (DRY_RUN) {
56+
return
57+
}
58+
59+
await fs.writeFile(file, newString, 'utf8')
7660
}
7761

78-
function main(args) {
79-
if (args.length !== 2) {
80-
console.error('USAGE: change-version old_version new_version')
62+
async function main(args) {
63+
const [oldVersion, newVersion] = args
64+
65+
if (!oldVersion || !newVersion) {
66+
console.error('USAGE: change-version old_version new_version [--verbose] [--dry[-run]]')
8167
console.error('Got arguments:', args)
8268
process.exit(1)
8369
}
84-
const oldVersion = args[0]
85-
const newVersion = args[1]
86-
const EXCLUDED_DIRS = new Set([
87-
'.git',
88-
'node_modules',
89-
'vendor'
90-
])
91-
const INCLUDED_EXTENSIONS = new Set([
92-
// This extension whitelist is how we avoid modifying binary files
93-
'',
94-
'.css',
95-
'.html',
96-
'.js',
97-
'.json',
98-
'.md',
99-
'.scss',
100-
'.txt',
101-
'.yml'
102-
])
103-
replaceRecursively('.', EXCLUDED_DIRS, INCLUDED_EXTENSIONS, oldVersion, newVersion)
70+
71+
// 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)
73+
74+
try {
75+
const files = await globby(GLOB, GLOBBY_OPTIONS, EXCLUDED_FILES)
76+
77+
await Promise.all(files.map(file => replaceRecursively(file, oldVersion, newVersion)))
78+
} catch (error) {
79+
console.error(error)
80+
process.exit(1)
81+
}
10482
}
10583

10684
main(process.argv.slice(2))
Binary file not shown.

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@coreui/coreui-free-bootstrap-admin-template",
3-
"version": "4.0.0-alpha.2",
3+
"version": "4.0.0-beta.0",
44
"description": "Free Bootstrap Admin Template",
55
"keywords": [
66
"admin",

src/js/charts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
/**
55
* --------------------------------------------------------------------------
6-
* CoreUI Boostrap Admin Template (v4.0.0-alpha.2): main.js
6+
* CoreUI Boostrap Admin Template (v4.0.0-beta.0): main.js
77
* Licensed under MIT (https://coreui.io/license)
88
* --------------------------------------------------------------------------
99
*/

src/js/colors.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* --------------------------------------------------------------------------
5-
* CoreUI Boostrap Admin Template (v4.0.0-alpha.2): colors.js
5+
* CoreUI Boostrap Admin Template (v4.0.0-beta.0): colors.js
66
* Licensed under MIT (https://coreui.io/license)
77
* --------------------------------------------------------------------------
88
*/

src/js/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
/**
55
* --------------------------------------------------------------------------
6-
* CoreUI Boostrap Admin Template (v4.0.0-alpha.2): main.js
6+
* CoreUI Boostrap Admin Template (v4.0.0-beta.0): main.js
77
* Licensed under MIT (https://coreui.io/license)
88
* --------------------------------------------------------------------------
99
*/

src/js/popovers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* --------------------------------------------------------------------------
5-
* CoreUI Free Boostrap Admin Template (v4.0.0-alpha.2): popovers.js
5+
* CoreUI Free Boostrap Admin Template (v4.0.0-beta.0): popovers.js
66
* Licensed under MIT (https://coreui.io/license)
77
* --------------------------------------------------------------------------
88
*/

src/js/toasts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* --------------------------------------------------------------------------
5-
* CoreUI Free Boostrap Admin Template (v4.0.0-alpha.2): popovers.js
5+
* CoreUI Free Boostrap Admin Template (v4.0.0-beta.0): popovers.js
66
* Licensed under MIT (https://coreui.io/license)
77
* --------------------------------------------------------------------------
88
*/

src/js/tooltips.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* --------------------------------------------------------------------------
5-
* CoreUI Free Boostrap Admin Template (v4.0.0-alpha.2): tooltips.js
5+
* CoreUI Free Boostrap Admin Template (v4.0.0-beta.0): tooltips.js
66
* Licensed under MIT (https://coreui.io/license)
77
* --------------------------------------------------------------------------
88
*/

src/js/widgets.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* --------------------------------------------------------------------------
5-
* CoreUI Boostrap Admin Template (v4.0.0-alpha.2): main.js
5+
* CoreUI Boostrap Admin Template (v4.0.0-beta.0): main.js
66
* Licensed under MIT (https://coreui.io/license)
77
* --------------------------------------------------------------------------
88
*/

src/pug/views/docs/contents.pug

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
extends ../../_layout/default.pug
2+
3+
block view
4+
.card
5+
.card-header
6+
strong Contents
7+
span.small.ms-1 What’s included
8+
.card-body
9+
p Within the download you’ll find the following directories and files, logically grouping common assets and providing both compiled and minified variations. You’ll see something like this:
10+
pre.hljs
11+
code
12+
| free-bootstrap-admin-template/
13+
| ├── build/
14+
| ├── src/
15+
| │ ├── assets/
16+
| │ │ ├── brand/
17+
| │ │ ├── favicon/
18+
| │ │ ├── icons/
19+
| │ │ ├── img/
20+
| │ ├── js/
21+
| │ ├── pug/
22+
| │ │ ├── _layout/
23+
| │ │ ├── _partial/
24+
| │ │ ├── base/
25+
| │ │ ├── buttons/
26+
| │ │ ├── icons/
27+
| │ │ ├── notifications/
28+
| │ │ ├── ...
29+
| │ │ ├── index.pug
30+
| │ │ └── ...
31+
| │ ├── scss/
32+
| │ ├── vendors/
33+
| │ └── views/
34+
| │ ├── base/
35+
| │ ├── buttons/
36+
| │ ├── css/
37+
| │ ├── icons/
38+
| │ ├── notifications/
39+
| │ ├── ...
40+
| │ ├── index.html
41+
| │ └── ...
42+
| └── package.json

src/pug/views/docs/installation.pug

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
extends ../../_layout/default.pug
2+
3+
block view
4+
.card
5+
.card-header
6+
strong Installation
7+
.card-body
8+
h2 Installation
9+
h3 Clone repo
10+
pre.hljs.language-bash
11+
code
12+
| # clone the repo
13+
| $ git clone https://github.com/coreui/coreui-free-bootstrap-admin-template.git my-project
14+
|
15+
| # go into app's directory
16+
| $ cd my-project
17+
|
18+
| # install app's dependencies
19+
| $ npm install
20+
21+
h2 Usage
22+
pre.hljs.language-bash
23+
code
24+
| # serve with hot reload at localhost:3000.
25+
| $ npm run serve
26+
|
27+
| # build for production with minification
28+
| $ npm run build
29+

0 commit comments

Comments
 (0)