UNPKG

556 BJavaScriptView Raw
1/**
2 * Initialize the block plugin.
3 *
4 * @param {string} blockName The block name.
5 * @param {string} blockDir The block directory.
6 */
7
8'use strict';
9
10const path = require( 'path' );
11
12module.exports = ( blockName, blockDir ) => {
13 // Root path.
14 const root = process.cwd();
15
16 // Get path to cgb-scripts.
17 const scriptsPath = path.resolve(
18 blockDir,
19 'node_modules',
20 'cgb-scripts',
21 'scripts',
22 'init.js'
23 );
24
25 // Require cgb-scripts.
26 const init = require( scriptsPath );
27
28 // Run the initializer function.
29 init( root, blockName, blockDir );
30};