1 | const path = require('path');
|
2 |
|
3 | const pathExists = require('path-exists');
|
4 | const { copyFiles } = require('mrm-core');
|
5 |
|
6 |
|
7 | const 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 |
|
19 | const 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 |
|
28 | const filesOnce = [
|
29 | 'src/index.js',
|
30 | 'src/cjs.js',
|
31 | 'src/options.json',
|
32 | 'CHANGELOG.md',
|
33 | ];
|
34 |
|
35 | module.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 | };
|