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

Improve install size #27

Closed
szmarczak opened this issue Sep 25, 2020 · 6 comments · Fixed by #41
Closed

Improve install size #27

szmarczak opened this issue Sep 25, 2020 · 6 comments · Fixed by #41

Comments

@szmarczak
Copy link

szmarczak commented Sep 25, 2020

https://packagephobia.com/result?p=tempy

[email protected] install size is 1.61 MB

That's quite high. 0.6.0 was only 120KB.

@szmarczak szmarczak changed the title [email protected] install size is 1.61MB [email protected] install size is 1.61 MB Sep 25, 2020
@sindresorhus
Copy link
Owner

I agree, however, I have a plan. When the recursive option on rmdir is no longer experimental, we can use that one instead of del: https://nodejs.org/api/fs.html#fs_fs_rmdir_path_options_callback


Tip: You can use https://bundlephobia.com/[email protected] to see what dependencies take up of the most space.

@sindresorhus sindresorhus changed the title [email protected] install size is 1.61 MB Improve install size Sep 26, 2020
@sindresorhus
Copy link
Owner

I managed to improve it a little bit: https://packagephobia.com/result?p=tempy

@Richienb
Copy link
Contributor

Richienb commented Mar 17, 2021

When the recursive option on rmdir is no longer experimental

That's Node.js 12.10. Node.js 10 will EOL in 1 month and 2 weeks.

@fregante
Copy link

fregante commented Mar 17, 2021

Just in time for sindresorhus/meta#15!

Side note: Could fs.mkdtemp be used to replace unique-string?

I think from

tempy/index.js

Line 14 in 0e498c9

const getPath = (prefix = '') => path.join(tempDir, prefix + uniqueString());

to something like

const getPath = (prefix = '') => fs.mkdtempSync(path.join(tempDir, prefix));

@Richienb
Copy link
Contributor

I agree, however, I have a plan. When the recursive option on rmdir is no longer experimental, we can use that one instead of del: nodejs.org/api/fs.html#fs_fs_rmdir_path_options_callback

That option is deprecated now.

The alternative is fs.promises.rm in Node.js 14.14 which is 3 months away.

@Richienb
Copy link
Contributor

Side note: Could fs.mkdtemp be used to replace unique-string?

Yes it would, though we'd still need to use unique-string to generate the file since that isn't a feature yet

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 a pull request may close this issue.

4 participants