Skip to content

Commit 9adf769

Browse files
committed
refactor: store templates as .txt files
1 parent 36376fe commit 9adf769

File tree

7 files changed

+202
-6
lines changed

7 files changed

+202
-6
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

instructions.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export default function instructions (
2222
{ TemplateFile }: typeof sinkStatic,
2323
) {
2424
templates.forEach((filename) => {
25-
const dest = application.configPath(filename)
26-
const src = join(__dirname, 'config', filename)
25+
const dest = `${application.directoriesMap.get('config')}/${filename}`
26+
const src = join(__dirname, 'config', filename.replace(/.ts$/, '.txt'))
2727

2828
new TemplateFile(projectRoot, dest, src)
2929
.apply({})

package-lock.json

+190
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
"build/providers",
88
"build/adonis-typings",
99
"build/src",
10-
"build/index.d.ts",
11-
"build/index.js",
1210
"build/config",
1311
"build/instructions.js"
1412
],
@@ -18,7 +16,7 @@
1816
"test": "node japaFile.js",
1917
"lint": "tslint --project tsconfig.json",
2018
"clean": "del build",
21-
"compile": "npm run lint && npm run clean && tsc",
19+
"compile": "npm run lint && npm run clean && tsc && copyfiles config/* build",
2220
"build": "npm run compile",
2321
"commit": "git-cz",
2422
"release": "np",
@@ -47,6 +45,7 @@
4745
"@poppinss/dev-utils": "^1.0.0",
4846
"@types/node": "^12.6.8",
4947
"commitizen": "^4.0.3",
48+
"copyfiles": "^2.1.1",
5049
"cz-conventional-changelog": "^3.0.2",
5150
"del-cli": "^2.0.0",
5251
"doctoc": "^1.4.0",

test/fixtures/cors.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ import { IncomingMessage } from 'http'
1111
import { Assert } from 'japa/build/src/Assert'
1212

1313
import { CorsConfigContract } from '@ioc:Adonis/Core/Cors'
14-
import corsConfig from '../../config/cors'
14+
const corsConfig = {
15+
origin: true,
16+
methods: ['GET', 'PUT', 'POST'],
17+
headers: true,
18+
credentials: true,
19+
maxAge: 90,
20+
exposeHeaders: [],
21+
}
1522

1623
const CORS_HEADERS = [
1724
'access-control-allow-origin',

0 commit comments

Comments
 (0)