@strapi/generators 0.0.0-next.fab38a080023b0850fc7a8ec8605d1ee6970e3c9 → 0.0.0-next.fc1775f7731f8999840e56e298a216b9a6c5c4ad
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/LICENSE +18 -3
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -0
- package/dist/index.mjs.map +1 -0
- package/dist/plopfile.d.ts +2 -1
- package/dist/plopfile.d.ts.map +1 -0
- package/dist/plopfile.js +585 -28
- package/dist/plopfile.js.map +1 -1
- package/dist/plopfile.mjs +582 -0
- package/dist/plopfile.mjs.map +1 -0
- package/dist/plops/api.d.ts +2 -1
- package/dist/plops/api.d.ts.map +1 -0
- package/dist/plops/content-type.d.ts +2 -1
- package/dist/plops/content-type.d.ts.map +1 -0
- package/dist/plops/controller.d.ts +2 -1
- package/dist/plops/controller.d.ts.map +1 -0
- package/dist/plops/middleware.d.ts +2 -1
- package/dist/plops/middleware.d.ts.map +1 -0
- package/dist/plops/migration.d.ts +2 -1
- package/dist/plops/migration.d.ts.map +1 -0
- package/dist/plops/policy.d.ts +2 -1
- package/dist/plops/policy.d.ts.map +1 -0
- package/dist/plops/prompts/bootstrap-api-prompts.d.ts +1 -0
- package/dist/plops/prompts/bootstrap-api-prompts.d.ts.map +1 -0
- package/dist/plops/prompts/ct-names-prompts.d.ts +1 -0
- package/dist/plops/prompts/ct-names-prompts.d.ts.map +1 -0
- package/dist/plops/prompts/get-attributes-prompts.d.ts +1 -0
- package/dist/plops/prompts/get-attributes-prompts.d.ts.map +1 -0
- package/dist/plops/prompts/get-destination-prompts.d.ts +1 -0
- package/dist/plops/prompts/get-destination-prompts.d.ts.map +1 -0
- package/dist/plops/prompts/kind-prompts.d.ts +1 -0
- package/dist/plops/prompts/kind-prompts.d.ts.map +1 -0
- package/dist/plops/service.d.ts +2 -1
- package/dist/plops/service.d.ts.map +1 -0
- package/dist/plops/utils/get-file-path.d.ts +2 -1
- package/dist/plops/utils/get-file-path.d.ts.map +1 -0
- package/dist/plops/utils/get-formatted-date.d.ts +1 -0
- package/dist/plops/utils/get-formatted-date.d.ts.map +1 -0
- package/dist/plops/utils/validate-attribute-input.d.ts +1 -0
- package/dist/plops/utils/validate-attribute-input.d.ts.map +1 -0
- package/dist/plops/utils/validate-file-name-input.d.ts +1 -0
- package/dist/plops/utils/validate-file-name-input.d.ts.map +1 -0
- package/dist/plops/utils/validate-input.d.ts +1 -0
- package/dist/plops/utils/validate-input.d.ts.map +1 -0
- package/dist/templates/js/content-type.schema.json.hbs +0 -1
- package/dist/templates/ts/content-type.schema.json.hbs +0 -1
- package/dist/templates/ts/middleware.ts.hbs +2 -2
- package/package.json +18 -16
- package/dist/files/js/plugin/.editorconfig +0 -7
- package/dist/files/js/plugin/.gitattributes +0 -103
- package/dist/files/js/plugin/admin/src/components/Initializer/index.js +0 -26
- package/dist/files/js/plugin/admin/src/components/PluginIcon/index.js +0 -12
- package/dist/files/js/plugin/admin/src/index.js +0 -63
- package/dist/files/js/plugin/admin/src/pages/App/index.js +0 -25
- package/dist/files/js/plugin/admin/src/pages/HomePage/index.js +0 -20
- package/dist/files/js/plugin/admin/src/pluginId.js +0 -5
- package/dist/files/js/plugin/admin/src/translations/en.json +0 -1
- package/dist/files/js/plugin/admin/src/translations/fr.json +0 -1
- package/dist/files/js/plugin/admin/src/utils/getTrad.js +0 -5
- package/dist/files/js/plugin/server/bootstrap.js +0 -5
- package/dist/files/js/plugin/server/config/index.js +0 -6
- package/dist/files/js/plugin/server/content-types/index.js +0 -3
- package/dist/files/js/plugin/server/controllers/index.js +0 -7
- package/dist/files/js/plugin/server/controllers/my-controller.js.hbs +0 -10
- package/dist/files/js/plugin/server/destroy.js +0 -5
- package/dist/files/js/plugin/server/index.js +0 -25
- package/dist/files/js/plugin/server/middlewares/index.js +0 -3
- package/dist/files/js/plugin/server/policies/index.js +0 -3
- package/dist/files/js/plugin/server/register.js +0 -5
- package/dist/files/js/plugin/server/routes/index.js +0 -10
- package/dist/files/js/plugin/server/services/index.js +0 -7
- package/dist/files/js/plugin/server/services/my-service.js +0 -7
- package/dist/files/js/plugin/strapi-admin.js +0 -3
- package/dist/files/js/plugin/strapi-server.js +0 -3
- package/dist/files/ts/plugin/.editorconfig +0 -7
- package/dist/files/ts/plugin/.gitattributes +0 -103
- package/dist/files/ts/plugin/admin/src/components/Initializer/index.tsx +0 -24
- package/dist/files/ts/plugin/admin/src/components/PluginIcon/index.tsx +0 -12
- package/dist/files/ts/plugin/admin/src/index.tsx +0 -67
- package/dist/files/ts/plugin/admin/src/pages/App/index.tsx +0 -25
- package/dist/files/ts/plugin/admin/src/pages/HomePage/index.tsx +0 -19
- package/dist/files/ts/plugin/admin/src/pluginId.ts +0 -5
- package/dist/files/ts/plugin/admin/src/translations/en.json +0 -1
- package/dist/files/ts/plugin/admin/src/translations/fr.json +0 -1
- package/dist/files/ts/plugin/admin/src/utils/getTrad.ts +0 -5
- package/dist/files/ts/plugin/custom.d.ts +0 -5
- package/dist/files/ts/plugin/server/bootstrap.ts +0 -5
- package/dist/files/ts/plugin/server/config/index.ts +0 -4
- package/dist/files/ts/plugin/server/content-types/index.ts +0 -1
- package/dist/files/ts/plugin/server/controllers/index.ts +0 -5
- package/dist/files/ts/plugin/server/controllers/my-controller.ts.hbs +0 -10
- package/dist/files/ts/plugin/server/destroy.ts +0 -5
- package/dist/files/ts/plugin/server/index.ts +0 -23
- package/dist/files/ts/plugin/server/middlewares/index.ts +0 -1
- package/dist/files/ts/plugin/server/policies/index.ts +0 -1
- package/dist/files/ts/plugin/server/register.ts +0 -5
- package/dist/files/ts/plugin/server/routes/index.ts +0 -10
- package/dist/files/ts/plugin/server/services/index.ts +0 -5
- package/dist/files/ts/plugin/server/services/my-service.ts +0 -7
- package/dist/files/ts/plugin/strapi-admin.js +0 -3
- package/dist/files/ts/plugin/strapi-server.js +0 -3
- package/dist/files/ts/plugin/tsconfig.json +0 -20
- package/dist/files/ts/plugin/tsconfig.server.json +0 -25
- package/dist/plops/api.js +0 -79
- package/dist/plops/api.js.map +0 -1
- package/dist/plops/content-type.js +0 -158
- package/dist/plops/content-type.js.map +0 -1
- package/dist/plops/controller.js +0 -40
- package/dist/plops/controller.js.map +0 -1
- package/dist/plops/middleware.js +0 -40
- package/dist/plops/middleware.js.map +0 -1
- package/dist/plops/migration.js +0 -35
- package/dist/plops/migration.js.map +0 -1
- package/dist/plops/plugin.d.ts +0 -3
- package/dist/plops/plugin.js +0 -107
- package/dist/plops/plugin.js.map +0 -1
- package/dist/plops/policy.js +0 -40
- package/dist/plops/policy.js.map +0 -1
- package/dist/plops/prompts/bootstrap-api-prompts.js +0 -12
- package/dist/plops/prompts/bootstrap-api-prompts.js.map +0 -1
- package/dist/plops/prompts/ct-names-prompts.js +0 -68
- package/dist/plops/prompts/ct-names-prompts.js.map +0 -1
- package/dist/plops/prompts/draft-and-publish-prompts.d.ts +0 -3
- package/dist/plops/prompts/draft-and-publish-prompts.js +0 -12
- package/dist/plops/prompts/draft-and-publish-prompts.js.map +0 -1
- package/dist/plops/prompts/get-attributes-prompts.js +0 -95
- package/dist/plops/prompts/get-attributes-prompts.js.map +0 -1
- package/dist/plops/prompts/get-destination-prompts.js +0 -72
- package/dist/plops/prompts/get-destination-prompts.js.map +0 -1
- package/dist/plops/prompts/kind-prompts.js +0 -21
- package/dist/plops/prompts/kind-prompts.js.map +0 -1
- package/dist/plops/service.js +0 -38
- package/dist/plops/service.js.map +0 -1
- package/dist/plops/utils/get-file-path.js +0 -15
- package/dist/plops/utils/get-file-path.js.map +0 -1
- package/dist/plops/utils/get-formatted-date.js +0 -9
- package/dist/plops/utils/get-formatted-date.js.map +0 -1
- package/dist/plops/utils/validate-attribute-input.js +0 -10
- package/dist/plops/utils/validate-attribute-input.js.map +0 -1
- package/dist/plops/utils/validate-file-name-input.js +0 -10
- package/dist/plops/utils/validate-file-name-input.js.map +0 -1
- package/dist/plops/utils/validate-input.js +0 -10
- package/dist/plops/utils/validate-input.js.map +0 -1
- package/dist/templates/js/README.md.hbs +0 -3
- package/dist/templates/js/plugin-package.json.hbs +0 -42
- package/dist/templates/ts/README.md.hbs +0 -3
- 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
|
|
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,
|
|
22
|
-
|
|
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,6 @@
|
|
|
1
|
-
export declare const runCLI: () => void
|
|
2
|
-
export declare const generate: (generatorName: string, options:
|
|
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>;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,32 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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;
|
|
4
15
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
+
);
|
|
16
47
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
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
|
+
});
|
|
30
62
|
};
|
|
31
63
|
exports.generate = generate;
|
|
32
|
-
|
|
64
|
+
exports.runCLI = runCLI;
|
|
65
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
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;;;"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
);
|
|
21
|
+
};
|
|
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
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +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;"}
|
package/dist/plopfile.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
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"}
|