Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
changeKind: fix
packages:
- "@typespec/emitter-framework"
- "@typespec/http-canonicalization"
- "@typespec/http-client"
- "@typespec/http-client-js"
- "@typespec/http-server-js"
- "@typespec/http-specs"
- "@typespec/mutator-framework"
- "@typespec/protobuf"
- "@typespec/spec-api"
- "@typespec/spec-coverage-sdk"
- "@typespec/spector"
---

Exclude build artifacts from published packages
19 changes: 19 additions & 0 deletions eng/common/scripts/package-files.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { existsSync, readdirSync, readFileSync } from "node:fs";
import { join } from "node:path";
import { expect, it } from "vitest";

it("requires publishable packages to declare their published files", () => {
const packagesDir = new URL("../../../packages", import.meta.url);
const packagesWithoutFiles = readdirSync(packagesDir, { withFileTypes: true })
.filter((entry) => entry.isDirectory())
.filter((entry) => {
const packageJsonPath = join(packagesDir.pathname, entry.name, "package.json");
if (!existsSync(packageJsonPath)) return false;

const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
return packageJson.private !== true && packageJson.files === undefined;
})
.map((entry) => entry.name);

expect(packagesWithoutFiles).toEqual([]);
});
3 changes: 3 additions & 0 deletions packages/emitter-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"type": "git",
"url": "git+https://github.com/microsoft/typespec.git"
},
"files": [
"dist/**"
],
"scripts": {
"build": "alloy build",
"clean": "rimraf ./dist",
Expand Down
3 changes: 3 additions & 0 deletions packages/http-canonicalization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"import": "./dist/src/index.js"
}
},
"files": [
"dist/**"
],
"keywords": [],
"author": "",
"license": "MIT",
Expand Down
4 changes: 4 additions & 0 deletions packages/http-client-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
"import": "./dist/src/components/index.js"
}
},
"files": [
"dist/**",
"!dist/test/**"
],
"keywords": [
"typespec",
"javascript",
Expand Down
5 changes: 5 additions & 0 deletions packages/http-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
"import": "./dist/src/components/index.js"
}
},
"files": [
"lib/*.tsp",
"dist/**",
"!dist/test/**"
],
"peerDependencies": {
"@alloy-js/core": "catalog:",
"@alloy-js/typescript": "catalog:",
Expand Down
5 changes: 5 additions & 0 deletions packages/http-server-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
"bin": {
"hsjs-scaffold": "./cmd/hsjs-scaffold.mjs"
},
"files": [
"dist/**",
"cmd/**",
"!dist/test/**"
],
"scripts": {
"clean": "rimraf ./dist ./temp",
"build": "pnpm build:helpers && pnpm build:src",
Expand Down
5 changes: 5 additions & 0 deletions packages/http-specs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"description": "Spec scenarios and mock apis",
"main": "dist/index.js",
"type": "module",
"files": [
"dist/**",
"specs/**",
"assets/**"
],
"scripts": {
"watch": "tsc -p ./tsconfig.build.json --watch",
"build": "tsc -p ./tsconfig.build.json && pnpm validate-scenarios && pnpm build:smoke",
Expand Down
3 changes: 3 additions & 0 deletions packages/mutator-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"import": "./dist/src/index.js"
}
},
"files": [
"dist/**"
],
"keywords": [],
"author": "",
"license": "MIT",
Expand Down
5 changes: 5 additions & 0 deletions packages/protobuf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
},
"type": "module",
"tspMain": "lib/proto.tsp",
"files": [
"lib/*.tsp",
"dist/**",
"!dist/test/**"
],
"scripts": {
"clean": "rimraf ./dist ./temp",
"build": "pnpm gen-extern-signature && tsc -p tsconfig.build.json && pnpm lint-typespec-library",
Expand Down
3 changes: 3 additions & 0 deletions packages/spec-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"import": "./dist/index.js"
}
},
"files": [
"dist/**"
],
"scripts": {
"watch": "tsc -p ./tsconfig.build.json --watch",
"build": "tsc -p ./tsconfig.build.json",
Expand Down
3 changes: 3 additions & 0 deletions packages/spec-coverage-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"description": "Spec utility to manage the reported coverage",
"main": "dist/index.js",
"type": "module",
"files": [
"dist/**"
],
"scripts": {
"watch": "tsc -p ./tsconfig.build.json --watch",
"build": "tsc -p ./tsconfig.build.json",
Expand Down
6 changes: 6 additions & 0 deletions packages/spector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"bin": {
"tsp-spector": "./cmd/cli.mjs"
},
"files": [
"lib/*.tsp",
"dist/**",
"cmd/**",
"!dist/test/**"
],
"scripts": {
"watch": "tsc -p ./tsconfig.build.json --watch",
"build": "pnpm gen-extern-signature && tsc -p tsconfig.build.json",
Expand Down
Loading