File tree Expand file tree Collapse file tree
packages/create-guten-block/app Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ * Install a starter .gitignore
3+ */
4+
5+ 'use strict' ;
6+
7+ const path = require ( 'path' ) ;
8+ const fs = require ( 'fs-extra' ) ;
9+ const shell = require ( 'shelljs' ) ;
10+
11+ module . exports = ( blockDir ) => {
12+ shell . cd ( blockDir ) ;
13+ shell . touch ( '.gitignore' ) ;
14+
15+ // Build a default .gitignore
16+ const ignore = `node_modules\ndist/` ;
17+
18+ return new Promise ( async resolve => {
19+ await fs . writeFileSync (
20+ path . join ( process . cwd ( ) , '.gitignore' ) ,
21+ ignore + '\n'
22+ ) ;
23+ resolve ( true ) ;
24+ } ) ;
25+ } ;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ const clearConsole = require( './consoleClear' );
1616const updateNotifier = require ( './updateNotifier' ) ;
1717const createPluginDir = require ( './createPluginDir' ) ;
1818const npmInstallScripts = require ( './npmInstallScripts' ) ;
19+ const createGitignore = require ( './createGitignore' ) ;
1920
2021module . exports = async ( ) => {
2122 clearConsole ( ) ;
@@ -26,7 +27,7 @@ module.exports = async() => {
2627 // 1. Set the CLI and get the blockName.
2728 const blockName = cli ( ) ;
2829
29- // 2. Build the block direcotry path.
30+ // 2. Build the block directory path.
3031 const blockDir = await getBlockDir ( blockName ) ;
3132
3233 // 2. Pre print.
@@ -42,6 +43,7 @@ module.exports = async() => {
4243 ) } `
4344 ) ;
4445 await createPluginDir ( blockName ) ;
46+ await createGitignore ( blockDir ) ;
4547 spinner . succeed ( ) ;
4648
4749 // 4. NPM install cgb-scripts.
You can’t perform that action at this time.
0 commit comments