Skip to content

Commit

Permalink
fix: ESM / CJS bundlers etc. (#2144)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaellis authored Jun 25, 2023
1 parent d68d53b commit 52cc710
Show file tree
Hide file tree
Showing 58 changed files with 1,047 additions and 977 deletions.
16 changes: 16 additions & 0 deletions .changeset/gorgeous-experts-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'react-spring': patch
'@react-spring/animated': patch
'@react-spring/parallax': patch
'@react-spring/shared': patch
'@react-spring/types': patch
'@react-spring/native': patch
'@react-spring/core': patch
'@react-spring/rafz': patch
'@react-spring/konva': patch
'@react-spring/three': patch
'@react-spring/zdog': patch
'@react-spring/web': patch
---

fix: mjs exports
50 changes: 44 additions & 6 deletions .github/publish-ci/are-the-types-wrong/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from '@arethetypeswrong/core'
import React from 'react'
import { render, Text, Box, Static } from 'ink'
import yargs from 'yargs/yargs'

const allResolutionKinds: ResolutionKind[] = [
'node10',
Expand Down Expand Up @@ -74,9 +75,9 @@ interface Checks {
problems?: Problem[]
}

const packagePath = path.join(__dirname, './package.tgz')
const rsPackagePath = path.join(__dirname, './web/package.tgz')

const packageTgzBytes = fs.readFileSync(packagePath)
const rsPackageTgzBytes = fs.readFileSync(rsPackagePath)

function Header({ text, width }: { text: string; width: number | string }) {
return (
Expand Down Expand Up @@ -232,8 +233,19 @@ function ChecksTable(props: { checks?: Checks }) {
)
}

;(async function main() {
const analysis = await checkTgz(packageTgzBytes)
const { argv } = yargs(process.argv).option('nonErrorProblems', {
alias: 'n',
type: 'array',
description: 'Do not treat these problems as errors for CLI exit codes',
choices: Object.keys(problemShortDescriptions) as ProblemKind[],
})

interface CLIOptions {
nonErrorProblems?: ProblemKind[]
}

;(async function main({ nonErrorProblems = [] }: CLIOptions) {
const analysis = await checkTgz(rsPackageTgzBytes)

const checks: Checks = {
analysis,
Expand Down Expand Up @@ -263,6 +275,32 @@ function ChecksTable(props: { checks?: Checks }) {
</Static>
)

const exitCode = checks.problems?.length ?? 0
const { problems = [] } = checks

console.log('\n\nProblem results:')

if (nonErrorProblems.length) {
console.log(
'Treating these problem categories as non-errors: ',
nonErrorProblems
)
}

const filteredProblems = problems.filter(
p => !nonErrorProblems.includes(p.kind)
)

if (filteredProblems.length) {
console.error(
'Remaining problems: ',
filteredProblems.map(p => p.kind)
)
} else {
console.log('No errors found!')
}

const exitCode = filteredProblems.length
process.exit(exitCode)
})()
})({
nonErrorProblems: argv.nonErrorProblems as ProblemKind[],
})
9 changes: 4 additions & 5 deletions .github/publish-ci/are-the-types-wrong/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@
"test": "yarn tsx main.tsx"
},
"dependencies": {
"@react-spring/web": "*",
"ink": "^4.0.0",
"object-hash": "^3.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-spring": "^9.7.1"
"react": "^18.2.0"
},
"devDependencies": {
"@arethetypeswrong/core": "^0.0.4",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"shelljs": "^0.8.5",
"tsx": "^3.12.5"
"tsx": "^3.12.5",
"yargs": "^17.7.1"
},
"resolutions": {
"@arethetypeswrong/core@^0.0.4": "patch:@arethetypeswrong/core@npm%3A0.0.4#./.yarn/patches/@arethetypeswrong-core-npm-0.0.4-edb717a66b.patch"
Expand Down
Loading

1 comment on commit 52cc710

@vercel
Copy link

@vercel vercel bot commented on 52cc710 Jun 25, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.