@plop-next/core 0.1.0 → 0.1.2
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/README.md +64 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/package.json +7 -4
- package/CHANGELOG.md +0 -19
package/README.md
CHANGED
|
@@ -1 +1,64 @@
|
|
|
1
|
-
# core
|
|
1
|
+
# @plop-next/core
|
|
2
|
+
|
|
3
|
+
Core engine for plop-next.
|
|
4
|
+
|
|
5
|
+
This package contains the low-level building blocks used by the CLI:
|
|
6
|
+
|
|
7
|
+
- generator registry and execution primitives
|
|
8
|
+
- prompt handler registry
|
|
9
|
+
- theming system
|
|
10
|
+
- error classes and utilities
|
|
11
|
+
|
|
12
|
+
If you only need the CLI, use `@plop-next/cli`.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @plop-next/core
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
or:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
yarn add @plop-next/core
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quick example
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { PlopNextCore } from "@plop-next/core";
|
|
30
|
+
|
|
31
|
+
const core = new PlopNextCore();
|
|
32
|
+
|
|
33
|
+
core.setGenerator("demo", {
|
|
34
|
+
description: "Minimal generator",
|
|
35
|
+
prompts: [],
|
|
36
|
+
actions: [],
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const generators = core.getGeneratorList();
|
|
40
|
+
console.log(generators.map((g) => ("name" in g ? g.name : "separator")));
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Common exports
|
|
44
|
+
|
|
45
|
+
- `PlopNextCore`
|
|
46
|
+
- `ActionRunner`
|
|
47
|
+
- `PromptHandlerRegistry`
|
|
48
|
+
- `registerBuiltInPromptHandlers`
|
|
49
|
+
- `defaultTheme`
|
|
50
|
+
- `ErrorHandler`
|
|
51
|
+
- `Separator`
|
|
52
|
+
|
|
53
|
+
## Development scripts
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
yarn workspace @plop-next/core build
|
|
57
|
+
yarn workspace @plop-next/core test
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Links
|
|
61
|
+
|
|
62
|
+
- Documentation: [https://nivvdiy.github.io/plop-next/](https://nivvdiy.github.io/plop-next/)
|
|
63
|
+
- Repository: [https://github.com/nivvdiy/plop-next](https://github.com/nivvdiy/plop-next)
|
|
64
|
+
- Issues: [https://github.com/nivvdiy/plop-next/issues](https://github.com/nivvdiy/plop-next/issues)
|
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ type Keybinding = {
|
|
|
28
28
|
action: string;
|
|
29
29
|
description?: string;
|
|
30
30
|
};
|
|
31
|
-
declare const BUILT_IN_PROMPT_TYPES: readonly ["input", "select", "
|
|
31
|
+
declare const BUILT_IN_PROMPT_TYPES: readonly ["input", "select", "generatorList", "list", "checkbox", "confirm", "search", "password", "expand", "editor", "number", "rawlist"];
|
|
32
32
|
type PromptThemeType = (typeof BUILT_IN_PROMPT_TYPES)[number];
|
|
33
33
|
type NormalizedChoice<Value> = {
|
|
34
34
|
value: Value;
|
package/dist/index.js
CHANGED
|
@@ -489,7 +489,7 @@ import { select } from "@inquirer/prompts";
|
|
|
489
489
|
function createSelectHandler(fn) {
|
|
490
490
|
const selectFn = fn ?? select;
|
|
491
491
|
return {
|
|
492
|
-
types: ["list", "select", "
|
|
492
|
+
types: ["list", "select", "generatorList"],
|
|
493
493
|
async ask(type, config) {
|
|
494
494
|
const {
|
|
495
495
|
name: _name,
|
|
@@ -855,7 +855,7 @@ var BUILT_IN_PROMPT_THEME_SELECTORS = {
|
|
|
855
855
|
keybindings: true
|
|
856
856
|
},
|
|
857
857
|
list: { baseSelector: "select" },
|
|
858
|
-
|
|
858
|
+
generatorList: { baseSelector: "select" },
|
|
859
859
|
checkbox: {
|
|
860
860
|
prefix: true,
|
|
861
861
|
spinner: true,
|
|
@@ -1351,7 +1351,7 @@ var replacements = Object.entries(specialMainSymbols);
|
|
|
1351
1351
|
var BUILT_IN_PROMPT_TYPES = [
|
|
1352
1352
|
"input",
|
|
1353
1353
|
"select",
|
|
1354
|
-
"
|
|
1354
|
+
"generatorList",
|
|
1355
1355
|
"list",
|
|
1356
1356
|
"checkbox",
|
|
1357
1357
|
"confirm",
|
|
@@ -2072,7 +2072,7 @@ var PlopNextCore = class {
|
|
|
2072
2072
|
* Merges in order: defaultTheme → type defaults → user global theme → user type theme.
|
|
2073
2073
|
*/
|
|
2074
2074
|
resolvePromptTypeTheme(type) {
|
|
2075
|
-
if (type === "
|
|
2075
|
+
if (type === "generatorList") {
|
|
2076
2076
|
const selectDefaults = PROMPT_TYPE_THEMES["select"];
|
|
2077
2077
|
const userSelectTheme = this.resolveUserPromptTypeTheme("select");
|
|
2078
2078
|
const userGeneratorSelectTheme = this.resolveUserPromptTypeTheme(type);
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plop-next/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Core utilities and types for plop-next",
|
|
5
5
|
"bugs": {
|
|
6
|
-
"url": "https://github.com/
|
|
6
|
+
"url": "https://github.com/Nivvdiy/plop-next/issues"
|
|
7
7
|
},
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"author": "Nivvdiy <nivvdiy@gmail.com>",
|
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
"repository": {
|
|
15
15
|
"directory": "packages/core",
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/
|
|
17
|
+
"url": "https://github.com/Nivvdiy/plop-next.git"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"registry": "https://registry.npmjs.org"
|
|
18
21
|
},
|
|
19
22
|
"scripts": {
|
|
20
23
|
"build": "tsup src/index.ts --format esm --dts",
|
|
@@ -49,4 +52,4 @@
|
|
|
49
52
|
},
|
|
50
53
|
"sideEffects": false,
|
|
51
54
|
"types": "dist/index.d.ts"
|
|
52
|
-
}
|
|
55
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# @plop-next/core
|
|
2
|
-
|
|
3
|
-
## 0.1.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- "@plop-next/cli": minor
|
|
8
|
-
|
|
9
|
-
"@plop-next/core": minor
|
|
10
|
-
|
|
11
|
-
"@plop-next/i18n": minor
|
|
12
|
-
|
|
13
|
-
Refactor internal generator prompt handling from generator-select to generatorList across cli, core, and i18n.
|
|
14
|
-
|
|
15
|
-
Reserve generatorList for internal generator selection and improve validation and error messages.
|
|
16
|
-
|
|
17
|
-
Align theme selector flow and generated scaffold theme slots with generatorList.
|
|
18
|
-
|
|
19
|
-
Update i18n/theme integrations and tests to keep behavior consistent.
|