UNPKG

644 BJavaScriptView Raw
1'use strict';
2
3const fs = require('fs-extra');
4const path = require('path');
5const spawn = require('cross-spawn');
6
7
8module.exports = {
9 createDir (root) {
10 fs.ensureDirSync(root);
11 },
12
13 copyExample (root) {
14 const example = path.resolve(__dirname, '../examples/1-simple-block');
15 fs.copySync(example, root);
16 },
17
18 addGitIgnore (root) {
19 const data = ['build', 'node_modules', 'package-lock.json', '.DS_Store', ''].join('\n');
20 fs.writeFileSync(path.resolve(root, '.gitignore'), data);
21 },
22
23 runNPM (root) {
24 return spawn.sync(
25 'npm',
26 ['--prefix', root, 'install'],
27 { stdio: 'inherit' }
28 );
29 }
30};