Skip to content

Commit ff852c2

Browse files
Ship TypeScript sources
1 parent efc4f2f commit ff852c2

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

.changeset/strong-cats-share.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@typeonce/effect-machine": patch
3+
---
4+
5+
Include the original TypeScript sources in the published package.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"license": "MIT",
1616
"sideEffects": false,
1717
"files": [
18+
"src/**/*.ts",
1819
"dist",
1920
"docs",
2021
"README.md",

scripts/pack-check.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { mkdtemp, rm } from "node:fs/promises"
1+
import { mkdtemp, readdir, rm } from "node:fs/promises"
22
import { tmpdir } from "node:os"
33
import { join, resolve } from "node:path"
44
import { spawnSync } from "node:child_process"
@@ -18,7 +18,11 @@ try {
1818
const listing = spawnSync("tar", ["-tzf", archive], { encoding: "utf8" })
1919
if (listing.status !== 0) throw new Error(listing.stderr)
2020
const files = listing.stdout.trim().split("\n")
21+
const sourceFiles = (await readdir(join(root, "src"), { recursive: true }))
22+
.filter((file) => file.endsWith(".ts"))
23+
.map((file) => `package/src/${file.replaceAll("\\", "/")}`)
2124
const required = [
25+
...sourceFiles,
2226
"package/dist/index.js",
2327
"package/dist/index.d.ts",
2428
"package/dist/unstable/reactivity/index.js",
@@ -47,7 +51,7 @@ try {
4751
if (legacyBuildFiles.length > 0) {
4852
throw new Error(`tarball contains legacy entrypoint artifacts:\n${legacyBuildFiles.join("\n")}`)
4953
}
50-
const forbidden = files.filter((file) => /^package\/(?:src|test|typetest|scripts|\.github|\.changeset)\//.test(file))
54+
const forbidden = files.filter((file) => /^package\/(?:test|typetest|scripts|\.github|\.changeset)\//.test(file))
5155
if (forbidden.length > 0) throw new Error(`tarball contains repository files:\n${forbidden.join("\n")}`)
5256
console.log(`pack verification passed (${files.length} files)`)
5357
} finally {

0 commit comments

Comments
 (0)