@webpack-contrib/defaults
Version:
Project configuration and boilerplate defaults for webpack projects
30 lines (23 loc) • 1.02 kB
JavaScript
;
const path = require('path');
const pathExists = require('path-exists');
const {
copyFiles
} = require('mrm-core'); // These files will be overwritten without any confirmation
const files = ['.circleci/config.yml', '.github/CODEOWNERS', '.github/PULL_REQUEST_TEMPLATE.md', '.github/CONTRIBUTING.md', '.editorconfig', '.eslintrc.js', '.prettierrc', 'appveyor.yml', 'LICENSE'];
const testFiles = ['test/loader.test.js', 'test/options.test.js', 'test/fixtures/fixture.js', 'test/fixtures/foo.js', 'test/helpers/compiler.js']; // These files will by created only once
const filesOnce = ['src/index.js', 'src/cjs.js', 'src/options.json', 'CHANGELOG.md'];
module.exports = () => {
const templatesDir = path.resolve(__dirname, '../../templates');
copyFiles(templatesDir, files);
pathExists('./test').then(exists => {
if (!exists) {
copyFiles(templatesDir, testFiles, {
overwrite: false
});
}
});
copyFiles(templatesDir, filesOnce, {
overwrite: false
});
};