forked from fastify/fastify-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheject-ts.js
More file actions
42 lines (37 loc) · 686 Bytes
/
eject-ts.js
File metadata and controls
42 lines (37 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'use strict'
const path = require('path')
const generify = require('generify')
const log = require('./log')
function eject (dir) {
return new Promise((resolve, reject) => {
generify(
path.join(__dirname, 'templates', 'eject-ts'),
dir,
{},
function (file) {
log('debug', `generated ${file}`)
},
function (err) {
if (err) {
return reject(err)
}
resolve()
}
)
})
}
function cli () {
eject(process.cwd()).catch(function (err) {
if (err) {
log('error', err.message)
process.exit(1)
}
})
}
module.exports = {
eject,
cli
}
if (require.main === module) {
cli()
}