Merge branch 'master' into fix/doc_error

This commit is contained in:
Alexandre BODIN 2019-06-14 23:43:08 +02:00 committed by GitHub
commit e29dc8ce75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 17 deletions

View File

@ -6,7 +6,7 @@ Strapi comes with a full featured Command Line Interface (CLI) which lets you sc
## strapi new ## strapi new
Create a new project Create a new project.
```bash ```bash
strapi new <name> strapi new <name>
@ -33,33 +33,33 @@ options: [--debug|--quickstart|--dbclient=<dbclient> --dbhost=<dbhost> --dbport=
## strapi develop|dev ## 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. 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 ::: 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 ## 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). 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 ::: note
You can specify a NODE_ENV to use the configurations in the `./config/envrionments` folder (e.g development|staging|production) 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 By default the `development` envrionment will be used.
::: :::
## strapi build ## strapi build
Builds your admin panel Builds your admin panel.
::: note ::: note
You can specify a NODE_ENV to use the configurations in the `./config/envrionments` folder (e.g development|staging|production) 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 By default the `development` envrionment will be used.
::: :::
## strapi generate:api ## strapi generate:api
@ -96,7 +96,7 @@ The first letter of the filename will be uppercased.
## strapi generate:controller ## strapi generate:controller
Create a new controller Create a new controller.
```bash ```bash
strapi generate:controller <name> strapi generate:controller <name>
@ -123,7 +123,7 @@ The first letter of the filename will be uppercased.
## strapi generate:model ## strapi generate:model
Create a new model Create a new model.
```bash ```bash
strapi generate:model <name> [<attribute:type>] strapi generate:model <name> [<attribute:type>]
@ -159,7 +159,7 @@ The first letter of the filename will be uppercased.
## strapi generate:service ## strapi generate:service
Create a new service Create a new service.
```bash ```bash
strapi generate:service <name> strapi generate:service <name>
@ -186,7 +186,7 @@ The first letter of the filename will be uppercased.
## strapi generate:policy ## strapi generate:policy
Create a new policy Create a new policy.
```bash ```bash
strapi generate:policy <name> strapi generate:policy <name>

View File

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

View File

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