@strapi/generators 0.0.0-next.e6eaa3d0563c85f80fd88b258df70a55c057096e → 0.0.0-next.e98ae27d8c69c68823eb7c46cf329385637ba393

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 (93) hide show
  1. package/LICENSE +18 -3
  2. package/dist/index.d.ts +2 -2
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +33 -26
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +32 -26
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/plopfile.d.ts +1 -1
  9. package/dist/plopfile.d.ts.map +1 -1
  10. package/dist/plopfile.js +621 -667
  11. package/dist/plopfile.js.map +1 -1
  12. package/dist/plopfile.mjs +621 -645
  13. package/dist/plopfile.mjs.map +1 -1
  14. package/dist/plops/api.d.ts +1 -1
  15. package/dist/plops/api.d.ts.map +1 -1
  16. package/dist/plops/content-type.d.ts +1 -1
  17. package/dist/plops/content-type.d.ts.map +1 -1
  18. package/dist/plops/controller.d.ts +1 -1
  19. package/dist/plops/controller.d.ts.map +1 -1
  20. package/dist/plops/middleware.d.ts +1 -1
  21. package/dist/plops/middleware.d.ts.map +1 -1
  22. package/dist/plops/migration.d.ts +1 -1
  23. package/dist/plops/migration.d.ts.map +1 -1
  24. package/dist/plops/policy.d.ts +1 -1
  25. package/dist/plops/policy.d.ts.map +1 -1
  26. package/dist/plops/service.d.ts +1 -1
  27. package/dist/plops/service.d.ts.map +1 -1
  28. package/dist/plops/utils/get-file-path.d.ts +1 -1
  29. package/dist/templates/js/content-type.schema.json.hbs +0 -1
  30. package/dist/templates/ts/content-type.schema.json.hbs +0 -1
  31. package/dist/templates/ts/middleware.ts.hbs +2 -2
  32. package/package.json +16 -14
  33. package/dist/files/js/plugin/.gitattributes +0 -103
  34. package/dist/files/js/plugin/admin/src/components/Initializer/index.js +0 -26
  35. package/dist/files/js/plugin/admin/src/components/PluginIcon/index.js +0 -12
  36. package/dist/files/js/plugin/admin/src/index.js +0 -61
  37. package/dist/files/js/plugin/admin/src/pages/App/index.js +0 -25
  38. package/dist/files/js/plugin/admin/src/pages/HomePage/index.js +0 -20
  39. package/dist/files/js/plugin/admin/src/pluginId.js +0 -5
  40. package/dist/files/js/plugin/admin/src/translations/en.json +0 -1
  41. package/dist/files/js/plugin/admin/src/translations/fr.json +0 -1
  42. package/dist/files/js/plugin/admin/src/utils/getTrad.js +0 -5
  43. package/dist/files/js/plugin/server/bootstrap.js +0 -5
  44. package/dist/files/js/plugin/server/config/index.js +0 -6
  45. package/dist/files/js/plugin/server/content-types/index.js +0 -3
  46. package/dist/files/js/plugin/server/controllers/index.js +0 -7
  47. package/dist/files/js/plugin/server/controllers/my-controller.js.hbs +0 -10
  48. package/dist/files/js/plugin/server/destroy.js +0 -5
  49. package/dist/files/js/plugin/server/index.js +0 -25
  50. package/dist/files/js/plugin/server/middlewares/index.js +0 -3
  51. package/dist/files/js/plugin/server/policies/index.js +0 -3
  52. package/dist/files/js/plugin/server/register.js +0 -5
  53. package/dist/files/js/plugin/server/routes/index.js +0 -10
  54. package/dist/files/js/plugin/server/services/index.js +0 -7
  55. package/dist/files/js/plugin/server/services/my-service.js +0 -7
  56. package/dist/files/js/plugin/strapi-admin.js +0 -3
  57. package/dist/files/js/plugin/strapi-server.js +0 -3
  58. package/dist/files/ts/plugin/.gitattributes +0 -103
  59. package/dist/files/ts/plugin/admin/src/components/Initializer/index.tsx +0 -24
  60. package/dist/files/ts/plugin/admin/src/components/PluginIcon/index.tsx +0 -12
  61. package/dist/files/ts/plugin/admin/src/index.tsx +0 -67
  62. package/dist/files/ts/plugin/admin/src/pages/App/index.tsx +0 -25
  63. package/dist/files/ts/plugin/admin/src/pages/HomePage/index.tsx +0 -19
  64. package/dist/files/ts/plugin/admin/src/pluginId.ts +0 -5
  65. package/dist/files/ts/plugin/admin/src/translations/en.json +0 -1
  66. package/dist/files/ts/plugin/admin/src/translations/fr.json +0 -1
  67. package/dist/files/ts/plugin/admin/src/utils/getTrad.ts +0 -5
  68. package/dist/files/ts/plugin/custom.d.ts +0 -5
  69. package/dist/files/ts/plugin/server/bootstrap.ts +0 -5
  70. package/dist/files/ts/plugin/server/config/index.ts +0 -4
  71. package/dist/files/ts/plugin/server/content-types/index.ts +0 -1
  72. package/dist/files/ts/plugin/server/controllers/index.ts +0 -5
  73. package/dist/files/ts/plugin/server/controllers/my-controller.ts.hbs +0 -10
  74. package/dist/files/ts/plugin/server/destroy.ts +0 -5
  75. package/dist/files/ts/plugin/server/index.ts +0 -23
  76. package/dist/files/ts/plugin/server/middlewares/index.ts +0 -1
  77. package/dist/files/ts/plugin/server/policies/index.ts +0 -1
  78. package/dist/files/ts/plugin/server/register.ts +0 -5
  79. package/dist/files/ts/plugin/server/routes/index.ts +0 -10
  80. package/dist/files/ts/plugin/server/services/index.ts +0 -5
  81. package/dist/files/ts/plugin/server/services/my-service.ts +0 -7
  82. package/dist/files/ts/plugin/strapi-admin.js +0 -3
  83. package/dist/files/ts/plugin/strapi-server.js +0 -3
  84. package/dist/files/ts/plugin/tsconfig.json +0 -20
  85. package/dist/files/ts/plugin/tsconfig.server.json +0 -25
  86. package/dist/plops/plugin.d.ts +0 -4
  87. package/dist/plops/plugin.d.ts.map +0 -1
  88. package/dist/plops/prompts/draft-and-publish-prompts.d.ts +0 -4
  89. package/dist/plops/prompts/draft-and-publish-prompts.d.ts.map +0 -1
  90. package/dist/templates/js/README.md.hbs +0 -3
  91. package/dist/templates/js/plugin-package.json.hbs +0 -42
  92. package/dist/templates/ts/README.md.hbs +0 -3
  93. package/dist/templates/ts/plugin-package.json.hbs +0 -51
package/LICENSE CHANGED
@@ -2,7 +2,21 @@ Copyright (c) 2015-present Strapi Solutions SAS
2
2
 
3
3
  Portions of the Strapi software are licensed as follows:
4
4
 
5
- * All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined in "ee/LICENSE".
5
+ * All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined below.
6
+
7
+ Enterprise License
8
+
9
+ If you or the company you represent has entered into a written agreement referencing the Enterprise Edition of the Strapi source code available at
10
+ https://github.com/strapi/strapi, then such agreement applies to your use of the Enterprise Edition of the Strapi Software. If you or the company you
11
+ represent is using the Enterprise Edition of the Strapi Software in connection with a subscription to our cloud offering, then the agreement you have
12
+ agreed to with respect to our cloud offering and the licenses included in such agreement apply to your use of the Enterprise Edition of the Strapi Software.
13
+ Otherwise, the Strapi Enterprise Software License Agreement (found here https://strapi.io/enterprise-terms) applies to your use of the Enterprise Edition of the Strapi Software.
14
+
15
+ BY ACCESSING OR USING THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE RELEVANT REFERENCED AGREEMENT.
16
+ IF YOU ARE NOT AUTHORIZED TO ACCEPT THESE TERMS ON BEHALF OF THE COMPANY YOU REPRESENT OR IF YOU DO NOT AGREE TO ALL OF THE RELEVANT TERMS AND CONDITIONS REFERENCED AND YOU
17
+ HAVE NOT OTHERWISE EXECUTED A WRITTEN AGREEMENT WITH STRAPI, YOU ARE NOT AUTHORIZED TO ACCESS OR USE OR ALLOW ANY USER TO ACCESS OR USE ANY PART OF
18
+ THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE. YOUR ACCESS RIGHTS ARE CONDITIONAL ON YOUR CONSENT TO THE RELEVANT REFERENCED TERMS TO THE EXCLUSION OF ALL OTHER TERMS;
19
+ IF THE RELEVANT REFERENCED TERMS ARE CONSIDERED AN OFFER BY YOU, ACCEPTANCE IS EXPRESSLY LIMITED TO THE RELEVANT REFERENCED TERMS.
6
20
 
7
21
  * All software outside of the above-mentioned directories or restrictions above is available under the "MIT Expat" license as set forth below.
8
22
 
@@ -18,5 +32,6 @@ furnished to do so, subject to the following conditions:
18
32
  The above copyright notice and this permission notice shall be included in all
19
33
  copies or substantial portions of the Software.
20
34
 
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
35
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
37
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export declare const runCLI: () => void;
2
- export declare const generate: (generatorName: string, options: unknown, { dir, plopFile }?: {
1
+ export declare const runCLI: () => Promise<void>;
2
+ export declare const generate: <T extends Record<string, any>>(generatorName: string, options: T, { dir, plopFile }?: {
3
3
  dir?: string | undefined;
4
4
  plopFile?: string | undefined;
5
5
  }) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,MAAM,YAKlB,CAAC;AAGF,eAAO,MAAM,QAAQ,kBACJ,MAAM,WACZ,OAAO;;;mBAcjB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM,qBAkBlB,CAAC;AAGF,eAAO,MAAM,QAAQ,iDACJ,MAAM,WACZ,CAAC;;;mBAcX,CAAC"}
package/dist/index.js CHANGED
@@ -1,31 +1,38 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const node_path = require("node:path");
4
- const plop = require("plop");
5
- const nodePlop = require("node-plop");
6
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
7
- const nodePlop__default = /* @__PURE__ */ _interopDefault(nodePlop);
8
- const runCLI = () => {
9
- plop.Plop.launch({ configPath: node_path.join(__dirname, "plopfile.js") }, (env) => {
10
- const options = { ...env, dest: node_path.join(process.cwd(), "src") };
11
- plop.run(options, void 0, true);
12
- });
1
+ 'use strict';
2
+
3
+ var node_path = require('node:path');
4
+ var nodePlop = require('node-plop');
5
+
6
+ // Starts the Plop CLI programmatically
7
+ const runCLI = async ()=>{
8
+ const { Plop, run } = await import('plop');
9
+ Plop.prepare({
10
+ configPath: node_path.join(__dirname, 'plopfile.js')
11
+ }, (env)=>{
12
+ const argv = process.argv.slice(2); // Extract command-line arguments
13
+ Plop.execute(env, argv, (env, argv)=>{
14
+ const options = {
15
+ ...env,
16
+ dest: node_path.join(process.cwd(), 'src')
17
+ };
18
+ return run(options, argv, true); // Pass the third argument 'true' for passArgsBeforeDashes
19
+ });
20
+ });
13
21
  };
14
- const generate = async (generatorName, options, { dir = process.cwd(), plopFile = "plopfile.js" } = {}) => {
15
- const plop2 = nodePlop__default.default(node_path.join(__dirname, plopFile), {
16
- destBasePath: node_path.join(dir, "src"),
17
- force: false
18
- });
19
- const generator = plop2.getGenerator(generatorName);
20
- await generator.runActions(options, {
21
- onSuccess() {
22
- },
23
- onFailure() {
24
- },
25
- onComment() {
26
- }
27
- });
22
+ // Runs a generator programmatically without prompts
23
+ const generate = async (generatorName, options, { dir = process.cwd(), plopFile = 'plopfile.js' } = {})=>{
24
+ const plop = nodePlop(node_path.join(__dirname, plopFile), {
25
+ destBasePath: node_path.join(dir, 'src'),
26
+ force: false
27
+ });
28
+ const generator = plop.getGenerator(generatorName);
29
+ await generator.runActions(options, {
30
+ onSuccess () {},
31
+ onFailure () {},
32
+ onComment () {}
33
+ });
28
34
  };
35
+
29
36
  exports.generate = generate;
30
37
  exports.runCLI = runCLI;
31
38
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { Plop, run } from 'plop';\nimport nodePlop from 'node-plop';\n\n// Starts the Plop CLI programmatically\nexport const runCLI = () => {\n Plop.launch({ configPath: join(__dirname, 'plopfile.js') }, (env) => {\n const options = { ...env, dest: join(process.cwd(), 'src') };\n run(options, undefined, true);\n });\n};\n\n// Runs a generator programmatically without prompts\nexport const generate = async (\n generatorName: string,\n options: unknown,\n { dir = process.cwd(), plopFile = 'plopfile.js' } = {}\n) => {\n const plop = nodePlop(join(__dirname, plopFile), {\n destBasePath: join(dir, 'src'),\n force: false,\n });\n\n const generator = plop.getGenerator(generatorName);\n await generator.runActions(options, {\n onSuccess() {},\n onFailure() {},\n onComment() {},\n });\n};\n"],"names":["Plop","join","run","plop","nodePlop"],"mappings":";;;;;;;AAKO,MAAM,SAAS,MAAM;AACrBA,YAAA,OAAO,EAAE,YAAYC,UAAAA,KAAK,WAAW,aAAa,KAAK,CAAC,QAAQ;AAC7D,UAAA,UAAU,EAAE,GAAG,KAAK,MAAMA,eAAK,QAAQ,IAAA,GAAO,KAAK;AACrDC,SAAAA,IAAA,SAAS,QAAW,IAAI;AAAA,EAAA,CAC7B;AACH;AAGO,MAAM,WAAW,OACtB,eACA,SACA,EAAE,MAAM,QAAQ,OAAO,WAAW,cAAc,IAAI,CAAA,MACjD;AACH,QAAMC,QAAOC,kBAAA,QAASH,UAAK,KAAA,WAAW,QAAQ,GAAG;AAAA,IAC/C,cAAcA,UAAAA,KAAK,KAAK,KAAK;AAAA,IAC7B,OAAO;AAAA,EAAA,CACR;AAEK,QAAA,YAAYE,MAAK,aAAa,aAAa;AAC3C,QAAA,UAAU,WAAW,SAAS;AAAA,IAClC,YAAY;AAAA,IAAC;AAAA,IACb,YAAY;AAAA,IAAC;AAAA,IACb,YAAY;AAAA,IAAC;AAAA,EAAA,CACd;AACH;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport nodePlop from 'node-plop';\n\n// Starts the Plop CLI programmatically\nexport const runCLI = async () => {\n const { Plop, run } = await import('plop');\n\n Plop.prepare(\n {\n configPath: join(__dirname, 'plopfile.js'),\n },\n (env) => {\n const argv = process.argv.slice(2); // Extract command-line arguments\n Plop.execute(env, argv, (env, argv) => {\n const options = {\n ...env,\n dest: join(process.cwd(), 'src'), // this will make the destination path to be based on the cwd when calling the wrapper\n };\n return run(options, argv, true); // Pass the third argument 'true' for passArgsBeforeDashes\n });\n }\n );\n};\n\n// Runs a generator programmatically without prompts\nexport const generate = async <T extends Record<string, any>>(\n generatorName: string,\n options: T,\n { dir = process.cwd(), plopFile = 'plopfile.js' } = {}\n) => {\n const plop = nodePlop(join(__dirname, plopFile), {\n destBasePath: join(dir, 'src'),\n force: false,\n });\n\n const generator = plop.getGenerator(generatorName);\n await generator.runActions(options satisfies T, {\n onSuccess() {},\n onFailure() {},\n onComment() {},\n });\n};\n"],"names":["runCLI","Plop","run","prepare","configPath","join","__dirname","env","argv","process","slice","execute","options","dest","cwd","generate","generatorName","dir","plopFile","plop","nodePlop","destBasePath","force","generator","getGenerator","runActions","onSuccess","onFailure","onComment"],"mappings":";;;;;AAGA;MACaA,MAAS,GAAA,UAAA;IACpB,MAAM,EAAEC,IAAI,EAAEC,GAAG,EAAE,GAAG,MAAM,OAAO,MAAA,CAAA;AAEnCD,IAAAA,IAAAA,CAAKE,OAAO,CACV;AACEC,QAAAA,UAAAA,EAAYC,eAAKC,SAAW,EAAA,aAAA;AAC9B,KAAA,EACA,CAACC,GAAAA,GAAAA;AACC,QAAA,MAAMC,OAAOC,OAAQD,CAAAA,IAAI,CAACE,KAAK,CAAC;AAChCT,QAAAA,IAAAA,CAAKU,OAAO,CAACJ,GAAKC,EAAAA,IAAAA,EAAM,CAACD,GAAKC,EAAAA,IAAAA,GAAAA;AAC5B,YAAA,MAAMI,OAAU,GAAA;AACd,gBAAA,GAAGL,GAAG;gBACNM,IAAMR,EAAAA,cAAAA,CAAKI,OAAQK,CAAAA,GAAG,EAAI,EAAA,KAAA;AAC5B,aAAA;AACA,YAAA,OAAOZ,GAAIU,CAAAA,OAAAA,EAASJ,IAAM,EAAA,IAAA,CAAA,CAAA;AAC5B,SAAA,CAAA;AACF,KAAA,CAAA;AAEJ;AAEA;MACaO,QAAW,GAAA,OACtBC,aACAJ,EAAAA,OAAAA,EACA,EAAEK,GAAMR,GAAAA,OAAAA,CAAQK,GAAG,EAAE,EAAEI,QAAW,GAAA,aAAa,EAAE,GAAG,EAAE,GAAA;AAEtD,IAAA,MAAMC,IAAOC,GAAAA,QAAAA,CAASf,cAAKC,CAAAA,SAAAA,EAAWY,QAAW,CAAA,EAAA;AAC/CG,QAAAA,YAAAA,EAAchB,eAAKY,GAAK,EAAA,KAAA,CAAA;QACxBK,KAAO,EAAA;AACT,KAAA,CAAA;IAEA,MAAMC,SAAAA,GAAYJ,IAAKK,CAAAA,YAAY,CAACR,aAAAA,CAAAA;IACpC,MAAMO,SAAAA,CAAUE,UAAU,CAACb,OAAqB,EAAA;QAC9Cc,SAAa,CAAA,GAAA,EAAA;QACbC,SAAa,CAAA,GAAA,EAAA;QACbC,SAAa,CAAA,GAAA;AACf,KAAA,CAAA;AACF;;;;;"}
package/dist/index.mjs CHANGED
@@ -1,29 +1,35 @@
1
- import { join } from "node:path";
2
- import { Plop, run } from "plop";
3
- import nodePlop from "node-plop";
4
- const runCLI = () => {
5
- Plop.launch({ configPath: join(__dirname, "plopfile.js") }, (env) => {
6
- const options = { ...env, dest: join(process.cwd(), "src") };
7
- run(options, void 0, true);
8
- });
1
+ import { join } from 'node:path';
2
+ import nodePlop from 'node-plop';
3
+
4
+ // Starts the Plop CLI programmatically
5
+ const runCLI = async ()=>{
6
+ const { Plop, run } = await import('plop');
7
+ Plop.prepare({
8
+ configPath: join(__dirname, 'plopfile.js')
9
+ }, (env)=>{
10
+ const argv = process.argv.slice(2); // Extract command-line arguments
11
+ Plop.execute(env, argv, (env, argv)=>{
12
+ const options = {
13
+ ...env,
14
+ dest: join(process.cwd(), 'src')
15
+ };
16
+ return run(options, argv, true); // Pass the third argument 'true' for passArgsBeforeDashes
17
+ });
18
+ });
9
19
  };
10
- const generate = async (generatorName, options, { dir = process.cwd(), plopFile = "plopfile.js" } = {}) => {
11
- const plop = nodePlop(join(__dirname, plopFile), {
12
- destBasePath: join(dir, "src"),
13
- force: false
14
- });
15
- const generator = plop.getGenerator(generatorName);
16
- await generator.runActions(options, {
17
- onSuccess() {
18
- },
19
- onFailure() {
20
- },
21
- onComment() {
22
- }
23
- });
24
- };
25
- export {
26
- generate,
27
- runCLI
20
+ // Runs a generator programmatically without prompts
21
+ const generate = async (generatorName, options, { dir = process.cwd(), plopFile = 'plopfile.js' } = {})=>{
22
+ const plop = nodePlop(join(__dirname, plopFile), {
23
+ destBasePath: join(dir, 'src'),
24
+ force: false
25
+ });
26
+ const generator = plop.getGenerator(generatorName);
27
+ await generator.runActions(options, {
28
+ onSuccess () {},
29
+ onFailure () {},
30
+ onComment () {}
31
+ });
28
32
  };
33
+
34
+ export { generate, runCLI };
29
35
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { Plop, run } from 'plop';\nimport nodePlop from 'node-plop';\n\n// Starts the Plop CLI programmatically\nexport const runCLI = () => {\n Plop.launch({ configPath: join(__dirname, 'plopfile.js') }, (env) => {\n const options = { ...env, dest: join(process.cwd(), 'src') };\n run(options, undefined, true);\n });\n};\n\n// Runs a generator programmatically without prompts\nexport const generate = async (\n generatorName: string,\n options: unknown,\n { dir = process.cwd(), plopFile = 'plopfile.js' } = {}\n) => {\n const plop = nodePlop(join(__dirname, plopFile), {\n destBasePath: join(dir, 'src'),\n force: false,\n });\n\n const generator = plop.getGenerator(generatorName);\n await generator.runActions(options, {\n onSuccess() {},\n onFailure() {},\n onComment() {},\n });\n};\n"],"names":[],"mappings":";;;AAKO,MAAM,SAAS,MAAM;AACrB,OAAA,OAAO,EAAE,YAAY,KAAK,WAAW,aAAa,KAAK,CAAC,QAAQ;AAC7D,UAAA,UAAU,EAAE,GAAG,KAAK,MAAM,KAAK,QAAQ,IAAA,GAAO,KAAK;AACrD,QAAA,SAAS,QAAW,IAAI;AAAA,EAAA,CAC7B;AACH;AAGO,MAAM,WAAW,OACtB,eACA,SACA,EAAE,MAAM,QAAQ,OAAO,WAAW,cAAc,IAAI,CAAA,MACjD;AACH,QAAM,OAAO,SAAS,KAAK,WAAW,QAAQ,GAAG;AAAA,IAC/C,cAAc,KAAK,KAAK,KAAK;AAAA,IAC7B,OAAO;AAAA,EAAA,CACR;AAEK,QAAA,YAAY,KAAK,aAAa,aAAa;AAC3C,QAAA,UAAU,WAAW,SAAS;AAAA,IAClC,YAAY;AAAA,IAAC;AAAA,IACb,YAAY;AAAA,IAAC;AAAA,IACb,YAAY;AAAA,IAAC;AAAA,EAAA,CACd;AACH;"}
1
+ {"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport nodePlop from 'node-plop';\n\n// Starts the Plop CLI programmatically\nexport const runCLI = async () => {\n const { Plop, run } = await import('plop');\n\n Plop.prepare(\n {\n configPath: join(__dirname, 'plopfile.js'),\n },\n (env) => {\n const argv = process.argv.slice(2); // Extract command-line arguments\n Plop.execute(env, argv, (env, argv) => {\n const options = {\n ...env,\n dest: join(process.cwd(), 'src'), // this will make the destination path to be based on the cwd when calling the wrapper\n };\n return run(options, argv, true); // Pass the third argument 'true' for passArgsBeforeDashes\n });\n }\n );\n};\n\n// Runs a generator programmatically without prompts\nexport const generate = async <T extends Record<string, any>>(\n generatorName: string,\n options: T,\n { dir = process.cwd(), plopFile = 'plopfile.js' } = {}\n) => {\n const plop = nodePlop(join(__dirname, plopFile), {\n destBasePath: join(dir, 'src'),\n force: false,\n });\n\n const generator = plop.getGenerator(generatorName);\n await generator.runActions(options satisfies T, {\n onSuccess() {},\n onFailure() {},\n onComment() {},\n });\n};\n"],"names":["runCLI","Plop","run","prepare","configPath","join","__dirname","env","argv","process","slice","execute","options","dest","cwd","generate","generatorName","dir","plopFile","plop","nodePlop","destBasePath","force","generator","getGenerator","runActions","onSuccess","onFailure","onComment"],"mappings":";;;AAGA;MACaA,MAAS,GAAA,UAAA;IACpB,MAAM,EAAEC,IAAI,EAAEC,GAAG,EAAE,GAAG,MAAM,OAAO,MAAA,CAAA;AAEnCD,IAAAA,IAAAA,CAAKE,OAAO,CACV;AACEC,QAAAA,UAAAA,EAAYC,KAAKC,SAAW,EAAA,aAAA;AAC9B,KAAA,EACA,CAACC,GAAAA,GAAAA;AACC,QAAA,MAAMC,OAAOC,OAAQD,CAAAA,IAAI,CAACE,KAAK,CAAC;AAChCT,QAAAA,IAAAA,CAAKU,OAAO,CAACJ,GAAKC,EAAAA,IAAAA,EAAM,CAACD,GAAKC,EAAAA,IAAAA,GAAAA;AAC5B,YAAA,MAAMI,OAAU,GAAA;AACd,gBAAA,GAAGL,GAAG;gBACNM,IAAMR,EAAAA,IAAAA,CAAKI,OAAQK,CAAAA,GAAG,EAAI,EAAA,KAAA;AAC5B,aAAA;AACA,YAAA,OAAOZ,GAAIU,CAAAA,OAAAA,EAASJ,IAAM,EAAA,IAAA,CAAA,CAAA;AAC5B,SAAA,CAAA;AACF,KAAA,CAAA;AAEJ;AAEA;MACaO,QAAW,GAAA,OACtBC,aACAJ,EAAAA,OAAAA,EACA,EAAEK,GAAMR,GAAAA,OAAAA,CAAQK,GAAG,EAAE,EAAEI,QAAW,GAAA,aAAa,EAAE,GAAG,EAAE,GAAA;AAEtD,IAAA,MAAMC,IAAOC,GAAAA,QAAAA,CAASf,IAAKC,CAAAA,SAAAA,EAAWY,QAAW,CAAA,EAAA;AAC/CG,QAAAA,YAAAA,EAAchB,KAAKY,GAAK,EAAA,KAAA,CAAA;QACxBK,KAAO,EAAA;AACT,KAAA,CAAA;IAEA,MAAMC,SAAAA,GAAYJ,IAAKK,CAAAA,YAAY,CAACR,aAAAA,CAAAA;IACpC,MAAMO,SAAAA,CAAUE,UAAU,CAACb,OAAqB,EAAA;QAC9Cc,SAAa,CAAA,GAAA,EAAA;QACbC,SAAa,CAAA,GAAA,EAAA;QACbC,SAAa,CAAA,GAAA;AACf,KAAA,CAAA;AACF;;;;"}
@@ -1,4 +1,4 @@
1
- import { NodePlopAPI } from 'plop';
1
+ import type { NodePlopAPI } from 'plop';
2
2
  declare const _default: (plop: NodePlopAPI) => void;
3
3
  export default _default;
4
4
  //# sourceMappingURL=plopfile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plopfile.d.ts","sourceRoot":"","sources":["../src/plopfile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;+BAWb,WAAW;AAAjC,wBAcE"}
1
+ {"version":3,"file":"plopfile.d.ts","sourceRoot":"","sources":["../src/plopfile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;+BAUlB,WAAW;AAAjC,wBAaE"}