Skip to content

fix: [embed-react] types fix for compatible with TypeScript's "moduleResolution": "bundler"#12327

Merged
PeerRich merged 4 commits intocalcom:mainfrom
LarsArtmann:patch-2
Nov 20, 2023
Merged

fix: [embed-react] types fix for compatible with TypeScript's "moduleResolution": "bundler"#12327
PeerRich merged 4 commits intocalcom:mainfrom
LarsArtmann:patch-2

Conversation

@LarsArtmann
Copy link
Contributor

@LarsArtmann LarsArtmann commented Nov 11, 2023

fix: [embed-react] types fix for compatible with TypeScript's "moduleResolution": "bundler"

  • moved types in exports to the first position to comply with the standard
  • updated version so a new release can be rolled out

References

#11432
#11408

…on to comply with the standard + Update version so a new release can be rolled out + ref: calcom#11432
@CLAassistant
Copy link

CLAassistant commented Nov 11, 2023

CLA assistant check
All committers have signed the CLA.

@vercel
Copy link

vercel bot commented Nov 11, 2023

@LarsArtmann is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 11, 2023

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link to collect XP and win prizes!

@PeerRich PeerRich added the Low priority Created by Linear-GitHub Sync label Nov 16, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Nov 16, 2023

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@PeerRich PeerRich merged commit 9eb2ae4 into calcom:main Nov 20, 2023
@LarsArtmann LarsArtmann deleted the patch-2 branch November 20, 2023 18:10
zomars pushed a commit that referenced this pull request Nov 22, 2023
…Resolution": "bundler" (#12327)

Co-authored-by: Peer Richelsen <peer@cal.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
@lott-ai
Copy link

lott-ai commented Nov 25, 2023

@PeerRich can you publish the @calcom/embed-react package that includes this fix for typings? (v1.3.1) 🙏

https://www.npmjs.com/package/@calcom/embed-react?activeTab=versions

image

jakazzy pushed a commit to jakazzy/cal.com that referenced this pull request Dec 5, 2023
…Resolution": "bundler" (calcom#12327)

Co-authored-by: Peer Richelsen <peer@cal.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
@Larkify
Copy link

Larkify commented Jan 25, 2024

Is this ever going to be published? It's been months and this is a breaking change that prevents anyone trying to use this package from being able to compile it

@LarsArtmann
Copy link
Contributor Author

Since this is still not published, I wanted to share my current work around.
It was created just for me. I'm using pnpm. Feel free to change it to fix your project.

Adding it to your scripts in the package.json will let it run after every install.

...
"scripts": {
  "postinstall": "node fix-type.js",
}
...

TypeScript version

import fs from "node:fs"

function fixType() {
	fixTypeAt("./node_modules/@calcom/embed-react/package.json")
	fixTypeAt("../../node_modules/@calcom/embed-react/package.json")
}

function fixTypeAt(path: string) {
	if (!fs.existsSync(path)) {
		console.warn("Cannot find package.json at", path)
		return
	}
	console.log("Found package.json at", path)

	const packageJsonRaw = fs.readFileSync(path, "utf8")
	const packageJson = JSON.parse(packageJsonRaw)

	packageJson.exports["."].types = "./dist/embed-react/src/index.d.ts"

	fs.writeFileSync(path, JSON.stringify(packageJson, null, 2))
}

fixType()

JavaScript version

import fs from "node:fs";
function fixType() {
    fixTypeAt("./node_modules/@calcom/embed-react/package.json");
    fixTypeAt("../../node_modules/@calcom/embed-react/package.json");
}
function fixTypeAt(path) {
    if (!fs.existsSync(path)) {
        console.warn("Cannot find package.json at", path);
        return;
    }
    console.log("Found package.json at", path);
    const packageJsonRaw = fs.readFileSync(path, "utf8");
    const packageJson = JSON.parse(packageJsonRaw);
    packageJson.exports["."].types = "./dist/embed-react/src/index.d.ts";
    fs.writeFileSync(path, JSON.stringify(packageJson, null, 2));
}
fixType();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Low priority Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants