-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d05cff
commit 9780300
Showing
37 changed files
with
639 additions
and
591 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module.exports = { | ||
root: true, | ||
|
||
parserOptions: { | ||
sourceType: 'commonjs' | ||
}, | ||
|
||
extends: [ | ||
'eslint:recommended', | ||
'quasar/base' | ||
], | ||
|
||
rules: { | ||
'no-unused-vars': [ 'error', { ignoreRestSiblings: true, argsIgnorePattern: '^_' } ] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
.DS_Store | ||
/node_modules | ||
.vscode | ||
.postcssrc.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"singleQuote": true, | ||
"$schema": "https://json.schemastore.org/prettierrc", | ||
"semi": false, | ||
"bracketSameLine": true, | ||
"singleQuote": true, | ||
"printWidth": 120, | ||
"trailingComma": "none" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
module.exports.generalAnimations = [ | ||
'bounce', | ||
'flash', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
module.exports.generalAnimations = [ | ||
'bounce', | ||
'flash', | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,93 @@ | ||
const packageName = "animate.css"; | ||
const packageName = 'animate.css' | ||
|
||
// ------------ | ||
|
||
const { globSync } = require("tinyglobby"); | ||
const { copySync } = require("fs-extra"); | ||
const { writeFileSync } = require("fs"); | ||
const { join, resolve, basename } = require("path"); | ||
const { globSync } = require('tinyglobby') | ||
const { copySync } = require('fs-extra') | ||
const { writeFileSync } = require('fs') | ||
const { join, resolve, basename } = require('path') | ||
|
||
const dist = resolve(__dirname, "../animate"); | ||
const dist = resolve(__dirname, '../animate') | ||
|
||
const pkgFolder = resolve(__dirname, `../node_modules/${packageName}/`); | ||
const cssFiles = globSync(pkgFolder + "/source/*/*.css"); | ||
const cssNames = new Set(); | ||
const pkgFolder = resolve(__dirname, `../node_modules/${ packageName }/`) | ||
const cssFiles = globSync(pkgFolder + '/source/*/*.css') | ||
const cssNames = new Set() | ||
|
||
const inAnimations = []; | ||
const outAnimations = []; | ||
const generalAnimations = []; | ||
const inAnimations = [] | ||
const outAnimations = [] | ||
const generalAnimations = [] | ||
|
||
function extract(file) { | ||
const name = basename(file).match(/(.*)\.css/)[1]; | ||
function extract (file) { | ||
const name = basename(file).match(/(.*)\.css/)[ 1 ] | ||
|
||
if (cssNames.has(name)) { | ||
return; | ||
return | ||
} | ||
|
||
copySync(file, join(dist, name + ".css")); | ||
cssNames.add(name); | ||
copySync(file, join(dist, name + '.css')) | ||
cssNames.add(name) | ||
|
||
if (name.indexOf("In") > -1) { | ||
inAnimations.push(name); | ||
} else if (name.indexOf("Out") > -1) { | ||
outAnimations.push(name); | ||
} else { | ||
generalAnimations.push(name); | ||
if (name.indexOf('In') > -1) { | ||
inAnimations.push(name) | ||
} | ||
else if (name.indexOf('Out') > -1) { | ||
outAnimations.push(name) | ||
} | ||
else { | ||
generalAnimations.push(name) | ||
} | ||
} | ||
|
||
function getList(prefix) { | ||
function getList (prefix) { | ||
return ` | ||
${prefix}generalAnimations = ${JSON.stringify(generalAnimations, null, 2)} | ||
${ prefix }generalAnimations = ${ JSON.stringify(generalAnimations, null, 2) } | ||
${prefix}inAnimations = ${JSON.stringify(inAnimations, null, 2)} | ||
${ prefix }inAnimations = ${ JSON.stringify(inAnimations, null, 2) } | ||
${prefix}outAnimations = ${JSON.stringify(outAnimations, null, 2)} | ||
`.replace(/"/g, "'"); | ||
${ prefix }outAnimations = ${ JSON.stringify(outAnimations, null, 2) } | ||
`.replace(/"/g, "'") | ||
} | ||
|
||
if (cssFiles.length === 0) { | ||
console.log("WARNING. Animate.css skipped completely"); | ||
} else { | ||
console.log('WARNING. Animate.css skipped completely') | ||
} | ||
else { | ||
cssFiles.forEach((file) => { | ||
extract(file); | ||
}); | ||
extract(file) | ||
}) | ||
|
||
generalAnimations.sort(); | ||
inAnimations.sort(); | ||
outAnimations.sort(); | ||
generalAnimations.sort() | ||
inAnimations.sort() | ||
outAnimations.sort() | ||
|
||
copySync(join(pkgFolder, "LICENSE"), join(dist, "LICENSE")); | ||
copySync(join(pkgFolder, 'LICENSE'), join(dist, 'LICENSE')) | ||
|
||
const common = getList("module.exports."); | ||
const common = getList('module.exports.') | ||
|
||
writeFileSync(join(dist, "animate-list.js"), common, "utf-8"); | ||
writeFileSync(join(dist, 'animate-list.js'), common, 'utf-8') | ||
writeFileSync( | ||
join(dist, "animate-list.mjs"), | ||
getList("export const "), | ||
"utf-8", | ||
); | ||
writeFileSync(join(dist, "animate-list.common.js"), common, "utf-8"); | ||
join(dist, 'animate-list.mjs'), | ||
getList('export const '), | ||
'utf-8' | ||
) | ||
writeFileSync(join(dist, 'animate-list.common.js'), common, 'utf-8') | ||
|
||
writeFileSync( | ||
join(dist, "animate-list.d.ts"), | ||
getList("export type ") | ||
.replace(/\[/g, "") | ||
.replace(/\]/g, ";") | ||
.replace(/\ {2}'/g, " | '") | ||
.replace(/,/g, ""), | ||
"utf-8", | ||
); | ||
join(dist, 'animate-list.d.ts'), | ||
getList('export type ') | ||
.replace(/\[/g, '') | ||
.replace(/\]/g, ';') | ||
.replace(/ {2}'/g, " | '") | ||
.replace(/,/g, ''), | ||
'utf-8' | ||
) | ||
writeFileSync( | ||
join(dist, "animate-list.common.d.ts"), | ||
getList("export type ") | ||
.replace(/\[/g, "") | ||
.replace(/\]/g, ";") | ||
.replace(/\ {2}'/g, " | '") | ||
.replace(/,/g, ""), | ||
"utf-8", | ||
); | ||
join(dist, 'animate-list.common.d.ts'), | ||
getList('export type ') | ||
.replace(/\[/g, '') | ||
.replace(/\]/g, ';') | ||
.replace(/ {2}'/g, " | '") | ||
.replace(/,/g, ''), | ||
'utf-8' | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,103 @@ | ||
const packageName = "bootstrap-icons"; | ||
const distName = "bootstrap-icons"; | ||
const iconSetName = "Bootstrap"; | ||
const prefix = "bi"; | ||
const packageName = 'bootstrap-icons' | ||
const distName = 'bootstrap-icons' | ||
const iconSetName = 'Bootstrap' | ||
const prefix = 'bi' | ||
|
||
// ------------ | ||
|
||
const { globSync } = require("tinyglobby"); | ||
const { copySync } = require("fs-extra"); | ||
const { writeFileSync } = require("fs"); | ||
const { resolve, join } = require("path"); | ||
const { globSync } = require('tinyglobby') | ||
const { copySync } = require('fs-extra') | ||
const { writeFileSync } = require('fs') | ||
const { resolve, join } = require('path') | ||
|
||
const skipped = []; | ||
const distFolder = resolve(__dirname, "../bootstrap-icons"); | ||
const skipped = [] | ||
const distFolder = resolve(__dirname, '../bootstrap-icons') | ||
const { | ||
defaultNameMapper, | ||
extract, | ||
writeExports, | ||
copyCssFile, | ||
} = require("./utils"); | ||
copyCssFile | ||
} = require('./utils') | ||
|
||
const svgFolder = resolve(__dirname, `../node_modules/${packageName}/icons/`); | ||
const svgFiles = globSync(svgFolder + "/*.svg"); | ||
let iconNames = new Set(); | ||
const svgFolder = resolve(__dirname, `../node_modules/${ packageName }/icons/`) | ||
const svgFiles = globSync(svgFolder + '/*.svg') | ||
let iconNames = new Set() | ||
|
||
const svgExports = []; | ||
const typeExports = []; | ||
const svgExports = [] | ||
const typeExports = [] | ||
|
||
svgFiles.forEach((file) => { | ||
const name = defaultNameMapper(file, prefix); | ||
const name = defaultNameMapper(file, prefix) | ||
|
||
if (iconNames.has(name)) { | ||
return; | ||
return | ||
} | ||
|
||
try { | ||
const { svgDef, typeDef } = extract(file, name); | ||
svgExports.push(svgDef); | ||
typeExports.push(typeDef); | ||
|
||
iconNames.add(name); | ||
} catch (err) { | ||
console.error(err); | ||
skipped.push(name); | ||
const { svgDef, typeDef } = extract(file, name) | ||
svgExports.push(svgDef) | ||
typeExports.push(typeDef) | ||
|
||
iconNames.add(name) | ||
} | ||
catch (err) { | ||
console.error(err) | ||
skipped.push(name) | ||
} | ||
}); | ||
}) | ||
|
||
iconNames = [...iconNames]; | ||
iconNames = [ ...iconNames ] | ||
svgExports.sort((a, b) => { | ||
return ("" + a).localeCompare(b); | ||
}); | ||
return ('' + a).localeCompare(b) | ||
}) | ||
typeExports.sort((a, b) => { | ||
return ("" + a).localeCompare(b); | ||
}); | ||
return ('' + a).localeCompare(b) | ||
}) | ||
iconNames.sort((a, b) => { | ||
return ("" + a).localeCompare(b); | ||
}); | ||
return ('' + a).localeCompare(b) | ||
}) | ||
|
||
writeExports( | ||
iconSetName, | ||
packageName, | ||
distFolder, | ||
svgExports, | ||
typeExports, | ||
skipped, | ||
); | ||
skipped | ||
) | ||
|
||
// then update webfont files | ||
|
||
const webfont = ["bootstrap-icons.woff", "bootstrap-icons.woff2"]; | ||
const webfont = [ 'bootstrap-icons.woff', 'bootstrap-icons.woff2' ] | ||
|
||
webfont.forEach((file) => { | ||
copySync( | ||
resolve(__dirname, `../node_modules/${packageName}/font/fonts/${file}`), | ||
resolve(__dirname, `../bootstrap-icons/${file}`), | ||
); | ||
}); | ||
resolve(__dirname, `../node_modules/${ packageName }/font/fonts/${ file }`), | ||
resolve(__dirname, `../bootstrap-icons/${ file }`) | ||
) | ||
}) | ||
|
||
copyCssFile({ | ||
from: resolve( | ||
__dirname, | ||
`../node_modules/${packageName}/font/bootstrap-icons.css`, | ||
`../node_modules/${ packageName }/font/bootstrap-icons.css` | ||
), | ||
to: resolve(__dirname, "../bootstrap-icons/bootstrap-icons.css"), | ||
to: resolve(__dirname, '../bootstrap-icons/bootstrap-icons.css'), | ||
replaceFn: (content) => { | ||
return content.replace( | ||
/src:[^;]+;/, | ||
'src: url("./bootstrap-icons.woff2") format("woff2"), url("./bootstrap-icons.woff") format("woff");', | ||
); | ||
}, | ||
}); | ||
'src: url("./bootstrap-icons.woff2") format("woff2"), url("./bootstrap-icons.woff") format("woff");' | ||
) | ||
} | ||
}) | ||
|
||
copySync( | ||
resolve(__dirname, `../node_modules/${packageName}/LICENSE`), | ||
resolve(__dirname, "../bootstrap-icons/LICENSE"), | ||
); | ||
resolve(__dirname, `../node_modules/${ packageName }/LICENSE`), | ||
resolve(__dirname, '../bootstrap-icons/LICENSE') | ||
) | ||
|
||
// write the JSON file | ||
const file = resolve(__dirname, join("..", distName, "icons.json")); | ||
writeFileSync(file, JSON.stringify([...iconNames].sort(), null, 2), "utf-8"); | ||
const file = resolve(__dirname, join('..', distName, 'icons.json')) | ||
writeFileSync(file, JSON.stringify([ ...iconNames ].sort(), null, 2), 'utf-8') | ||
|
||
console.log(`${distName} done with ${iconNames.length} icons`); | ||
console.log(`${ distName } done with ${ iconNames.length } icons`) |
Oops, something went wrong.