UNPKG

601 BJavaScriptView Raw
1/**
2 * Install a starter .gitignore
3 */
4
5'use strict';
6
7const path = require( 'path' );
8const fs = require( 'fs-extra' );
9const shell = require( 'shelljs' );
10
11module.exports = (blockDir) => {
12 shell.cd( blockDir );
13 shell.touch( '.gitignore' );
14
15 // Build a default .gitignore
16 const ignore = [
17 'node_modules\n',
18 '## Uncomment line below if you prefer to',
19 '## keep compiled files out of version control',
20 '# dist/'
21 ].join('\n');
22
23 return new Promise( async resolve => {
24 await fs.writeFileSync(
25 path.join( process.cwd(), '.gitignore' ),
26 ignore + '\n'
27 );
28 resolve( true );
29 } );
30};