2019-06-20 16:38:15 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const execa = require('execa');
|
|
|
|
|
2019-09-26 14:03:22 +02:00
|
|
|
const { trackUsage, captureError } = require('./utils/usage');
|
2019-06-20 16:38:15 +02:00
|
|
|
const defaultConfigs = require('./utils/db-configs.js');
|
|
|
|
const clientDependencies = require('./utils/db-client-dependencies.js');
|
|
|
|
const createProject = require('./create-project');
|
|
|
|
|
|
|
|
module.exports = async function createQuickStartProject(scope) {
|
|
|
|
console.log('Creating a quickstart project.');
|
|
|
|
await trackUsage({ event: 'didChooseQuickstart', scope });
|
|
|
|
|
|
|
|
// get default sqlite config
|
|
|
|
const client = 'sqlite';
|
|
|
|
const configuration = {
|
|
|
|
client,
|
|
|
|
connection: defaultConfigs[client],
|
2019-07-03 11:20:14 +02:00
|
|
|
dependencies: clientDependencies({ scope, client }),
|
2019-06-20 16:38:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
await createProject(scope, configuration);
|
|
|
|
|
|
|
|
if (scope.runQuickstartApp === true) {
|
2019-07-08 16:13:36 +02:00
|
|
|
console.log(`Running your Strapi application.`);
|
2019-06-20 16:38:15 +02:00
|
|
|
|
|
|
|
await execa('npm', ['run', 'develop'], {
|
|
|
|
stdio: 'inherit',
|
|
|
|
cwd: scope.rootPath,
|
|
|
|
env: {
|
|
|
|
FORCE_COLOR: 1,
|
|
|
|
},
|
2019-10-08 08:56:51 +02:00
|
|
|
}).catch(error => {
|
|
|
|
if (error && error.stderr) {
|
|
|
|
(error.stderr || '')
|
|
|
|
.trim()
|
|
|
|
.split('\n')
|
|
|
|
.forEach(line => {
|
|
|
|
console.error(line);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return captureError(error);
|
|
|
|
});
|
2019-06-20 16:38:15 +02:00
|
|
|
}
|
|
|
|
};
|