Skip to content

Commit

Permalink
refactor: use .txt extension for defining templates
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Nov 11, 2019
1 parent 546e1a1 commit 6e1827d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tasks/copyTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import { TaskFn } from '../src/contracts'
import { packages } from '../src/boilerplate/packages'

const templates = [
'server.ts',
'start/app.ts',
'start/kernel.ts',
'start/routes.ts',
'app/Exceptions/Handler.ts',
'providers/AppProvider.ts',
'server.txt',
'start/app.txt',
'start/kernel.txt',
'start/routes.txt',
'app/Exceptions/Handler.txt',
'providers/AppProvider.txt',
]

/**
Expand All @@ -38,7 +38,7 @@ const task: TaskFn = (absPath, _app, state) => {
/**
* Defining providers for the `start/app` file
*/
if (template === 'start/app.ts') {
if (template === 'start/app.txt') {
data.providers = []
Object.keys(boilerPlatePackages).forEach((name) => {
if (boilerPlatePackages[name].providers.length) {
Expand All @@ -52,16 +52,16 @@ const task: TaskFn = (absPath, _app, state) => {
/**
* Middleware based upon the type of project
*/
if (template === 'start/kernel.ts') {
if (template === 'start/kernel.txt') {
data.middleware = state.boilerplate === 'api'
? [`'App/Middleware/SpoofAccept',`, `'Adonis/Addons/BodyParserMiddleware',`]
: [`'Adonis/Addons/BodyParserMiddleware',`]
}

new TemplateFile(
absPath,
template,
join(__dirname, '..', 'templates', template.replace(/\.ts$/, '.txt')),
template.replace(/\.txt$/, '.ts'),
join(__dirname, '..', 'templates', template),
)
.apply(data)
.commit()
Expand Down

0 comments on commit 6e1827d

Please sign in to comment.