Skip to content

Commit

Permalink
Enhance type definitions by adding SuperCodeGeneratorFileProps and im…
Browse files Browse the repository at this point in the history
…proving onCreate props structure
  • Loading branch information
jeremytenjo committed Feb 4, 2025
1 parent bee74ee commit df4b5a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/common/generateCode/handlers/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import openFile from '../../../../utils/folderFiles/openFile'
import logError from '../../../../utils/log/logError'
import getWorkspacePath from '../../../../utils/workspace/getWorkspacePath'
import { SuperCodeGeneratorHelpersProps } from './helpers'
import { SuperCodeGeneratorConfigSchema } from '../../..'
import { SuperCodeGeneratorConfigSchema, SuperCodeGeneratorFileProps } from '../../..'

export default async function create(props: {
name: string
Expand Down Expand Up @@ -34,7 +34,7 @@ export default async function create(props: {
await Promise.all(
props.componentConfig.files.map(async (file, index) => {
const openOnCreate = index === 0
const fileProperties = {
const fileProperties: SuperCodeGeneratorFileProps = {
name: props.name,
helpers: props.helpers,
folderPath: props.componentOutputPath,
Expand Down
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export type SuperCodeGeneratorConfigSchema<CustomProps = object> = {
outputWithoutParentDir?: boolean
usageInstructions?: string
hooks?: {
onCreate: (props: { outputPath: string, componentName: string }) => void | Promise<void>
onCreate: (props: {
outputPath: string
componentName: string
}) => void | Promise<void>
}
options?: {
createNamedFolder?: boolean
Expand All @@ -36,6 +39,7 @@ export type SuperCodeGeneratorFilesSchema<CustomProps = object> =

export type SuperCodeGeneratorFileProps<CustomProps = object> = {
name: string
folderPath?: string
helpers?: SuperCodeGeneratorHelpersProps
customProps?: CustomProps
type?: string
Expand Down Expand Up @@ -72,4 +76,3 @@ export function activate(context: vscode.ExtensionContext) {
export function deactivate() {
console.log(`${extensionName} deactivated!`)
}

0 comments on commit df4b5a0

Please sign in to comment.