Merge branch 'master' into patch-1

This commit is contained in:
Alexandre BODIN 2019-06-14 23:54:44 +02:00 committed by GitHub
commit e6d6ec2c2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 119 additions and 120 deletions

View File

@ -6,7 +6,7 @@ Strapi comes with a full featured Command Line Interface (CLI) which lets you sc
## strapi new
Create a new project
Create a new project.
```bash
strapi new <name>
@ -33,33 +33,33 @@ options: [--debug|--quickstart|--dbclient=<dbclient> --dbhost=<dbhost> --dbport=
## strapi develop|dev
Start a Strapi application with autoReload activated.
Start a Strapi application with autoReload enabled.
Strapi modifies/creates files at runtime and needs to restart when new files are created. To achieve this, `strapi develop` adds a file watcher and restarts the application when necessary.
::: note
You should never use this command to run a Strapi application in production
You should never use this command to run a Strapi application in production.
:::
## strapi start
Start a Strapi application without autoReloading.
Start a Strapi application with autoReload disabled.
This commands is there to run a Strapi application without restarts and file writes (aimed at production usage).
When run certain features are disabled because they require application restarts.
Certain features are disabled in the `strapi start` mode because they require application restarts.
::: note
You can specify a NODE_ENV to use the configurations in the `./config/envrionments` folder (e.g development|staging|production)
By default the `development` envrionment will be used
You can specify a NODE_ENV to use the configurations in the `./config/environments/[development|staging|production]` folder.
By default the `development` envrionment will be used.
:::
## strapi build
Builds your admin panel
Builds your admin panel.
::: note
You can specify a NODE_ENV to use the configurations in the `./config/envrionments` folder (e.g development|staging|production)
By default the `development` envrionment will be used
You can specify a NODE_ENV to use the configurations in the `./config/environments/[development|staging|production]` folder.
By default the `development` envrionment will be used.
:::
## strapi generate:api
@ -96,7 +96,7 @@ The first letter of the filename will be uppercased.
## strapi generate:controller
Create a new controller
Create a new controller.
```bash
strapi generate:controller <name>
@ -123,7 +123,7 @@ The first letter of the filename will be uppercased.
## strapi generate:model
Create a new model
Create a new model.
```bash
strapi generate:model <name> [<attribute:type>]
@ -159,7 +159,7 @@ The first letter of the filename will be uppercased.
## strapi generate:service
Create a new service
Create a new service.
```bash
strapi generate:service <name>
@ -186,7 +186,7 @@ The first letter of the filename will be uppercased.
## strapi generate:policy
Create a new policy
Create a new policy.
```bash
strapi generate:policy <name>

View File

@ -294,7 +294,7 @@ module.exports = {
.populate('author');
// Send the list of users.
ctx.body = users;
ctx.body = articles;
}
}
```

View File

@ -11,7 +11,7 @@ When you create a new Content type or a new model. You will see a new empty serv
Here are the core methods (and their current implementation).
You can simply copy and paste this code to your own service file to customize the methods.
Youc an read about `strapi.query` calls [here](./queries.md)
You can read about `strapi.query` calls [here](./queries.md)
::: warning
In the following example your controller, service and model is named `product`

View File

@ -1,7 +1,7 @@
{
"name": "getstarted",
"private": true,
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "A Strapi application.",
"scripts": {
"develop": "strapi develop",
@ -14,22 +14,25 @@
"lodash": "^4.17.5",
"pg": "^7.10.0",
"sqlite3": "^4.0.6",
"strapi": "3.0.0-beta.4",
"strapi-admin": "3.0.0-beta.4",
"strapi-hook-bookshelf": "3.0.0-beta.4",
"strapi-hook-knex": "3.0.0-beta.4",
"strapi-middleware-views": "3.0.0-beta.4",
"strapi-plugin-content-manager": "3.0.0-beta.4",
"strapi-plugin-content-type-builder": "3.0.0-beta.4",
"strapi-plugin-documentation": "3.0.0-beta.4",
"strapi-plugin-email": "3.0.0-beta.4",
"strapi-plugin-graphql": "3.0.0-beta.4",
"strapi-plugin-settings-manager": "3.0.0-beta.4",
"strapi-plugin-upload": "3.0.0-beta.4",
"strapi-plugin-users-permissions": "3.0.0-beta.4",
"strapi-provider-email-mailgun": "3.0.0-beta.4",
"strapi-provider-upload-aws-s3": "3.0.0-beta.4",
"strapi-utils": "3.0.0-beta.4"
"strapi": "3.0.0-beta.5",
"strapi-admin": "3.0.0-beta.5",
"strapi-hook-bookshelf": "3.0.0-beta.5",
"strapi-hook-knex": "3.0.0-beta.5",
"strapi-middleware-views": "3.0.0-beta.5",
"strapi-plugin-content-manager": "3.0.0-beta.5",
"strapi-plugin-content-type-builder": "3.0.0-beta.5",
"strapi-plugin-documentation": "3.0.0-beta.5",
"strapi-plugin-email": "3.0.0-beta.5",
"strapi-plugin-graphql": "3.0.0-beta.5",
"strapi-plugin-settings-manager": "3.0.0-beta.5",
"strapi-plugin-upload": "3.0.0-beta.5",
"strapi-plugin-users-permissions": "3.0.0-beta.5",
"strapi-provider-email-mailgun": "3.0.0-beta.5",
"strapi-provider-upload-aws-s3": "3.0.0-beta.5",
"strapi-utils": "3.0.0-beta.5"
},
"strapi": {
"uuid": "getstarted"
},
"engines": {
"node": "^10.0.0",

View File

@ -1,5 +1,5 @@
{
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"packages": [
"packages/*",
"examples/*"

View File

@ -1,6 +1,6 @@
{
"name": "strapi-admin",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Strapi Admin",
"repository": {
"type": "git",
@ -73,8 +73,8 @@
"sanitize.css": "^4.1.0",
"sass-loader": "^7.1.0",
"shelljs": "^0.7.8",
"strapi-helper-plugin": "3.0.0-beta.4",
"strapi-utils": "3.0.0-beta.4",
"strapi-helper-plugin": "3.0.0-beta.5",
"strapi-utils": "3.0.0-beta.5",
"style-loader": "^0.23.1",
"styled-components": "^4.2.0",
"terser-webpack-plugin": "^1.2.3",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-api",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"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-beta.4",
"version": "3.0.0-beta.5",
"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-beta.4",
"version": "3.0.0-beta.5",
"description": "Generate a model for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -47,18 +47,6 @@ module.exports = async (scope, cb) => {
cb(err);
}
loader.start('Building your admin UI ...');
try {
await execa('npm', ['run', 'build'], {
cwd: scope.rootPath,
});
loader.succeed();
} catch (err) {
loader.fail();
trackSuccess('didNotBuildAdminUI', scope);
cb(err);
}
trackSuccess('didCreateProject', scope);
console.log();

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-new",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Generate a new Strapi application.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-plugin",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"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-beta.4",
"version": "3.0.0-beta.5",
"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-beta.4",
"version": "3.0.0-beta.5",
"description": "Generate a service for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Master of ceremonies for the Strapi generators.",
"homepage": "http://strapi.io",
"keywords": [
@ -20,7 +20,7 @@
"fs-extra": "^8.0.1",
"lodash": "^4.17.11",
"reportback": "^2.0.2",
"strapi-utils": "3.0.0-beta.4"
"strapi-utils": "3.0.0-beta.5"
},
"author": {
"name": "Strapi team",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-helper-plugin",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Helper for Strapi plugins development",
"files": [
"dist"

View File

@ -1,6 +1,6 @@
{
"name": "strapi-hook-bookshelf",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Bookshelf hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@ -21,8 +21,8 @@
"lodash": "^4.17.11",
"pluralize": "^7.0.0",
"rimraf": "^2.6.3",
"strapi-hook-knex": "3.0.0-beta.4",
"strapi-utils": "3.0.0-beta.4"
"strapi-hook-knex": "3.0.0-beta.5",
"strapi-utils": "3.0.0-beta.5"
},
"strapi": {
"dependencies": [

View File

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

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "strapi-hook-mongoose",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Mongoose hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@ -20,7 +20,7 @@
"mongoose-float": "^1.0.4",
"pluralize": "^7.0.0",
"rimraf": "^2.6.3",
"strapi-utils": "3.0.0-beta.4"
"strapi-utils": "3.0.0-beta.5"
},
"author": {
"email": "hi@strapi.io",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-hook-redis",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Redis hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@ -19,7 +19,7 @@
"lodash": "^4.17.11",
"rimraf": "^2.6.3",
"stack-trace": "0.0.10",
"strapi-utils": "3.0.0-beta.4"
"strapi-utils": "3.0.0-beta.5"
},
"author": {
"email": "hi@strapi.io",

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-content-manager",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "A powerful UI to easily manage your data.",
"strapi": {
"name": "Content Manager",
@ -32,8 +32,8 @@
"redux-immutable": "^4.0.0",
"reselect": "^3.0.1",
"showdown": "^1.9.0",
"strapi-helper-plugin": "3.0.0-beta.4",
"strapi-utils": "3.0.0-beta.4",
"strapi-helper-plugin": "3.0.0-beta.5",
"strapi-utils": "3.0.0-beta.5",
"styled-components": "^4.2.0"
},
"author": {

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-content-type-builder",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Strapi plugin to create content type (API).",
"strapi": {
"name": "Content Type Builder",
@ -28,9 +28,9 @@
"redux": "^4.0.1",
"redux-immutable": "^4.0.0",
"reselect": "^3.0.1",
"strapi-generate": "3.0.0-beta.4",
"strapi-generate-api": "3.0.0-beta.4",
"strapi-helper-plugin": "3.0.0-beta.4"
"strapi-generate": "3.0.0-beta.5",
"strapi-generate-api": "3.0.0-beta.5",
"strapi-helper-plugin": "3.0.0-beta.5"
},
"author": {
"name": "Strapi team",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-documentation",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "This is the description of the plugin.",
"strapi": {
"name": "Documentation",
@ -33,7 +33,7 @@
"redux": "^4.0.1",
"redux-immutable": "^4.0.0",
"reselect": "^4.0.0",
"strapi-helper-plugin": "3.0.0-beta.4",
"strapi-helper-plugin": "3.0.0-beta.5",
"swagger-ui-dist": "3.22.1"
},
"author": {

View File

@ -10,7 +10,6 @@ const path = require('path');
const _ = require('lodash');
const moment = require('moment');
const pathToRegexp = require('path-to-regexp');
const settings = require('../config/settings.json');
const defaultComponents = require('./utils/components.json');
const form = require('./utils/forms.json');
const parametersOptions = require('./utils/parametersOptions.json');
@ -494,7 +493,7 @@ module.exports = {
const apisDoc = this.retrieveDocumentationFiles(false, version);
const pluginsDoc = this.retrieveDocumentationFiles(true, version);
const appDoc = [...apisDoc, ...pluginsDoc];
const defaultSettings = _.cloneDeep(settings);
const defaultSettings = _.cloneDeep(strapi.plugins.documentation.config);
_.set(defaultSettings, ['info', 'x-generation-date'], moment().format('L LTS'));
_.set(defaultSettings, ['info', 'version'], version);
const tags = appDoc.reduce((acc, current) => {

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-email",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "This is the description of the plugin.",
"strapi": {
"name": "Email",
@ -12,13 +12,13 @@
"test": "echo \"no tests yet\""
},
"dependencies": {
"strapi-provider-email-sendmail": "3.0.0-beta.4",
"strapi-utils": "3.0.0-beta.4"
"strapi-provider-email-sendmail": "3.0.0-beta.5",
"strapi-utils": "3.0.0-beta.5"
},
"devDependencies": {
"react-copy-to-clipboard": "5.0.1",
"rimraf": "^2.6.3",
"strapi-helper-plugin": "3.0.0-beta.4"
"strapi-helper-plugin": "3.0.0-beta.5"
},
"author": {
"name": "Strapi team",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-graphql",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "This is the description of the plugin.",
"strapi": {
"name": "graphql",
@ -23,7 +23,7 @@
"graphql-type-long": "^0.1.1",
"koa-compose": "^4.0.0",
"pluralize": "^7.0.0",
"strapi-utils": "3.0.0-beta.4"
"strapi-utils": "3.0.0-beta.5"
},
"devDependencies": {
"cross-env": "^5.2.0",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-settings-manager",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Strapi plugin to manage settings.",
"strapi": {
"name": "Settings Manager",
@ -27,7 +27,7 @@
"redux": "^4.0.1",
"reselect": "^3.0.1",
"shelljs": "^0.7.8",
"strapi-helper-plugin": "3.0.0-beta.4"
"strapi-helper-plugin": "3.0.0-beta.5"
},
"author": {
"name": "Strapi team",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-upload",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "This is the description of the plugin.",
"strapi": {
"name": "Files Upload",
@ -23,9 +23,9 @@
"react-router-dom": "^5.0.0",
"react-transition-group": "^2.5.0",
"reactstrap": "^5.0.0",
"strapi-helper-plugin": "3.0.0-beta.4",
"strapi-provider-upload-local": "3.0.0-beta.4",
"strapi-utils": "3.0.0-beta.4",
"strapi-helper-plugin": "3.0.0-beta.5",
"strapi-provider-upload-local": "3.0.0-beta.5",
"strapi-utils": "3.0.0-beta.5",
"stream-to-array": "^2.3.0",
"uuid": "^3.2.1"
},

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-users-permissions",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Protect your API with a full-authentication process based on JWT",
"strapi": {
"name": "Roles & Permissions",
@ -32,8 +32,8 @@
"reactstrap": "^5.0.0",
"redux-saga": "^0.16.0",
"request": "^2.83.0",
"strapi-helper-plugin": "3.0.0-beta.4",
"strapi-utils": "3.0.0-beta.4",
"strapi-helper-plugin": "3.0.0-beta.5",
"strapi-utils": "3.0.0-beta.5",
"uuid": "^3.1.0"
},
"author": {

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-email-amazon-ses",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Amazon SES provider for strapi email",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-email-mailgun",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Mailgun provider for strapi email plugin",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-email-sendgrid",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Sendgrid provider for strapi email",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-email-sendmail",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Sendmail provider for strapi email",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-upload-aws-s3",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "AWS S3 provider for strapi upload",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-upload-cloudinary",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Cloudinary provider for strapi upload",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-upload-local",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Local provider for strapi upload",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-upload-rackspace",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Rackspace provider for strapi upload",
"main": "./lib",
"keywords": [],

View File

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

View File

@ -4,6 +4,7 @@
const http = require('http');
const path = require('path');
const { EventEmitter } = require('events');
const fse = require('fs-extra');
const Koa = require('koa');
const _ = require('lodash');
const { logger, models } = require('strapi-utils');
@ -102,6 +103,17 @@ class Strapi extends EventEmitter {
this.fs = createStrapiFs(this);
}
requireProjectBootstrap() {
const bootstrapPath = path.resolve(
this.dir,
'config/functions/bootstrap.js'
);
if (fse.existsSync(bootstrapPath)) {
require(bootstrapPath);
}
}
async start(cb) {
try {
// Emit starting event.

View File

@ -3,7 +3,6 @@
const path = require('path');
const cluster = require('cluster');
const fs = require('fs-extra');
const { cyan } = require('chalk');
const chokidar = require('chokidar');
const execa = require('execa');
@ -18,7 +17,6 @@ module.exports = async function({ build }) {
const dir = process.cwd();
if (build && !fs.existsSync(path.join(dir, 'build'))) {
console.log(`> No ${cyan('build')} dir found. Starting build`);
try {
execa.shellSync('npm run -s build', {
stdio: 'inherit',

View File

@ -30,9 +30,9 @@ module.exports = {
}
},
usage: async function() {
async usage(config) {
try {
if (this.config.uuid) {
if (config.uuid) {
const publicKey = fs.readFileSync(
path.resolve(__dirname, 'resources', 'key.pub')
);
@ -60,7 +60,7 @@ module.exports = {
if (verifier.verify(publicKey, await signedHash.text(), 'hex')) {
return new Promise(resolve => {
vm.runInNewContext(code)(
this.config.uuid,
config.uuid,
exposer(dependencies),
resolve
);

View File

@ -1,6 +1,6 @@
{
"name": "strapi",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"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": [
@ -64,16 +64,15 @@
"resolve-cwd": "^3.0.0",
"rimraf": "^2.6.2",
"shelljs": "^0.8.3",
"strapi-admin": "3.0.0-beta.4",
"strapi-generate": "3.0.0-beta.4",
"strapi-generate-api": "3.0.0-beta.4",
"strapi-generate-controller": "3.0.0-beta.4",
"strapi-generate-model": "3.0.0-beta.4",
"strapi-generate-new": "3.0.0-beta.4",
"strapi-generate-plugin": "3.0.0-beta.4",
"strapi-generate-policy": "3.0.0-beta.4",
"strapi-generate-service": "3.0.0-beta.4",
"strapi-utils": "3.0.0-beta.4"
"strapi-generate": "3.0.0-beta.5",
"strapi-generate-api": "3.0.0-beta.5",
"strapi-generate-controller": "3.0.0-beta.5",
"strapi-generate-model": "3.0.0-beta.5",
"strapi-generate-new": "3.0.0-beta.5",
"strapi-generate-plugin": "3.0.0-beta.5",
"strapi-generate-policy": "3.0.0-beta.5",
"strapi-generate-service": "3.0.0-beta.5",
"strapi-utils": "3.0.0-beta.5"
},
"scripts": {
"test": "jest --verbose",