Update generator function names and revise transform method

Renamed the generator function names in both 'keystatic/generator.ts' and 'package/generator.ts' for clarity and specificity. Also removed 'answers' parameter from the transform function in 'keystatic/generator.ts' and subsequently removed the associated prettier formatting command.
This commit is contained in:
giancarlo
2024-05-07 18:58:45 +07:00
parent 374c506c38
commit fc3929c7dd
2 changed files with 4 additions and 10 deletions

View File

@@ -2,7 +2,7 @@ import type { PlopTypes } from '@turbo/gen';
import { execSync } from 'node:child_process';
export function createKeystaticAdminGenerator(plop: PlopTypes.NodePlopAPI) {
return plop.setGenerator('init', {
return plop.setGenerator('keystatic', {
description: 'Generate a the admin for Keystatic',
prompts: [],
actions: [
@@ -24,7 +24,7 @@ export function createKeystaticAdminGenerator(plop: PlopTypes.NodePlopAPI) {
{
type: 'modify',
path: 'apps/web/package.json',
async transform(content, answers) {
async transform(content) {
const pkg = JSON.parse(content);
const dep = `@keystatic/next`;
@@ -40,7 +40,7 @@ export function createKeystaticAdminGenerator(plop: PlopTypes.NodePlopAPI) {
return JSON.stringify(pkg, null, 2);
},
},
async (answers) => {
async () => {
/**
* Install deps and format everything
*/
@@ -52,12 +52,6 @@ export function createKeystaticAdminGenerator(plop: PlopTypes.NodePlopAPI) {
stdio: 'inherit',
});
execSync(
`pnpm prettier --write packages/${
(answers as { name: string }).name
}/** --list-different`,
);
return `Keystatic admin generated!`;
},
],

View File

@@ -2,7 +2,7 @@ import type { PlopTypes } from '@turbo/gen';
import { execSync } from 'node:child_process';
export function createPackageGenerator(plop: PlopTypes.NodePlopAPI) {
plop.setGenerator('init', {
plop.setGenerator('package', {
description: 'Generate a new package for the Monorepo',
prompts: [
{