mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-18 19:30:37 +03:00
improve build setup
This commit is contained in:
@@ -5,7 +5,7 @@ module.exports = ({ paths = [], verbose = false } = {}) => {
|
||||
let cleaned = false;
|
||||
return {
|
||||
name: 'clean',
|
||||
async buildStart() {
|
||||
buildStart() {
|
||||
if (!cleaned) {
|
||||
paths.forEach((currPath) => {
|
||||
const resolvedPath = path.resolve(currPath);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = ({ paths = [], verbose = false } = {}) => {
|
||||
return {
|
||||
name: 'copy',
|
||||
buildStart() {
|
||||
paths.forEach((currPath) => {
|
||||
const resolvedPath = path.resolve(currPath);
|
||||
|
||||
if (fs.existsSync(resolvedPath)) {
|
||||
if (verbose) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Copy: ${resolvedPath}`);
|
||||
}
|
||||
this.emitFile({
|
||||
type: 'asset',
|
||||
source: fs.readFileSync(resolvedPath),
|
||||
fileName: path.basename(resolvedPath),
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = ({ input = 'package.json', output = 'package.json', json } = {}) => {
|
||||
const resolvedInput = path.resolve(input);
|
||||
const inputPackageJson = require(resolvedInput);
|
||||
return {
|
||||
name: 'packageJson',
|
||||
buildStart() {
|
||||
this.emitFile({
|
||||
type: 'asset',
|
||||
source: JSON.stringify(
|
||||
typeof json === 'function' ? json(inputPackageJson) : inputPackageJson,
|
||||
null,
|
||||
2
|
||||
),
|
||||
fileName: output,
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user