Skip to content

Conversation

error-four-o-four
Copy link
Contributor

@error-four-o-four error-four-o-four commented May 27, 2025

  1. Please make all pull requests on the dev branch. ✅
  2. Don't commit build files ✅
  3. Try to get all tests to pass. ✅

Hey there,

as already mentioned I began to migrate dependencies fs-extra, glob, rimraf

Additionally .mjs and .cjs files were included in the linter config. FYI: simple-sort-import does not work with commonJS files (link). This could be a reason to migrate the scripts. I'd be happy to update this PR and implement this change if you're interested.

I didn't investigate other dependencies yet but npmgraph provides a good entrypoint to do so.

A few other things that caught my attention but aren't implemented yet:

  • The npm script docs fails because scripts/generate_docs.cjs does not exist (has issue)
  • I recently switched from windows to WSL/Ubuntu and had to explicitly set executablePath to make puppeteer happy and successfully run the tests (I think this has a very low priority)
  • Could you please elaborate why tslib is included as a dependency? I guess it's because the .ts files are also included via the field files in package.json, right?

Copy link

codecov bot commented May 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.95%. Comparing base (2626e0a) to head (84b2e2d).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1348   +/-   ##
=======================================
  Coverage   98.95%   98.95%           
=======================================
  Files         203      203           
  Lines       22725    22725           
  Branches      996      997    +1     
=======================================
  Hits        22487    22487           
  Misses        237      237           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@error-four-o-four
Copy link
Contributor Author

error-four-o-four commented May 29, 2025

closes #1339

Oh dear.

After all this PR reduces the following stats:

  • Amount of dependencies (including devDependencies): 927 => 904
  • Modules with multiple versions: 80 => 78
  • Deprecated Modules: 10 => 3

but there are still a few things to do:

@rollup/plugin-commonjs
@types/chai
@types/mocha
codecov
concurrently
http-server
plotly.js-dist
semver
typedoc
ua-parser-js
webpack-cli
yargs

When using @rollup/plugin-commonjs >=27 the tests fail because external modules can't be resolved. I've tried to add "allowSyntheticDefaultImports": true to the compiler options but without any success. I'd have to investigate the webpack bundle process and tools a bit further. At the moment I'm very tempted to migrate to vite and vitest but I don't know if this is a viable option (esp. in regard to the workflows of @tonejs/ui and tonejs.github.io) but not today.

@error-four-o-four error-four-o-four marked this pull request as ready for review May 29, 2025 18:52
Copy link
Contributor

@tambien tambien left a comment

Choose a reason for hiding this comment

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

thanks for this!

package.json Outdated
"docs:json": "typedoc --options \"./scripts/typedoc.json\" --json \"./docs/tone.json\"",
"remove": "node -e \"fs.rmSync('./build', { recursive: true, force: true })\"",
"build": "npm run increment && npm run remove && npm run ts:build && npm run webpack:build",
"docs": "typedoc --options \"./scripts/typedoc.json\" --json \"./docs/tone.json\"",
Copy link
Contributor

Choose a reason for hiding this comment

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

could we keep this as docs:json, this script is actually referenced in the docs generating script here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad. I didn't know that it's used in the homepage. I'm wondering if it's worth to take a look at the typedoc API or if this should be adjusted in any kind of way?

"build": "npm run increment && rimraf build && npm run ts:build && npm run webpack:build",
"docs": "node scripts/generate_docs.cjs",
"docs:json": "typedoc --options \"./scripts/typedoc.json\" --json \"./docs/tone.json\"",
"remove": "node -e \"fs.rmSync('./build', { recursive: true, force: true })\"",
Copy link
Contributor

Choose a reason for hiding this comment

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

also out of curiosity, why remove rimraf? seems like the code was more succinct before

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rimraf pulls in many transitive dependencies. The builtin node module provides the same functionality. The Disadvantage is that it depends on the Nodejs runtime which excludes older Nodejs versions, Bun and Deno users. If it's desired to support them I'd recommend to use premove which has zero dependencies.

I'm uncertain if 'remove' is the best name for this script. One could also name it 'clean' or use it as the npm lifecycle script 'prebuild'.

Less dependencies means a smaller footprint and less maintenance cost

feels good

@tambien tambien merged commit 9e44843 into Tonejs:dev Aug 13, 2025
7 checks passed
@tambien
Copy link
Contributor

tambien commented Aug 13, 2025

thank you!! really appreciate the time you put into making the library simpler and more maintainable 🙏🏻

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.

3 participants