@strapi/strapi 4.1.6-alpha.0 → 4.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Strapi.js +4 -2
- package/lib/commands/develop.js +3 -0
- package/lib/core/app-configuration/index.js +1 -0
- package/lib/core/bootstrap.js +9 -1
- package/lib/middlewares/session.js +3 -1
- package/lib/services/server/index.js +1 -1
- package/lib/utils/get-dirs.js +3 -3
- package/package.json +12 -12
package/lib/Strapi.js
CHANGED
|
@@ -50,8 +50,8 @@ const LIFECYCLES = {
|
|
|
50
50
|
class Strapi {
|
|
51
51
|
constructor(opts = {}) {
|
|
52
52
|
destroyOnSignal(this);
|
|
53
|
-
|
|
54
|
-
const appConfig = loadConfiguration(
|
|
53
|
+
const rootDir = opts.dir || process.cwd();
|
|
54
|
+
const appConfig = loadConfiguration(rootDir, opts);
|
|
55
55
|
this.container = createContainer(this);
|
|
56
56
|
this.container.register('config', createConfigProvider(appConfig));
|
|
57
57
|
this.container.register('content-types', contentTypesRegistry(this));
|
|
@@ -65,6 +65,8 @@ class Strapi {
|
|
|
65
65
|
this.container.register('apis', apisRegistry(this));
|
|
66
66
|
this.container.register('auth', createAuth(this));
|
|
67
67
|
|
|
68
|
+
this.dirs = utils.getDirs(rootDir, { strapi: this });
|
|
69
|
+
|
|
68
70
|
this.isLoaded = false;
|
|
69
71
|
this.reload = this.reload();
|
|
70
72
|
this.server = createServer(this);
|
package/lib/commands/develop.js
CHANGED
|
@@ -8,6 +8,7 @@ const execa = require('execa');
|
|
|
8
8
|
const { getOr } = require('lodash/fp');
|
|
9
9
|
|
|
10
10
|
const { createLogger } = require('@strapi/logger');
|
|
11
|
+
const { joinBy } = require('@strapi/utils');
|
|
11
12
|
const loadConfiguration = require('../core/app-configuration');
|
|
12
13
|
const strapi = require('../index');
|
|
13
14
|
const buildAdmin = require('./build');
|
|
@@ -131,6 +132,8 @@ function watchFileChanges({ dir, strapiInstance, watchIgnoreFiles, polling }) {
|
|
|
131
132
|
'**/index.html',
|
|
132
133
|
'**/public',
|
|
133
134
|
'**/public/**',
|
|
135
|
+
strapiInstance.dirs.public,
|
|
136
|
+
joinBy('/', strapiInstance.dirs.public, '**'),
|
|
134
137
|
'**/*.db*',
|
|
135
138
|
'**/exports/**',
|
|
136
139
|
...watchIgnoreFiles,
|
package/lib/core/bootstrap.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { getConfigUrls } = require('@strapi/utils');
|
|
4
|
+
const fse = require('fs-extra');
|
|
4
5
|
|
|
5
|
-
module.exports = function({ strapi }) {
|
|
6
|
+
module.exports = async function({ strapi }) {
|
|
6
7
|
strapi.config.port = strapi.config.get('server.port') || strapi.config.port;
|
|
7
8
|
strapi.config.host = strapi.config.get('server.host') || strapi.config.host;
|
|
8
9
|
|
|
@@ -22,4 +23,11 @@ module.exports = function({ strapi }) {
|
|
|
22
23
|
if (!shouldServeAdmin) {
|
|
23
24
|
strapi.config.serveAdminPanel = false;
|
|
24
25
|
}
|
|
26
|
+
|
|
27
|
+
// ensure public repository exists
|
|
28
|
+
if (!(await fse.pathExists(strapi.dirs.public))) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
`The public folder (${strapi.dirs.public}) doesn't exist or is not accessible. Please make sure it exists.`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
25
33
|
};
|
|
@@ -19,7 +19,9 @@ const defaultConfig = {
|
|
|
19
19
|
module.exports = (userConfig, { strapi }) => {
|
|
20
20
|
const keys = strapi.server.app.keys;
|
|
21
21
|
if (!isArray(keys) || isEmpty(keys) || keys.some(isEmpty)) {
|
|
22
|
-
throw new Error(
|
|
22
|
+
throw new Error(
|
|
23
|
+
`App keys are required. Please set app.keys in config/server.js (ex: keys: ['myKeyA', 'myKeyB'])`
|
|
24
|
+
);
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
const config = defaultsDeep(defaultConfig, userConfig);
|
|
@@ -30,7 +30,7 @@ const healthCheck = async ctx => {
|
|
|
30
30
|
const createServer = strapi => {
|
|
31
31
|
const app = createKoaApp({
|
|
32
32
|
proxy: strapi.config.get('server.proxy'),
|
|
33
|
-
keys:
|
|
33
|
+
keys: strapi.config.get('server.app.keys'),
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
const router = new Router();
|
package/lib/utils/get-dirs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { join } = require('path');
|
|
3
|
+
const { join, resolve } = require('path');
|
|
4
4
|
|
|
5
|
-
const getDirs = root => ({
|
|
5
|
+
const getDirs = (root, { strapi }) => ({
|
|
6
6
|
root,
|
|
7
7
|
src: join(root, 'src'),
|
|
8
8
|
api: join(root, 'src', 'api'),
|
|
@@ -11,7 +11,7 @@ const getDirs = root => ({
|
|
|
11
11
|
policies: join(root, 'src', 'policies'),
|
|
12
12
|
middlewares: join(root, 'src', 'middlewares'),
|
|
13
13
|
config: join(root, 'config'),
|
|
14
|
-
public:
|
|
14
|
+
public: resolve(root, strapi.config.get('server.dirs.public')),
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
module.exports = getDirs;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/strapi",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.7",
|
|
4
4
|
"description": "An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -80,16 +80,16 @@
|
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@koa/cors": "3.1.0",
|
|
82
82
|
"@koa/router": "10.1.1",
|
|
83
|
-
"@strapi/admin": "4.1.
|
|
84
|
-
"@strapi/database": "4.1.
|
|
85
|
-
"@strapi/generate-new": "4.1.
|
|
86
|
-
"@strapi/generators": "4.1.
|
|
87
|
-
"@strapi/logger": "4.1.
|
|
88
|
-
"@strapi/plugin-content-manager": "4.1.
|
|
89
|
-
"@strapi/plugin-content-type-builder": "4.1.
|
|
90
|
-
"@strapi/plugin-email": "4.1.
|
|
91
|
-
"@strapi/plugin-upload": "4.1.
|
|
92
|
-
"@strapi/utils": "4.1.
|
|
83
|
+
"@strapi/admin": "4.1.7",
|
|
84
|
+
"@strapi/database": "4.1.7",
|
|
85
|
+
"@strapi/generate-new": "4.1.7",
|
|
86
|
+
"@strapi/generators": "4.1.7",
|
|
87
|
+
"@strapi/logger": "4.1.7",
|
|
88
|
+
"@strapi/plugin-content-manager": "4.1.7",
|
|
89
|
+
"@strapi/plugin-content-type-builder": "4.1.7",
|
|
90
|
+
"@strapi/plugin-email": "4.1.7",
|
|
91
|
+
"@strapi/plugin-upload": "4.1.7",
|
|
92
|
+
"@strapi/utils": "4.1.7",
|
|
93
93
|
"bcryptjs": "2.4.3",
|
|
94
94
|
"boxen": "5.1.2",
|
|
95
95
|
"chalk": "4.1.2",
|
|
@@ -136,5 +136,5 @@
|
|
|
136
136
|
"node": ">=12.22.0 <=16.x.x",
|
|
137
137
|
"npm": ">=6.0.0"
|
|
138
138
|
},
|
|
139
|
-
"gitHead": "
|
|
139
|
+
"gitHead": "1699aac1515f439ed69d0b68a43555c1d497554f"
|
|
140
140
|
}
|