|
| 1 | +import type { PlopTypes } from '@turbo/gen'; |
| 2 | + |
| 3 | +export default function generator(plop: PlopTypes.NodePlopAPI): void { |
| 4 | + // SDK/Utilities Package Generator |
| 5 | + plop.setGenerator('sdk', { |
| 6 | + description: 'Create a new SDK or utility package', |
| 7 | + prompts: [ |
| 8 | + { |
| 9 | + type: 'input', |
| 10 | + name: 'name', |
| 11 | + message: |
| 12 | + "What is the name of the package? (e.g., 'sdk-trace-web', 'context-zone')", |
| 13 | + }, |
| 14 | + { |
| 15 | + type: 'input', |
| 16 | + name: 'description', |
| 17 | + message: 'What is the package description?', |
| 18 | + }, |
| 19 | + ], |
| 20 | + actions: [ |
| 21 | + { |
| 22 | + type: 'add', |
| 23 | + path: 'packages/{{kebabCase name}}/package.json', |
| 24 | + templateFile: 'templates/sdk/package.json.hbs', |
| 25 | + }, |
| 26 | + { |
| 27 | + type: 'add', |
| 28 | + path: 'packages/{{kebabCase name}}/src/index.ts', |
| 29 | + templateFile: 'templates/sdk/index.ts.hbs', |
| 30 | + }, |
| 31 | + { |
| 32 | + type: 'add', |
| 33 | + path: 'packages/{{kebabCase name}}/tsconfig.json', |
| 34 | + templateFile: 'templates/shared/tsconfig.json.hbs', |
| 35 | + }, |
| 36 | + { |
| 37 | + type: 'add', |
| 38 | + path: 'packages/{{kebabCase name}}/README.md', |
| 39 | + templateFile: 'templates/sdk/README.md.hbs', |
| 40 | + }, |
| 41 | + ], |
| 42 | + }); |
| 43 | + |
| 44 | + // Instrumentation Package Generator |
| 45 | + plop.setGenerator('instrumentation', { |
| 46 | + description: 'Create a new browser instrumentation package', |
| 47 | + prompts: [ |
| 48 | + { |
| 49 | + type: 'input', |
| 50 | + name: 'name', |
| 51 | + message: |
| 52 | + "What API/feature are you instrumenting? (e.g., 'fetch', 'long-task', 'user-interaction')", |
| 53 | + }, |
| 54 | + { |
| 55 | + type: 'input', |
| 56 | + name: 'description', |
| 57 | + message: 'What is the package description?', |
| 58 | + }, |
| 59 | + ], |
| 60 | + actions: [ |
| 61 | + { |
| 62 | + type: 'add', |
| 63 | + path: 'packages/instrumentation-{{kebabCase name}}/package.json', |
| 64 | + templateFile: 'templates/instrumentation/package.json.hbs', |
| 65 | + }, |
| 66 | + { |
| 67 | + type: 'add', |
| 68 | + path: 'packages/instrumentation-{{kebabCase name}}/src/index.ts', |
| 69 | + templateFile: 'templates/instrumentation/index.ts.hbs', |
| 70 | + }, |
| 71 | + { |
| 72 | + type: 'add', |
| 73 | + path: 'packages/instrumentation-{{kebabCase name}}/src/instrumentation.ts', |
| 74 | + templateFile: 'templates/instrumentation/instrumentation.ts.hbs', |
| 75 | + }, |
| 76 | + { |
| 77 | + type: 'add', |
| 78 | + path: 'packages/instrumentation-{{kebabCase name}}/tsconfig.json', |
| 79 | + templateFile: 'templates/shared/tsconfig.json.hbs', |
| 80 | + }, |
| 81 | + { |
| 82 | + type: 'add', |
| 83 | + path: 'packages/instrumentation-{{kebabCase name}}/README.md', |
| 84 | + templateFile: 'templates/instrumentation/README.md.hbs', |
| 85 | + }, |
| 86 | + ], |
| 87 | + }); |
| 88 | +} |
0 commit comments