diff --git a/.changeset/bright-trees-taste.md b/.changeset/bright-trees-taste.md new file mode 100644 index 0000000..a66555f --- /dev/null +++ b/.changeset/bright-trees-taste.md @@ -0,0 +1,5 @@ +--- +'@strapi/sdk-plugin': patch +--- + +Fix build for v5 plugins diff --git a/package.json b/package.json index 7cb967d..04f3f6d 100644 --- a/package.json +++ b/package.json @@ -58,11 +58,11 @@ "watch": "pack-up watch" }, "dependencies": { - "@strapi/pack-up": "5.0.0", + "@strapi/pack-up": ">=5.0.1-alpha.1 <6.0.0", "@types/prompts": "2.4.9", "boxen": "5.1.2", "chalk": "4.1.2", - "commander": "8.3.0", + "commander": "12.1.0", "concurrently": "^8.2.2", "get-latest-version": "5.1.0", "git-url-parse": "13.1.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2d8f7fa..cbd6830 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@strapi/pack-up': - specifier: 5.0.0 - version: 5.0.0(@types/node@20.12.6) + specifier: '>=5.0.1-alpha.1 <6.0.0' + version: 5.0.1-alpha.1(@types/node@20.12.6) '@types/prompts': specifier: 2.4.9 version: 2.4.9 @@ -21,8 +21,8 @@ importers: specifier: 4.1.2 version: 4.1.2 commander: - specifier: 8.3.0 - version: 8.3.0 + specifier: 12.1.0 + version: 12.1.0 concurrently: specifier: ^8.2.2 version: 8.2.2 @@ -823,8 +823,8 @@ packages: typescript: optional: true - '@strapi/pack-up@5.0.0': - resolution: {integrity: sha512-XN00SUwiR/rFTXxA3TMyuPt6SN4r6vuhUtx3y2D0NTzgVToNi++MyspPQ/jHbolHhQxUWnet6X/2JRprtE/YpQ==} + '@strapi/pack-up@5.0.1-alpha.1': + resolution: {integrity: sha512-FEuo7jcU+YTB8Q1UZteSZ0i/ghWBccBYX57ZOrUcDK6zKuUc0GOIGp010KzqaEHLJkU5c0Us+Cz3yTN7+8omiQ==} engines: {node: '>=18.0.0 <=20.x.x', npm: '>=6.0.0'} hasBin: true @@ -1458,6 +1458,10 @@ packages: resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==} engines: {node: '>=16'} + commander@12.1.0: + resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==} + engines: {node: '>=18'} + commander@8.3.0: resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==} engines: {node: '>= 12'} @@ -4890,7 +4894,7 @@ snapshots: - prettier - supports-color - '@strapi/pack-up@5.0.0(@types/node@20.12.6)': + '@strapi/pack-up@5.0.1-alpha.1(@types/node@20.12.6)': dependencies: '@vitejs/plugin-react-swc': 3.6.0(vite@5.2.8(@types/node@20.12.6)) boxen: 5.1.2 @@ -5681,6 +5685,8 @@ snapshots: commander@11.1.0: {} + commander@12.1.0: {} + commander@8.3.0: {} common-tags@1.8.2: {} diff --git a/src/cli/commands/plugin/init/action.ts b/src/cli/commands/plugin/init/action.ts index a690697..d05da17 100644 --- a/src/cli/commands/plugin/init/action.ts +++ b/src/cli/commands/plugin/init/action.ts @@ -19,6 +19,7 @@ const USE_BETA_VERSIONS: string[] = [ '@strapi/icons', '@strapi/strapi', '@strapi/sdk-plugin', + '@strapi/typescript-utils', ] as const; export default async ( @@ -310,6 +311,7 @@ const PLUGIN_TEMPLATE = defineTemplate(async ({ logger, gitConfig, packagePath } ...pkgJson.dependencies, '@strapi/design-system': '*', '@strapi/icons': '*', + 'react-intl': '*', }; pkgJson.devDependencies = { diff --git a/src/cli/commands/plugin/init/files/server.ts b/src/cli/commands/plugin/init/files/server.ts index 9c098fb..ad67f34 100644 --- a/src/cli/commands/plugin/init/files/server.ts +++ b/src/cli/commands/plugin/init/files/server.ts @@ -9,34 +9,20 @@ const TYPESCRIPT = (pluginName: string): TemplateFile[] => [ /** * Application methods */ - import bootstrap from './bootstrap'; - import destroy from './destroy'; - import register from './register'; + export * as bootstrap from './bootstrap'; + export * as destroy from './destroy'; + export * as register from './register'; /** * Plugin server methods */ - import config from './config'; - import contentTypes from './content-types'; - import controllers from './controllers'; - import middlewares from './middlewares'; - import policies from './policies'; - import routes from './routes'; - import services from './services'; - - export default { - bootstrap, - destroy, - register, - - config, - controllers, - contentTypes, - middlewares, - policies, - routes, - services, - }; + export * as config from './config'; + export * as contentTypes from './content-types'; + export * as controllers from './controllers'; + export * as middlewares from './middlewares'; + export * as policies from './policies'; + export * as routes from './routes'; + export * as services from './services'; `, }, { @@ -93,11 +79,7 @@ const TYPESCRIPT = (pluginName: string): TemplateFile[] => [ { name: 'server/src/controllers/index.ts', contents: outdent` - import controller from './controller'; - - export default { - controller, - }; + export * as controller from './controller'; `, }, { @@ -149,11 +131,7 @@ const TYPESCRIPT = (pluginName: string): TemplateFile[] => [ { name: 'server/src/services/index.ts', contents: outdent` - import service from './service'; - - export default { - service, - }; + export * as service from './service'; `, }, {