Skip to content

Commit

Permalink
fix read package json throws if not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
mistlog committed Dec 22, 2019
1 parent 65e92cc commit b314203
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cli/cli.ts
Expand Up @@ -26,7 +26,8 @@ else
{

//
const project_package = readJsonSync(join(working_directory, "package.json")) || { devDependencies: {} };
const project_package = readJsonSync(join(working_directory, "package.json"), { throws: false }) || { devDependencies: {} };

const dsl_names = Object.keys(project_package.devDependencies).filter(key => key.startsWith("draft-dsl"));
const dsls = dsl_names.map(name => require(`${join(working_directory, "node_modules", name)}`).dsl);
config.dsls = dsls;
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "typedraft",
"version": "0.0.2",
"version": "0.0.3",
"description": "TypeDraft is a superset of typescript with built-in support for DSL extension and literate programming.",
"keywords": [
"literate programming",
Expand Down

0 comments on commit b314203

Please sign in to comment.