Skip to content

Commit

Permalink
Fix issue when publishing both next and current release (#281)
Browse files Browse the repository at this point in the history
By emitting the types to their own folder, and then ignoring that folder, it doesn't both TS anymore that you have emitted twice.
  • Loading branch information
frehner committed Oct 17, 2022
1 parent 8a4a65e commit 30e9299
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-stingrays-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ladle/react": patch
---

Fix issue in GitHub Actions when publishing both next and current release.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ build
yarn-error.log
cjs
.turbo
.pnpm-store
.pnpm-store
packages/ladle/typings-for-build
2 changes: 1 addition & 1 deletion packages/ladle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"clean": "rimraf dist && rimraf .ladle && rimraf build && rimraf *.tsbuildinfo",
"serve": "node ./lib/cli/cli.js serve",
"test": "cross-env IMPORT_ROOT=\"./\" vitest",
"types": "tsc --project tsconfig.typesoutput.json && cp ./lib/app/exports.d.ts ./lib/app/exports.d.cts"
"types": "tsc --project tsconfig.typesoutput.json && cp ./typings-for-build/app/exports.d.ts ./typings-for-build/app/exports.d.cts"
},
"dependencies": {
"@babel/code-frame": "^7.18.6",
Expand Down
6 changes: 3 additions & 3 deletions packages/ladle/scripts/package-types-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ let oldExports = null;

export function preparePackageJsonForPublish(packageJson) {
oldTypes = packageJson.types;
packageJson.types = "./lib/app/exports.d.ts";
packageJson.types = "./typings-for-build/app/exports.d.ts";

oldExports = JSON.parse(JSON.stringify(packageJson.exports));
packageJson.exports["."] = {
types: {
import: "./lib/app/exports.d.ts",
require: "./lib/app/exports.d.cts",
import: "./typings-for-build/app/exports.d.ts",
require: "./typings-for-build/app/exports.d.cts",
},
default: "./lib/app/exports.ts",
};
Expand Down
6 changes: 4 additions & 2 deletions packages/ladle/tsconfig.typesoutput.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"compilerOptions": {
"noEmit": false,
"declaration": true,
"emitDeclarationOnly": true
"emitDeclarationOnly": true,
"declarationDir": "typings-for-build"
},
"include": ["lib/**/*", "src/**/*"]
"include": ["lib/**/*", "src/**/*"],
"exclude": ["typings-for-build"]
}

1 comment on commit 30e9299

@vercel
Copy link

@vercel vercel bot commented on 30e9299 Oct 17, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

ladle – ./

ladle.vercel.app
ladle-git-main-miksu.vercel.app
ladle.dev
ladle-miksu.vercel.app

Please sign in to comment.