Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(client-utils): Fix type generation for ESM and add exports field #18822

Merged
merged 5 commits into from
Dec 14, 2023
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
2 changes: 1 addition & 1 deletion packages/common/client-utils/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ module.exports = {
},
],
],
testMatch: ["**/dist/test/jest/?(*.)+(spec|test).js"],
testMatch: ["**/dist/test/jest/?(*.)+(spec|test).?js"],
testPathIgnorePatterns: ["/node_modules/"],
};
41 changes: 13 additions & 28 deletions packages/common/client-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"license": "MIT",
"author": "Microsoft and contributors",
"sideEffects": false,
"main": "dist/index.js",
"module": "lib/index.js",
"main": "dist/index.cjs",
"module": "lib/index.mjs",
"browser": {
"./dist/indexNode.js": "./dist/indexBrowser.js",
"./lib/indexNode.js": "./lib/indexBrowser.js"
"./dist/indexNode.cjs": "./dist/indexBrowser.cjs",
"./lib/indexNode.mjs": "./lib/indexBrowser.mjs"
},
"types": "dist/index.d.ts",
"scripts": {
Expand All @@ -26,11 +26,9 @@
"build:commonjs": "fluid-build . --task commonjs",
"build:compile": "fluid-build . --task compile",
"build:docs": "fluid-build . --task api",
"build:esnext": "tsc --project ./tsconfig.esnext.json",
"build:test": "concurrently npm:build:test:mocha npm:build:test:jest npm:build:test:types",
"build:test:jest": "tsc --project ./src/test/jest/tsconfig.json",
"build:test:mocha": "tsc --project ./src/test/mocha/tsconfig.json",
"build:test:types": "tsc --project ./src/test/types/tsconfig.json",
"build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
"build:rename-types": "renamer \"lib/**\" -f .d.ts -r .d.mts --force",
"build:test": "tsc-multi --config ./tsc-multi.test.json",
"check:are-the-types-wrong": "attw --pack",
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
"ci:build:docs": "api-extractor run",
Expand All @@ -45,8 +43,8 @@
"test": "npm run test:mocha && npm run test:jest",
"test:coverage": "c8 npm test",
"test:jest": "jest",
"test:mocha": "mocha --recursive \"dist/test/mocha/**/*.spec.js\" --exit --project test/tsconfig.json",
"tsc": "tsc",
"test:mocha": "mocha --recursive \"dist/test/mocha/**/*.spec.?js\" --exit --project test/tsconfig.json",
"tsc": "tsc-multi --config ../../../common/build/build-common/tsc-multi.cjs.json",
"typetests:gen": "fluid-type-test-generator",
"typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
},
Expand Down Expand Up @@ -82,6 +80,7 @@
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.13.3",
"@fluid-internal/client-utils-previous": "npm:@fluid-internal/client-utils@2.0.0-internal.7.3.0",
"@fluid-tools/build-cli": "^0.28.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.28.0",
Expand Down Expand Up @@ -112,42 +111,28 @@
"moment": "^2.21.0",
"prettier": "~3.0.3",
"puppeteer": "^17.1.3",
"renamer": "^4.0.0",
"rewire": "^5.0.0",
"rimraf": "^4.4.0",
"sinon": "^7.4.2",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"tsc-multi": "^1.1.0",
"typescript": "~5.1.6"
},
"fluidBuild": {
"tasks": {
"eslint": [
"tsc",
"build:test:mocha",
"build:test:jest",
"build:test:types"
],
"build:docs": {
"dependsOn": [
"...",
"api-extractor:commonjs",
"api-extractor:esnext"
],
"script": false
},
"build:test:jest": [
"tsc"
],
"build:test:mocha": [
"tsc"
],
"build:test:types": [
"tsc"
]
}
}
},
"typeValidation": {
"disabled": true,
"broken": {}
}
}
2 changes: 1 addition & 1 deletion packages/common/client-utils/src/test/jest/gitHash.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import rewire from "rewire";
import * as HashNode from "../../hashFileNode";

// Use rewire to access private functions
const HashBrowser = rewire("../../hashFileBrowser");
const HashBrowser = rewire("../../hashFileBrowser.cjs");

async function getFileContents(p: string): Promise<Buffer> {
return new Promise<Buffer>((resolve, reject) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { strict as assert } from "node:assert";
import { EventEmitter } from "node:events";
import { IErrorEvent } from "@fluidframework/core-interfaces";
import { EventForwarder } from "../..";
import { EventForwarder } from "../../eventForwarder";

interface ITestEvents extends IErrorEvent {
(event: "testEvent", listener: (name: string, count: number) => void);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
import { strict as assert } from "node:assert";
import { IErrorEvent } from "@fluidframework/core-interfaces";
import { TypedEventEmitter } from "../..";
import { TypedEventEmitter } from "../../typedEventEmitter";

describe("TypedEventEmitter", () => {
it("Validate Function proxies", () => {
Expand Down
Loading