From 07517f212ed362b7c0782daba663010a7676101e Mon Sep 17 00:00:00 2001 From: smallstonesk <575913857@qq.com> Date: Tue, 22 Sep 2020 09:39:37 +0800 Subject: [PATCH] fix: read file failed --- packages/cli/package.json | 2 +- packages/cli/src/cmd/dev/addPlugins.js | 2 +- packages/cli/src/cmd/dev/template/index.js | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 95009dc..aa9a70d 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@imove/cli", - "version": "0.0.1", + "version": "0.0.2", "description": "imove client", "main": "index.js", "bin": { diff --git a/packages/cli/src/cmd/dev/addPlugins.js b/packages/cli/src/cmd/dev/addPlugins.js index 0064cef..3a017c9 100644 --- a/packages/cli/src/cmd/dev/addPlugins.js +++ b/packages/cli/src/cmd/dev/addPlugins.js @@ -6,7 +6,7 @@ const INSERT_USE_PLUGINS_COMMENT = '\/\/ use plugins here'; const setup = async (plugins, logicBasePath) => { const entryFilePath = path.join(logicBasePath, 'index.js'); - const codes = await fs.readFile(entryFilePath); + const codes = await fs.readFile(entryFilePath, 'utf8'); const modifiedContent = codes .replace(new RegExp(INSERT_IMPORT_PLUGINS_COMMENT), () => { return plugins diff --git a/packages/cli/src/cmd/dev/template/index.js b/packages/cli/src/cmd/dev/template/index.js index c09d49a..e699a93 100644 --- a/packages/cli/src/cmd/dev/template/index.js +++ b/packages/cli/src/cmd/dev/template/index.js @@ -2,7 +2,6 @@ import Logic from './logic'; import dsl from './dsl.json'; // import plugins here - const logic = new Logic({dsl}); // use plugins here