Skip to content

Commit

Permalink
refactor: rename preload stubs directory name
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Dec 19, 2023
1 parent 4a8643d commit a6ab2f4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion commands/make/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class MakePreload extends BaseCommand {
/**
* The stub to use for generating the preload file
*/
protected stubPath: string = 'make/preload_file/main.stub'
protected stubPath: string = 'make/preload/main.stub'

/**
* Check if the mentioned environments are valid
Expand Down
File renamed without changes.
23 changes: 23 additions & 0 deletions stubs/make/validator/resource.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{#var validatorFileName = generators.validatorFileName(entity.name)}}
{{{
exports({
to: app.validatorsPath(entity.path, validatorFileName)
})
}}}
import vine from '@vinejs/vine'

/**
* Validator to validate the payload when creating
* a new {{ entity.name }}.
*/
export const create{{ entity.name }}Validator = vine.compile(
vine.object({})
)

/**
* Validator to validate the payload when updating
* an existing {{ entity.name }}.
*/
export const update{{ entity.name }}Validator = vine.compile(
vine.object({})
)
2 changes: 1 addition & 1 deletion tests/commands/make_preload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test.group('Make preload file', () => {
const command = await ace.create(MakePreload, ['app', '--environments=web'])
await command.exec()

const { contents } = await new StubsFactory().prepare('make/preload_file/main.stub', {
const { contents } = await new StubsFactory().prepare('make/preload/main.stub', {
entity: ace.app.generators.createEntity('app'),
})
await assert.fileEquals('start/app.ts', contents)
Expand Down
2 changes: 1 addition & 1 deletion tests/stubs/make_prldfile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test.group('Make preload file', () => {
await app.init()

const stubs = await app.stubs.create()
const stub = await stubs.build('make/preload_file/main.stub', {
const stub = await stubs.build('make/preload/main.stub', {
source: stubsRoot,
})
const { destination } = await stub.prepare({
Expand Down

0 comments on commit a6ab2f4

Please sign in to comment.