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

require('ical-generator') without '.default' #253

Merged
merged 3 commits into from
May 12, 2021

Conversation

fratzinger
Copy link
Contributor

overwriting module.exports with Object.assign makes const ical = require('ical-generator') fully functional in js.
No need for '.default' anymore.

It changes nothing for typescript. It's only for Javascript, so the following isn't true anymore:

I updated to ical-generator@2.x.x and now get TypeError: ical is not a function errors
If you still want to use require() to import in version 2 onwards, please use require('ical-generator').default. The reason for this change is that from version 2 on, other objects such as types and interfaces required for typescript are exported as well (#247).

Destructured requires work the same in js and ts.

Pull Request Checklist

  • My code follows the code style of this project
    • Run npm run lint to double check
  • My change requires a change to the documentation
    • I have updated the documentation accordingly
  • I have added tests to cover my changes
    • Run npm run test to run the unit tests and npm run coverage to generate a coverage report
  • All new and existing tests passed
  • My commit messages follow the commit guidelines

overwriting module.exports with Object.assign makes `const ical = require('ical-generator')` fully functional in js.
No need for '.default' anymore.
@sebbo2002
Copy link
Owner

Uh, that's a nice one, thank you. I'll add a test to pass the code coverage check and merge it, thank you very much! ❤️

@sebbo2002 sebbo2002 self-assigned this May 12, 2021
@sebbo2002 sebbo2002 merged commit 7ebe4ae into sebbo2002:develop May 12, 2021
@github-actions github-actions bot mentioned this pull request May 12, 2021
github-actions bot pushed a commit that referenced this pull request May 12, 2021
# [2.1.0-develop.4](v2.1.0-develop.3...v2.1.0-develop.4) (2021-05-12)

### Features

* Allow use of `require('ical-generator')` without `.default` ([31833a6](31833a6)), closes [#253](#253)
@sebbo2002
Copy link
Owner

🎉 This PR is included in version 2.1.0-develop.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@fratzinger
Copy link
Contributor Author

Nice! Thanks for the quick reaction! Glad it is helpful :)

github-actions bot pushed a commit that referenced this pull request May 13, 2021
# [2.1.0](v2.0.0...v2.1.0) (2021-05-13)

### Features

* Allow use of `require('ical-generator')` without `.default` ([31833a6](31833a6)), closes [#253](#253)
* Export `formatDate` and some other tool functions ([6142e11](6142e11)), closes [#248](#248)
* first commit ([dc8fa4a](dc8fa4a))
@sebbo2002
Copy link
Owner

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

sebbo2002 added a commit that referenced this pull request Mar 17, 2023
BREAKING CHANGE: Importing the generator with `const ical = require('ical-generator');` (introduced with 2.1.0 / #253) will not work anymore, please use `const { default: ical } = require('ical-generator');` or move to fancy ESM imports (`import ical from 'ical-generator' ;`).
@sebbo2002 sebbo2002 mentioned this pull request Mar 17, 2023
github-actions bot pushed a commit that referenced this pull request Mar 17, 2023
# [4.0.0-develop.1](v3.6.2-develop.4...v4.0.0-develop.1) (2023-03-17)

### Features

* ESM Module ([7e1f07a](7e1f07a))

### BREAKING CHANGES

* Importing the generator with `const ical = require('ical-generator');` (introduced with 2.1.0 / #253) will not work anymore, please use `const { default: ical } = require('ical-generator');` or move to fancy ESM imports (`import ical from 'ical-generator' ;`).
github-actions bot pushed a commit that referenced this pull request Mar 30, 2023
# [4.0.0](v3.6.1...v4.0.0) (2023-03-30)

### Bug Fixes

* **Event:** Add `RRULE:` prefix in event.repeating() if it's not already there ([92c2034](92c2034)), closes [#459](#459)
* Update escaping for quoted values ([faf5c70](faf5c70)), closes [#463](#463)

### Build System

* Deprecate node.js 12 ([426588b](426588b))
* Native ESM support ([7b86a4f](7b86a4f))

### Features

* ESM Module ([7e1f07a](7e1f07a))

### BREAKING CHANGES

* Importing the generator with `const ical = require('ical-generator');` (introduced with 2.1.0 / #253) will not work anymore, please use `const { default: ical } = require('ical-generator');` or move to fancy ESM imports (`import ical from 'ical-generator' ;`).
* From now on, only node.js ^14.8.0 || >=16.0.0 are supported
* Only Support for node.js ^12.20.0 || >=14.13.1
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants