@strapi/strapi 5.0.0-beta.7 → 5.0.0-beta.9

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.
Files changed (100) hide show
  1. package/dist/cli/commands/index.d.ts.map +1 -1
  2. package/dist/cli/commands/index.js +1 -14
  3. package/dist/cli/commands/index.js.map +1 -1
  4. package/dist/cli/commands/index.mjs +1 -14
  5. package/dist/cli/commands/index.mjs.map +1 -1
  6. package/dist/cli/index.d.ts.map +1 -1
  7. package/dist/cli/index.js +30 -0
  8. package/dist/cli/index.js.map +1 -1
  9. package/dist/cli/index.mjs +30 -0
  10. package/dist/cli/index.mjs.map +1 -1
  11. package/dist/cli/utils/data-transfer.d.ts.map +1 -1
  12. package/dist/cli/utils/data-transfer.js +29 -21
  13. package/dist/cli/utils/data-transfer.js.map +1 -1
  14. package/dist/cli/utils/data-transfer.mjs +29 -21
  15. package/dist/cli/utils/data-transfer.mjs.map +1 -1
  16. package/package.json +25 -25
  17. package/dist/cli/commands/plugin/build.d.ts +0 -7
  18. package/dist/cli/commands/plugin/build.d.ts.map +0 -1
  19. package/dist/cli/commands/plugin/build.js +0 -88
  20. package/dist/cli/commands/plugin/build.js.map +0 -1
  21. package/dist/cli/commands/plugin/build.mjs +0 -85
  22. package/dist/cli/commands/plugin/build.mjs.map +0 -1
  23. package/dist/cli/commands/plugin/init/action.d.ts +0 -6
  24. package/dist/cli/commands/plugin/init/action.d.ts.map +0 -1
  25. package/dist/cli/commands/plugin/init/action.js +0 -414
  26. package/dist/cli/commands/plugin/init/action.js.map +0 -1
  27. package/dist/cli/commands/plugin/init/action.mjs +0 -409
  28. package/dist/cli/commands/plugin/init/action.mjs.map +0 -1
  29. package/dist/cli/commands/plugin/init/command.d.ts +0 -7
  30. package/dist/cli/commands/plugin/init/command.d.ts.map +0 -1
  31. package/dist/cli/commands/plugin/init/command.js +0 -9
  32. package/dist/cli/commands/plugin/init/command.js.map +0 -1
  33. package/dist/cli/commands/plugin/init/command.mjs +0 -10
  34. package/dist/cli/commands/plugin/init/command.mjs.map +0 -1
  35. package/dist/cli/commands/plugin/init/files/admin.d.ts +0 -5
  36. package/dist/cli/commands/plugin/init/files/admin.d.ts.map +0 -1
  37. package/dist/cli/commands/plugin/init/files/admin.js +0 -283
  38. package/dist/cli/commands/plugin/init/files/admin.js.map +0 -1
  39. package/dist/cli/commands/plugin/init/files/admin.mjs +0 -283
  40. package/dist/cli/commands/plugin/init/files/admin.mjs.map +0 -1
  41. package/dist/cli/commands/plugin/init/files/editorConfig.d.ts +0 -4
  42. package/dist/cli/commands/plugin/init/files/editorConfig.d.ts.map +0 -1
  43. package/dist/cli/commands/plugin/init/files/editorConfig.js +0 -26
  44. package/dist/cli/commands/plugin/init/files/editorConfig.js.map +0 -1
  45. package/dist/cli/commands/plugin/init/files/editorConfig.mjs +0 -26
  46. package/dist/cli/commands/plugin/init/files/editorConfig.mjs.map +0 -1
  47. package/dist/cli/commands/plugin/init/files/eslint.d.ts +0 -4
  48. package/dist/cli/commands/plugin/init/files/eslint.d.ts.map +0 -1
  49. package/dist/cli/commands/plugin/init/files/eslint.js +0 -11
  50. package/dist/cli/commands/plugin/init/files/eslint.js.map +0 -1
  51. package/dist/cli/commands/plugin/init/files/eslint.mjs +0 -11
  52. package/dist/cli/commands/plugin/init/files/eslint.mjs.map +0 -1
  53. package/dist/cli/commands/plugin/init/files/gitIgnore.d.ts +0 -4
  54. package/dist/cli/commands/plugin/init/files/gitIgnore.d.ts.map +0 -1
  55. package/dist/cli/commands/plugin/init/files/gitIgnore.js +0 -34
  56. package/dist/cli/commands/plugin/init/files/gitIgnore.js.map +0 -1
  57. package/dist/cli/commands/plugin/init/files/gitIgnore.mjs +0 -34
  58. package/dist/cli/commands/plugin/init/files/gitIgnore.mjs.map +0 -1
  59. package/dist/cli/commands/plugin/init/files/prettier.d.ts +0 -5
  60. package/dist/cli/commands/plugin/init/files/prettier.d.ts.map +0 -1
  61. package/dist/cli/commands/plugin/init/files/prettier.js +0 -25
  62. package/dist/cli/commands/plugin/init/files/prettier.js.map +0 -1
  63. package/dist/cli/commands/plugin/init/files/prettier.mjs +0 -25
  64. package/dist/cli/commands/plugin/init/files/prettier.mjs.map +0 -1
  65. package/dist/cli/commands/plugin/init/files/server.d.ts +0 -5
  66. package/dist/cli/commands/plugin/init/files/server.d.ts.map +0 -1
  67. package/dist/cli/commands/plugin/init/files/server.js +0 -360
  68. package/dist/cli/commands/plugin/init/files/server.js.map +0 -1
  69. package/dist/cli/commands/plugin/init/files/server.mjs +0 -360
  70. package/dist/cli/commands/plugin/init/files/server.mjs.map +0 -1
  71. package/dist/cli/commands/plugin/init/files/typescript.d.ts +0 -9
  72. package/dist/cli/commands/plugin/init/files/typescript.d.ts.map +0 -1
  73. package/dist/cli/commands/plugin/init/files/typescript.js +0 -66
  74. package/dist/cli/commands/plugin/init/files/typescript.js.map +0 -1
  75. package/dist/cli/commands/plugin/init/files/typescript.mjs +0 -66
  76. package/dist/cli/commands/plugin/init/files/typescript.mjs.map +0 -1
  77. package/dist/cli/commands/plugin/init/index.d.ts +0 -2
  78. package/dist/cli/commands/plugin/init/index.d.ts.map +0 -1
  79. package/dist/cli/commands/plugin/link-watch.d.ts +0 -7
  80. package/dist/cli/commands/plugin/link-watch.d.ts.map +0 -1
  81. package/dist/cli/commands/plugin/link-watch.js +0 -89
  82. package/dist/cli/commands/plugin/link-watch.js.map +0 -1
  83. package/dist/cli/commands/plugin/link-watch.mjs +0 -82
  84. package/dist/cli/commands/plugin/link-watch.mjs.map +0 -1
  85. package/dist/cli/commands/plugin/verify.d.ts +0 -7
  86. package/dist/cli/commands/plugin/verify.d.ts.map +0 -1
  87. package/dist/cli/commands/plugin/verify.js +0 -37
  88. package/dist/cli/commands/plugin/verify.js.map +0 -1
  89. package/dist/cli/commands/plugin/verify.mjs +0 -34
  90. package/dist/cli/commands/plugin/verify.mjs.map +0 -1
  91. package/dist/cli/commands/plugin/watch.d.ts +0 -7
  92. package/dist/cli/commands/plugin/watch.d.ts.map +0 -1
  93. package/dist/cli/commands/plugin/watch.js +0 -86
  94. package/dist/cli/commands/plugin/watch.js.map +0 -1
  95. package/dist/cli/commands/plugin/watch.mjs +0 -83
  96. package/dist/cli/commands/plugin/watch.mjs.map +0 -1
  97. package/dist/cli/utils/pkg.js +0 -111
  98. package/dist/cli/utils/pkg.js.map +0 -1
  99. package/dist/cli/utils/pkg.mjs +0 -87
  100. package/dist/cli/utils/pkg.mjs.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "5.0.0-beta.7",
3
+ "version": "5.0.0-beta.9",
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",
@@ -109,25 +109,25 @@
109
109
  },
110
110
  "dependencies": {
111
111
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
112
- "@strapi/admin": "5.0.0-beta.7",
113
- "@strapi/content-manager": "5.0.0-beta.7",
114
- "@strapi/content-releases": "5.0.0-beta.7",
115
- "@strapi/content-type-builder": "5.0.0-beta.7",
116
- "@strapi/core": "5.0.0-beta.7",
117
- "@strapi/data-transfer": "5.0.0-beta.7",
118
- "@strapi/database": "5.0.0-beta.7",
119
- "@strapi/email": "5.0.0-beta.7",
120
- "@strapi/generate-new": "5.0.0-beta.7",
121
- "@strapi/generators": "5.0.0-beta.7",
122
- "@strapi/i18n": "5.0.0-beta.7",
123
- "@strapi/logger": "5.0.0-beta.7",
112
+ "@strapi/admin": "5.0.0-beta.9",
113
+ "@strapi/content-manager": "5.0.0-beta.9",
114
+ "@strapi/content-releases": "5.0.0-beta.9",
115
+ "@strapi/content-type-builder": "5.0.0-beta.9",
116
+ "@strapi/core": "5.0.0-beta.9",
117
+ "@strapi/data-transfer": "5.0.0-beta.9",
118
+ "@strapi/database": "5.0.0-beta.9",
119
+ "@strapi/email": "5.0.0-beta.9",
120
+ "@strapi/generate-new": "5.0.0-beta.9",
121
+ "@strapi/generators": "5.0.0-beta.9",
122
+ "@strapi/i18n": "5.0.0-beta.9",
123
+ "@strapi/logger": "5.0.0-beta.9",
124
124
  "@strapi/pack-up": "5.0.0",
125
- "@strapi/permissions": "5.0.0-beta.7",
126
- "@strapi/review-workflows": "5.0.0-beta.7",
127
- "@strapi/types": "5.0.0-beta.7",
128
- "@strapi/typescript-utils": "5.0.0-beta.7",
129
- "@strapi/upload": "5.0.0-beta.7",
130
- "@strapi/utils": "5.0.0-beta.7",
125
+ "@strapi/permissions": "5.0.0-beta.9",
126
+ "@strapi/review-workflows": "5.0.0-beta.9",
127
+ "@strapi/types": "5.0.0-beta.9",
128
+ "@strapi/typescript-utils": "5.0.0-beta.9",
129
+ "@strapi/upload": "5.0.0-beta.9",
130
+ "@strapi/utils": "5.0.0-beta.9",
131
131
  "@types/nodemon": "1.19.6",
132
132
  "@vitejs/plugin-react-swc": "3.6.0",
133
133
  "boxen": "5.1.2",
@@ -141,7 +141,7 @@
141
141
  "copyfiles": "2.4.1",
142
142
  "css-loader": "^6.10.0",
143
143
  "dotenv": "16.4.5",
144
- "esbuild": "0.19.11",
144
+ "esbuild": "0.21.3",
145
145
  "esbuild-loader": "^2.21.0",
146
146
  "esbuild-register": "3.5.0",
147
147
  "execa": "5.1.1",
@@ -180,10 +180,10 @@
180
180
  "@types/node": "18.19.24",
181
181
  "@types/webpack-bundle-analyzer": "4.7.0",
182
182
  "@types/webpack-hot-middleware": "2.25.9",
183
- "eslint-config-custom": "5.0.0-beta.7",
184
- "react": "^18.2.0",
185
- "react-dom": "^18.2.0",
186
- "tsconfig": "5.0.0-beta.7"
183
+ "eslint-config-custom": "5.0.0-beta.9",
184
+ "react": "18.3.1",
185
+ "react-dom": "18.3.1",
186
+ "tsconfig": "5.0.0-beta.9"
187
187
  },
188
188
  "peerDependencies": {
189
189
  "react": "^17.0.0 || ^18.0.0",
@@ -195,5 +195,5 @@
195
195
  "node": ">=18.0.0 <=20.x.x",
196
196
  "npm": ">=6.0.0"
197
197
  },
198
- "gitHead": "a86c75effabb5eb8aa36a2e9563f2878ddfbb4c1"
198
+ "gitHead": "0a5a7b91474a18df8a8c6c81613cca1f9c598445"
199
199
  }
@@ -1,7 +0,0 @@
1
- import type { StrapiCommand } from '../../types';
2
- /**
3
- * `$ strapi plugin:build`
4
- */
5
- declare const command: StrapiCommand;
6
- export { command };
7
- //# sourceMappingURL=build.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/plugin/build.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,aAAa,CAAC;AAmG7D;;GAEG;AACH,QAAA,MAAM,OAAO,EAAE,aASd,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -1,88 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const commander = require("commander");
4
- const boxen = require("boxen");
5
- const chalk = require("chalk");
6
- const packUp = require("@strapi/pack-up");
7
- const commander$1 = require("../../utils/commander.js");
8
- const helpers = require("../../utils/helpers.js");
9
- const pkg = require("../../utils/pkg.js");
10
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
11
- const boxen__default = /* @__PURE__ */ _interopDefault(boxen);
12
- const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
13
- const action = async ({ force, ...opts }, _cmd, { logger, cwd }) => {
14
- try {
15
- process.env.NODE_ENV = "production";
16
- const pkg$1 = await pkg.loadPkg({ cwd, logger });
17
- const pkgJson = await pkg.validatePkg({ pkg: pkg$1 });
18
- if (!pkgJson.exports["./strapi-admin"] && !pkgJson.exports["./strapi-server"]) {
19
- throw new Error(
20
- "You need to have either a strapi-admin or strapi-server export in your package.json"
21
- );
22
- }
23
- const bundles = [];
24
- if (pkgJson.exports["./strapi-admin"]) {
25
- const exp = pkgJson.exports["./strapi-admin"];
26
- const bundle = {
27
- source: exp.source,
28
- import: exp.import,
29
- require: exp.require,
30
- runtime: "web"
31
- };
32
- if (exp.types) {
33
- bundle.types = exp.types;
34
- bundle.tsconfig = "./admin/tsconfig.build.json";
35
- }
36
- bundles.push(bundle);
37
- }
38
- if (pkgJson.exports["./strapi-server"]) {
39
- const exp = pkgJson.exports["./strapi-server"];
40
- const bundle = {
41
- source: exp.source,
42
- import: exp.import,
43
- require: exp.require,
44
- runtime: "node"
45
- };
46
- if (exp.types) {
47
- bundle.types = exp.types;
48
- bundle.tsconfig = "./server/tsconfig.build.json";
49
- }
50
- bundles.push(bundle);
51
- }
52
- await packUp.build({
53
- cwd,
54
- configFile: false,
55
- config: {
56
- bundles,
57
- dist: "./dist",
58
- /**
59
- * ignore the exports map of a plugin, because we're streamlining the
60
- * process and ensuring the server package and admin package are built
61
- * with the correct runtime and their individual tsconfigs
62
- */
63
- exports: {}
64
- },
65
- ...opts
66
- });
67
- } catch (err) {
68
- logger.error(
69
- "There seems to be an unexpected error, try again with --debug for more information \n"
70
- );
71
- if (err instanceof Error && err.stack) {
72
- console.log(
73
- chalk__default.default.red(
74
- boxen__default.default(err.stack, {
75
- padding: 1,
76
- align: "left"
77
- })
78
- )
79
- );
80
- }
81
- process.exit(1);
82
- }
83
- };
84
- const command = ({ ctx }) => {
85
- return commander.createCommand("plugin:build").description("Bundle your strapi plugin for publishing.").addOption(commander$1.forceOption).option("-d, --debug", "Enable debugging mode with verbose logs", false).option("--silent", "Don't log anything", false).option("--sourcemap", "produce sourcemaps", false).option("--minify", "minify the output", false).action((...args) => helpers.runAction("plugin:build", action)(...args, ctx));
86
- };
87
- exports.command = command;
88
- //# sourceMappingURL=build.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.js","sources":["../../../../src/cli/commands/plugin/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport boxen from 'boxen';\nimport chalk from 'chalk';\nimport { BuildCLIOptions, ConfigBundle, build } from '@strapi/pack-up';\n\nimport { forceOption } from '../../utils/commander';\nimport { runAction } from '../../utils/helpers';\nimport { Export, loadPkg, validatePkg } from '../../utils/pkg';\nimport type { CLIContext, StrapiCommand } from '../../types';\n\ninterface ActionOptions extends BuildCLIOptions {\n force?: boolean;\n}\n\nconst action = async (\n { force, ...opts }: ActionOptions,\n _cmd: unknown,\n { logger, cwd }: CLIContext\n) => {\n try {\n /**\n * ALWAYS set production for using plugin build CLI.\n */\n process.env.NODE_ENV = 'production';\n\n const pkg = await loadPkg({ cwd, logger });\n const pkgJson = await validatePkg({ pkg });\n\n if (!pkgJson.exports['./strapi-admin'] && !pkgJson.exports['./strapi-server']) {\n throw new Error(\n 'You need to have either a strapi-admin or strapi-server export in your package.json'\n );\n }\n\n const bundles: ConfigBundle[] = [];\n\n if (pkgJson.exports['./strapi-admin']) {\n const exp = pkgJson.exports['./strapi-admin'] as Export;\n\n const bundle: ConfigBundle = {\n source: exp.source,\n import: exp.import,\n require: exp.require,\n runtime: 'web',\n };\n\n if (exp.types) {\n bundle.types = exp.types;\n // TODO: should this be sliced from the source path...?\n bundle.tsconfig = './admin/tsconfig.build.json';\n }\n\n bundles.push(bundle);\n }\n\n if (pkgJson.exports['./strapi-server']) {\n const exp = pkgJson.exports['./strapi-server'] as Export;\n\n const bundle: ConfigBundle = {\n source: exp.source,\n import: exp.import,\n require: exp.require,\n runtime: 'node',\n };\n\n if (exp.types) {\n bundle.types = exp.types;\n // TODO: should this be sliced from the source path...?\n bundle.tsconfig = './server/tsconfig.build.json';\n }\n\n bundles.push(bundle);\n }\n\n await build({\n cwd,\n configFile: false,\n config: {\n bundles,\n dist: './dist',\n /**\n * ignore the exports map of a plugin, because we're streamlining the\n * process and ensuring the server package and admin package are built\n * with the correct runtime and their individual tsconfigs\n */\n exports: {},\n },\n ...opts,\n });\n } catch (err) {\n logger.error(\n 'There seems to be an unexpected error, try again with --debug for more information \\n'\n );\n if (err instanceof Error && err.stack) {\n console.log(\n chalk.red(\n boxen(err.stack, {\n padding: 1,\n align: 'left',\n })\n )\n );\n }\n process.exit(1);\n }\n};\n\n/**\n * `$ strapi plugin:build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('plugin:build')\n .description('Bundle your strapi plugin for publishing.')\n .addOption(forceOption)\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'produce sourcemaps', false)\n .option('--minify', 'minify the output', false)\n .action((...args) => runAction('plugin:build', action)(...args, ctx));\n};\n\nexport { command };\n"],"names":["pkg","loadPkg","validatePkg","build","chalk","boxen","createCommand","forceOption","runAction"],"mappings":";;;;;;;;;;;;AAcA,MAAM,SAAS,OACb,EAAE,OAAO,GAAG,KAAK,GACjB,MACA,EAAE,QAAQ,UACP;AACC,MAAA;AAIF,YAAQ,IAAI,WAAW;AAEvB,UAAMA,QAAM,MAAMC,IAAA,QAAQ,EAAE,KAAK,OAAQ,CAAA;AACzC,UAAM,UAAU,MAAMC,IAAAA,YAAY,EAAEF,KAAAA,MAAK,CAAA;AAErC,QAAA,CAAC,QAAQ,QAAQ,gBAAgB,KAAK,CAAC,QAAQ,QAAQ,iBAAiB,GAAG;AAC7E,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAM,UAA0B,CAAA;AAE5B,QAAA,QAAQ,QAAQ,gBAAgB,GAAG;AAC/B,YAAA,MAAM,QAAQ,QAAQ,gBAAgB;AAE5C,YAAM,SAAuB;AAAA,QAC3B,QAAQ,IAAI;AAAA,QACZ,QAAQ,IAAI;AAAA,QACZ,SAAS,IAAI;AAAA,QACb,SAAS;AAAA,MAAA;AAGX,UAAI,IAAI,OAAO;AACb,eAAO,QAAQ,IAAI;AAEnB,eAAO,WAAW;AAAA,MACpB;AAEA,cAAQ,KAAK,MAAM;AAAA,IACrB;AAEI,QAAA,QAAQ,QAAQ,iBAAiB,GAAG;AAChC,YAAA,MAAM,QAAQ,QAAQ,iBAAiB;AAE7C,YAAM,SAAuB;AAAA,QAC3B,QAAQ,IAAI;AAAA,QACZ,QAAQ,IAAI;AAAA,QACZ,SAAS,IAAI;AAAA,QACb,SAAS;AAAA,MAAA;AAGX,UAAI,IAAI,OAAO;AACb,eAAO,QAAQ,IAAI;AAEnB,eAAO,WAAW;AAAA,MACpB;AAEA,cAAQ,KAAK,MAAM;AAAA,IACrB;AAEA,UAAMG,aAAM;AAAA,MACV;AAAA,MACA,YAAY;AAAA,MACZ,QAAQ;AAAA,QACN;AAAA,QACA,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAMN,SAAS,CAAC;AAAA,MACZ;AAAA,MACA,GAAG;AAAA,IAAA,CACJ;AAAA,WACM,KAAK;AACL,WAAA;AAAA,MACL;AAAA,IAAA;AAEE,QAAA,eAAe,SAAS,IAAI,OAAO;AAC7B,cAAA;AAAA,QACNC,eAAAA,QAAM;AAAA,UACJC,eAAA,QAAM,IAAI,OAAO;AAAA,YACf,SAAS;AAAA,YACT,OAAO;AAAA,UAAA,CACR;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAKA,MAAM,UAAyB,CAAC,EAAE,UAAU;AAC1C,SAAOC,UAAAA,cAAc,cAAc,EAChC,YAAY,2CAA2C,EACvD,UAAUC,uBAAW,EACrB,OAAO,eAAe,2CAA2C,KAAK,EACtE,OAAO,YAAY,sBAAsB,KAAK,EAC9C,OAAO,eAAe,sBAAsB,KAAK,EACjD,OAAO,YAAY,qBAAqB,KAAK,EAC7C,OAAO,IAAI,SAASC,kBAAU,gBAAgB,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC;AACxE;;"}
@@ -1,85 +0,0 @@
1
- import { createCommand } from "commander";
2
- import boxen from "boxen";
3
- import chalk from "chalk";
4
- import { build } from "@strapi/pack-up";
5
- import { forceOption } from "../../utils/commander.mjs";
6
- import { runAction } from "../../utils/helpers.mjs";
7
- import { loadPkg, validatePkg } from "../../utils/pkg.mjs";
8
- const action = async ({ force, ...opts }, _cmd, { logger, cwd }) => {
9
- try {
10
- process.env.NODE_ENV = "production";
11
- const pkg = await loadPkg({ cwd, logger });
12
- const pkgJson = await validatePkg({ pkg });
13
- if (!pkgJson.exports["./strapi-admin"] && !pkgJson.exports["./strapi-server"]) {
14
- throw new Error(
15
- "You need to have either a strapi-admin or strapi-server export in your package.json"
16
- );
17
- }
18
- const bundles = [];
19
- if (pkgJson.exports["./strapi-admin"]) {
20
- const exp = pkgJson.exports["./strapi-admin"];
21
- const bundle = {
22
- source: exp.source,
23
- import: exp.import,
24
- require: exp.require,
25
- runtime: "web"
26
- };
27
- if (exp.types) {
28
- bundle.types = exp.types;
29
- bundle.tsconfig = "./admin/tsconfig.build.json";
30
- }
31
- bundles.push(bundle);
32
- }
33
- if (pkgJson.exports["./strapi-server"]) {
34
- const exp = pkgJson.exports["./strapi-server"];
35
- const bundle = {
36
- source: exp.source,
37
- import: exp.import,
38
- require: exp.require,
39
- runtime: "node"
40
- };
41
- if (exp.types) {
42
- bundle.types = exp.types;
43
- bundle.tsconfig = "./server/tsconfig.build.json";
44
- }
45
- bundles.push(bundle);
46
- }
47
- await build({
48
- cwd,
49
- configFile: false,
50
- config: {
51
- bundles,
52
- dist: "./dist",
53
- /**
54
- * ignore the exports map of a plugin, because we're streamlining the
55
- * process and ensuring the server package and admin package are built
56
- * with the correct runtime and their individual tsconfigs
57
- */
58
- exports: {}
59
- },
60
- ...opts
61
- });
62
- } catch (err) {
63
- logger.error(
64
- "There seems to be an unexpected error, try again with --debug for more information \n"
65
- );
66
- if (err instanceof Error && err.stack) {
67
- console.log(
68
- chalk.red(
69
- boxen(err.stack, {
70
- padding: 1,
71
- align: "left"
72
- })
73
- )
74
- );
75
- }
76
- process.exit(1);
77
- }
78
- };
79
- const command = ({ ctx }) => {
80
- return createCommand("plugin:build").description("Bundle your strapi plugin for publishing.").addOption(forceOption).option("-d, --debug", "Enable debugging mode with verbose logs", false).option("--silent", "Don't log anything", false).option("--sourcemap", "produce sourcemaps", false).option("--minify", "minify the output", false).action((...args) => runAction("plugin:build", action)(...args, ctx));
81
- };
82
- export {
83
- command
84
- };
85
- //# sourceMappingURL=build.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.mjs","sources":["../../../../src/cli/commands/plugin/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport boxen from 'boxen';\nimport chalk from 'chalk';\nimport { BuildCLIOptions, ConfigBundle, build } from '@strapi/pack-up';\n\nimport { forceOption } from '../../utils/commander';\nimport { runAction } from '../../utils/helpers';\nimport { Export, loadPkg, validatePkg } from '../../utils/pkg';\nimport type { CLIContext, StrapiCommand } from '../../types';\n\ninterface ActionOptions extends BuildCLIOptions {\n force?: boolean;\n}\n\nconst action = async (\n { force, ...opts }: ActionOptions,\n _cmd: unknown,\n { logger, cwd }: CLIContext\n) => {\n try {\n /**\n * ALWAYS set production for using plugin build CLI.\n */\n process.env.NODE_ENV = 'production';\n\n const pkg = await loadPkg({ cwd, logger });\n const pkgJson = await validatePkg({ pkg });\n\n if (!pkgJson.exports['./strapi-admin'] && !pkgJson.exports['./strapi-server']) {\n throw new Error(\n 'You need to have either a strapi-admin or strapi-server export in your package.json'\n );\n }\n\n const bundles: ConfigBundle[] = [];\n\n if (pkgJson.exports['./strapi-admin']) {\n const exp = pkgJson.exports['./strapi-admin'] as Export;\n\n const bundle: ConfigBundle = {\n source: exp.source,\n import: exp.import,\n require: exp.require,\n runtime: 'web',\n };\n\n if (exp.types) {\n bundle.types = exp.types;\n // TODO: should this be sliced from the source path...?\n bundle.tsconfig = './admin/tsconfig.build.json';\n }\n\n bundles.push(bundle);\n }\n\n if (pkgJson.exports['./strapi-server']) {\n const exp = pkgJson.exports['./strapi-server'] as Export;\n\n const bundle: ConfigBundle = {\n source: exp.source,\n import: exp.import,\n require: exp.require,\n runtime: 'node',\n };\n\n if (exp.types) {\n bundle.types = exp.types;\n // TODO: should this be sliced from the source path...?\n bundle.tsconfig = './server/tsconfig.build.json';\n }\n\n bundles.push(bundle);\n }\n\n await build({\n cwd,\n configFile: false,\n config: {\n bundles,\n dist: './dist',\n /**\n * ignore the exports map of a plugin, because we're streamlining the\n * process and ensuring the server package and admin package are built\n * with the correct runtime and their individual tsconfigs\n */\n exports: {},\n },\n ...opts,\n });\n } catch (err) {\n logger.error(\n 'There seems to be an unexpected error, try again with --debug for more information \\n'\n );\n if (err instanceof Error && err.stack) {\n console.log(\n chalk.red(\n boxen(err.stack, {\n padding: 1,\n align: 'left',\n })\n )\n );\n }\n process.exit(1);\n }\n};\n\n/**\n * `$ strapi plugin:build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('plugin:build')\n .description('Bundle your strapi plugin for publishing.')\n .addOption(forceOption)\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'produce sourcemaps', false)\n .option('--minify', 'minify the output', false)\n .action((...args) => runAction('plugin:build', action)(...args, ctx));\n};\n\nexport { command };\n"],"names":[],"mappings":";;;;;;;AAcA,MAAM,SAAS,OACb,EAAE,OAAO,GAAG,KAAK,GACjB,MACA,EAAE,QAAQ,UACP;AACC,MAAA;AAIF,YAAQ,IAAI,WAAW;AAEvB,UAAM,MAAM,MAAM,QAAQ,EAAE,KAAK,OAAQ,CAAA;AACzC,UAAM,UAAU,MAAM,YAAY,EAAE,IAAK,CAAA;AAErC,QAAA,CAAC,QAAQ,QAAQ,gBAAgB,KAAK,CAAC,QAAQ,QAAQ,iBAAiB,GAAG;AAC7E,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAM,UAA0B,CAAA;AAE5B,QAAA,QAAQ,QAAQ,gBAAgB,GAAG;AAC/B,YAAA,MAAM,QAAQ,QAAQ,gBAAgB;AAE5C,YAAM,SAAuB;AAAA,QAC3B,QAAQ,IAAI;AAAA,QACZ,QAAQ,IAAI;AAAA,QACZ,SAAS,IAAI;AAAA,QACb,SAAS;AAAA,MAAA;AAGX,UAAI,IAAI,OAAO;AACb,eAAO,QAAQ,IAAI;AAEnB,eAAO,WAAW;AAAA,MACpB;AAEA,cAAQ,KAAK,MAAM;AAAA,IACrB;AAEI,QAAA,QAAQ,QAAQ,iBAAiB,GAAG;AAChC,YAAA,MAAM,QAAQ,QAAQ,iBAAiB;AAE7C,YAAM,SAAuB;AAAA,QAC3B,QAAQ,IAAI;AAAA,QACZ,QAAQ,IAAI;AAAA,QACZ,SAAS,IAAI;AAAA,QACb,SAAS;AAAA,MAAA;AAGX,UAAI,IAAI,OAAO;AACb,eAAO,QAAQ,IAAI;AAEnB,eAAO,WAAW;AAAA,MACpB;AAEA,cAAQ,KAAK,MAAM;AAAA,IACrB;AAEA,UAAM,MAAM;AAAA,MACV;AAAA,MACA,YAAY;AAAA,MACZ,QAAQ;AAAA,QACN;AAAA,QACA,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAMN,SAAS,CAAC;AAAA,MACZ;AAAA,MACA,GAAG;AAAA,IAAA,CACJ;AAAA,WACM,KAAK;AACL,WAAA;AAAA,MACL;AAAA,IAAA;AAEE,QAAA,eAAe,SAAS,IAAI,OAAO;AAC7B,cAAA;AAAA,QACN,MAAM;AAAA,UACJ,MAAM,IAAI,OAAO;AAAA,YACf,SAAS;AAAA,YACT,OAAO;AAAA,UAAA,CACR;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAKA,MAAM,UAAyB,CAAC,EAAE,UAAU;AAC1C,SAAO,cAAc,cAAc,EAChC,YAAY,2CAA2C,EACvD,UAAU,WAAW,EACrB,OAAO,eAAe,2CAA2C,KAAK,EACtE,OAAO,YAAY,sBAAsB,KAAK,EAC9C,OAAO,eAAe,sBAAsB,KAAK,EACjD,OAAO,YAAY,qBAAqB,KAAK,EAC7C,OAAO,IAAI,SAAS,UAAU,gBAAgB,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC;AACxE;"}
@@ -1,6 +0,0 @@
1
- import { InitOptions } from '@strapi/pack-up';
2
- import { CLIContext } from '../../../types';
3
- type ActionOptions = Pick<InitOptions, 'silent' | 'debug'>;
4
- declare const _default: (packagePath: string, { silent, debug }: ActionOptions, { logger, cwd }: CLIContext) => Promise<void>;
5
- export default _default;
6
- //# sourceMappingURL=action.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/plugin/init/action.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,WAAW,EAMZ,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,KAAK,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAC;sCAG5C,MAAM,qBACA,aAAa,mBACf,UAAU;AAH7B,wBAkCE"}