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