Merge branch 'master' of github.com:strapi/strapi into user-permissions

This commit is contained in:
Jim Laurie 2017-11-10 10:06:23 +01:00
commit fe57abdb2f
35 changed files with 208 additions and 70 deletions

View File

@ -1,6 +1,6 @@
{
"private": true,
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"devDependencies": {
"assert": "~1.3.0",
"babel-eslint": "^6.1.2",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-admin",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Strapi Admin",
"repository": {
"type": "git",
@ -26,8 +26,8 @@
"cheerio": "^1.0.0-rc.2",
"fs-extra": "^0.30.0",
"sanitize.css": "^4.1.0",
"strapi-helper-plugin": "3.0.0-alpha.6.4",
"strapi-utils": "3.0.0-alpha.6.4"
"strapi-helper-plugin": "3.0.0-alpha.6.7",
"strapi-utils": "3.0.0-alpha.6.7"
},
"devDependencies": {
"cross-env": "^5.1.1",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-bookshelf",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Bookshelf hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@ -20,8 +20,8 @@
"knex": "^0.13.0",
"lodash": "^4.17.4",
"pluralize": "^6.0.0",
"strapi-knex": "3.0.0-alpha.6.4",
"strapi-utils": "3.0.0-alpha.6.4"
"strapi-knex": "3.0.0-alpha.6.7",
"strapi-utils": "3.0.0-alpha.6.7"
},
"strapi": {
"isHook": true,

View File

@ -1,6 +1,6 @@
{
"name": "strapi-ejs",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "EJS hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -0,0 +1,10 @@
# Don't check auto-generated stuff into git
coverage
node_modules
stats.json
package-lock.json
# Cruft
.DS_Store
npm-debug.log
.idea

View File

@ -6,6 +6,7 @@
const { exec } = require('child_process');
const path = require('path');
const fs = require('fs-extra');
/**
* Runs after this generator has finished
@ -15,10 +16,13 @@ const path = require('path');
*/
module.exports = (scope, cb) => {
// Copy the admin files.
fs.copySync(path.resolve(__dirname, '..', 'files'), path.resolve(scope.rootPath, 'admin'));
if (scope.developerMode) {
return cb();
}
// Install back-end admin `node_modules`.
exec('npm install --production --ignore-scripts', {
cwd: path.resolve(scope.rootPath, 'admin')

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-admin",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Generate the default admin panel for a Strapi application.",
"homepage": "http://strapi.io",
"keywords": [
@ -15,7 +15,7 @@
"dependencies": {
"fs-extra": "^4.0.1",
"lodash": "^4.17.4",
"strapi-admin": "3.0.0-alpha.6.4"
"strapi-admin": "3.0.0-alpha.6.7"
},
"author": {
"email": "hi@strapi.io",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-api",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Generate an API for a Strapi application.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-controller",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Generate a controller for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-model",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Generate a model for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -0,0 +1,101 @@
############################
# OS X
############################
.DS_Store
.AppleDouble
.LSOverride
Icon
.Spotlight-V100
.Trashes
._*
############################
# Linux
############################
*~
############################
# Windows
############################
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
*.cab
*.msi
*.msm
*.msp
############################
# Packages
############################
*.7z
*.csv
*.dat
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.com
*.class
*.dll
*.exe
*.o
*.seed
*.so
*.swo
*.swp
*.swn
*.swm
*.out
*.pid
############################
# Logs and databases
############################
*.log
*.sql
############################
# Misc.
############################
*#
ssl
.idea
nbproject
############################
# Node.js
############################
lib-cov
lcov.info
pids
logs
results
node_modules
.node_history
package-lock.json
############################
# Tests
############################
testApp
coverage

View File

@ -6,6 +6,7 @@
// Public node modules.
const _ = require('lodash');
const uuid = require('uuid/v4');
/**
* Expose main package JSON of the application
@ -21,6 +22,13 @@ module.exports = scope => {
'private': true,
'version': '0.1.0',
'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': {
'babel-eslint': '^7.1.1',
'eslint': '^3.12.2',
@ -31,16 +39,7 @@ module.exports = scope => {
'dependencies': {
'lodash': '4.x.x',
'strapi': getDependencyVersion(cliPkg, 'strapi'),
'strapi-mongoose': getDependencyVersion(cliPkg, 'strapi'),
'strapi-generate': getDependencyVersion(cliPkg, 'strapi'),
'strapi-generate-api': 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-utils/script/plugin-install.js'
'strapi-mongoose': getDependencyVersion(cliPkg, 'strapi')
},
'author': {
'name': scope.author || 'A Strapi developer',
@ -52,6 +51,9 @@ module.exports = scope => {
'email': scope.email || '',
'url': scope.website || ''
}],
'strapi': {
'uuid': uuid()
},
'engines': {
'node': '>= 7.0.0',
'npm': '>= 3.0.0'

View File

@ -33,9 +33,6 @@ module.exports = {
'.editorconfig': {
copy: 'editorconfig'
},
'.gitignore': {
copy: 'gitignore'
},
'.npmignore': {
copy: 'npmignore'
},

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-new",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Generate a new Strapi application.",
"homepage": "http://strapi.io",
"keywords": [
@ -17,7 +17,8 @@
"fs-extra": "^4.0.0",
"get-installed-path": "^3.0.1",
"lodash": "^4.17.4",
"strapi-utils": "3.0.0-alpha.6.4"
"strapi-utils": "3.0.0-alpha.6.7",
"uuid": "^3.1.0"
},
"scripts": {
"prepublish": "npm prune"

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-plugin",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Generate an plugin for a Strapi application.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-policy",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Generate a policy for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-service",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Generate a service for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -232,15 +232,8 @@ function parseTarget(target, scope, cb) {
// If we couldn't find a generator using the configured module,
// try requiring `strapi-generate-<module>` to get the core generator.
if (!subGenerator && !module.match(/^strapi-generate-/)) {
let strapiRoot = scope.strapiRoot;
// Handle local installation
if (strapiRoot.endsWith('node_modules/strapi')) {
strapiRoot = process.cwd();
}
try {
subGenerator = require(path.resolve(strapiRoot, 'node_modules', 'strapi-generate-' + module));
subGenerator = require(path.resolve(process.mainModule.paths[1], 'strapi-generate-' + module));
} catch (e1) {
requireError = e1;
}

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Master of ceremonies for the Strapi generators.",
"homepage": "http://strapi.io",
"keywords": [
@ -17,7 +17,7 @@
"fs-extra": "^4.0.0",
"lodash": "^4.17.4",
"reportback": "^2.0.1",
"strapi-utils": "3.0.0-alpha.6.4"
"strapi-utils": "3.0.0-alpha.6.7"
},
"author": {
"name": "Strapi team",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-helper-plugin",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Helper for Strapi plugins development",
"engines": {
"node": ">= 8.0.0",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-knex",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Knex hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-middleware-views",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Views hook to enable server-side rendering for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-mongoose",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Mongoose hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@ -20,7 +20,7 @@
"mongoose-double": "0.0.1",
"mongoose-float": "^1.0.2",
"pluralize": "^6.0.0",
"strapi-utils": "3.0.0-alpha.6.4"
"strapi-utils": "3.0.0-alpha.6.7"
},
"strapi": {
"isHook": true

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-content-manager",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "A powerful UI to easily manage your data.",
"engines": {
"node": ">= 8.0.0",
@ -47,7 +47,7 @@
"dependencies": {
"prop-types": "^15.5.10",
"react-select": "^1.0.0-rc.5",
"strapi-helper-plugin": "3.0.0-alpha.6.4"
"strapi-helper-plugin": "3.0.0-alpha.6.7"
},
"devDependencies": {
"cross-env": "^5.1.1",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-content-type-builder",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Strapi plugin to create content type (API).",
"strapi": {
"name": "Content Type Builder",
@ -32,9 +32,9 @@
"react-dom": "^15.6.1",
"react-transition-group": "^1.2.0",
"reactstrap": "^4.8.0",
"strapi-generate": "3.0.0-alpha.6.4",
"strapi-generate-api": "3.0.0-alpha.6.4",
"strapi-helper-plugin": "3.0.0-alpha.6.4"
"strapi-generate": "3.0.0-alpha.6.7",
"strapi-generate-api": "3.0.0-alpha.6.7",
"strapi-helper-plugin": "3.0.0-alpha.6.7"
},
"devDependencies": {
"cross-env": "^5.1.1",

View File

@ -27,7 +27,7 @@ export function checkFormValidity(formData, formValidations, formErrors) {
}
// If section is disabled don't need further checks
if (includes(key, 'enabled') && !value) return false;
if (includes(key, 'enabled') && !value || !valueValidations) return false;
forEach(valueValidations.nestedValidations, (nestedValidations) => {
if (nestedValidations.validations.required && !has(formData, nestedValidations.target)) {

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-settings-manager",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Strapi plugin to manage settings.",
"strapi": {
"name": "Settings Manager",
@ -31,7 +31,7 @@
"react-select": "^1.0.0-rc.5",
"react-transition-group": "^1.2.0",
"reactstrap": "^4.8.0",
"strapi-helper-plugin": "3.0.0-alpha.6.4"
"strapi-helper-plugin": "3.0.0-alpha.6.7"
},
"devDependencies": {
"cross-env": "^5.1.1",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-redis",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Redis hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@ -18,7 +18,7 @@
"ioredis": "^3.1.2",
"lodash": "^4.17.4",
"stack-trace": "0.0.10",
"strapi-utils": "3.0.0-alpha.6.4"
"strapi-utils": "3.0.0-alpha.6.7"
},
"strapi": {
"isHook": true

View File

@ -1,6 +1,6 @@
{
"name": "strapi-utils",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "Shared utilities for the Strapi packages",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -8,7 +8,7 @@
// Node.js core.
const { exec } = require('child_process');
const fs = require('fs');
const fs = require('fs-extra');
const path = require('path');
// Logger.
@ -55,7 +55,7 @@ module.exports = function (plugin, cliArguments) {
logger.debug('Installing the plugin from npm registry.');
// Install the plugin from the npm registry.
exec(`npm install ${pluginId}@alpha --ignore-scripts --no-save`, (err) => {
exec(`npm install ${pluginId}@alpha --ignore-scripts --no-save --prefix ${pluginPath}`, (err) => {
if (err) {
logger.error(`An error occurred during plugin installation. \nPlease make sure this plugin is available on npm: https://www.npmjs.com/package/${pluginId}`);
process.exit(1);
@ -69,7 +69,7 @@ module.exports = function (plugin, cliArguments) {
logger.debug(`Moving the \`node_modules/${pluginId}\` folder to the \`./plugins\` folder.`);
// Move the plugin from the `node_modules` folder to the `./plugins` folder.
fs.renameSync(`./node_modules/${pluginId}`, pluginPath);
fs.copySync(`${pluginPath}/node_modules/${pluginId}`, pluginPath);
// Success.
logger.info('The plugin has been successfully installed.');

View File

@ -114,6 +114,8 @@ class Strapi extends EventEmitter {
cb();
}
});
utils.usage.call(this);
} catch (e) {
this.log.debug(`Server wasn't able to start properly.`);
this.log.error(e);

View File

@ -64,6 +64,7 @@ module.exports.nested = function() {
module.exports.app = async function() {
// 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.node = process.versions.node;

View File

@ -1,9 +1,13 @@
'use strict';
// Dependencies.
const fs = require('fs');
const path = require('path');
const { map } = require('async');
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 = {
loadFile: function(url) {
@ -97,5 +101,17 @@ module.exports = {
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.
}
}
};

View File

@ -14,6 +14,7 @@ const _ = require('lodash');
// Define files/dir paths
const pluginsDirPath = path.join(process.cwd(), 'plugins');
const adminDirPath = path.join(process.cwd(), 'admin');
const plugins = fs.readdirSync(pluginsDirPath);
// Install dependencies for each plugins
@ -28,3 +29,12 @@ _.forEach(plugins, plugin => {
console.log(err);
}
});
// Install admin dependencies
console.log(`Install admin dependencies...`);
try {
exec(`cd ${adminDirPath} && npm install --prod --ignore-scripts`);
} catch (err) {
console.log(err);
}

View File

@ -1,6 +1,6 @@
{
"name": "strapi",
"version": "3.0.0-alpha.6.4",
"version": "3.0.0-alpha.6.7",
"description": "An open source solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier.",
"homepage": "http://strapi.io",
"keywords": [
@ -49,16 +49,17 @@
"koa-session": "^5.5.0",
"koa-static": "^4.0.1",
"lodash": "^4.16.5",
"node-fetch": "^1.7.3",
"node-schedule": "^1.2.0",
"semver": "^5.4.1",
"stack-trace": "0.0.10",
"strapi-generate": "3.0.0-alpha.6.4",
"strapi-generate-admin": "3.0.0-alpha.6.4",
"strapi-generate-api": "3.0.0-alpha.6.4",
"strapi-generate-new": "3.0.0-alpha.6.4",
"strapi-generate-policy": "3.0.0-alpha.6.4",
"strapi-generate-service": "3.0.0-alpha.6.4",
"strapi-utils": "3.0.0-alpha.6.4"
"strapi-generate": "3.0.0-alpha.6.7",
"strapi-generate-admin": "3.0.0-alpha.6.7",
"strapi-generate-api": "3.0.0-alpha.6.7",
"strapi-generate-new": "3.0.0-alpha.6.7",
"strapi-generate-policy": "3.0.0-alpha.6.7",
"strapi-generate-service": "3.0.0-alpha.6.7",
"strapi-utils": "3.0.0-alpha.6.7"
},
"author": {
"email": "hi@strapi.io",