mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 17:23:02 +00:00
* Bump glob from 8.1.0 to 9.2.1 Bumps [glob](https://github.com/isaacs/node-glob) from 8.1.0 to 9.2.1. - [Release notes](https://github.com/isaacs/node-glob/releases) - [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md) - [Commits](https://github.com/isaacs/node-glob/compare/v8.1.0...v9.2.1) --- updated-dependencies: - dependency-name: glob dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * update build script to glob v9 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Martin Raifer <martin@raifer.tech>
65 lines
1.6 KiB
JavaScript
65 lines
1.6 KiB
JavaScript
/* eslint-disable no-console */
|
|
const chalk = require('chalk');
|
|
const concat = require('concat-files');
|
|
const glob = require('glob');
|
|
const fs = require('fs');
|
|
const postcss = require('postcss');
|
|
const prepend = require('postcss-selector-prepend');
|
|
const autoprefixer = require('autoprefixer');
|
|
|
|
let _currBuild = null;
|
|
|
|
// if called directly, do the thing.
|
|
if (process.argv[1].indexOf('build_css.js') > -1) {
|
|
buildCSS();
|
|
} else {
|
|
module.exports = buildCSS;
|
|
}
|
|
|
|
|
|
function buildCSS() {
|
|
if (_currBuild) return _currBuild;
|
|
|
|
const START = '🏗 ' + chalk.yellow('Building css...');
|
|
const END = '👍 ' + chalk.green('css built');
|
|
|
|
console.log('');
|
|
console.log(START);
|
|
console.time(END);
|
|
|
|
return _currBuild =
|
|
Promise.resolve()
|
|
.then(() => glob('css/**/*.css'))
|
|
.then(files => doConcat(files.sort(), 'dist/iD.css'))
|
|
.then(() => {
|
|
const css = fs.readFileSync('dist/iD.css', 'utf8');
|
|
return postcss([
|
|
autoprefixer,
|
|
prepend({ selector: '.ideditor ' })
|
|
])
|
|
.process(css, { from: 'dist/iD.css', to: 'dist/iD.css' });
|
|
})
|
|
.then(result => fs.writeFileSync('dist/iD.css', result.css))
|
|
.then(() => {
|
|
console.timeEnd(END);
|
|
console.log('');
|
|
_currBuild = null;
|
|
})
|
|
.catch(err => {
|
|
console.error(err);
|
|
console.log('');
|
|
_currBuild = null;
|
|
process.exit(1);
|
|
});
|
|
}
|
|
|
|
|
|
function doConcat(files, output) {
|
|
return new Promise((resolve, reject) => {
|
|
concat(files, output, (err) => {
|
|
if (err) return reject(err);
|
|
resolve();
|
|
});
|
|
});
|
|
}
|