Skip to content

Switch to Preconstruct#61

Merged
bvaughn merged 1 commit intobvaughn:masterfrom
Andarist:preconstruct
May 29, 2023
Merged

Switch to Preconstruct#61
bvaughn merged 1 commit intobvaughn:masterfrom
Andarist:preconstruct

Conversation

@Andarist
Copy link
Copy Markdown
Contributor

No description provided.

"presets": ["@babel/preset-typescript"],
"plugins": [
"@babel/plugin-proposal-class-properties",
["@babel/plugin-proposal-class-properties", { "loose": true }],
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this allows you to skip some Babel helpers from being injected into the output

@@ -1,6 +1,5 @@
{
"compilerOptions": {
"esModuleInterop": true,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's best not to use this option when building libraries - it might "taint" the dependency and force all of the consumers to also use this option

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular package wasn't actually prone to this, so it's fine right now.

@bvaughn bvaughn merged commit 5ceaef9 into bvaughn:master May 29, 2023
@bvaughn
Copy link
Copy Markdown
Owner

bvaughn commented May 29, 2023

Thank you! 🙇🏼

@bvaughn
Copy link
Copy Markdown
Owner

bvaughn commented May 29, 2023

I think this change broke the test target:

    Details:

    /Users/bvaughn/Documents/git/oss/react-virtualized-auto-sizer/src/vendor/detectElementResize.js:285
    export { createDetectElementResize };
    ^^^^^^

    SyntaxError: Unexpected token 'export'

      1 | import { Component, createElement, CSSProperties, ReactElement } from "react";
      2 |
    > 3 | import {
        | ^
      4 |   createDetectElementResize,
      5 |   DetectElementResize,
      6 | } from "./vendor/detectElementResize";

      at Runtime.createScriptFromCode (node_modules/.pnpm/jest-runtime@29.5.0/node_modules/jest-runtime/build/index.js:1495:14)
      at Object.<anonymous> (src/AutoSizer.ts:3:1)
      at Object.<anonymous> (src/AutoSizer.test.tsx:8:1)

My bad for not having tests run on PRs for this project 💩

@Andarist
Copy link
Copy Markdown
Contributor Author

I will look into this soon

@bvaughn
Copy link
Copy Markdown
Owner

bvaughn commented May 29, 2023

This fixes it:

diff --git a/jest.config.js b/jest.config.js
index bd9f347..5352e83 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,5 +1,15 @@
 /** @type {import('ts-jest').JestConfigWithTsJest} */
 module.exports = {
+  globals: {
+    "ts-jest": {
+      tsconfig: {
+        allowJs: true,
+      },
+    },
+  },
   preset: "ts-jest",
   testMatch: ["**/*.test.{ts,tsx}"],
+  transform: {
+    "^.+\\.[tj]sx?$": "ts-jest",
+  },
 };

@bvaughn
Copy link
Copy Markdown
Owner

bvaughn commented May 29, 2023

Published in 1.0.19

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants