1 |
|
2 |
|
3 | /* Post-install script for the linter */
|
4 |
|
5 | // Import the node modules
|
6 | const fs = require('fs');
|
7 | const path = require('path');
|
8 |
|
9 | // Create the symbolic link to a file
|
10 | const createLink = (file) => {
|
11 |
|
12 | // Resolve the paths for the file
|
13 | const package = path.resolve(__dirname, file);
|
14 | const project = path.resolve(process.env.INIT_CWD, file);
|
15 |
|
16 | // Check that the file does not exists in the project folder
|
17 | if (!fs.existsSync(project)) {
|
18 |
|
19 | // Create a symbolic link to the file in the project folder
|
20 | fs.symlinkSync(package, project);
|
21 | }
|
22 | }
|
23 |
|
24 | // Create the symbolic links to the files
|
25 | createLink('.eslintignore');
|
26 | createLink('.eslintrc.js'); |
\ | No newline at end of file |