UNPKG

1.11 kBJavaScriptView Raw
1const path = require('path');
2
3const pathExists = require('path-exists');
4const { copyFiles } = require('mrm-core');
5
6// These files will be overwritten without any confirmation
7const files = [
8 '.github/CODEOWNERS',
9 '.github/PULL_REQUEST_TEMPLATE.md',
10 '.github/CONTRIBUTING.md',
11 '.editorconfig',
12 '.eslintrc.js',
13 '.prettierrc.js',
14 'azure-pipelines.yml',
15 'babel.config.js',
16 'commitlint.config.js',
17 'husky.config.js',
18 'lint-staged.config.js',
19 'LICENSE',
20];
21
22const testFiles = [
23 'test/loader.test.js',
24 'test/options.test.js',
25 'test/fixtures/fixture.js',
26 'test/fixtures/foo.js',
27 'test/helpers/compiler.js',
28];
29
30// These files will by created only once
31const filesOnce = [
32 'src/index.js',
33 'src/cjs.js',
34 'src/options.json',
35 'CHANGELOG.md',
36];
37
38module.exports = () => {
39 const templatesDir = path.resolve(__dirname, '../../templates');
40
41 copyFiles(templatesDir, files);
42
43 pathExists('./test').then((exists) => {
44 if (!exists) {
45 copyFiles(templatesDir, testFiles, { overwrite: false });
46 }
47 });
48
49 copyFiles(templatesDir, filesOnce, { overwrite: false });
50};