Skip to content

Conversation

@ijlee2
Copy link
Contributor

@ijlee2 ijlee2 commented Jun 13, 2025

Background

Closes #360.

The published plugin is unusually large due to vite. In v2.0.5 (before .npmignore had been added), it had weighed at 3.73 MB. In v2.0.6, at 2.93 MB.

Using vite is also unnecessary for simple Node projects. We can use tsc to compile the TypeScript files, then publish the resulting dist folder. This results in fewer dependencies and a package size around 30.2 kB (0.8% of the size in v2.0.5, 1.01% of that in v2.0.6).

Before: Unpacked size of 2.9 MB
➜ npm publish --dry-un

> [email protected] prepack
> pnpm build

> [email protected] build
> tsc && vite build

npm notice Tarball Contents
npm notice 1.1kB LICENSE.md
npm notice 9.4kB README.md
npm notice 2.9MB dist/prettier-plugin-ember-template-tag.js
npm notice 2.8kB package.json
npm notice Tarball Details
npm notice name: prettier-plugin-ember-template-tag
npm notice version: 2.0.6
npm notice filename: prettier-plugin-ember-template-tag-2.0.6.tgz
npm notice package size: 555.8 kB
npm notice unpacked size: 2.9 MB
npm notice total files: 4
After: Unpacked size of 30.2 kB
➜ npm publish --dry-un

> [email protected] prepack
> pnpm build

> [email protected] build
> ./build.sh --production

SUCCESS: Built dist.

npm notice Tarball Contents
npm notice 1.1kB LICENSE.md
npm notice 9.4kB README.md
npm notice 536B dist/src/languages.js
npm notice 166B dist/src/main.js
npm notice 449B dist/src/options.js
npm notice 662B dist/src/parsers.js
npm notice 2.2kB dist/src/parsers/convert-ast.js
npm notice 67B dist/src/parsers/index.js
npm notice 2.5kB dist/src/parsers/preprocess.js
npm notice 3.2kB dist/src/printers.js
npm notice 1.1kB dist/src/printers/ambiguity.js
npm notice 347B dist/src/printers/ignore.js
npm notice 89B dist/src/printers/index.js
npm notice 2.3kB dist/src/printers/print.js
npm notice 1.6kB dist/src/types/glimmer.js
npm notice 217B dist/src/utils/assert.js
npm notice 854B dist/src/utils/content-tag.js
npm notice 395B dist/src/utils/doc.js
npm notice 202B dist/src/utils/index.js
npm notice 2.8kB package.json
npm notice Tarball Details
npm notice name: prettier-plugin-ember-template-tag
npm notice version: 2.0.6
npm notice filename: prettier-plugin-ember-template-tag-2.0.6.tgz
npm notice package size: 10.6 kB
npm notice unpacked size: 30.2 kB
npm notice total files: 20

@ijlee2 ijlee2 force-pushed the remove-vite-for-build branch 2 times, most recently from 67831e4 to f1902ae Compare June 13, 2025 10:31
@ijlee2 ijlee2 marked this pull request as ready for review June 13, 2025 10:47
"test:example": "pnpm preexample && cd examples && pnpm test",
"test:run": "vitest run",
"test:ui": "vitest --ui"
"test:vitest": "vitest run --exclude dist-for-testing --exclude tests"
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 renamed the folder tests (previously used to store files for vitest), because @codemod-utils/tests expects fixtures and test files for its testing to be in the tests folder.

@ijlee2 ijlee2 force-pushed the remove-vite-for-build branch from f1902ae to 384959e Compare June 13, 2025 10:54
@ijlee2 ijlee2 force-pushed the remove-vite-for-build branch from 384959e to e99b58e Compare June 13, 2025 16:11
Copy link
Member

@NullVoxPopuli NullVoxPopuli left a comment

Choose a reason for hiding this comment

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

I don't think we want to use tsc for compilation.

It's likely that we bundle dependencies and modules, because having fewer modules is significantly more performant.

We recently put template-lint in bundles, to see significant speed increases to the overall runtime for large projects, and time to response in editors.

Now, sure, the package is large, but i'd like to see the 'package.json#files' array utilized better.
I agree that npmignore is not a good tool.

I believe this pr's purpose should just result in adding/changing the files array, and deleting npmignore

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.

Published package is too large

2 participants