@strapi/strapi 4.2.0 → 4.2.3
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
CHANGED
|
@@ -230,7 +230,13 @@ program
|
|
|
230
230
|
// `$ strapi opt-out-telemetry`
|
|
231
231
|
program
|
|
232
232
|
.command('telemetry:disable')
|
|
233
|
-
.description('
|
|
233
|
+
.description('Disable anonymous telemetry and metadata sending to Strapi analytics')
|
|
234
234
|
.action(getLocalScript('opt-out-telemetry'));
|
|
235
235
|
|
|
236
|
+
// `$ strapi opt-in-telemetry`
|
|
237
|
+
program
|
|
238
|
+
.command('telemetry:enable')
|
|
239
|
+
.description('Enable anonymous telemetry and metadata sending to Strapi analytics')
|
|
240
|
+
.action(getLocalScript('opt-in-telemetry'));
|
|
241
|
+
|
|
236
242
|
program.parseAsync(process.argv);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { resolve } = require('path');
|
|
4
|
+
const fse = require('fs-extra');
|
|
5
|
+
const chalk = require('chalk');
|
|
6
|
+
const fetch = require('node-fetch');
|
|
7
|
+
const { v4: uuidv4 } = require('uuid');
|
|
8
|
+
const machineID = require('../utils/machine-id');
|
|
9
|
+
|
|
10
|
+
const readPackageJSON = async path => {
|
|
11
|
+
try {
|
|
12
|
+
const packageObj = await fse.readJson(path);
|
|
13
|
+
return packageObj;
|
|
14
|
+
} catch (err) {
|
|
15
|
+
console.error(`${chalk.red('Error')}: ${err.message}`);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const writePackageJSON = async (path, file, spacing) => {
|
|
20
|
+
try {
|
|
21
|
+
await fse.writeJson(path, file, { spaces: spacing });
|
|
22
|
+
return true;
|
|
23
|
+
} catch (err) {
|
|
24
|
+
console.error(`${chalk.red('Error')}: ${err.message}`);
|
|
25
|
+
console.log(
|
|
26
|
+
`${chalk.yellow(
|
|
27
|
+
'Warning'
|
|
28
|
+
)}: There has been an error, please set "telemetryDisabled": false in the "strapi" object of your package.json manually.`
|
|
29
|
+
);
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const generateNewPackageJSON = packageObj => {
|
|
35
|
+
if (!packageObj.strapi) {
|
|
36
|
+
return {
|
|
37
|
+
...packageObj,
|
|
38
|
+
strapi: {
|
|
39
|
+
uuid: uuidv4(),
|
|
40
|
+
telemetryDisabled: false,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
} else {
|
|
44
|
+
return {
|
|
45
|
+
...packageObj,
|
|
46
|
+
strapi: {
|
|
47
|
+
...packageObj.strapi,
|
|
48
|
+
uuid: packageObj.strapi.uuid ? packageObj.strapi.uuid : uuidv4(),
|
|
49
|
+
telemetryDisabled: false,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const sendEvent = async uuid => {
|
|
56
|
+
try {
|
|
57
|
+
await fetch('https://analytics.strapi.io/track', {
|
|
58
|
+
method: 'POST',
|
|
59
|
+
body: JSON.stringify({
|
|
60
|
+
event: 'didOptInTelemetry',
|
|
61
|
+
uuid,
|
|
62
|
+
deviceId: machineID(),
|
|
63
|
+
}),
|
|
64
|
+
headers: { 'Content-Type': 'application/json' },
|
|
65
|
+
});
|
|
66
|
+
} catch (e) {
|
|
67
|
+
//...
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
module.exports = async function optInTelemetry() {
|
|
72
|
+
const packageJSONPath = resolve(process.cwd(), 'package.json');
|
|
73
|
+
const exists = await fse.pathExists(packageJSONPath);
|
|
74
|
+
|
|
75
|
+
if (!exists) {
|
|
76
|
+
console.log(`${chalk.yellow('Warning')}: could not find package.json`);
|
|
77
|
+
process.exit(0);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const packageObj = await readPackageJSON(packageJSONPath);
|
|
81
|
+
|
|
82
|
+
if (packageObj.strapi && packageObj.strapi.uuid) {
|
|
83
|
+
if (packageObj.strapi.telemetryDisabled === false) {
|
|
84
|
+
console.log(`${chalk.yellow('Warning:')} telemetry is already enabled`);
|
|
85
|
+
process.exit(0);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const updatedPackageJSON = generateNewPackageJSON(packageObj);
|
|
90
|
+
|
|
91
|
+
const write = await writePackageJSON(packageJSONPath, updatedPackageJSON, 2);
|
|
92
|
+
|
|
93
|
+
if (!write) {
|
|
94
|
+
process.exit(0);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
await sendEvent(updatedPackageJSON.strapi.uuid);
|
|
98
|
+
console.log(`${chalk.green('Successfully opted into and enabled Strapi telemetry')}`);
|
|
99
|
+
process.exit(0);
|
|
100
|
+
};
|
|
@@ -4,12 +4,14 @@ const path = require('path');
|
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const loadFile = require('./load-config-file');
|
|
6
6
|
|
|
7
|
+
const VALID_EXTENSIONS = ['.js', '.json'];
|
|
8
|
+
|
|
7
9
|
module.exports = dir => {
|
|
8
10
|
if (!fs.existsSync(dir)) return {};
|
|
9
11
|
|
|
10
12
|
return fs
|
|
11
13
|
.readdirSync(dir, { withFileTypes: true })
|
|
12
|
-
.filter(file => file.isFile())
|
|
14
|
+
.filter(file => file.isFile() && VALID_EXTENSIONS.includes(path.extname(file.name)))
|
|
13
15
|
.reduce((acc, file) => {
|
|
14
16
|
const key = path.basename(file.name, path.extname(file.name));
|
|
15
17
|
|
|
@@ -29,7 +29,7 @@ class WebhookRunner {
|
|
|
29
29
|
|
|
30
30
|
this.config = _.merge(defaultConfiguration, configuration);
|
|
31
31
|
|
|
32
|
-
this.queue = new WorkerQueue({ logger,
|
|
32
|
+
this.queue = new WorkerQueue({ logger, concurrency: 5 });
|
|
33
33
|
this.queue.subscribe(this.executeListener.bind(this));
|
|
34
34
|
}
|
|
35
35
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/strapi",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.3",
|
|
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.2.
|
|
84
|
-
"@strapi/database": "4.2.
|
|
85
|
-
"@strapi/generate-new": "4.2.
|
|
86
|
-
"@strapi/generators": "4.2.
|
|
87
|
-
"@strapi/logger": "4.2.
|
|
88
|
-
"@strapi/plugin-content-manager": "4.2.
|
|
89
|
-
"@strapi/plugin-content-type-builder": "4.2.
|
|
90
|
-
"@strapi/plugin-email": "4.2.
|
|
91
|
-
"@strapi/plugin-upload": "4.2.
|
|
92
|
-
"@strapi/utils": "4.2.
|
|
83
|
+
"@strapi/admin": "4.2.3",
|
|
84
|
+
"@strapi/database": "4.2.3",
|
|
85
|
+
"@strapi/generate-new": "4.2.3",
|
|
86
|
+
"@strapi/generators": "4.2.3",
|
|
87
|
+
"@strapi/logger": "4.2.3",
|
|
88
|
+
"@strapi/plugin-content-manager": "4.2.3",
|
|
89
|
+
"@strapi/plugin-content-type-builder": "4.2.3",
|
|
90
|
+
"@strapi/plugin-email": "4.2.3",
|
|
91
|
+
"@strapi/plugin-upload": "4.2.3",
|
|
92
|
+
"@strapi/utils": "4.2.3",
|
|
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.2",
|
|
99
99
|
"commander": "8.2.0",
|
|
100
100
|
"configstore": "5.0.1",
|
|
101
101
|
"debug": "4.3.2",
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
"execa": "5.1.1",
|
|
105
105
|
"fs-extra": "10.0.0",
|
|
106
106
|
"glob": "7.2.0",
|
|
107
|
-
"http-errors": "1.8.
|
|
108
|
-
"inquirer": "8.2.
|
|
107
|
+
"http-errors": "1.8.1",
|
|
108
|
+
"inquirer": "8.2.4",
|
|
109
109
|
"is-docker": "2.2.1",
|
|
110
110
|
"koa": "2.13.3",
|
|
111
111
|
"koa-body": "4.2.0",
|
|
@@ -121,21 +121,21 @@
|
|
|
121
121
|
"node-fetch": "2.6.7",
|
|
122
122
|
"node-machine-id": "1.1.12",
|
|
123
123
|
"node-schedule": "2.0.0",
|
|
124
|
-
"open": "8.
|
|
124
|
+
"open": "8.4.0",
|
|
125
125
|
"ora": "5.4.1",
|
|
126
126
|
"package-json": "7.0.0",
|
|
127
127
|
"qs": "6.10.1",
|
|
128
128
|
"resolve-cwd": "3.0.0",
|
|
129
|
-
"semver": "7.3.
|
|
129
|
+
"semver": "7.3.7",
|
|
130
130
|
"statuses": "2.0.1",
|
|
131
131
|
"uuid": "^3.3.2"
|
|
132
132
|
},
|
|
133
133
|
"devDependencies": {
|
|
134
|
-
"supertest": "
|
|
134
|
+
"supertest": "6.2.4"
|
|
135
135
|
},
|
|
136
136
|
"engines": {
|
|
137
137
|
"node": ">=14.19.1 <=16.x.x",
|
|
138
138
|
"npm": ">=6.0.0"
|
|
139
139
|
},
|
|
140
|
-
"gitHead": "
|
|
140
|
+
"gitHead": "fe296baf71cb932d45183d5335285eaf30a6fad6"
|
|
141
141
|
}
|