@next-core/yo 1.5.74 → 1.5.76

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-core/yo",
3
- "version": "1.5.74",
3
+ "version": "1.5.76",
4
4
  "description": "Generator for next v3",
5
5
  "homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/yo",
6
6
  "license": "GPL-3.0",
@@ -34,5 +34,5 @@
34
34
  "@next-core/theme": "^1.5.4",
35
35
  "react": "0.0.0-experimental-ee8509801-20230117"
36
36
  },
37
- "gitHead": "ca772f7ee7b8e78c12a5e979bd36c2b216b72444"
37
+ "gitHead": "910762b07eccf013728a8e5f963af6ad794c9f16"
38
38
  }
package/src/plopfile.js CHANGED
@@ -67,12 +67,16 @@ export default function (
67
67
  "libDevDependencies",
68
68
  getObjectPartialInPackageJson(libDevDependencies)
69
69
  );
70
- plop.setHelper("getTagName", (brickType, pkgName, brickName, lastNameOnly) =>
71
- brickType === "common"
72
- ? `eo-${brickName}`
73
- : lastNameOnly
74
- ? brickName
75
- : `${pkgName}.${brickName}`
70
+ plop.setHelper(
71
+ "getTagName",
72
+ (brickType, pkgName, brickName, lastNameOnly, stripEo) =>
73
+ brickType === "common"
74
+ ? stripEo
75
+ ? brickName
76
+ : `eo-${brickName}`
77
+ : lastNameOnly
78
+ ? brickName
79
+ : `${pkgName}.${brickName}`
76
80
  );
77
81
  plop.setHelper("getDirectory", (type, pkgName, libName) =>
78
82
  type === "bricks"
@@ -83,15 +87,15 @@ export default function (
83
87
  );
84
88
  plop.setPartial(
85
89
  "tagName",
86
- "{{getTagName brickType pkgName brickName false}}"
90
+ "{{getTagName brickType pkgName brickName false false}}"
87
91
  );
88
92
  plop.setPartial(
89
93
  "lastTagName",
90
- "{{getTagName brickType pkgName brickName true}}"
94
+ "{{getTagName brickType pkgName brickName true false}}"
91
95
  );
92
96
  plop.setPartial(
93
97
  "className",
94
- "{{pascalCase (getTagName brickType pkgName brickName true)}}"
98
+ "{{pascalCase (getTagName brickType pkgName brickName true true)}}"
95
99
  );
96
100
 
97
101
  // create your generators here
@@ -10,10 +10,14 @@ import styleText from "./styles.shadow.css";
10
10
 
11
11
  {{#if useI18n}}
12
12
  initializeReactI18n(NS, locales);
13
- {{/if}}
14
13
 
14
+ {{/if}}
15
15
  const { defineElement, property } = createDecorators();
16
16
 
17
+ export interface {{>className}}Props {
18
+ // Define props here.
19
+ }
20
+
17
21
  /**
18
22
  * 构件 `{{>tagName}}`
19
23
  */
@@ -21,7 +25,7 @@ export
21
25
  @defineElement("{{>tagName}}", {
22
26
  styleTexts: [styleText],
23
27
  })
24
- class {{>className}} extends ReactNextElement {
28
+ class {{>className}} extends ReactNextElement implements {{>className}}Props {
25
29
  render() {
26
30
  return (
27
31
  <{{>className}}Component />
@@ -29,11 +33,11 @@ class {{>className}} extends ReactNextElement {
29
33
  }
30
34
  }
31
35
 
32
- export interface {{>className}}Props {
33
- // Define props here.
36
+ export interface {{>className}}ComponentProps extends {{>className}}Props {
37
+ // Define react event handlers here.
34
38
  }
35
39
 
36
- export function {{>className}}Component(props: {{>className}}Props) {
40
+ export function {{>className}}Component(props: {{>className}}ComponentProps) {
37
41
  {{#if useI18n}}
38
42
  const { t } = useTranslation(NS);
39
43
  const hello = t(K.HELLO);