Merge branch 'master' into patch-2

This commit is contained in:
Jim LAURIE 2019-01-22 10:42:07 +01:00 committed by GitHub
commit 040d6ec4f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 3 deletions

View File

@ -6,7 +6,7 @@
// Public node modules.
const _ = require('lodash');
const uuid = require('uuid/v4');
const { packageManager } = require('strapi-utils');
/**
@ -72,7 +72,7 @@ module.exports = scope => {
}],
'strapi': {
'packageManager': pkgManager,
'uuid': uuid()
'uuid': scope.uuid
},
'engines': {
"node": ">= 10.0.0",

View File

@ -5,8 +5,8 @@
*/
// Node.js core.
const path = require('path');
const { exec, execSync } = require('child_process');
const path = require('path');
// Public node modules.
const _ = require('lodash');
@ -15,6 +15,7 @@ const fs = require('fs-extra');
const npm = require('enpeem');
const ora = require('ora');
const shell = require('shelljs');
const request = require('request');
// Logger.
const { packageManager } = require('strapi-utils');
@ -32,6 +33,8 @@ module.exports = (scope, cb) => {
console.log(`The app has been connected to the database ${green('successfully')}!`);
console.log();
trackSuccess('didConnectDatabase', scope);
console.log('🏗 Application generation:');
let loader = ora('Copy dashboard').start();
@ -193,7 +196,19 @@ module.exports = (scope, cb) => {
console.log('⚡️ Start application:');
console.log(`$ ${green('strapi start')}`);
trackSuccess('didCreateProject', scope);
cb();
});
}
};
function trackSuccess(event, scope) {
request
.post('https://analytics.strapi.io/track')
.form({
event,
uuid: scope.uuid
})
.on('error', () => {});
}

View File

@ -17,6 +17,7 @@ const {cyan} = require('chalk');
const fs = require('fs-extra');
const inquirer = require('inquirer');
const shell = require('shelljs');
const uuid = require('uuid/v4');
// Logger.
const { packageManager } = require('strapi-utils');
@ -46,6 +47,7 @@ module.exports = (scope, cb) => {
// Make changes to the rootPath where the Strapi project will be created.
scope.rootPath = path.resolve(process.cwd(), scope.name || '');
scope.tmpPath = path.resolve(os.tmpdir(), `strapi${ crypto.randomBytes(6).toString('hex') }`);
scope.uuid = uuid();
// Ensure we aren't going to inadvertently delete any files.
try {

View File

@ -19,6 +19,7 @@
"listr": "^0.14.1",
"lodash": "^4.17.5",
"ora": "^2.1.0",
"request": "^2.88.0",
"strapi-utils": "3.0.0-alpha.19",
"uuid": "^3.1.0"
},

View File

@ -9,6 +9,7 @@
/* eslint-disable no-useless-escape */
const crypto = require('crypto');
const _ = require('lodash');
const emailRegExp = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
module.exports = {
@ -326,6 +327,10 @@ module.exports = {
}
}
if (!hasAdmin) {
strapi.emit('didCreateFirstAdmin');
}
ctx.send({
jwt,
user: _.omit(user.toJSON ? user.toJSON() : user, ['password', 'resetPasswordToken'])