39 lines
894 B
JavaScript
Raw Normal View History

2016-12-01 16:44:03 +01:00
'use strict';
/**
* Module dependencies
*/
const { exec } = require('child_process');
const path = require('path');
2017-11-03 17:15:53 +01:00
const fs = require('fs-extra');
2018-07-10 11:08:58 +02:00
const { packageManager } = require('strapi-utils'); // eslint-disable-line import/no-unresolved
2016-12-01 16:44:03 +01:00
/**
* Runs after this generator has finished
*
* @param {Object} scope
* @param {Function} cb
*/
module.exports = (scope, cb) => {
2017-11-03 17:15:53 +01:00
// Copy the admin files.
fs.copySync(path.resolve(__dirname, '..', 'files'), path.resolve(scope.rootPath, 'admin'));
if (scope.developerMode) {
return cb();
}
2017-11-03 17:15:53 +01:00
2017-09-08 17:14:11 +02:00
// Install back-end admin `node_modules`.
2018-06-22 16:46:48 +02:00
const cmd = packageManager.isStrapiInstalledWithNPM() ? 'npm install --production --ignore-scripts' : 'yarn install --production --ignore-scripts';
2018-06-21 15:07:50 +02:00
exec(cmd, {
cwd: path.resolve(scope.rootPath, 'admin')
2017-09-08 17:14:11 +02:00
}, (err) => {
if (err) {
return cb(err);
}
2016-12-01 16:44:03 +01:00
cb();
});
2016-12-01 16:44:03 +01:00
};