Skip to content

Commit

Permalink
remove build script and just read package.json file
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed May 23, 2024
1 parent ac31feb commit cea119c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 deletions.
18 changes: 0 additions & 18 deletions build/pkg-version.js

This file was deleted.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "ts-json-schema-generator",
"version": "2.0.0",
"description": "Generate JSON schema from your Typescript sources",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
Expand Down Expand Up @@ -94,7 +93,6 @@
"build": "npm run build:cjs && npm run build:esm",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:esm": "tsc -p tsconfig.json",
"postbuild": "node build/pkg-version.js",
"watch": "tsc -w",
"lint": "eslint",
"format": "eslint --fix",
Expand Down
6 changes: 3 additions & 3 deletions ts-json-schema-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { createGenerator } from "./factory/generator.js";
import type { Config } from "./src/Config.js";
import { BaseError } from "./src/Error/BaseError.js";
import { formatError } from "./src/Utils/formatError.js";
import fs from "node:fs";

// This constant gets replaced by the build script
const pkgVersion = "0.0.0";
const pkg = JSON.parse(fs.readFileSync("package.json", "utf8"));

const args = new Command()
.option("-p, --path <path>", "Source file path")
Expand Down Expand Up @@ -51,7 +51,7 @@ const args = new Command()
[],
)
.option("--additional-properties", "Allow additional properties for objects with no index signature", false)
.version(pkgVersion)
.version(pkg.version)
.parse(process.argv)
.opts();

Expand Down

0 comments on commit cea119c

Please sign in to comment.