UNPKG

1.03 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 '.circleci/config.yml',
9 '.github/CODEOWNERS',
10 '.github/PULL_REQUEST_TEMPLATE.md',
11 '.github/CONTRIBUTING.md',
12 '.editorconfig',
13 '.eslintrc.js',
14 '.prettierrc',
15 'appveyor.yml',
16 'LICENSE',
17];
18
19const testFiles = [
20 'test/loader.test.js',
21 'test/options.test.js',
22 'test/fixtures/fixture.js',
23 'test/fixtures/foo.js',
24 'test/helpers/compiler.js',
25];
26
27// These files will by created only once
28const filesOnce = [
29 'src/index.js',
30 'src/cjs.js',
31 'src/options.json',
32 'CHANGELOG.md',
33];
34
35module.exports = () => {
36 const templatesDir = path.resolve(__dirname, '../../templates');
37
38 copyFiles(templatesDir, files);
39
40 pathExists('./test').then((exists) => {
41 if (!exists) {
42 copyFiles(templatesDir, testFiles, { overwrite: false });
43 }
44 });
45
46 copyFiles(templatesDir, filesOnce, { overwrite: false });
47};