Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ jobs:

- name: Build
run: yarn run build

- name: Check package contents
run: yarn check:package
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,7 @@ jobs:
run: yarn check
- name: Build
run: yarn build
- name: Check package contents
run: yarn check:package
- name: Publish package
run: yarn npm publish --access public --provenance
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{
"name": "@huskly/cli",
"version": "1.2.6",
"version": "1.2.7",
"description": "Terminal-based trading tools for Schwab and IBKR through the IBKR gateway",
"type": "module",
"files": [
"dist",
"README.md",
"LICENSE"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": "https://github.com/huskly/cli",
Expand All @@ -25,6 +30,7 @@
},
"scripts": {
"build": "tsc -p tsconfig.build.json",
"check:package": "node scripts/checkPackageFiles.mjs",
"start": "node dist/index.js",
"dev": "tsx src/index.ts",
"test": "node --conditions=tsx --import tsx --test \"test/**/*.test.ts\"",
Expand Down
20 changes: 20 additions & 0 deletions scripts/checkPackageFiles.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { execFileSync } from "node:child_process";
import { readdir } from "node:fs/promises";

const built = (await readdir("dist", { recursive: true }))
.filter((path) => path.endsWith(".js"))
.map((path) => `dist/${path}`);
const packed = execFileSync("yarn", ["pack", "--dry-run", "--json"], {
encoding: "utf8",
})
.trimEnd()
.split("\n")
.map((line) => JSON.parse(line).location)
.filter((path) => typeof path === "string");
const missing = built.filter((path) => !packed.includes(path));

if (built.length === 0 || missing.length > 0) {
throw new Error(`Package is missing built JavaScript files: ${missing.join(", ")}`);
}

console.log(`Package includes all ${built.length} built JavaScript files.`);
Loading