create-strapi-app 5.49.0 → 5.50.0
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/dist/create-strapi.d.ts.map +1 -1
- package/dist/create-strapi.js +22 -1
- package/dist/create-strapi.js.map +1 -1
- package/dist/create-strapi.mjs +22 -1
- package/dist/create-strapi.mjs.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/check-requirements.d.ts.map +1 -1
- package/dist/utils/check-requirements.js +2 -1
- package/dist/utils/check-requirements.js.map +1 -1
- package/dist/utils/check-requirements.mjs +2 -1
- package/dist/utils/check-requirements.mjs.map +1 -1
- package/dist/utils/dot-env.d.ts.map +1 -1
- package/dist/utils/dot-env.js +2 -0
- package/dist/utils/dot-env.js.map +1 -1
- package/dist/utils/dot-env.mjs +2 -0
- package/dist/utils/dot-env.mjs.map +1 -1
- package/dist/utils/get-package-manager-args.d.ts.map +1 -1
- package/dist/utils/package-json.d.ts.map +1 -1
- package/dist/utils/package-json.js +5 -7
- package/dist/utils/package-json.js.map +1 -1
- package/dist/utils/package-json.mjs +5 -7
- package/dist/utils/package-json.mjs.map +1 -1
- package/dist/utils/pnpm-config.d.ts +18 -0
- package/dist/utils/pnpm-config.d.ts.map +1 -0
- package/dist/utils/pnpm-config.js +113 -0
- package/dist/utils/pnpm-config.js.map +1 -0
- package/dist/utils/pnpm-config.mjs +96 -0
- package/dist/utils/pnpm-config.mjs.map +1 -0
- package/package.json +4 -4
- package/templates/example/config/admin.ts +4 -4
- package/templates/example/config/api.ts +4 -0
- package/templates/example/config/database.ts +11 -3
- package/templates/example/config/plugins.ts +40 -1
- package/templates/example/config/server.ts +4 -1
- package/templates/example/tsconfig.json +1 -1
- package/templates/example-js/config/api.js +4 -0
- package/templates/example-js/config/plugins.js +40 -1
- package/templates/vanilla/config/admin.ts +4 -4
- package/templates/vanilla/config/api.ts +4 -0
- package/templates/vanilla/config/database.ts +11 -3
- package/templates/vanilla/config/plugins.ts +40 -1
- package/templates/vanilla/config/server.ts +4 -1
- package/templates/vanilla/tsconfig.json +1 -1
- package/templates/vanilla-js/config/api.js +4 -0
- package/templates/vanilla-js/config/plugins.js +40 -1
|
@@ -2,6 +2,7 @@ import { join } from 'path';
|
|
|
2
2
|
import { kebabCase, mergeWith } from 'lodash';
|
|
3
3
|
import fse from 'fs-extra';
|
|
4
4
|
import { engines } from './engines.mjs';
|
|
5
|
+
import { shouldUsePackageJsonPnpmConfig, getPnpmOnlyBuiltDependencies } from './pnpm-config.mjs';
|
|
5
6
|
|
|
6
7
|
const mergePackageJson = (existingPkg, pkg)=>mergeWith({}, existingPkg, pkg, (_objValue, srcValue)=>{
|
|
7
8
|
if (Array.isArray(srcValue)) {
|
|
@@ -9,18 +10,15 @@ const mergePackageJson = (existingPkg, pkg)=>mergeWith({}, existingPkg, pkg, (_o
|
|
|
9
10
|
}
|
|
10
11
|
return undefined;
|
|
11
12
|
});
|
|
12
|
-
const
|
|
13
|
-
if (scope.packageManager !== 'pnpm' || scope.
|
|
13
|
+
const getPnpmPackageJsonConfig = (scope, existingPkg)=>{
|
|
14
|
+
if (scope.packageManager !== 'pnpm' || !shouldUsePackageJsonPnpmConfig(scope.pnpmVersion)) {
|
|
14
15
|
return {};
|
|
15
16
|
}
|
|
16
17
|
const existingOnlyBuiltDependencies = Array.isArray(existingPkg.pnpm?.onlyBuiltDependencies) ? existingPkg.pnpm.onlyBuiltDependencies.filter((dep)=>typeof dep === 'string') : [];
|
|
17
18
|
return {
|
|
18
19
|
pnpm: {
|
|
19
20
|
...existingPkg.pnpm ?? {},
|
|
20
|
-
onlyBuiltDependencies:
|
|
21
|
-
...existingOnlyBuiltDependencies,
|
|
22
|
-
'better-sqlite3'
|
|
23
|
-
])).sort()
|
|
21
|
+
onlyBuiltDependencies: getPnpmOnlyBuiltDependencies(scope, existingOnlyBuiltDependencies)
|
|
24
22
|
}
|
|
25
23
|
};
|
|
26
24
|
};
|
|
@@ -41,7 +39,7 @@ async function createPackageJSON(scope) {
|
|
|
41
39
|
installId: scope.installId
|
|
42
40
|
},
|
|
43
41
|
engines,
|
|
44
|
-
...
|
|
42
|
+
...getPnpmPackageJsonConfig(scope, existingPkg)
|
|
45
43
|
};
|
|
46
44
|
// copy templates
|
|
47
45
|
await fse.writeJSON(pkgJSONPath, sortPackageJson(mergePackageJson(existingPkg, pkg)), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-json.mjs","sources":["../../src/utils/package-json.ts"],"sourcesContent":["import { join } from 'path';\nimport { kebabCase, mergeWith } from 'lodash';\nimport fse from 'fs-extra';\n\nimport { engines } from './engines';\nimport type { Scope } from '../types';\n\ntype PnpmPackageConfig = {\n onlyBuiltDependencies?: string[];\n [key: string]: unknown;\n};\n\ntype PackageJson = {\n pnpm?: PnpmPackageConfig;\n [key: string]: unknown;\n};\n\nconst mergePackageJson = (existingPkg: PackageJson, pkg: PackageJson) =>\n mergeWith({}, existingPkg, pkg, (_objValue, srcValue) => {\n if (Array.isArray(srcValue)) {\n return srcValue;\n }\n\n return undefined;\n });\n\nconst
|
|
1
|
+
{"version":3,"file":"package-json.mjs","sources":["../../src/utils/package-json.ts"],"sourcesContent":["import { join } from 'path';\nimport { kebabCase, mergeWith } from 'lodash';\nimport fse from 'fs-extra';\n\nimport { engines } from './engines';\nimport { getPnpmOnlyBuiltDependencies, shouldUsePackageJsonPnpmConfig } from './pnpm-config';\nimport type { Scope } from '../types';\n\ntype PnpmPackageConfig = {\n onlyBuiltDependencies?: string[];\n [key: string]: unknown;\n};\n\ntype PackageJson = {\n pnpm?: PnpmPackageConfig;\n [key: string]: unknown;\n};\n\nconst mergePackageJson = (existingPkg: PackageJson, pkg: PackageJson) =>\n mergeWith({}, existingPkg, pkg, (_objValue, srcValue) => {\n if (Array.isArray(srcValue)) {\n return srcValue;\n }\n\n return undefined;\n });\n\nconst getPnpmPackageJsonConfig = (scope: Scope, existingPkg: PackageJson) => {\n if (scope.packageManager !== 'pnpm' || !shouldUsePackageJsonPnpmConfig(scope.pnpmVersion)) {\n return {};\n }\n\n const existingOnlyBuiltDependencies = Array.isArray(existingPkg.pnpm?.onlyBuiltDependencies)\n ? existingPkg.pnpm.onlyBuiltDependencies.filter((dep): dep is string => typeof dep === 'string')\n : [];\n\n return {\n pnpm: {\n ...(existingPkg.pnpm ?? {}),\n onlyBuiltDependencies: getPnpmOnlyBuiltDependencies(scope, existingOnlyBuiltDependencies),\n },\n };\n};\n\nexport async function createPackageJSON(scope: Scope) {\n const { sortPackageJson } = await import('sort-package-json');\n\n const pkgJSONPath = join(scope.rootPath, 'package.json');\n\n const existingPkg = (await fse.readJSON(pkgJSONPath).catch(() => ({}))) as PackageJson;\n\n const pkg = {\n name: kebabCase(scope.name),\n private: true,\n version: '0.1.0',\n description: 'A Strapi application',\n devDependencies: scope.devDependencies ?? {},\n dependencies: scope.dependencies ?? {},\n strapi: {\n ...(scope.packageJsonStrapi ?? {}),\n uuid: scope.uuid,\n installId: scope.installId,\n },\n engines,\n ...getPnpmPackageJsonConfig(scope, existingPkg),\n };\n\n // copy templates\n await fse.writeJSON(pkgJSONPath, sortPackageJson(mergePackageJson(existingPkg, pkg)), {\n spaces: 2,\n });\n}\n"],"names":["mergePackageJson","existingPkg","pkg","mergeWith","_objValue","srcValue","Array","isArray","undefined","getPnpmPackageJsonConfig","scope","packageManager","shouldUsePackageJsonPnpmConfig","pnpmVersion","existingOnlyBuiltDependencies","pnpm","onlyBuiltDependencies","filter","dep","getPnpmOnlyBuiltDependencies","createPackageJSON","sortPackageJson","pkgJSONPath","join","rootPath","fse","readJSON","catch","name","kebabCase","private","version","description","devDependencies","dependencies","strapi","packageJsonStrapi","uuid","installId","engines","writeJSON","spaces"],"mappings":";;;;;;AAkBA,MAAMA,gBAAAA,GAAmB,CAACC,WAAAA,EAA0BC,GAAAA,GAClDC,SAAAA,CAAU,EAAC,EA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,WAAAA,EAAa,sBAAA;QACbC,eAAAA,EAAiBvB,KAAAA,CAAMuB,eAAe,IAAI,EAAC;QAC3CC,YAAAA,EAAcxB,KAAAA,CAAMwB,YAAY,IAAI,EAAC;QACrCC,MAAAA,EAAQ;AACN,YAAA,GAAIzB,KAAAA,CAAM0B,iBAAiB,IAAI,EAAE;AACjCC,YAAAA,IAAAA,EAAM3B,MAAM2B,IAAI;AAChBC,YAAAA,SAAAA,EAAW5B,MAAM4B;AACnB,SAAA;AACAC,QAAAA,OAAAA;QACA,GAAG9B,wBAAAA,CAAyBC,OAAOT,WAAAA;AACrC,KAAA;;AAGA,IAAA,MAAMwB,IAAIe,SAAS,CAAClB,aAAaD,eAAAA,CAAgBrB,gBAAAA,CAAiBC,aAAaC,GAAAA,CAAAA,CAAAA,EAAO;QACpFuC,MAAAA,EAAQ;AACV,KAAA,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Scope } from '../types';
|
|
2
|
+
/** allowBuilds in pnpm-workspace.yaml (pnpm >= 10.26). */
|
|
3
|
+
export declare const PNPM_WORKSPACE_CONFIG_MIN_VERSION = "10.26.0";
|
|
4
|
+
/** pnpm 11 reads project settings from pnpm-workspace.yaml only. */
|
|
5
|
+
export declare const PNPM11_MIN_VERSION = "11.0.0";
|
|
6
|
+
/**
|
|
7
|
+
* Native / tooling packages Strapi needs to run postinstall scripts for (admin build, upload, sqlite).
|
|
8
|
+
*/
|
|
9
|
+
export declare const PNPM_STRAPI_BUILD_PACKAGES: readonly ["@swc/core", "core-js-pure", "esbuild", "sharp"];
|
|
10
|
+
export declare const PNPM_SQLITE_BUILD_PACKAGE = "better-sqlite3";
|
|
11
|
+
export declare const shouldUsePnpmWorkspaceConfig: (pnpmVersion: string | null | undefined) => boolean;
|
|
12
|
+
export declare const shouldUsePackageJsonPnpmConfig: (pnpmVersion: string | null | undefined) => boolean;
|
|
13
|
+
export declare const getPnpmBuildPackageNames: (scope: Scope) => string[];
|
|
14
|
+
export declare const getPnpmAllowBuilds: (scope: Scope) => Record<string, true>;
|
|
15
|
+
export declare const getPnpmOnlyBuiltDependencies: (scope: Scope, existing?: string[]) => string[];
|
|
16
|
+
export declare const formatPnpmWorkspaceYaml: (scope: Scope, pnpmVersion: string | null) => string;
|
|
17
|
+
export declare const writePnpmWorkspaceConfig: (scope: Scope, pnpmVersion: string | null) => Promise<void>;
|
|
18
|
+
//# sourceMappingURL=pnpm-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pnpm-config.d.ts","sourceRoot":"","sources":["../../src/utils/pnpm-config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,0DAA0D;AAC1D,eAAO,MAAM,iCAAiC,YAAY,CAAC;AAE3D,oEAAoE;AACpE,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,0BAA0B,4DAK7B,CAAC;AAEX,eAAO,MAAM,yBAAyB,mBAAmB,CAAC;AAE1D,eAAO,MAAM,4BAA4B,GAAI,aAAa,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,OAIrF,CAAC;AAEF,eAAO,MAAM,8BAA8B,GAAI,aAAa,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,OAQvF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,OAAO,KAAK,KAAG,MAAM,EAQ7D,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,OAAO,KAAK,KAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAKpE,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,OAAO,KAAK,EAAE,WAAU,MAAM,EAAO,KAAG,MAAM,EAE1F,CAAC;AAUF,eAAO,MAAM,uBAAuB,GAAI,OAAO,KAAK,EAAE,aAAa,MAAM,GAAG,IAAI,KAAG,MAuBlF,CAAC;AAgBF,eAAO,MAAM,wBAAwB,GACnC,OAAO,KAAK,EACZ,aAAa,MAAM,GAAG,IAAI,KACzB,OAAO,CAAC,IAAI,CAgBd,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var path = require('node:path');
|
|
4
|
+
var fse = require('fs-extra');
|
|
5
|
+
var semver = require('semver');
|
|
6
|
+
|
|
7
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
var fse__default = /*#__PURE__*/_interopDefault(fse);
|
|
10
|
+
var semver__default = /*#__PURE__*/_interopDefault(semver);
|
|
11
|
+
|
|
12
|
+
/** allowBuilds in pnpm-workspace.yaml (pnpm >= 10.26). */ const PNPM_WORKSPACE_CONFIG_MIN_VERSION = '10.26.0';
|
|
13
|
+
/** pnpm 11 reads project settings from pnpm-workspace.yaml only. */ const PNPM11_MIN_VERSION = '11.0.0';
|
|
14
|
+
/**
|
|
15
|
+
* Native / tooling packages Strapi needs to run postinstall scripts for (admin build, upload, sqlite).
|
|
16
|
+
*/ const PNPM_STRAPI_BUILD_PACKAGES = [
|
|
17
|
+
'@swc/core',
|
|
18
|
+
'core-js-pure',
|
|
19
|
+
'esbuild',
|
|
20
|
+
'sharp'
|
|
21
|
+
];
|
|
22
|
+
const PNPM_SQLITE_BUILD_PACKAGE = 'better-sqlite3';
|
|
23
|
+
const shouldUsePnpmWorkspaceConfig = (pnpmVersion)=>{
|
|
24
|
+
const normalized = pnpmVersion ? semver__default.default.coerce(pnpmVersion)?.version : null;
|
|
25
|
+
return normalized ? semver__default.default.gte(normalized, PNPM_WORKSPACE_CONFIG_MIN_VERSION) : true;
|
|
26
|
+
};
|
|
27
|
+
const shouldUsePackageJsonPnpmConfig = (pnpmVersion)=>{
|
|
28
|
+
const normalized = pnpmVersion ? semver__default.default.coerce(pnpmVersion)?.version : null;
|
|
29
|
+
if (!normalized) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return semver__default.default.lt(normalized, PNPM_WORKSPACE_CONFIG_MIN_VERSION);
|
|
33
|
+
};
|
|
34
|
+
const getPnpmBuildPackageNames = (scope)=>{
|
|
35
|
+
const packages = new Set(PNPM_STRAPI_BUILD_PACKAGES);
|
|
36
|
+
if (scope.database.client === 'sqlite') {
|
|
37
|
+
packages.add(PNPM_SQLITE_BUILD_PACKAGE);
|
|
38
|
+
}
|
|
39
|
+
return Array.from(packages).sort();
|
|
40
|
+
};
|
|
41
|
+
const getPnpmAllowBuilds = (scope)=>{
|
|
42
|
+
return Object.fromEntries(getPnpmBuildPackageNames(scope).map((name)=>[
|
|
43
|
+
name,
|
|
44
|
+
true
|
|
45
|
+
]));
|
|
46
|
+
};
|
|
47
|
+
const getPnpmOnlyBuiltDependencies = (scope, existing = [])=>{
|
|
48
|
+
return Array.from(new Set([
|
|
49
|
+
...existing,
|
|
50
|
+
...getPnpmBuildPackageNames(scope)
|
|
51
|
+
])).sort();
|
|
52
|
+
};
|
|
53
|
+
const quoteYamlKey = (key)=>{
|
|
54
|
+
if (/^[a-z0-9_-]+$/.test(key)) {
|
|
55
|
+
return key;
|
|
56
|
+
}
|
|
57
|
+
return `'${key}'`;
|
|
58
|
+
};
|
|
59
|
+
const formatPnpmWorkspaceYaml = (scope, pnpmVersion)=>{
|
|
60
|
+
const allowBuilds = getPnpmAllowBuilds(scope);
|
|
61
|
+
const normalized = pnpmVersion ? semver__default.default.coerce(pnpmVersion)?.version : null;
|
|
62
|
+
const isPnpm11 = normalized ? semver__default.default.gte(normalized, PNPM11_MIN_VERSION) : true;
|
|
63
|
+
const lines = [
|
|
64
|
+
'packages:',
|
|
65
|
+
" - '.'",
|
|
66
|
+
''
|
|
67
|
+
];
|
|
68
|
+
if (isPnpm11) {
|
|
69
|
+
lines.push('# Allow day-0 @strapi/* npm publishes while keeping pnpm 11 supply-chain defaults for other deps.', 'minimumReleaseAgeExclude:', " - '@strapi/*'", '');
|
|
70
|
+
}
|
|
71
|
+
lines.push('allowBuilds:');
|
|
72
|
+
for (const name of Object.keys(allowBuilds).sort()){
|
|
73
|
+
lines.push(` ${quoteYamlKey(name)}: true`);
|
|
74
|
+
}
|
|
75
|
+
lines.push('');
|
|
76
|
+
return lines.join('\n');
|
|
77
|
+
};
|
|
78
|
+
const hasParentPnpmWorkspace = async (rootPath)=>{
|
|
79
|
+
let dir = path.join(rootPath, '..');
|
|
80
|
+
while(dir !== path.join(dir, '..')){
|
|
81
|
+
if (await fse__default.default.pathExists(path.join(dir, 'pnpm-workspace.yaml'))) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
dir = path.join(dir, '..');
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
};
|
|
88
|
+
const writePnpmWorkspaceConfig = async (scope, pnpmVersion)=>{
|
|
89
|
+
if (scope.packageManager !== 'pnpm' || !shouldUsePnpmWorkspaceConfig(pnpmVersion)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const workspaceFile = path.join(scope.rootPath, 'pnpm-workspace.yaml');
|
|
93
|
+
if (await hasParentPnpmWorkspace(scope.rootPath)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (await fse__default.default.pathExists(workspaceFile)) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
await fse__default.default.writeFile(workspaceFile, formatPnpmWorkspaceYaml(scope, pnpmVersion));
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
exports.PNPM11_MIN_VERSION = PNPM11_MIN_VERSION;
|
|
103
|
+
exports.PNPM_SQLITE_BUILD_PACKAGE = PNPM_SQLITE_BUILD_PACKAGE;
|
|
104
|
+
exports.PNPM_STRAPI_BUILD_PACKAGES = PNPM_STRAPI_BUILD_PACKAGES;
|
|
105
|
+
exports.PNPM_WORKSPACE_CONFIG_MIN_VERSION = PNPM_WORKSPACE_CONFIG_MIN_VERSION;
|
|
106
|
+
exports.formatPnpmWorkspaceYaml = formatPnpmWorkspaceYaml;
|
|
107
|
+
exports.getPnpmAllowBuilds = getPnpmAllowBuilds;
|
|
108
|
+
exports.getPnpmBuildPackageNames = getPnpmBuildPackageNames;
|
|
109
|
+
exports.getPnpmOnlyBuiltDependencies = getPnpmOnlyBuiltDependencies;
|
|
110
|
+
exports.shouldUsePackageJsonPnpmConfig = shouldUsePackageJsonPnpmConfig;
|
|
111
|
+
exports.shouldUsePnpmWorkspaceConfig = shouldUsePnpmWorkspaceConfig;
|
|
112
|
+
exports.writePnpmWorkspaceConfig = writePnpmWorkspaceConfig;
|
|
113
|
+
//# sourceMappingURL=pnpm-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pnpm-config.js","sources":["../../src/utils/pnpm-config.ts"],"sourcesContent":["import { join } from 'node:path';\nimport fse from 'fs-extra';\nimport semver from 'semver';\n\nimport type { Scope } from '../types';\n\n/** allowBuilds in pnpm-workspace.yaml (pnpm >= 10.26). */\nexport const PNPM_WORKSPACE_CONFIG_MIN_VERSION = '10.26.0';\n\n/** pnpm 11 reads project settings from pnpm-workspace.yaml only. */\nexport const PNPM11_MIN_VERSION = '11.0.0';\n\n/**\n * Native / tooling packages Strapi needs to run postinstall scripts for (admin build, upload, sqlite).\n */\nexport const PNPM_STRAPI_BUILD_PACKAGES = [\n '@swc/core',\n 'core-js-pure',\n 'esbuild',\n 'sharp',\n] as const;\n\nexport const PNPM_SQLITE_BUILD_PACKAGE = 'better-sqlite3';\n\nexport const shouldUsePnpmWorkspaceConfig = (pnpmVersion: string | null | undefined): boolean => {\n const normalized = pnpmVersion ? semver.coerce(pnpmVersion)?.version : null;\n\n return normalized ? semver.gte(normalized, PNPM_WORKSPACE_CONFIG_MIN_VERSION) : true;\n};\n\nexport const shouldUsePackageJsonPnpmConfig = (pnpmVersion: string | null | undefined): boolean => {\n const normalized = pnpmVersion ? semver.coerce(pnpmVersion)?.version : null;\n\n if (!normalized) {\n return false;\n }\n\n return semver.lt(normalized, PNPM_WORKSPACE_CONFIG_MIN_VERSION);\n};\n\nexport const getPnpmBuildPackageNames = (scope: Scope): string[] => {\n const packages = new Set<string>(PNPM_STRAPI_BUILD_PACKAGES);\n\n if (scope.database.client === 'sqlite') {\n packages.add(PNPM_SQLITE_BUILD_PACKAGE);\n }\n\n return Array.from(packages).sort();\n};\n\nexport const getPnpmAllowBuilds = (scope: Scope): Record<string, true> => {\n return Object.fromEntries(getPnpmBuildPackageNames(scope).map((name) => [name, true])) as Record<\n string,\n true\n >;\n};\n\nexport const getPnpmOnlyBuiltDependencies = (scope: Scope, existing: string[] = []): string[] => {\n return Array.from(new Set([...existing, ...getPnpmBuildPackageNames(scope)])).sort();\n};\n\nconst quoteYamlKey = (key: string): string => {\n if (/^[a-z0-9_-]+$/.test(key)) {\n return key;\n }\n\n return `'${key}'`;\n};\n\nexport const formatPnpmWorkspaceYaml = (scope: Scope, pnpmVersion: string | null): string => {\n const allowBuilds = getPnpmAllowBuilds(scope);\n const normalized = pnpmVersion ? semver.coerce(pnpmVersion)?.version : null;\n const isPnpm11 = normalized ? semver.gte(normalized, PNPM11_MIN_VERSION) : true;\n\n const lines = ['packages:', \" - '.'\", ''];\n\n if (isPnpm11) {\n lines.push(\n '# Allow day-0 @strapi/* npm publishes while keeping pnpm 11 supply-chain defaults for other deps.',\n 'minimumReleaseAgeExclude:',\n \" - '@strapi/*'\",\n ''\n );\n }\n\n lines.push('allowBuilds:');\n for (const name of Object.keys(allowBuilds).sort()) {\n lines.push(` ${quoteYamlKey(name)}: true`);\n }\n lines.push('');\n\n return lines.join('\\n');\n};\n\nconst hasParentPnpmWorkspace = async (rootPath: string): Promise<boolean> => {\n let dir = join(rootPath, '..');\n\n while (dir !== join(dir, '..')) {\n if (await fse.pathExists(join(dir, 'pnpm-workspace.yaml'))) {\n return true;\n }\n\n dir = join(dir, '..');\n }\n\n return false;\n};\n\nexport const writePnpmWorkspaceConfig = async (\n scope: Scope,\n pnpmVersion: string | null\n): Promise<void> => {\n if (scope.packageManager !== 'pnpm' || !shouldUsePnpmWorkspaceConfig(pnpmVersion)) {\n return;\n }\n\n const workspaceFile = join(scope.rootPath, 'pnpm-workspace.yaml');\n\n if (await hasParentPnpmWorkspace(scope.rootPath)) {\n return;\n }\n\n if (await fse.pathExists(workspaceFile)) {\n return;\n }\n\n await fse.writeFile(workspaceFile, formatPnpmWorkspaceYaml(scope, pnpmVersion));\n};\n"],"names":["PNPM_WORKSPACE_CONFIG_MIN_VERSION","PNPM11_MIN_VERSION","PNPM_STRAPI_BUILD_PACKAGES","PNPM_SQLITE_BUILD_PACKAGE","shouldUsePnpmWorkspaceConfig","pnpmVersion","normalized","semver","coerce","version","gte","shouldUsePackageJsonPnpmConfig","lt","getPnpmBuildPackageNames","scope","packages","Set","database","client","add","Array","from","sort","getPnpmAllowBuilds","Object","fromEntries","map","name","getPnpmOnlyBuiltDependencies","existing","quoteYamlKey","key","test","formatPnpmWorkspaceYaml","allowBuilds","isPnpm11","lines","push","keys","join","hasParentPnpmWorkspace","rootPath","dir","fse","pathExists","writePnpmWorkspaceConfig","packageManager","workspaceFile","writeFile"],"mappings":";;;;;;;;;;;AAMA,2DACO,MAAMA,iCAAAA,GAAoC;AAEjD,qEACO,MAAMC,kBAAAA,GAAqB;AAElC;;UAGaC,0BAAAA,GAA6B;AACxC,IAAA,WAAA;AACA,IAAA,cAAA;AACA,IAAA,SAAA;AACA,IAAA;;AAGK,MAAMC,4BAA4B;AAElC,MAAMC,+BAA+B,CAACC,WAAAA,GAAAA;AAC3C,IAAA,MAAMC,aAAaD,WAAAA,GAAcE,uBAAAA,CAAOC,MAAM,CAACH,cAAcI,OAAAA,GAAU,IAAA;AAEvE,IAAA,OAAOH,UAAAA,GAAaC,uBAAAA,CAAOG,GAAG,CAACJ,YAAYN,iCAAAA,CAAAA,GAAqC,IAAA;AAClF;AAEO,MAAMW,iCAAiC,CAACN,WAAAA,GAAAA;AAC7C,IAAA,MAAMC,aAAaD,WAAAA,GAAcE,uBAAAA,CAAOC,MAAM,CAACH,cAAcI,OAAAA,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A;IAEA,OAAO,KAAA;AACT,CAAA;AAEO,MAAMG,wBAAAA,GAA2B,OACtC/B,KAAAA,EACAT,WAAAA,GAAAA;AAEA,IAAA,IAAIS,MAAMgC,cAAc,KAAK,MAAA,IAAU,CAAC1C,6BAA6BC,WAAAA,CAAAA,EAAc;AACjF,QAAA;AACF,IAAA;AAEA,IAAA,MAAM0C,aAAAA,GAAgBR,SAAAA,CAAKzB,KAAAA,CAAM2B,QAAQ,EAAE,qBAAA,CAAA;AAE3C,IAAA,IAAI,MAAMD,sBAAAA,CAAuB1B,KAAAA,CAAM2B,QAAQ,CAAA,EAAG;AAChD,QAAA;AACF,IAAA;AAEA,IAAA,IAAI,MAAME,oBAAAA,CAAIC,UAAU,CAACG,aAAAA,CAAAA,EAAgB;AACvC,QAAA;AACF,IAAA;AAEA,IAAA,MAAMJ,oBAAAA,CAAIK,SAAS,CAACD,aAAAA,EAAed,wBAAwBnB,KAAAA,EAAOT,WAAAA,CAAAA,CAAAA;AACpE;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import fse from 'fs-extra';
|
|
3
|
+
import semver from 'semver';
|
|
4
|
+
|
|
5
|
+
/** allowBuilds in pnpm-workspace.yaml (pnpm >= 10.26). */ const PNPM_WORKSPACE_CONFIG_MIN_VERSION = '10.26.0';
|
|
6
|
+
/** pnpm 11 reads project settings from pnpm-workspace.yaml only. */ const PNPM11_MIN_VERSION = '11.0.0';
|
|
7
|
+
/**
|
|
8
|
+
* Native / tooling packages Strapi needs to run postinstall scripts for (admin build, upload, sqlite).
|
|
9
|
+
*/ const PNPM_STRAPI_BUILD_PACKAGES = [
|
|
10
|
+
'@swc/core',
|
|
11
|
+
'core-js-pure',
|
|
12
|
+
'esbuild',
|
|
13
|
+
'sharp'
|
|
14
|
+
];
|
|
15
|
+
const PNPM_SQLITE_BUILD_PACKAGE = 'better-sqlite3';
|
|
16
|
+
const shouldUsePnpmWorkspaceConfig = (pnpmVersion)=>{
|
|
17
|
+
const normalized = pnpmVersion ? semver.coerce(pnpmVersion)?.version : null;
|
|
18
|
+
return normalized ? semver.gte(normalized, PNPM_WORKSPACE_CONFIG_MIN_VERSION) : true;
|
|
19
|
+
};
|
|
20
|
+
const shouldUsePackageJsonPnpmConfig = (pnpmVersion)=>{
|
|
21
|
+
const normalized = pnpmVersion ? semver.coerce(pnpmVersion)?.version : null;
|
|
22
|
+
if (!normalized) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return semver.lt(normalized, PNPM_WORKSPACE_CONFIG_MIN_VERSION);
|
|
26
|
+
};
|
|
27
|
+
const getPnpmBuildPackageNames = (scope)=>{
|
|
28
|
+
const packages = new Set(PNPM_STRAPI_BUILD_PACKAGES);
|
|
29
|
+
if (scope.database.client === 'sqlite') {
|
|
30
|
+
packages.add(PNPM_SQLITE_BUILD_PACKAGE);
|
|
31
|
+
}
|
|
32
|
+
return Array.from(packages).sort();
|
|
33
|
+
};
|
|
34
|
+
const getPnpmAllowBuilds = (scope)=>{
|
|
35
|
+
return Object.fromEntries(getPnpmBuildPackageNames(scope).map((name)=>[
|
|
36
|
+
name,
|
|
37
|
+
true
|
|
38
|
+
]));
|
|
39
|
+
};
|
|
40
|
+
const getPnpmOnlyBuiltDependencies = (scope, existing = [])=>{
|
|
41
|
+
return Array.from(new Set([
|
|
42
|
+
...existing,
|
|
43
|
+
...getPnpmBuildPackageNames(scope)
|
|
44
|
+
])).sort();
|
|
45
|
+
};
|
|
46
|
+
const quoteYamlKey = (key)=>{
|
|
47
|
+
if (/^[a-z0-9_-]+$/.test(key)) {
|
|
48
|
+
return key;
|
|
49
|
+
}
|
|
50
|
+
return `'${key}'`;
|
|
51
|
+
};
|
|
52
|
+
const formatPnpmWorkspaceYaml = (scope, pnpmVersion)=>{
|
|
53
|
+
const allowBuilds = getPnpmAllowBuilds(scope);
|
|
54
|
+
const normalized = pnpmVersion ? semver.coerce(pnpmVersion)?.version : null;
|
|
55
|
+
const isPnpm11 = normalized ? semver.gte(normalized, PNPM11_MIN_VERSION) : true;
|
|
56
|
+
const lines = [
|
|
57
|
+
'packages:',
|
|
58
|
+
" - '.'",
|
|
59
|
+
''
|
|
60
|
+
];
|
|
61
|
+
if (isPnpm11) {
|
|
62
|
+
lines.push('# Allow day-0 @strapi/* npm publishes while keeping pnpm 11 supply-chain defaults for other deps.', 'minimumReleaseAgeExclude:', " - '@strapi/*'", '');
|
|
63
|
+
}
|
|
64
|
+
lines.push('allowBuilds:');
|
|
65
|
+
for (const name of Object.keys(allowBuilds).sort()){
|
|
66
|
+
lines.push(` ${quoteYamlKey(name)}: true`);
|
|
67
|
+
}
|
|
68
|
+
lines.push('');
|
|
69
|
+
return lines.join('\n');
|
|
70
|
+
};
|
|
71
|
+
const hasParentPnpmWorkspace = async (rootPath)=>{
|
|
72
|
+
let dir = join(rootPath, '..');
|
|
73
|
+
while(dir !== join(dir, '..')){
|
|
74
|
+
if (await fse.pathExists(join(dir, 'pnpm-workspace.yaml'))) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
dir = join(dir, '..');
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
};
|
|
81
|
+
const writePnpmWorkspaceConfig = async (scope, pnpmVersion)=>{
|
|
82
|
+
if (scope.packageManager !== 'pnpm' || !shouldUsePnpmWorkspaceConfig(pnpmVersion)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const workspaceFile = join(scope.rootPath, 'pnpm-workspace.yaml');
|
|
86
|
+
if (await hasParentPnpmWorkspace(scope.rootPath)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (await fse.pathExists(workspaceFile)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
await fse.writeFile(workspaceFile, formatPnpmWorkspaceYaml(scope, pnpmVersion));
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export { PNPM11_MIN_VERSION, PNPM_SQLITE_BUILD_PACKAGE, PNPM_STRAPI_BUILD_PACKAGES, PNPM_WORKSPACE_CONFIG_MIN_VERSION, formatPnpmWorkspaceYaml, getPnpmAllowBuilds, getPnpmBuildPackageNames, getPnpmOnlyBuiltDependencies, shouldUsePackageJsonPnpmConfig, shouldUsePnpmWorkspaceConfig, writePnpmWorkspaceConfig };
|
|
96
|
+
//# sourceMappingURL=pnpm-config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pnpm-config.mjs","sources":["../../src/utils/pnpm-config.ts"],"sourcesContent":["import { join } from 'node:path';\nimport fse from 'fs-extra';\nimport semver from 'semver';\n\nimport type { Scope } from '../types';\n\n/** allowBuilds in pnpm-workspace.yaml (pnpm >= 10.26). */\nexport const PNPM_WORKSPACE_CONFIG_MIN_VERSION = '10.26.0';\n\n/** pnpm 11 reads project settings from pnpm-workspace.yaml only. */\nexport const PNPM11_MIN_VERSION = '11.0.0';\n\n/**\n * Native / tooling packages Strapi needs to run postinstall scripts for (admin build, upload, sqlite).\n */\nexport const PNPM_STRAPI_BUILD_PACKAGES = [\n '@swc/core',\n 'core-js-pure',\n 'esbuild',\n 'sharp',\n] as const;\n\nexport const PNPM_SQLITE_BUILD_PACKAGE = 'better-sqlite3';\n\nexport const shouldUsePnpmWorkspaceConfig = (pnpmVersion: string | null | undefined): boolean => {\n const normalized = pnpmVersion ? semver.coerce(pnpmVersion)?.version : null;\n\n return normalized ? semver.gte(normalized, PNPM_WORKSPACE_CONFIG_MIN_VERSION) : true;\n};\n\nexport const shouldUsePackageJsonPnpmConfig = (pnpmVersion: string | null | undefined): boolean => {\n const normalized = pnpmVersion ? semver.coerce(pnpmVersion)?.version : null;\n\n if (!normalized) {\n return false;\n }\n\n return semver.lt(normalized, PNPM_WORKSPACE_CONFIG_MIN_VERSION);\n};\n\nexport const getPnpmBuildPackageNames = (scope: Scope): string[] => {\n const packages = new Set<string>(PNPM_STRAPI_BUILD_PACKAGES);\n\n if (scope.database.client === 'sqlite') {\n packages.add(PNPM_SQLITE_BUILD_PACKAGE);\n }\n\n return Array.from(packages).sort();\n};\n\nexport const getPnpmAllowBuilds = (scope: Scope): Record<string, true> => {\n return Object.fromEntries(getPnpmBuildPackageNames(scope).map((name) => [name, true])) as Record<\n string,\n true\n >;\n};\n\nexport const getPnpmOnlyBuiltDependencies = (scope: Scope, existing: string[] = []): string[] => {\n return Array.from(new Set([...existing, ...getPnpmBuildPackageNames(scope)])).sort();\n};\n\nconst quoteYamlKey = (key: string): string => {\n if (/^[a-z0-9_-]+$/.test(key)) {\n return key;\n }\n\n return `'${key}'`;\n};\n\nexport const formatPnpmWorkspaceYaml = (scope: Scope, pnpmVersion: string | null): string => {\n const allowBuilds = getPnpmAllowBuilds(scope);\n const normalized = pnpmVersion ? semver.coerce(pnpmVersion)?.version : null;\n const isPnpm11 = normalized ? semver.gte(normalized, PNPM11_MIN_VERSION) : true;\n\n const lines = ['packages:', \" - '.'\", ''];\n\n if (isPnpm11) {\n lines.push(\n '# Allow day-0 @strapi/* npm publishes while keeping pnpm 11 supply-chain defaults for other deps.',\n 'minimumReleaseAgeExclude:',\n \" - '@strapi/*'\",\n ''\n );\n }\n\n lines.push('allowBuilds:');\n for (const name of Object.keys(allowBuilds).sort()) {\n lines.push(` ${quoteYamlKey(name)}: true`);\n }\n lines.push('');\n\n return lines.join('\\n');\n};\n\nconst hasParentPnpmWorkspace = async (rootPath: string): Promise<boolean> => {\n let dir = join(rootPath, '..');\n\n while (dir !== join(dir, '..')) {\n if (await fse.pathExists(join(dir, 'pnpm-workspace.yaml'))) {\n return true;\n }\n\n dir = join(dir, '..');\n }\n\n return false;\n};\n\nexport const writePnpmWorkspaceConfig = async (\n scope: Scope,\n pnpmVersion: string | null\n): Promise<void> => {\n if (scope.packageManager !== 'pnpm' || !shouldUsePnpmWorkspaceConfig(pnpmVersion)) {\n return;\n }\n\n const workspaceFile = join(scope.rootPath, 'pnpm-workspace.yaml');\n\n if (await hasParentPnpmWorkspace(scope.rootPath)) {\n return;\n }\n\n if (await fse.pathExists(workspaceFile)) {\n return;\n }\n\n await fse.writeFile(workspaceFile, formatPnpmWorkspaceYaml(scope, pnpmVersion));\n};\n"],"names":["PNPM_WORKSPACE_CONFIG_MIN_VERSION","PNPM11_MIN_VERSION","PNPM_STRAPI_BUILD_PACKAGES","PNPM_SQLITE_BUILD_PACKAGE","shouldUsePnpmWorkspaceConfig","pnpmVersion","normalized","semver","coerce","version","gte","shouldUsePackageJsonPnpmConfig","lt","getPnpmBuildPackageNames","scope","packages","Set","database","client","add","Array","from","sort","getPnpmAllowBuilds","Object","fromEntries","map","name","getPnpmOnlyBuiltDependencies","existing","quoteYamlKey","key","test","formatPnpmWorkspaceYaml","allowBuilds","isPnpm11","lines","push","keys","join","hasParentPnpmWorkspace","rootPath","dir","fse","pathExists","writePnpmWorkspaceConfig","packageManager","workspaceFile","writeFile"],"mappings":";;;;AAMA,2DACO,MAAMA,iCAAAA,GAAoC;AAEjD,qEACO,MAAMC,kBAAAA,GAAqB;AAElC;;UAGaC,0BAAAA,GAA6B;AACxC,IAAA,WAAA;AACA,IAAA,cAAA;AACA,IAAA,SAAA;AACA,IAAA;;AAGK,MAAMC,4BAA4B;AAElC,MAAMC,+BAA+B,CAACC,WAAAA,GAAAA;AAC3C,IAAA,MAAMC,aAAaD,WAAAA,GAAcE,MAAAA,CAAOC,MAAM,CAACH,cAAcI,OAAAA,GAAU,IAAA;AAEvE,IAAA,OAAOH,UAAAA,GAAaC,MAAAA,CAAOG,GAAG,CAACJ,YAAYN,iCAAAA,CAAAA,GAAqC,IAAA;AAClF;AAEO,MAAMW,iCAAiC,CAACN,WAAAA,GAAAA;AAC7C,IAAA,MAAMC,aAAaD,WAAAA,GAAcE,MAAAA,CAAOC,MAAM,CAACH,cAAcI,OAAAA,GAAU,IAAA;AAEvE,IAAA,IAAI,CAACH,UAAAA,EAAY;QACf,OAAO,KAAA;AACT,IAAA;IAEA,OAAOC,MAAAA,CAAOK,EAAE,C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AMgC,cAAc,KAAK,MAAA,IAAU,CAAC1C,6BAA6BC,WAAAA,CAAAA,EAAc;AACjF,QAAA;AACF,IAAA;AAEA,IAAA,MAAM0C,aAAAA,GAAgBR,IAAAA,CAAKzB,KAAAA,CAAM2B,QAAQ,EAAE,qBAAA,CAAA;AAE3C,IAAA,IAAI,MAAMD,sBAAAA,CAAuB1B,KAAAA,CAAM2B,QAAQ,CAAA,EAAG;AAChD,QAAA;AACF,IAAA;AAEA,IAAA,IAAI,MAAME,GAAAA,CAAIC,UAAU,CAACG,aAAAA,CAAAA,EAAgB;AACvC,QAAA;AACF,IAAA;AAEA,IAAA,MAAMJ,GAAAA,CAAIK,SAAS,CAACD,aAAAA,EAAed,wBAAwBnB,KAAAA,EAAOT,WAAAA,CAAAA,CAAAA;AACpE;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-strapi-app",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.50.0",
|
|
4
4
|
"description": "Generate a new Strapi application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"create-strapi-app",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"watch": "run -T rollup -c -w"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@strapi/cloud-cli": "5.
|
|
54
|
+
"@strapi/cloud-cli": "5.50.0",
|
|
55
55
|
"async-retry": "1.3.3",
|
|
56
56
|
"chalk": "4.1.2",
|
|
57
57
|
"commander": "8.3.0",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"@types/async-retry": "^1",
|
|
71
71
|
"@types/fs-extra": "11.0.4",
|
|
72
72
|
"@types/inquirer": "9.0.9",
|
|
73
|
-
"eslint-config-custom": "5.
|
|
74
|
-
"tsconfig": "5.
|
|
73
|
+
"eslint-config-custom": "5.50.0",
|
|
74
|
+
"tsconfig": "5.50.0"
|
|
75
75
|
},
|
|
76
76
|
"engines": {
|
|
77
77
|
"node": ">=20.0.0 <=26.x.x",
|
|
@@ -2,18 +2,18 @@ import type { Core } from '@strapi/strapi';
|
|
|
2
2
|
|
|
3
3
|
const config = ({ env }: Core.Config.Shared.ConfigParams): Core.Config.Admin => ({
|
|
4
4
|
auth: {
|
|
5
|
-
secret: env('ADMIN_JWT_SECRET')
|
|
5
|
+
secret: env('ADMIN_JWT_SECRET')!,
|
|
6
6
|
},
|
|
7
7
|
apiToken: {
|
|
8
|
-
salt: env('API_TOKEN_SALT')
|
|
8
|
+
salt: env('API_TOKEN_SALT')!,
|
|
9
9
|
},
|
|
10
10
|
transfer: {
|
|
11
11
|
token: {
|
|
12
|
-
salt: env('TRANSFER_TOKEN_SALT')
|
|
12
|
+
salt: env('TRANSFER_TOKEN_SALT')!,
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
secrets: {
|
|
16
|
-
encryptionKey: env('ENCRYPTION_KEY')
|
|
16
|
+
encryptionKey: env('ENCRYPTION_KEY')!,
|
|
17
17
|
},
|
|
18
18
|
flags: {
|
|
19
19
|
nps: env.bool('FLAG_NPS', true),
|
|
@@ -51,13 +51,21 @@ const config = ({ env }: Core.Config.Shared.ConfigParams): Core.Config.Database
|
|
|
51
51
|
},
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
if (!(client in connections)) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`Unsupported DATABASE_CLIENT: ${client}. Use "postgres", "mysql", or "sqlite".`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
type DatabaseClient = keyof typeof connections;
|
|
61
|
+
|
|
54
62
|
return {
|
|
55
63
|
connection: {
|
|
56
|
-
client,
|
|
57
|
-
...connections[client],
|
|
64
|
+
client: client as DatabaseClient,
|
|
65
|
+
...connections[client as DatabaseClient],
|
|
58
66
|
acquireConnectionTimeout: env.int('DATABASE_CONNECTION_TIMEOUT', 60000),
|
|
59
67
|
},
|
|
60
|
-
};
|
|
68
|
+
} as Core.Config.Database;
|
|
61
69
|
};
|
|
62
70
|
|
|
63
71
|
export default config;
|
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
import type { Core } from '@strapi/strapi';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const allowedMediaTypes = [
|
|
4
|
+
'image/*',
|
|
5
|
+
'video/*',
|
|
6
|
+
'audio/*',
|
|
7
|
+
'application/pdf',
|
|
8
|
+
'application/msword',
|
|
9
|
+
'application/vnd.openxmlformats-officedocument.*',
|
|
10
|
+
'text/plain',
|
|
11
|
+
'text/csv',
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const deniedExecutableTypes = [
|
|
15
|
+
'application/vnd.microsoft.portable-executable',
|
|
16
|
+
'application/x-msdownload',
|
|
17
|
+
'application/x-msdos-program',
|
|
18
|
+
'application/x-executable',
|
|
19
|
+
'application/x-dosexec',
|
|
20
|
+
'application/x-sh',
|
|
21
|
+
'text/x-shellscript',
|
|
22
|
+
'application/x-mach-binary',
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
const config = ({ env }: Core.Config.Shared.ConfigParams): Core.Config.Plugin => ({
|
|
26
|
+
'users-permissions': {
|
|
27
|
+
config: {
|
|
28
|
+
jwtManagement: 'refresh',
|
|
29
|
+
sessions: {
|
|
30
|
+
httpOnly: true,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
upload: {
|
|
35
|
+
config: {
|
|
36
|
+
security: {
|
|
37
|
+
allowedTypes: allowedMediaTypes,
|
|
38
|
+
deniedTypes: deniedExecutableTypes,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
4
43
|
|
|
5
44
|
export default config;
|
|
@@ -4,7 +4,10 @@ const config = ({ env }: Core.Config.Shared.ConfigParams): Core.Config.Server =>
|
|
|
4
4
|
host: env('HOST', '0.0.0.0'),
|
|
5
5
|
port: env.int('PORT', 1337),
|
|
6
6
|
app: {
|
|
7
|
-
keys: env.array('APP_KEYS')
|
|
7
|
+
keys: env.array('APP_KEYS')!,
|
|
8
|
+
},
|
|
9
|
+
webhooks: {
|
|
10
|
+
populateRelations: env.bool('WEBHOOKS_POPULATE_RELATIONS', false),
|
|
8
11
|
},
|
|
9
12
|
});
|
|
10
13
|
|
|
@@ -1 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
const allowedMediaTypes = [
|
|
2
|
+
'image/*',
|
|
3
|
+
'video/*',
|
|
4
|
+
'audio/*',
|
|
5
|
+
'application/pdf',
|
|
6
|
+
'application/msword',
|
|
7
|
+
'application/vnd.openxmlformats-officedocument.*',
|
|
8
|
+
'text/plain',
|
|
9
|
+
'text/csv',
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
const deniedExecutableTypes = [
|
|
13
|
+
'application/vnd.microsoft.portable-executable',
|
|
14
|
+
'application/x-msdownload',
|
|
15
|
+
'application/x-msdos-program',
|
|
16
|
+
'application/x-executable',
|
|
17
|
+
'application/x-dosexec',
|
|
18
|
+
'application/x-sh',
|
|
19
|
+
'text/x-shellscript',
|
|
20
|
+
'application/x-mach-binary',
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
module.exports = () => ({
|
|
24
|
+
'users-permissions': {
|
|
25
|
+
config: {
|
|
26
|
+
jwtManagement: 'refresh',
|
|
27
|
+
sessions: {
|
|
28
|
+
httpOnly: true,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
upload: {
|
|
33
|
+
config: {
|
|
34
|
+
security: {
|
|
35
|
+
allowedTypes: allowedMediaTypes,
|
|
36
|
+
deniedTypes: deniedExecutableTypes,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -2,18 +2,18 @@ import type { Core } from '@strapi/strapi';
|
|
|
2
2
|
|
|
3
3
|
const config = ({ env }: Core.Config.Shared.ConfigParams): Core.Config.Admin => ({
|
|
4
4
|
auth: {
|
|
5
|
-
secret: env('ADMIN_JWT_SECRET')
|
|
5
|
+
secret: env('ADMIN_JWT_SECRET')!,
|
|
6
6
|
},
|
|
7
7
|
apiToken: {
|
|
8
|
-
salt: env('API_TOKEN_SALT')
|
|
8
|
+
salt: env('API_TOKEN_SALT')!,
|
|
9
9
|
},
|
|
10
10
|
transfer: {
|
|
11
11
|
token: {
|
|
12
|
-
salt: env('TRANSFER_TOKEN_SALT')
|
|
12
|
+
salt: env('TRANSFER_TOKEN_SALT')!,
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
secrets: {
|
|
16
|
-
encryptionKey: env('ENCRYPTION_KEY')
|
|
16
|
+
encryptionKey: env('ENCRYPTION_KEY')!,
|
|
17
17
|
},
|
|
18
18
|
flags: {
|
|
19
19
|
nps: env.bool('FLAG_NPS', true),
|
|
@@ -51,13 +51,21 @@ const config = ({ env }: Core.Config.Shared.ConfigParams): Core.Config.Database
|
|
|
51
51
|
},
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
if (!(client in connections)) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`Unsupported DATABASE_CLIENT: ${client}. Use "postgres", "mysql", or "sqlite".`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
type DatabaseClient = keyof typeof connections;
|
|
61
|
+
|
|
54
62
|
return {
|
|
55
63
|
connection: {
|
|
56
|
-
client,
|
|
57
|
-
...connections[client],
|
|
64
|
+
client: client as DatabaseClient,
|
|
65
|
+
...connections[client as DatabaseClient],
|
|
58
66
|
acquireConnectionTimeout: env.int('DATABASE_CONNECTION_TIMEOUT', 60000),
|
|
59
67
|
},
|
|
60
|
-
};
|
|
68
|
+
} as Core.Config.Database;
|
|
61
69
|
};
|
|
62
70
|
|
|
63
71
|
export default config;
|