generated from mezielabs/adonis-package-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
32 lines (29 loc) · 980 Bytes
/
index.js
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
const fs = require('fs')
// fs.cp('./templates', './test', { force: true, recursive: true }, (error) => {
// console.log('S', error)
// })
fs.readdirSync('./templates/Controller').forEach((file) => {
const [fileName, extension] = file.split('.')
console.log(fileName)
fs.copyFileSync(
`./templates/Controller/${fileName}.${extension}`,
`./test/Controller/${fileName}.ts`
)
})
// fs.readdir('./templates/Controller', function (err, files) {
// //handling error
// if (err) {
// return console.log('Unable to scan directory: ' + err)
// }
// //listing all files using forEach
// files.forEach(function (file) {
// // Do whatever you want to do with the file
// console.log(file)
// const [fileName, extension] = file.split('.')
// console.log(fileName, { extension })
// // fs.copyFileSync(
// // `./templates/Controller/${fileName}.${extension}`,
// // `./test/Controller/${fileName}.ts`
// // )
// })
// })