File tree Expand file tree Collapse file tree 7 files changed +71
-29
lines changed Expand file tree Collapse file tree 7 files changed +71
-29
lines changed Original file line number Diff line number Diff line change 5
5
"workspaces" : [
6
6
" packages/*"
7
7
],
8
+ "type" : " module" ,
8
9
"scripts" : {
9
10
"bootstrap" : " lerna exec yarn install" ,
10
11
"build" : " lerna run build" ,
11
12
"test" : " lerna run --parallel test" ,
12
13
"format" : " eslint -c .eslintrc.cjs --fix ./" ,
13
- "prepare" : " husky install"
14
+ "prepare" : " husky install" ,
15
+ "plop" : " node ./packages/plop/bin/plop.js"
14
16
},
15
17
"bugs" : {
16
18
"url" : " https://github.com/plopjs/plop/issues"
Original file line number Diff line number Diff line change 37
37
"@types/inquirer-autocomplete-prompt" : " ^1.3.3" ,
38
38
"@types/node" : " ^16.11.10" ,
39
39
"dtslint" : " ^4.2.1" ,
40
- "plop" : " ^3.0.5" ,
41
40
"plop-pack-fancy-comments" : " ^0.2.1" ,
42
41
"typescript" : " ^4.5.2" ,
43
42
"vitest" : " ^0.5.5"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 43
43
"interpret" : " ^2.2.0" ,
44
44
"liftoff" : " ^4.0.0" ,
45
45
"minimist" : " ^1.2.5" ,
46
- "node-plop" : " ^0.30.0 " ,
46
+ "node-plop" : " * " ,
47
47
"ora" : " ^6.0.1" ,
48
48
"v8flags" : " ^4.0.0"
49
49
},
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ import { resolve , dirname } from "node:path" ;
2
+ import { renderPlop } from "./render.js" ;
3
+
4
+ import { fileURLToPath } from "node:url" ;
5
+
6
+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
7
+
8
+ test ( "should load ESM file" , async ( ) => {
9
+ const { findByText, userEvent } = await renderPlop ( [ ] , {
10
+ cwd : resolve ( __dirname , "./examples/esm" ) ,
11
+ } ) ;
12
+ expect ( await findByText ( "What is your name?" ) ) . toBeInTheConsole ( ) ;
13
+ userEvent . keyboard ( "Joe" ) ;
14
+ expect ( await findByText ( "Joe" ) ) . toBeInTheConsole ( ) ;
15
+ userEvent . keyboard ( "[Enter]" ) ;
16
+ } ) ;
Original file line number Diff line number Diff line change
1
+ export default function ( plop ) {
2
+ plop . setGenerator ( "node-plop-test" , {
3
+ prompts : [
4
+ {
5
+ type : "input" ,
6
+ name : "name" ,
7
+ message : function ( ) {
8
+ return "test name" ;
9
+ } ,
10
+ validate : function ( value ) {
11
+ if ( / .+ / . test ( value ) ) {
12
+ return true ;
13
+ }
14
+ return "test name is required" ;
15
+ } ,
16
+ } ,
17
+ ] ,
18
+ actions : [
19
+ {
20
+ type : "add" ,
21
+ path : "packages/node-plop/tests/{{dashCase name}}/{{dashCase name}}.spec.js" ,
22
+ templateFile : "plop-templates/node-plop-test.js" ,
23
+ } ,
24
+ ] ,
25
+ } ) ;
26
+
27
+ plop . setGenerator ( "plop-test" , {
28
+ prompts : [
29
+ {
30
+ type : "input" ,
31
+ name : "name" ,
32
+ message : function ( ) {
33
+ return "test name" ;
34
+ } ,
35
+ validate : function ( value ) {
36
+ if ( / .+ / . test ( value ) ) {
37
+ return true ;
38
+ }
39
+ return "test name is required" ;
40
+ } ,
41
+ } ,
42
+ ] ,
43
+ actions : [
44
+ {
45
+ type : "add" ,
46
+ path : "packages/plop/tests/{{dashCase name}}.spec.js" ,
47
+ templateFile : "plop-templates/plop-test.js" ,
48
+ } ,
49
+ ] ,
50
+ } ) ;
51
+ }
You can’t perform that action at this time.
0 commit comments