11/**
22 * New Block plugin intializer
33 *
4+ * TODO
45 * - Work in progress
6+ * - First pass
57 *
68 * - Copies the templates.
79 * - Prints final instructions.
@@ -86,60 +88,10 @@ const copyTemplateFiles = (
8688 * @param {string } blockName The block name.
8789 * @param {string } blockDir The block directory.
8890 */
89- const printNextSteps = ( blockName , blockDir ) => {
91+ const printNextSteps = blockName => {
9092 console . log (
9193 '\n\n✅ ' ,
92- chalk . black . bgGreen ( ' All done! Go build some Gutenberg blocks. \n' )
93- ) ;
94- console . log (
95- `CGB ${ chalk . dim (
96- '(create-guten-block)'
97- ) } has created a WordPress plugin called `,
98- chalk . dim ( blockName ) ,
99- ' that you can use with zero configurations #0CJS to build Gutenberg blocks with ESNext (i.e. ES6/7/8), React.js, JSX, Webpack, ESLint, etc.'
100- ) ;
101- console . log (
102- `\nCreated ${ chalk . dim ( blockName ) } plugin at: ${ chalk . dim ( blockDir ) } ` ,
103- '\nInside that directory, you can run several commands:\n'
104- ) ;
105-
106- console . log (
107- '\n👉 ' ,
108- ' Type' ,
109- chalk . black . bgWhite ( ' npm start ' ) ,
110- '\n\n' ,
111- ' Use to compile and run the block in development mode.' ,
112- '\n' ,
113- ' Watches for any changes and reports back any errors in your code.'
114- ) ;
115- console . log (
116- '\n\n👉 ' ,
117- ' Type' ,
118- chalk . black . bgWhite ( ' npm run build ' ) ,
119- '\n\n' ,
120- ' Use to build production code for your block inside dist folder.' ,
121- '\n' ,
122- ' Runs once and reports back the gzip file sizes of the produced code.'
123- ) ;
124-
125- console . log (
126- '\n👉 ' ,
127- ' Type' ,
128- chalk . black . bgWhite ( ' npm run eject ' ) ,
129- '\n\n' ,
130- ' Removes this tool and copies build dependencies, configuration files' ,
131- '\n' ,
132- ' and scripts into the plugin folder. ⚠️ It\'s a one way street.' ,
133- '\n' ,
134- ' If you do this, you can’t go back!'
135- ) ;
136-
137- console . log ( '\n\n' , chalk . black . bgGreen ( ' Get Started → \n' ) ) ;
138- console . log ( ' We suggest that you begin by typing: \n' ) ;
139- console . log (
140- ` ${ chalk . green ( 'cd' ) } ${ blockName } ` ,
141- '\n' ,
142- ` ${ chalk . green ( 'npm' ) } start` ,
94+ chalk . black . bgGreen ( ` Created a new block at .src/${ blockName } . ` ) ,
14395 '\n\n'
14496 ) ;
14597} ;
@@ -154,6 +106,8 @@ const printNextSteps = ( blockName, blockDir ) => {
154106 * @param {string } blockName The block name.
155107 * @param {string } blockDir The block directory.
156108 */
109+ // Define blockName
110+ // Define blockDir
157111module . exports = async ( root , blockName , blockDir ) => {
158112 // 0. Create block name for PHP functions.
159113 const blockNamePHPLower = blockName
@@ -177,5 +131,5 @@ module.exports = async( root, blockName, blockDir ) => {
177131 spinner . succeed ( ) ;
178132
179133 // 2. Prints next steps.
180- await printNextSteps ( blockName , blockDir ) ;
134+ await printNextSteps ( blockName ) ;
181135} ;
0 commit comments