From b4378cb2f2e7b1f58ef3a64d3c7b1f2d9427b19a Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 23 Mar 2020 00:10:55 -0400 Subject: [PATCH] Add a build script to help create the package. NPM "helpfully" uses .gitignore, which excludes dist/, but dist/ needs to make it into the NPM tarball. Rewrite a line in the copied package.json to explicitly include the dist/ files. --- build.sh | 22 ++++++++++++++++++++++ package.json | 9 ++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..c8d5a53 --- /dev/null +++ b/build.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# Copyright 2020 Blue Static +# This program is free software licensed under the GNU General Public License, +# version 3.0. The full text of the license can be found in LICENSE.txt. +# SPDX-License-Identifier: GPL-3.0-only + +OUTDIR=./dist + +set -ex + +# Clean. +rm -rf $OUTDIR + +# Compile. +tsc + +# Drop tests from the compiled output. +find $OUTDIR -type f -name '*.test.*' -exec rm {} + + +# "Preprocess" the dist package.json. +cp ./package.json $OUTDIR +sed -i '' -e s@\"dist/@\"@ $OUTDIR/package.json diff --git a/package.json b/package.json index a1aaab5..71f498c 100644 --- a/package.json +++ b/package.json @@ -1,20 +1,23 @@ { "name": "ustaxlib", - "version": "0.1.0", + "version": "1.0.0", "description": "A library for modeling individual US tax returns.", "scripts": { "dev": "jest --watch", "test": "jest", "check": "tsc --noEmit", "debug": "node --inspect-brk --stack-trace-limit=1000 node_modules/.bin/jest --coverage=false", - "prepublish": "tsc", - "build": "tsc && cp package.json dist" + "prepare": "./build.sh" }, "author": "Robert Sesek", "license": "GPL-3.0-only", "dependencies": { "typescript": "^3.8.2" }, + "files": [ + "dist/**/*", + "src/**/*" + ], "devDependencies": { "@types/jest": "^25.1.2", "jest": "^25.1.0", -- 2.43.5