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

Output typescript declarations during build. Resolves #289. #316

Merged
merged 1 commit into from
Aug 17, 2021

Conversation

joeldenning
Copy link
Member

See #289

@changeset-bot
Copy link

changeset-bot bot commented Aug 16, 2021

🦋 Changeset detected

Latest commit: 6836760

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
generator-single-spa Major
ts-config-single-spa Major
create-single-spa Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -9,6 +12,7 @@
"dependencies": {
"@types/jest": "^26.0.23",
"@types/systemjs": "^6.1.0",
"@types/webpack-env": "^1.16.0"
"@types/webpack-env": "^1.16.0",
"single-spa": "^5.9.3"
Copy link
Member Author

Choose a reason for hiding this comment

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

This single-spa-react types rely on the single-spa types, so I added this dependency. This file is used by more than just react applications, but I figure having the single-spa library and its types available is not a bad idea for util modules / root configs, as well

@@ -79,6 +83,8 @@ module.exports = class SingleSpaReactGenerator extends PnpmGenerator {
delete packageJson.devDependencies["webpack-config-single-spa"];
// Will be replaced by webpack-config-single-spa-react-ts
delete packageJson.devDependencies["webpack-config-single-spa-ts"];

packageJson.types = `dist/${this.options.orgName}-${this.options.projectName}.d.ts`;
Copy link
Member Author

Choose a reason for hiding this comment

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

In case people publish the packages to npm, the "types" field should be properly set

},
"include": ["src/**/*", "node_modules/@types"],
"files": ["<%- mainFile %>"],
Copy link
Member Author

Choose a reason for hiding this comment

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

The "files" configuration is necessary for typescript to know which file is the main file.

@@ -14,6 +14,7 @@
"es2016.array.include",
"es2018"
],
"noEmit": true
"declaration": true,
Copy link
Member Author

Choose a reason for hiding this comment

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

These changes are what makes this a breaking change - previously no types emitted, now types are emitted

Copy link
Contributor

@TheMcMurder TheMcMurder left a comment

Choose a reason for hiding this comment

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

Looks good to me

@TheMcMurder TheMcMurder merged commit 6ca8cbc into main Aug 17, 2021
@TheMcMurder TheMcMurder deleted the issue-289 branch August 17, 2021 15:41
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