67 lines
1.7 KiB
JavaScript
Raw Normal View History

2016-03-18 11:12:50 +01:00
'use strict';
/**
* Module dependencies
*/
// Public node modules.
const _ = require('lodash');
/**
* Expose main package JSON of the application
* with basic info, dependencies, etc.
*/
module.exports = scope => {
2016-03-18 11:12:50 +01:00
const cliPkg = scope.strapiPackageJSON || {};
// Finally, return the JSON.
return _.merge(scope.appPackageJSON || {}, {
'name': scope.name,
'private': true,
'version': '0.1.0',
'description': 'A Strapi application.',
2017-01-04 19:13:47 +01:00
'devDependencies': {
'babel-eslint': '^7.1.1',
'eslint': '^3.12.2',
'eslint-config-airbnb': '^13.0.0',
'eslint-plugin-import': '^2.2.0',
'eslint-plugin-react': '^6.8.0'
2017-01-04 19:13:47 +01:00
},
2016-03-18 11:12:50 +01:00
'dependencies': {
'lodash': '4.x.x',
2016-03-18 11:12:50 +01:00
'strapi': getDependencyVersion(cliPkg, 'strapi'),
2016-07-12 11:15:01 +02:00
'strapi-mongoose': getDependencyVersion(cliPkg, 'strapi-mongoose')
2016-03-18 11:12:50 +01:00
},
'main': './server.js',
'scripts': {
'start': 'node --harmony-async-await server.js',
2017-01-04 19:13:47 +01:00
'strapi': 'node_modules/strapi/bin/strapi.js', // Allow to use `npm run strapi` CLI,
'lint': 'node_modules/.bin/eslint api/**/*.js config/**/*.js plugins/**/*.js'
2016-03-18 11:12:50 +01:00
},
'author': {
'name': scope.author || 'A Strapi developer',
'email': scope.email || '',
'url': scope.website || ''
},
'maintainers': [{
'name': scope.author || 'A Strapi developer',
'email': scope.email || '',
'url': scope.website || ''
}],
'engines': {
2016-12-05 12:43:12 +01:00
'node': '>= 7.0.0',
2016-03-18 11:12:50 +01:00
'npm': '>= 3.0.0'
},
'license': scope.license || 'MIT'
});
};
/**
* Get dependencies version
*/
function getDependencyVersion(packageJSON, module) {
return module === packageJSON.name ? packageJSON.version : packageJSON.dependencies && packageJSON.dependencies[module];
2016-03-18 11:12:50 +01:00
}