@strapi/generators 5.9.0 → 5.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,65 +1,38 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
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
+ });
15
21
  };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
- const node_path = require("node:path");
26
- const nodePlop = require("node-plop");
27
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
28
- const nodePlop__default = /* @__PURE__ */ _interopDefault(nodePlop);
29
- const runCLI = async () => {
30
- const { Plop, run } = await import("plop");
31
- Plop.prepare(
32
- {
33
- configPath: node_path.join(__dirname, "plopfile.js")
34
- },
35
- (env) => {
36
- const argv = process.argv.slice(2);
37
- Plop.execute(env, argv, (env2, argv2) => {
38
- const options = {
39
- ...env2,
40
- dest: node_path.join(process.cwd(), "src")
41
- // this will make the destination path to be based on the cwd when calling the wrapper
42
- };
43
- return run(options, argv2, true);
44
- });
45
- }
46
- );
47
- };
48
- const generate = async (generatorName, options, { dir = process.cwd(), plopFile = "plopfile.js" } = {}) => {
49
- const plop = nodePlop__default.default(node_path.join(__dirname, plopFile), {
50
- destBasePath: node_path.join(dir, "src"),
51
- force: false
52
- });
53
- const generator = plop.getGenerator(generatorName);
54
- await generator.runActions(options, {
55
- onSuccess() {
56
- },
57
- onFailure() {
58
- },
59
- onComment() {
60
- }
61
- });
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
+ });
62
34
  };
35
+
63
36
  exports.generate = generate;
64
37
  exports.runCLI = runCLI;
65
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 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":["join","env","argv","nodePlop"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAM,SAAS,YAAY;AAChC,QAAM,EAAE,MAAM,QAAQ,MAAM,OAAO,MAAM;AAEpC,OAAA;AAAA,IACH;AAAA,MACE,YAAYA,UAAAA,KAAK,WAAW,aAAa;AAAA,IAC3C;AAAA,IACA,CAAC,QAAQ;AACP,YAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AACjC,WAAK,QAAQ,KAAK,MAAM,CAACC,MAAKC,UAAS;AACrC,cAAM,UAAU;AAAA,UACd,GAAGD;AAAAA,UACH,MAAMD,UAAA,KAAK,QAAQ,OAAO,KAAK;AAAA;AAAA,QACjC;AACO,eAAA,IAAI,SAASE,OAAM,IAAI;AAAA,MAAA,CAC/B;AAAA,IAAA;AAAA,EAEL;AACF;AAGO,MAAM,WAAW,OACtB,eACA,SACA,EAAE,MAAM,QAAQ,OAAO,WAAW,cAAc,IAAI,CAAA,MACjD;AACH,QAAM,OAAOC,kBAAA,QAASH,UAAK,KAAA,WAAW,QAAQ,GAAG;AAAA,IAC/C,cAAcA,UAAAA,KAAK,KAAK,KAAK;AAAA,IAC7B,OAAO;AAAA,EAAA,CACR;AAEK,QAAA,YAAY,KAAK,aAAa,aAAa;AAC3C,QAAA,UAAU,WAAW,SAAqB;AAAA,IAC9C,YAAY;AAAA,IAAC;AAAA,IACb,YAAY;AAAA,IAAC;AAAA,IACb,YAAY;AAAA,IAAA;AAAA,EAAC,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,41 +1,35 @@
1
- import { join } from "node:path";
2
- import nodePlop from "node-plop";
3
- const runCLI = async () => {
4
- const { Plop, run } = await import("plop");
5
- Plop.prepare(
6
- {
7
- configPath: join(__dirname, "plopfile.js")
8
- },
9
- (env) => {
10
- const argv = process.argv.slice(2);
11
- Plop.execute(env, argv, (env2, argv2) => {
12
- const options = {
13
- ...env2,
14
- dest: join(process.cwd(), "src")
15
- // this will make the destination path to be based on the cwd when calling the wrapper
16
- };
17
- return run(options, argv2, true);
18
- });
19
- }
20
- );
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
+ });
21
19
  };
22
- const generate = async (generatorName, options, { dir = process.cwd(), plopFile = "plopfile.js" } = {}) => {
23
- const plop = nodePlop(join(__dirname, plopFile), {
24
- destBasePath: join(dir, "src"),
25
- force: false
26
- });
27
- const generator = plop.getGenerator(generatorName);
28
- await generator.runActions(options, {
29
- onSuccess() {
30
- },
31
- onFailure() {
32
- },
33
- onComment() {
34
- }
35
- });
36
- };
37
- export {
38
- generate,
39
- 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
+ });
40
32
  };
33
+
34
+ export { generate, runCLI };
41
35
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
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":["env","argv"],"mappings":";;AAIO,MAAM,SAAS,YAAY;AAChC,QAAM,EAAE,MAAM,QAAQ,MAAM,OAAO,MAAM;AAEpC,OAAA;AAAA,IACH;AAAA,MACE,YAAY,KAAK,WAAW,aAAa;AAAA,IAC3C;AAAA,IACA,CAAC,QAAQ;AACP,YAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AACjC,WAAK,QAAQ,KAAK,MAAM,CAACA,MAAKC,UAAS;AACrC,cAAM,UAAU;AAAA,UACd,GAAGD;AAAAA,UACH,MAAM,KAAK,QAAQ,OAAO,KAAK;AAAA;AAAA,QACjC;AACO,eAAA,IAAI,SAASC,OAAM,IAAI;AAAA,MAAA,CAC/B;AAAA,IAAA;AAAA,EAEL;AACF;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,SAAqB;AAAA,IAC9C,YAAY;AAAA,IAAC;AAAA,IACb,YAAY;AAAA,IAAC;AAAA,IACb,YAAY;AAAA,IAAA;AAAA,EAAC,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;;;;"}