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

fix: clean published files #140

Merged

Conversation

jaydenseric
Copy link
Contributor

  • Whitelist published files with a package.json files field.

    It's much more robust to whitelist what gets published, instead of attempting to remember to blacklist via .npmignore file which is now deleted.

    This change prevents 7 unnecessary files from being published (you can verify what gets published by running npm pack):

    - 758B   .github/workflows/test.yml
    - 101B   .husky/commit-msg
    - 95B    .husky/pre-commit
    - 8B     .prettierignore
    - 21.8kB CHANGELOG.md
      1.1kB  LICENSE
      5.3kB  README.md
    - 70B    commitlint.config.js
      325B   lib/create-language.js
      10.1kB lib/descriptionFormatter.js
      6.8kB  lib/index.js
      16.0kB lib/parser.js
      4.4kB  lib/roles.js
      4.4kB  lib/stringify.js
      3.5kB  lib/tags.js
      77B    lib/types.js
      9.0kB  lib/utils.js
      2.0kB  package.json
    - 5.7kB  tsconfig.json
  • Prevent dev tool config from being published in package.json. It's best practice to keep dev tool config out of the package.json to reduce the published size of the package, in turn reducing the installed size of the package in user’s node_modules.

    • Prevent Husky config from being published in package.json.

    • Prevent Jest config from being published in package.json.

      The Jest config is in a .js file as it doesn't automatically respect a .jestrc.json file without having to use a --config CLI argument, but at least the Jest config can now be type checked.

      Also, a forward slash in a regex in the Jest config is now correctly escaped.

    There is still a package.json workspaces field that looks sketchy, but I figured messing around with Yarn and stuff might be too contentious for this PR.

This change prevents 7 unnecessary files from being published.
The Jest config can now be type checked. Also, a forward slash in a regex in the Jest config is now correctly escaped.
@jaydenseric jaydenseric changed the title Clean published files fix: clean published files Nov 13, 2021
@hosseinmd
Copy link
Owner

Awesome
could you add changelog to whitelist

@hosseinmd
Copy link
Owner

Is that good for SEO?

@jaydenseric
Copy link
Contributor Author

It's desirable not to publish the changelog so that the install size of the package is stable and it doesn't keep growing limitlessly over time as new versions are added to the changelog. Changelogs can become quite big.

It's safe to not publish the changelog, as no-one reads the it from within node_modules. NPM no longer forces CHANGELOG.md to be published. NPM still forces README.md to be published, but I think that's because there is a chance that it contains the software license.

The changelog versioned in the GitHub repo is a better reference for users to read, as any corrections for past version changelog entries (updates to broken links, adding missing changes, etc.) can be seen whereas the changelogs published to npm are frozen in time and can't be amended.

Let me know if you are still sure you want to publish the changlog and I'll update this PR :)

Is that good for SEO?

Sorry, I'm not sure exactly what you're referring to as "that".

@hosseinmd
Copy link
Owner

Thank you.

@hosseinmd hosseinmd merged commit a77e0f7 into hosseinmd:master Nov 13, 2021
@jaydenseric jaydenseric deleted the jaydenseric/clean-published-files branch November 13, 2021 07:56
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.

2 participants