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 Node.js 18, move to ESM and named exports #31

Merged
merged 6 commits into from
Mar 27, 2024

Conversation

yannbertrand
Copy link
Contributor

@yannbertrand yannbertrand commented Mar 25, 2024

Followed ESM docs and your work on other projects.

API Breaking changes:

  • const aperture = require('aperture')import {recorder} from 'aperture'
  • await aperture().startRecording()await recorder.startRecording
  • aperture.screensimport {screens} from 'aperture'
  • aperture.audioDevicesimport {audioDevices} from 'aperture'
  • aperture.videoCodecsimport {videoCodecs} from 'aperture'

ava, file-type, xo and electron-util last versions require Node 18 so I couldn't use them. Do you think it's worth upgrading to Node 18 now?

@yannbertrand yannbertrand changed the title Require Node.js 16 and move to ESM Require Node.js 16, move to ESM and name exports Mar 25, 2024
@yannbertrand yannbertrand changed the title Require Node.js 16, move to ESM and name exports Require Node.js 16, move to ESM and named exports Mar 25, 2024
@yannbertrand yannbertrand force-pushed the migrate-to-esm branch 2 times, most recently from 0895262 to da6d03c Compare March 25, 2024 15:40
example.js Outdated
const aperture = require('.');
import fs from 'node:fs';
import timers from 'node:timers/promises';
import {aperture, screens, audioDevices, videoCodecs} from './index.js';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import {aperture, screens, audioDevices, videoCodecs} from './index.js';
import {recorder, screens, audioDevices, videoCodecs} from './index.js';

Would make more sense to name it recorder, since we're doing changes anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about exporting the Recorder class? Not sure about the demos example naming

const recorder = new Recorder()

Copy link
Member

Choose a reason for hiding this comment

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

You cannot record two things at once, so I don't think being able to create a new instance is very useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I exported a Recorder instance named recorder.

readme.md Outdated Show resolved Hide resolved
@sindresorhus sindresorhus changed the title Require Node.js 16, move to ESM and named exports Require Node.js 18, move to ESM and named exports Mar 26, 2024
@sindresorhus sindresorhus merged commit 558b1b3 into wulkano:main Mar 27, 2024
2 checks passed
@sindresorhus
Copy link
Member

Thank you 🙏

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.

None yet

2 participants