* Initialize new brunch project. * @param {Object} options - skeleton like 'simple', path like '.'
(options = {})
| 5 | * @param {Object} options - skeleton like 'simple', path like '.' |
| 6 | */ |
| 7 | async function create(options = {}) { |
| 8 | const {initSkeleton} = require('./init-skeleton'); |
| 9 | const BrunchError = require('./utils/error'); |
| 10 | const loggy = require('loggy'); |
| 11 | |
| 12 | // Check for legacy syntax |
| 13 | if (options.parent) { |
| 14 | const rawArgs = options.parent.rawArgs; |
| 15 | const newArgs = rawArgs.slice(rawArgs.indexOf('new') + 1); |
| 16 | const oldSyntax = !options.skeleton && newArgs.length === 2; |
| 17 | if (oldSyntax) { |
| 18 | throw new BrunchError('LEGACY_NEW_SYNTAX', { |
| 19 | skeleton: newArgs[0], |
| 20 | path: newArgs[1], |
| 21 | }); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | try { |
| 26 | return await initSkeleton(options.skeleton, options.path); |
| 27 | } catch (error) { |
| 28 | loggy.error(error); |
| 29 | } |
| 30 | }; |
| 31 | |
| 32 | function build(options) { |
| 33 | const hasDebug = obj => { |
nothing calls this directly
no test coverage detected
searching dependent graphs…