@strapi/strapi 4.0.1 → 4.0.5
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/bin/strapi.js +0 -1
- package/lib/commands/build.js +3 -4
- package/lib/commands/develop.js +4 -2
- package/lib/core/loaders/plugins/index.js +0 -12
- package/lib/services/metrics/sender.js +2 -2
- package/lib/services/server/policy.js +2 -2
- package/lib/utils/machine-id.js +14 -0
- package/lib/utils/success.js +2 -2
- package/package.json +16 -15
package/bin/strapi.js
CHANGED
|
@@ -133,7 +133,6 @@ program
|
|
|
133
133
|
|
|
134
134
|
program
|
|
135
135
|
.command('build')
|
|
136
|
-
.option('--clean', 'Remove the build and .cache folders', false)
|
|
137
136
|
.option('--no-optimization', 'Build the Administration without assets optimization')
|
|
138
137
|
.description('Builds the strapi admin app')
|
|
139
138
|
.action(getLocalScript('build'));
|
package/lib/commands/build.js
CHANGED
|
@@ -12,7 +12,7 @@ const getEnabledPlugins = require('../core/loaders/plugins/get-enabled-plugins')
|
|
|
12
12
|
/**
|
|
13
13
|
* `$ strapi build`
|
|
14
14
|
*/
|
|
15
|
-
module.exports = async ({
|
|
15
|
+
module.exports = async ({ optimization, forceBuild = true }) => {
|
|
16
16
|
const dir = process.cwd();
|
|
17
17
|
|
|
18
18
|
const strapiInstance = strapi({
|
|
@@ -28,9 +28,8 @@ module.exports = async ({ clean, optimization, forceBuild = true }) => {
|
|
|
28
28
|
|
|
29
29
|
console.log(`Building your admin UI with ${green(env)} configuration ...`);
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
31
|
+
// Always remove the .cache and build folders
|
|
32
|
+
await strapiAdmin.clean({ dir });
|
|
34
33
|
|
|
35
34
|
ee({ dir });
|
|
36
35
|
|
package/lib/commands/develop.js
CHANGED
|
@@ -22,14 +22,14 @@ module.exports = async function({ build, watchAdmin, polling, browser }) {
|
|
|
22
22
|
const logger = createLogger(config.logger, {});
|
|
23
23
|
|
|
24
24
|
try {
|
|
25
|
-
if (cluster.isMaster) {
|
|
25
|
+
if (cluster.isMaster || cluster.isPrimary) {
|
|
26
26
|
const serveAdminPanel = getOr(true, 'admin.serveAdminPanel')(config);
|
|
27
27
|
|
|
28
28
|
const buildExists = fs.existsSync(path.join(dir, 'build'));
|
|
29
29
|
// Don't run the build process if the admin is in watch mode
|
|
30
30
|
if (build && !watchAdmin && serveAdminPanel && !buildExists) {
|
|
31
31
|
try {
|
|
32
|
-
await buildAdmin({
|
|
32
|
+
await buildAdmin({ optimization: false, forceBuild: false });
|
|
33
33
|
} catch (err) {
|
|
34
34
|
process.exit(1);
|
|
35
35
|
}
|
|
@@ -126,6 +126,8 @@ function watchFileChanges({ dir, strapiInstance, watchIgnoreFiles, polling }) {
|
|
|
126
126
|
'**/node_modules',
|
|
127
127
|
'**/node_modules/**',
|
|
128
128
|
'**/plugins.json',
|
|
129
|
+
'**/build',
|
|
130
|
+
'**/build/**',
|
|
129
131
|
'**/index.html',
|
|
130
132
|
'**/public',
|
|
131
133
|
'**/public/**',
|
|
@@ -55,17 +55,6 @@ const applyUserExtension = async plugins => {
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
const formatContentTypes = plugins => {
|
|
59
|
-
for (const pluginName in plugins) {
|
|
60
|
-
const plugin = plugins[pluginName];
|
|
61
|
-
for (const contentTypeName in plugin.contentTypes) {
|
|
62
|
-
const ctSchema = plugin.contentTypes[contentTypeName].schema;
|
|
63
|
-
ctSchema.plugin = pluginName;
|
|
64
|
-
ctSchema.uid = `plugin::${pluginName}.${ctSchema.singularName}`;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
58
|
const applyUserConfig = async plugins => {
|
|
70
59
|
const userPluginsConfig = await getUserPluginsConfig();
|
|
71
60
|
|
|
@@ -111,7 +100,6 @@ const loadPlugins = async strapi => {
|
|
|
111
100
|
// TODO: validate plugin format
|
|
112
101
|
await applyUserConfig(plugins);
|
|
113
102
|
await applyUserExtension(plugins);
|
|
114
|
-
formatContentTypes(plugins);
|
|
115
103
|
|
|
116
104
|
for (const pluginName in plugins) {
|
|
117
105
|
strapi.container.get('plugins').add(pluginName, plugins[pluginName]);
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
const os = require('os');
|
|
4
4
|
const _ = require('lodash');
|
|
5
5
|
const isDocker = require('is-docker');
|
|
6
|
-
const { machineIdSync } = require('node-machine-id');
|
|
7
6
|
const fetch = require('node-fetch');
|
|
8
7
|
const ciEnv = require('ci-info');
|
|
9
8
|
const ee = require('../../utils/ee');
|
|
9
|
+
const machineID = require('../../utils/machine-id');
|
|
10
10
|
const stringifyDeep = require('./stringify-deep');
|
|
11
11
|
|
|
12
12
|
const defaultQueryOpts = {
|
|
@@ -33,7 +33,7 @@ const addPackageJsonStrapiMetadata = (metadata, strapi) => {
|
|
|
33
33
|
*/
|
|
34
34
|
module.exports = strapi => {
|
|
35
35
|
const { uuid } = strapi.config;
|
|
36
|
-
const deviceId =
|
|
36
|
+
const deviceId = machineID();
|
|
37
37
|
const isEE = strapi.EE === true && ee.isEE === true;
|
|
38
38
|
|
|
39
39
|
const anonymous_metadata = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { propOr } = require('lodash/fp');
|
|
4
|
-
const {
|
|
4
|
+
const { PolicyError } = require('@strapi/utils').errors;
|
|
5
5
|
const { policy: policyUtils } = require('@strapi/utils');
|
|
6
6
|
|
|
7
7
|
const getPoliciesConfig = propOr([], 'config.policies');
|
|
@@ -17,7 +17,7 @@ const resolvePolicies = route => {
|
|
|
17
17
|
const result = await handler(context, config, { strapi });
|
|
18
18
|
|
|
19
19
|
if (![true, undefined].includes(result)) {
|
|
20
|
-
throw new
|
|
20
|
+
throw new PolicyError();
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { machineIdSync } = require('node-machine-id');
|
|
4
|
+
const uuid = require('uuid');
|
|
5
|
+
|
|
6
|
+
module.exports = () => {
|
|
7
|
+
try {
|
|
8
|
+
const deviceId = machineIdSync();
|
|
9
|
+
return deviceId;
|
|
10
|
+
} catch (error) {
|
|
11
|
+
const deviceId = uuid();
|
|
12
|
+
return deviceId;
|
|
13
|
+
}
|
|
14
|
+
};
|
package/lib/utils/success.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
const fetch = require('node-fetch');
|
|
8
|
-
const
|
|
8
|
+
const machineID = require('./machine-id');
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
11
|
* No need to worry about this file, we only retrieve anonymous data here.
|
|
@@ -21,7 +21,7 @@ try {
|
|
|
21
21
|
method: 'POST',
|
|
22
22
|
body: JSON.stringify({
|
|
23
23
|
event: 'didInstallStrapi',
|
|
24
|
-
deviceId:
|
|
24
|
+
deviceId: machineID(),
|
|
25
25
|
}),
|
|
26
26
|
headers: { 'Content-Type': 'application/json' },
|
|
27
27
|
}).catch(() => {});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/strapi",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
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,22 +80,22 @@
|
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@koa/cors": "3.1.0",
|
|
82
82
|
"@koa/router": "10.1.1",
|
|
83
|
-
"@strapi/admin": "4.0.
|
|
84
|
-
"@strapi/database": "4.0.
|
|
85
|
-
"@strapi/generate-new": "4.0.
|
|
86
|
-
"@strapi/generators": "4.0.
|
|
87
|
-
"@strapi/logger": "4.0.
|
|
88
|
-
"@strapi/plugin-content-manager": "4.0.
|
|
89
|
-
"@strapi/plugin-content-type-builder": "4.0.
|
|
90
|
-
"@strapi/plugin-email": "4.0.
|
|
91
|
-
"@strapi/plugin-upload": "4.0.
|
|
92
|
-
"@strapi/utils": "4.0.
|
|
83
|
+
"@strapi/admin": "4.0.5",
|
|
84
|
+
"@strapi/database": "4.0.5",
|
|
85
|
+
"@strapi/generate-new": "4.0.5",
|
|
86
|
+
"@strapi/generators": "4.0.5",
|
|
87
|
+
"@strapi/logger": "4.0.5",
|
|
88
|
+
"@strapi/plugin-content-manager": "4.0.5",
|
|
89
|
+
"@strapi/plugin-content-type-builder": "4.0.5",
|
|
90
|
+
"@strapi/plugin-email": "4.0.5",
|
|
91
|
+
"@strapi/plugin-upload": "4.0.5",
|
|
92
|
+
"@strapi/utils": "4.0.5",
|
|
93
93
|
"bcryptjs": "2.4.3",
|
|
94
94
|
"boxen": "5.1.2",
|
|
95
95
|
"chalk": "4.1.2",
|
|
96
96
|
"chokidar": "3.5.2",
|
|
97
97
|
"ci-info": "3.2.0",
|
|
98
|
-
"cli-table3": "0.6.
|
|
98
|
+
"cli-table3": "0.6.1",
|
|
99
99
|
"commander": "8.2.0",
|
|
100
100
|
"configstore": "5.0.1",
|
|
101
101
|
"debug": "4.3.2",
|
|
@@ -126,14 +126,15 @@
|
|
|
126
126
|
"qs": "6.10.1",
|
|
127
127
|
"resolve-cwd": "3.0.0",
|
|
128
128
|
"semver": "7.3.5",
|
|
129
|
-
"statuses": "2.0.1"
|
|
129
|
+
"statuses": "2.0.1",
|
|
130
|
+
"uuid": "^3.3.2"
|
|
130
131
|
},
|
|
131
132
|
"devDependencies": {
|
|
132
133
|
"supertest": "^6.1.6"
|
|
133
134
|
},
|
|
134
135
|
"engines": {
|
|
135
|
-
"node": ">=12.
|
|
136
|
+
"node": ">=12.22.0 <=16.x.x",
|
|
136
137
|
"npm": ">=6.0.0"
|
|
137
138
|
},
|
|
138
|
-
"gitHead": "
|
|
139
|
+
"gitHead": "45020eee065af8917011cc43398f95c4c624d6ad"
|
|
139
140
|
}
|