@strapi/strapi 4.2.0-alpha.9 → 4.2.0-beta.1
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/README.md +2 -3
- package/bin/strapi.js +6 -0
- package/lib/Strapi.js +6 -4
- package/lib/commands/build.js +2 -3
- package/lib/commands/builders/admin.js +4 -3
- package/lib/commands/builders/typescript.js +3 -6
- package/lib/commands/develop.js +8 -3
- package/lib/commands/opt-out-telemetry.js +83 -0
- package/lib/commands/watchAdmin.js +1 -2
- package/lib/core/app-configuration/index.js +5 -3
- package/lib/core/bootstrap.js +9 -1
- package/lib/core/loaders/plugins/get-enabled-plugins.js +1 -6
- package/lib/index.d.ts +1 -1
- package/lib/middlewares/public/index.js +1 -1
- package/lib/middlewares/session.js +3 -1
- package/lib/services/metrics/index.js +7 -1
- package/lib/services/metrics/sender.js +7 -0
- package/lib/services/server/index.js +1 -1
- package/lib/utils/get-dirs.js +5 -4
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -114,8 +114,7 @@ For general help using Strapi, please refer to [the official Strapi documentatio
|
|
|
114
114
|
- [Discord](https://discord.strapi.io) (For live discussion with the Community and Strapi team)
|
|
115
115
|
- [GitHub](https://github.com/strapi/strapi) (Bug reports, Contributions)
|
|
116
116
|
- [Community Forum](https://forum.strapi.io) (Questions and Discussions)
|
|
117
|
-
- [
|
|
118
|
-
- [ProductBoard](https://portal.productboard.com/strapi/tabs/2-under-consideration) (Roadmap, Feature requests)
|
|
117
|
+
- [Roadmap & Feature Requests](https://feedback.strapi.io/)
|
|
119
118
|
- [Twitter](https://twitter.com/strapijs) (Get the news fast)
|
|
120
119
|
- [Facebook](https://www.facebook.com/Strapi-616063331867161)
|
|
121
120
|
- [YouTube Channel](https://www.youtube.com/strapi) (Learn from Video Tutorials)
|
|
@@ -126,7 +125,7 @@ Follow our [migration guides](https://docs.strapi.io/developer-docs/latest/updat
|
|
|
126
125
|
|
|
127
126
|
## Roadmap
|
|
128
127
|
|
|
129
|
-
Check out our [roadmap](https://
|
|
128
|
+
Check out our [roadmap](https://feedback.strapi.io/) to get informed of the latest features released and the upcoming ones. You may also give us insights and vote for a specific feature.
|
|
130
129
|
|
|
131
130
|
## Documentation
|
|
132
131
|
|
package/bin/strapi.js
CHANGED
|
@@ -227,4 +227,10 @@ program
|
|
|
227
227
|
.description('List all the application controllers')
|
|
228
228
|
.action(getLocalScript('controllers/list'));
|
|
229
229
|
|
|
230
|
+
// `$ strapi opt-out-telemetry`
|
|
231
|
+
program
|
|
232
|
+
.command('telemetry:disable')
|
|
233
|
+
.description('Stop Strapi from sending anonymous telemetry and metadata')
|
|
234
|
+
.action(getLocalScript('opt-out-telemetry'));
|
|
235
|
+
|
|
230
236
|
program.parseAsync(process.argv);
|
package/lib/Strapi.js
CHANGED
|
@@ -65,18 +65,17 @@ const resolveWorkingDirectories = opts => {
|
|
|
65
65
|
const appDir = opts.appDir ? path.resolve(cwd, opts.appDir) : cwd;
|
|
66
66
|
const distDir = opts.distDir ? path.resolve(cwd, opts.distDir) : appDir;
|
|
67
67
|
|
|
68
|
-
return { appDir, distDir };
|
|
68
|
+
return { app: appDir, dist: distDir };
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
class Strapi {
|
|
72
72
|
constructor(opts = {}) {
|
|
73
73
|
destroyOnSignal(this);
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
this.dirs = utils.getDirs(resolveWorkingDirectories(opts));
|
|
75
|
+
const rootDirs = resolveWorkingDirectories(opts);
|
|
77
76
|
|
|
78
77
|
// Load the app configuration from the dist directory
|
|
79
|
-
const appConfig = loadConfiguration(
|
|
78
|
+
const appConfig = loadConfiguration({ appDir: rootDirs.app, distDir: rootDirs.dist }, opts);
|
|
80
79
|
|
|
81
80
|
// Instanciate the Strapi container
|
|
82
81
|
this.container = createContainer(this);
|
|
@@ -94,6 +93,9 @@ class Strapi {
|
|
|
94
93
|
this.container.register('apis', apisRegistry(this));
|
|
95
94
|
this.container.register('auth', createAuth(this));
|
|
96
95
|
|
|
96
|
+
// Create a mapping of every useful directory (for the app, dist and static directories)
|
|
97
|
+
this.dirs = utils.getDirs(rootDirs, { strapi: this });
|
|
98
|
+
|
|
97
99
|
// Strapi state management variables
|
|
98
100
|
this.isLoaded = false;
|
|
99
101
|
this.reload = this.reload();
|
package/lib/commands/build.js
CHANGED
|
@@ -11,10 +11,10 @@ module.exports = async ({ optimization, forceBuild = true }) => {
|
|
|
11
11
|
let buildDestDir = process.cwd();
|
|
12
12
|
const srcDir = process.cwd();
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const useTypeScriptServer = await tsUtils.isUsingTypeScript(srcDir);
|
|
15
15
|
|
|
16
16
|
// Typescript
|
|
17
|
-
if (
|
|
17
|
+
if (useTypeScriptServer) {
|
|
18
18
|
await buildTypeScript({ srcDir, watch: false });
|
|
19
19
|
|
|
20
20
|
// Update the dir path for the next steps
|
|
@@ -24,7 +24,6 @@ module.exports = async ({ optimization, forceBuild = true }) => {
|
|
|
24
24
|
await buildAdmin({
|
|
25
25
|
buildDestDir,
|
|
26
26
|
forceBuild,
|
|
27
|
-
isTSProject,
|
|
28
27
|
optimization,
|
|
29
28
|
srcDir,
|
|
30
29
|
});
|
|
@@ -10,10 +10,12 @@ const addSlash = require('../../utils/addSlash');
|
|
|
10
10
|
const strapi = require('../../index');
|
|
11
11
|
const getEnabledPlugins = require('../../core/loaders/plugins/get-enabled-plugins');
|
|
12
12
|
|
|
13
|
-
module.exports = async ({ buildDestDir, forceBuild = true,
|
|
13
|
+
module.exports = async ({ buildDestDir, forceBuild = true, optimization, srcDir }) => {
|
|
14
14
|
const strapiInstance = strapi({
|
|
15
|
-
//
|
|
15
|
+
// Directories
|
|
16
|
+
appDir: srcDir,
|
|
16
17
|
distDir: buildDestDir,
|
|
18
|
+
// Options
|
|
17
19
|
autoReload: true,
|
|
18
20
|
serveAdminPanel: false,
|
|
19
21
|
});
|
|
@@ -46,7 +48,6 @@ module.exports = async ({ buildDestDir, forceBuild = true, isTSProject, optimiza
|
|
|
46
48
|
backend: serverUrl,
|
|
47
49
|
adminPath: addSlash(adminPath),
|
|
48
50
|
},
|
|
49
|
-
useTypeScript: isTSProject,
|
|
50
51
|
})
|
|
51
52
|
.then(() => {
|
|
52
53
|
console.log('Admin UI built successfully');
|
|
@@ -5,8 +5,8 @@ const fs = require('fs-extra');
|
|
|
5
5
|
const tsUtils = require('@strapi/typescript-utils');
|
|
6
6
|
|
|
7
7
|
const cleanupDistDirectory = async distDir => {
|
|
8
|
-
if (!await fs.pathExists(distDir)){
|
|
9
|
-
return
|
|
8
|
+
if (!(await fs.pathExists(distDir))) {
|
|
9
|
+
return;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const dirContent = await fs.readdir(distDir);
|
|
@@ -14,21 +14,18 @@ const cleanupDistDirectory = async distDir => {
|
|
|
14
14
|
// Ignore the admin build folder
|
|
15
15
|
.filter(filename => filename !== 'build');
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
for (const filename of validFilenames) {
|
|
19
18
|
await fs.remove(path.resolve(distDir, filename));
|
|
20
19
|
}
|
|
21
20
|
};
|
|
22
21
|
|
|
23
22
|
module.exports = async ({ srcDir, distDir, watch = false }) => {
|
|
24
|
-
const isTSProject = await tsUtils.
|
|
23
|
+
const isTSProject = await tsUtils.isUsingTypeScript(srcDir);
|
|
25
24
|
|
|
26
25
|
if (!isTSProject) {
|
|
27
26
|
throw new Error(`tsconfig file not found in ${srcDir}`);
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
29
|
await cleanupDistDirectory(distDir);
|
|
33
30
|
|
|
34
31
|
return tsUtils.compile(srcDir, { watch });
|
package/lib/commands/develop.js
CHANGED
|
@@ -6,6 +6,7 @@ const fs = require('fs-extra');
|
|
|
6
6
|
const chokidar = require('chokidar');
|
|
7
7
|
const execa = require('execa');
|
|
8
8
|
const { getOr } = require('lodash/fp');
|
|
9
|
+
const { joinBy } = require('@strapi/utils');
|
|
9
10
|
const tsUtils = require('@strapi/typescript-utils');
|
|
10
11
|
|
|
11
12
|
const loadConfiguration = require('../core/app-configuration');
|
|
@@ -20,7 +21,7 @@ const { buildTypeScript, buildAdmin } = require('./builders');
|
|
|
20
21
|
module.exports = async function({ build, watchAdmin, polling, browser }) {
|
|
21
22
|
const appDir = process.cwd();
|
|
22
23
|
|
|
23
|
-
const isTSProject = await tsUtils.
|
|
24
|
+
const isTSProject = await tsUtils.isUsingTypeScript(appDir);
|
|
24
25
|
const distDir = isTSProject ? path.join(appDir, 'dist') : appDir;
|
|
25
26
|
|
|
26
27
|
try {
|
|
@@ -49,7 +50,7 @@ const primaryProcess = async ({ distDir, appDir, build, isTSProject, watchAdmin,
|
|
|
49
50
|
await buildTypeScript({ srcDir: appDir, distDir, watch: false });
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
const config = loadConfiguration(distDir);
|
|
53
|
+
const config = loadConfiguration({ appDir, distDir });
|
|
53
54
|
const serveAdminPanel = getOr(true, 'admin.serveAdminPanel')(config);
|
|
54
55
|
|
|
55
56
|
const buildExists = fs.existsSync(path.join(distDir, 'build'));
|
|
@@ -60,7 +61,6 @@ const primaryProcess = async ({ distDir, appDir, build, isTSProject, watchAdmin,
|
|
|
60
61
|
await buildAdmin({
|
|
61
62
|
buildDestDir: distDir,
|
|
62
63
|
forceBuild: false,
|
|
63
|
-
isTSProject,
|
|
64
64
|
optimization: false,
|
|
65
65
|
srcDir: appDir,
|
|
66
66
|
});
|
|
@@ -157,6 +157,9 @@ function watchFileChanges({ appDir, strapiInstance, watchIgnoreFiles, polling })
|
|
|
157
157
|
/tmp/,
|
|
158
158
|
'**/src/admin/**',
|
|
159
159
|
'**/src/plugins/**/admin/**',
|
|
160
|
+
// FIXME pass the plugin path to the strapiAdmin.build and strapiAdmin.watch in order to stop copying
|
|
161
|
+
// the FE files when using TS
|
|
162
|
+
'**/dist/src/plugins/test/admin/**',
|
|
160
163
|
'**/documentation',
|
|
161
164
|
'**/documentation/**',
|
|
162
165
|
'**/node_modules',
|
|
@@ -167,6 +170,8 @@ function watchFileChanges({ appDir, strapiInstance, watchIgnoreFiles, polling })
|
|
|
167
170
|
'**/index.html',
|
|
168
171
|
'**/public',
|
|
169
172
|
'**/public/**',
|
|
173
|
+
strapiInstance.dirs.static.public,
|
|
174
|
+
joinBy('/', strapiInstance.dirs.static.public, '**'),
|
|
170
175
|
'**/*.db*',
|
|
171
176
|
'**/exports/**',
|
|
172
177
|
'**/dist/**',
|
|
@@ -0,0 +1,83 @@
|
|
|
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 machineID = require('../utils/machine-id');
|
|
8
|
+
|
|
9
|
+
const readPackageJSON = async path => {
|
|
10
|
+
try {
|
|
11
|
+
const packageObj = await fse.readJson(path);
|
|
12
|
+
const uuid = packageObj.strapi ? packageObj.strapi.uuid : null;
|
|
13
|
+
|
|
14
|
+
return { uuid, packageObj };
|
|
15
|
+
} catch (err) {
|
|
16
|
+
console.error(`${chalk.red('Error')}: ${err.message}`);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const writePackageJSON = async (path, file, spacing) => {
|
|
21
|
+
try {
|
|
22
|
+
await fse.writeJson(path, file, { spaces: spacing });
|
|
23
|
+
return true;
|
|
24
|
+
} catch (err) {
|
|
25
|
+
console.error(`${chalk.red('Error')}: ${err.message}`);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const sendEvent = async uuid => {
|
|
30
|
+
try {
|
|
31
|
+
await fetch('https://analytics.strapi.io/track', {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
body: JSON.stringify({
|
|
34
|
+
event: 'didOptOutTelemetry',
|
|
35
|
+
uuid,
|
|
36
|
+
deviceId: machineID(),
|
|
37
|
+
}),
|
|
38
|
+
headers: { 'Content-Type': 'application/json' },
|
|
39
|
+
});
|
|
40
|
+
} catch (e) {
|
|
41
|
+
//...
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
module.exports = async function optOutTelemetry() {
|
|
46
|
+
const packageJSONPath = resolve(process.cwd(), 'package.json');
|
|
47
|
+
const exists = await fse.pathExists(packageJSONPath);
|
|
48
|
+
|
|
49
|
+
if (!exists) {
|
|
50
|
+
console.log(`${chalk.yellow('Warning')}: could not find package.json`);
|
|
51
|
+
process.exit(0);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { uuid, packageObj } = await readPackageJSON(packageJSONPath);
|
|
55
|
+
|
|
56
|
+
if ((packageObj.strapi && packageObj.strapi.telemetryDisabled) || !uuid) {
|
|
57
|
+
console.log(`${chalk.yellow('Warning:')} telemetry is already disabled`);
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const updatedPackageJSON = {
|
|
62
|
+
...packageObj,
|
|
63
|
+
strapi: {
|
|
64
|
+
...packageObj.strapi,
|
|
65
|
+
telemetryDisabled: true,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const write = await writePackageJSON(packageJSONPath, updatedPackageJSON, 2);
|
|
70
|
+
|
|
71
|
+
if (!write) {
|
|
72
|
+
console.log(
|
|
73
|
+
`${chalk.yellow(
|
|
74
|
+
'Warning'
|
|
75
|
+
)}: There has been an error, please set "telemetryDisabled": true in the "strapi" object of your package.json manually.`
|
|
76
|
+
);
|
|
77
|
+
process.exit(0);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
await sendEvent(uuid);
|
|
81
|
+
console.log(`${chalk.green('Successfully opted out of Strapi telemetry')}`);
|
|
82
|
+
process.exit(0);
|
|
83
|
+
};
|
|
@@ -12,7 +12,7 @@ const strapi = require('../index');
|
|
|
12
12
|
module.exports = async function({ browser }) {
|
|
13
13
|
const currentDirectory = process.cwd();
|
|
14
14
|
|
|
15
|
-
const isTSProject = await tsUtils.
|
|
15
|
+
const isTSProject = await tsUtils.isUsingTypeScript(currentDirectory);
|
|
16
16
|
const buildDestDir = isTSProject ? path.join(currentDirectory, 'dist') : currentDirectory;
|
|
17
17
|
|
|
18
18
|
const strapiInstance = strapi({
|
|
@@ -41,6 +41,5 @@ module.exports = async function({ browser }) {
|
|
|
41
41
|
backend: backendURL,
|
|
42
42
|
adminPath: addSlash(adminPath),
|
|
43
43
|
},
|
|
44
|
-
useTypeScript: isTSProject,
|
|
45
44
|
});
|
|
46
45
|
};
|
|
@@ -21,6 +21,7 @@ const defaultConfig = {
|
|
|
21
21
|
proxy: false,
|
|
22
22
|
cron: { enabled: false },
|
|
23
23
|
admin: { autoOpen: false },
|
|
24
|
+
dirs: { public: './public' },
|
|
24
25
|
},
|
|
25
26
|
admin: {},
|
|
26
27
|
api: {
|
|
@@ -30,12 +31,13 @@ const defaultConfig = {
|
|
|
30
31
|
},
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
module.exports = (
|
|
34
|
+
module.exports = (dirs, initialConfig = {}) => {
|
|
35
|
+
const { appDir, distDir } = dirs;
|
|
34
36
|
const { autoReload = false, serveAdminPanel = true } = initialConfig;
|
|
35
37
|
|
|
36
|
-
const pkgJSON = require(path.resolve(
|
|
38
|
+
const pkgJSON = require(path.resolve(appDir, 'package.json'));
|
|
37
39
|
|
|
38
|
-
const configDir = path.resolve(
|
|
40
|
+
const configDir = path.resolve(distDir || process.cwd(), 'config');
|
|
39
41
|
|
|
40
42
|
const rootConfig = {
|
|
41
43
|
launchedAt: Date.now(),
|
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.static.public))) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
`The public folder (${strapi.dirs.static.public}) doesn't exist or is not accessible. Please make sure it exists.`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
25
33
|
};
|
|
@@ -29,15 +29,11 @@ const toDetailedDeclaration = declaration => {
|
|
|
29
29
|
let detailedDeclaration = pick(['enabled'], declaration);
|
|
30
30
|
if (has('resolve', declaration)) {
|
|
31
31
|
let pathToPlugin = '';
|
|
32
|
-
let appPathToPlugin = '';
|
|
33
32
|
|
|
34
33
|
try {
|
|
35
34
|
pathToPlugin = dirname(require.resolve(declaration.resolve));
|
|
36
|
-
appPathToPlugin = pathToPlugin;
|
|
37
35
|
} catch (e) {
|
|
38
|
-
|
|
39
|
-
pathToPlugin = resolve(strapi.dirs.dist.root, declaration.resolve);
|
|
40
|
-
appPathToPlugin = resolve(strapi.dirs.app.root, declaration.resolve);
|
|
36
|
+
pathToPlugin = resolve(strapi.dirs.app.root, declaration.resolve);
|
|
41
37
|
|
|
42
38
|
if (!existsSync(pathToPlugin) || !statSync(pathToPlugin).isDirectory()) {
|
|
43
39
|
throw new Error(`${declaration.resolve} couldn't be resolved`);
|
|
@@ -45,7 +41,6 @@ const toDetailedDeclaration = declaration => {
|
|
|
45
41
|
}
|
|
46
42
|
|
|
47
43
|
detailedDeclaration.pathToPlugin = pathToPlugin;
|
|
48
|
-
detailedDeclaration.appPathToPlugin = appPathToPlugin;
|
|
49
44
|
}
|
|
50
45
|
return detailedDeclaration;
|
|
51
46
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { EntityService } from './services/entity-service';
|
|
|
3
3
|
import { Strapi as StrapiClass } from './Strapi';
|
|
4
4
|
|
|
5
5
|
export * as factories from './factories';
|
|
6
|
-
interface StrapiInterface extends StrapiClass {
|
|
6
|
+
export interface StrapiInterface extends StrapiClass {
|
|
7
7
|
query: Database['query'];
|
|
8
8
|
entityService: EntityService;
|
|
9
9
|
}
|
|
@@ -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);
|
|
@@ -24,13 +24,19 @@ const LIMITED_EVENTS = [
|
|
|
24
24
|
|
|
25
25
|
const createTelemetryInstance = strapi => {
|
|
26
26
|
const uuid = strapi.config.get('uuid');
|
|
27
|
-
const
|
|
27
|
+
const telemetryDisabled = strapi.config.get('packageJsonStrapi.telemetryDisabled');
|
|
28
|
+
const isDisabled =
|
|
29
|
+
!uuid || isTruthy(process.env.STRAPI_TELEMETRY_DISABLED) || isTruthy(telemetryDisabled);
|
|
28
30
|
|
|
29
31
|
const crons = [];
|
|
30
32
|
const sender = createSender(strapi);
|
|
31
33
|
const sendEvent = wrapWithRateLimit(sender, { limitedEvents: LIMITED_EVENTS });
|
|
32
34
|
|
|
33
35
|
return {
|
|
36
|
+
get isDisabled() {
|
|
37
|
+
return isDisabled;
|
|
38
|
+
},
|
|
39
|
+
|
|
34
40
|
register() {
|
|
35
41
|
if (!isDisabled) {
|
|
36
42
|
const pingCron = scheduleJob('0 0 12 * * *', () => sendEvent('ping'));
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const os = require('os');
|
|
4
|
+
const path = require('path');
|
|
4
5
|
const _ = require('lodash');
|
|
5
6
|
const isDocker = require('is-docker');
|
|
6
7
|
const fetch = require('node-fetch');
|
|
7
8
|
const ciEnv = require('ci-info');
|
|
9
|
+
const { isUsingTypeScriptSync } = require('@strapi/typescript-utils');
|
|
8
10
|
const ee = require('../../utils/ee');
|
|
9
11
|
const machineID = require('../../utils/machine-id');
|
|
10
12
|
const stringifyDeep = require('./stringify-deep');
|
|
@@ -36,6 +38,9 @@ module.exports = strapi => {
|
|
|
36
38
|
const deviceId = machineID();
|
|
37
39
|
const isEE = strapi.EE === true && ee.isEE === true;
|
|
38
40
|
|
|
41
|
+
const serverRootPath = strapi.dirs.app.root;
|
|
42
|
+
const adminRootPath = path.join(strapi.dirs.app.root, 'src', 'admin');
|
|
43
|
+
|
|
39
44
|
const anonymous_metadata = {
|
|
40
45
|
environment: strapi.config.environment,
|
|
41
46
|
os: os.type(),
|
|
@@ -47,6 +52,8 @@ module.exports = strapi => {
|
|
|
47
52
|
version: strapi.config.get('info.strapi'),
|
|
48
53
|
strapiVersion: strapi.config.get('info.strapi'),
|
|
49
54
|
projectType: isEE ? 'Enterprise' : 'Community',
|
|
55
|
+
useTypescriptOnServer: isUsingTypeScriptSync(serverRootPath),
|
|
56
|
+
useTypescriptOnAdmin: isUsingTypeScriptSync(adminRootPath),
|
|
50
57
|
};
|
|
51
58
|
|
|
52
59
|
addPackageJsonStrapiMetadata(anonymous_metadata, strapi);
|
|
@@ -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 = ({ appDir, distDir }) => ({
|
|
5
|
+
const getDirs = ({ app: appDir, dist: distDir }, { strapi }) => ({
|
|
6
6
|
dist: {
|
|
7
7
|
root: distDir,
|
|
8
8
|
src: join(distDir, 'src'),
|
|
@@ -12,7 +12,6 @@ const getDirs = ({ appDir, distDir }) => ({
|
|
|
12
12
|
policies: join(distDir, 'src', 'policies'),
|
|
13
13
|
middlewares: join(distDir, 'src', 'middlewares'),
|
|
14
14
|
config: join(distDir, 'config'),
|
|
15
|
-
public: join(distDir, 'public'),
|
|
16
15
|
},
|
|
17
16
|
app: {
|
|
18
17
|
root: appDir,
|
|
@@ -23,7 +22,9 @@ const getDirs = ({ appDir, distDir }) => ({
|
|
|
23
22
|
policies: join(appDir, 'src', 'policies'),
|
|
24
23
|
middlewares: join(appDir, 'src', 'middlewares'),
|
|
25
24
|
config: join(appDir, 'config'),
|
|
26
|
-
|
|
25
|
+
},
|
|
26
|
+
static: {
|
|
27
|
+
public: resolve(appDir, strapi.config.get('server.dirs.public')),
|
|
27
28
|
},
|
|
28
29
|
});
|
|
29
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/strapi",
|
|
3
|
-
"version": "4.2.0-
|
|
3
|
+
"version": "4.2.0-beta.1",
|
|
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,17 +80,17 @@
|
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@koa/cors": "3.1.0",
|
|
82
82
|
"@koa/router": "10.1.1",
|
|
83
|
-
"@strapi/admin": "4.2.0-
|
|
84
|
-
"@strapi/database": "4.2.0-
|
|
85
|
-
"@strapi/generate-new": "4.2.0-
|
|
86
|
-
"@strapi/generators": "4.2.0-
|
|
87
|
-
"@strapi/logger": "4.2.0-
|
|
88
|
-
"@strapi/plugin-content-manager": "4.2.0-
|
|
89
|
-
"@strapi/plugin-content-type-builder": "4.2.0-
|
|
90
|
-
"@strapi/plugin-email": "4.2.0-
|
|
91
|
-
"@strapi/plugin-upload": "4.2.0-
|
|
92
|
-
"@strapi/typescript-utils": "4.2.0-
|
|
93
|
-
"@strapi/utils": "4.2.0-
|
|
83
|
+
"@strapi/admin": "4.2.0-beta.1",
|
|
84
|
+
"@strapi/database": "4.2.0-beta.1",
|
|
85
|
+
"@strapi/generate-new": "4.2.0-beta.1",
|
|
86
|
+
"@strapi/generators": "4.2.0-beta.1",
|
|
87
|
+
"@strapi/logger": "4.2.0-beta.1",
|
|
88
|
+
"@strapi/plugin-content-manager": "4.2.0-beta.1",
|
|
89
|
+
"@strapi/plugin-content-type-builder": "4.2.0-beta.1",
|
|
90
|
+
"@strapi/plugin-email": "4.2.0-beta.1",
|
|
91
|
+
"@strapi/plugin-upload": "4.2.0-beta.1",
|
|
92
|
+
"@strapi/typescript-utils": "4.2.0-beta.1",
|
|
93
|
+
"@strapi/utils": "4.2.0-beta.1",
|
|
94
94
|
"bcryptjs": "2.4.3",
|
|
95
95
|
"boxen": "5.1.2",
|
|
96
96
|
"chalk": "4.1.2",
|
|
@@ -138,5 +138,5 @@
|
|
|
138
138
|
"node": ">=12.22.0 <=16.x.x",
|
|
139
139
|
"npm": ">=6.0.0"
|
|
140
140
|
},
|
|
141
|
-
"gitHead": "
|
|
141
|
+
"gitHead": "4fa2804f35e15ed72dfd309fb5bb1c4dba18932f"
|
|
142
142
|
}
|