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.
--- /dev/null
+#!/bin/sh
+# Copyright 2020 Blue Static <https://www.bluestatic.org>
+# 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
{
"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",