39 lines
932 B
JavaScript
Raw Normal View History

2016-12-01 16:44:03 +01:00
'use strict';
/**
* Module dependencies
*/
// Node.js core.
const path = require('path');
// Public node modules.
const _ = require('lodash');
const fs = require('fs-extra');
/**
* This `before` function is run before generating targets.
* Validate, configure defaults, get extra dependencies, etc.
*
* @param {Object} scope
* @param {Function} cb
*/
module.exports = function (scope, cb) {
// Copy the admin files.
2017-09-08 17:14:11 +02:00
fs.copySync(path.resolve(__dirname, '..', '..', 'strapi-admin'), path.resolve(scope.rootPath, 'admin'), {
// Skip `node_modules` folder.
filter: (file) => (!_.includes(file, 'node_modules') && !_.includes(file, 'package-lock.json'))
});
2016-12-01 16:44:03 +01:00
// Take another pass to take advantage of the defaults absorbed in previous passes.
_.defaults(scope, {
rootPath: scope.rootPath,
humanizedPath: '`./admin`'
});
// Trigger callback with no error to proceed.
return cb.success();
};