|
1 | 1 | import { MinimistArgs } from '@cosmwasm/ts-codegen-types'; |
2 | 2 | import dargs from 'dargs'; |
3 | | -import * as fs from 'fs'; |
| 3 | +import { lstatSync, readFileSync, writeFileSync } from 'fs'; |
4 | 4 | import { globSync as glob } from 'glob'; |
5 | 5 | import * as path from 'path'; |
6 | 6 | import * as shell from 'shelljs'; |
@@ -28,7 +28,7 @@ export default async (argv: MinimistArgs) => { |
28 | 28 | shell.exec(`git clone ${repo} ${name}`); |
29 | 29 | shell.cd(name); |
30 | 30 |
|
31 | | - const questions = JSON.parse(fs.readFileSync(`.questions.json`)); |
| 31 | + const questions = JSON.parse(readFileSync(`.questions.json`, 'utf-8')); |
32 | 32 |
|
33 | 33 | const fullname = shell |
34 | 34 | .exec('git config --global user.name', { silent: true }) |
@@ -87,9 +87,9 @@ export default async (argv: MinimistArgs) => { |
87 | 87 |
|
88 | 88 | for (let i = 0; i < files.length; i++) { |
89 | 89 | const templateFile = files[i]; |
90 | | - if (fs.lstatSync(templateFile).isDirectory()) continue; |
| 90 | + if (lstatSync(templateFile).isDirectory()) continue; |
91 | 91 |
|
92 | | - let content = fs.readFileSync(templateFile).toString(); |
| 92 | + let content = readFileSync(templateFile, 'utf-8'); |
93 | 93 | if ( |
94 | 94 | path.basename(templateFile) === 'LICENSE' && |
95 | 95 | license.__LICENSE__ === 'closed' |
@@ -128,7 +128,7 @@ Proprietary and confidential`; |
128 | 128 | // content = `# ${results.__MODULENAME__}`; |
129 | 129 | // } |
130 | 130 |
|
131 | | - fs.writeFileSync(templateFile, content); |
| 131 | + writeFileSync(templateFile, content); |
132 | 132 | } |
133 | 133 |
|
134 | 134 | shell.rm('-rf', '.git'); |
|
0 commit comments