Skip to content

Commit dabe057

Browse files
committed
Fix reading string from file
1 parent 5a8361b commit dabe057

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/ts-codegen/src/commands/create-boilerplate.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { MinimistArgs } from '@cosmwasm/ts-codegen-types';
22
import dargs from 'dargs';
3-
import * as fs from 'fs';
3+
import { lstatSync, readFileSync, writeFileSync } from 'fs';
44
import { globSync as glob } from 'glob';
55
import * as path from 'path';
66
import * as shell from 'shelljs';
@@ -28,7 +28,7 @@ export default async (argv: MinimistArgs) => {
2828
shell.exec(`git clone ${repo} ${name}`);
2929
shell.cd(name);
3030

31-
const questions = JSON.parse(fs.readFileSync(`.questions.json`));
31+
const questions = JSON.parse(readFileSync(`.questions.json`, 'utf-8'));
3232

3333
const fullname = shell
3434
.exec('git config --global user.name', { silent: true })
@@ -87,9 +87,9 @@ export default async (argv: MinimistArgs) => {
8787

8888
for (let i = 0; i < files.length; i++) {
8989
const templateFile = files[i];
90-
if (fs.lstatSync(templateFile).isDirectory()) continue;
90+
if (lstatSync(templateFile).isDirectory()) continue;
9191

92-
let content = fs.readFileSync(templateFile).toString();
92+
let content = readFileSync(templateFile, 'utf-8');
9393
if (
9494
path.basename(templateFile) === 'LICENSE' &&
9595
license.__LICENSE__ === 'closed'
@@ -128,7 +128,7 @@ Proprietary and confidential`;
128128
// content = `# ${results.__MODULENAME__}`;
129129
// }
130130

131-
fs.writeFileSync(templateFile, content);
131+
writeFileSync(templateFile, content);
132132
}
133133

134134
shell.rm('-rf', '.git');

0 commit comments

Comments
 (0)