Skip to content

Instantly share code, notes, and snippets.

@jacksteamdev
Last active February 28, 2020 16:31
Show Gist options
  • Save jacksteamdev/37175dd3fd80cce8553a025d8d656961 to your computer and use it in GitHub Desktop.
Save jacksteamdev/37175dd3fd80cce8553a025d8d656961 to your computer and use it in GitHub Desktop.
PlopJS when and transform TS usage examples
import { AddActionConfig, AddManyActionConfig, ModifyActionConfig, PlopGenerator } from './index';
export const gen: PlopGenerator = {
description: 'asfd',
prompts: [],
actions: [
{
type: 'add',
path: 'asfd',
template: 'asfd',
when(): string | void {
return 'abc';
},
transform(): string {
return 'abc';
}
},
{
type: 'addMany',
destination: 'abc',
base: 'abc',
templateFiles: 'abc',
globOptions: 'abc',
path: 'abc',
when(): string | void {
return 'abc';
},
transform(): string {
return 'abc';
}
},
{
type: 'modify',
path: 'abc',
pattern: 'abc',
template: 'abc',
templateFile: 'abc'
},
{
type: 'modify',
path: 'abc',
pattern: 'abc',
template: 'abc',
templateFile: 'abc',
transform(): string {
return 'abc';
}
},
{
type: 'modify',
path: 'abc',
transform(): string {
return 'abc';
}
}
] as [
AddActionConfig,
AddManyActionConfig,
ModifyActionConfig,
ModifyActionConfig,
ModifyActionConfig
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment