File size: 1,189 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import packageExists from '../utils/packageExists.js';

export const prompts = [
	{
		type: 'input',
		name: 'name',
		message: 'What should the package be called?',
		default: '',
		validate: ( value ) => {
			if ( /.+/.test( value ) ) {
				return packageExists( value ) ? 'A package with this name already exists' : true;
			}

			return 'The name is required';
		},
	},
	{
		type: 'input',
		name: 'description',
		message: 'Type a short description',
		default: '',
	},
	{
		type: 'confirm',
		name: 'public',
		message: 'Do you want to publish this package?',
		default: true,
	},
];

export const actions = [
	{
		type: 'add',
		path: '../{{kebabCase name}}/jest.config.js',
		templateFile: 'templates/shared/jest.config.js',
		abortOnFail: true,
	},
	{
		type: 'add',
		path: '../{{kebabCase name}}/README.md',
		templateFile: 'templates/shared/README.md.hbs',
		abortOnFail: true,
	},
	{
		type: 'add',
		path: '../{{kebabCase name}}/tsconfig-cjs.json',
		templateFile: 'templates/shared/tsconfig-cjs.json',
		abortOnFail: true,
	},
	{
		type: 'add',
		path: '../{{kebabCase name}}/tsconfig.json',
		templateFile: 'templates/shared/tsconfig.json.hbs',
		abortOnFail: true,
	},
];