@strapi/generators 0.0.0-next.ee56af7ae29770097422de95c0d5500908dce15c → 0.0.0-next.ef9237644b07791c05e1b7edc54d1921e59565ae

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.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,I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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;+BAUb,WAAW;AAAjC,wBAaE"}
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"}