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

Package Refactor (Tests, CI) #46

Closed
wants to merge 9 commits into from
Closed

Package Refactor (Tests, CI) #46

wants to merge 9 commits into from

Conversation

harshzalavadiya
Copy link
Contributor

@harshzalavadiya harshzalavadiya commented Jan 2, 2021

@Gozala I saw that this package can have many improvements that will make package maintainance easy for maintainers

Changelog

Tests

  • Moved from tape to jest since they were failing and test packages are not maintained from a while
  • Seprated from single test file to multiple test suites so it will be easy to read

Documentation

  • added JSDoc comments on function for imroved IDE autocomplete

CI

  • Moved to GitHub Actions since travis-ci.org is closing and ci.testling.com doesn't work anymore
  • for automated publish via github tagged release please set your NPM_AUTH_TOKEN to Your Repo > Settings > secrets > new repository secret more info here
  • Publish will be only triggured on tagged release otherwise for other PR/branch it will only run build + tests see https://github.com/harshzalavadiya/querystring/actions

File movements

  • renamed license.md to LICENSE since this it directly recognized by IDE like vscode as license file
  • renamed History.md to CHANGELOG.md with changelog guidelines
  • added .prettierrc.json to keep format consistant across any IDE
  • added .npmignore Only publish required files #45

I'll be happy to help if you need more explaination or help on this PR

Copy link
Collaborator

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

@harshzalavadiya great thanks for this! Still please see my comments

Ideally if such improvements are proposed with multiple PR's, each covering different matter (e.g. CI, prettification, meta updates are separate matters that can be handled exclusively in its own PR's)

Such approach will also allow us the take in obvious changes, while elaborate on once which require further clarification.

Anyway we can continue that way, see my comments.

src/decode.js Outdated
@@ -21,14 +21,31 @@

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's not nest files in src folder (there's no transpilation step involved, so there's no point to maintain src/dist division)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

package.json Outdated
Comment on lines 20 to 21
"commonjs",
"query",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think those keywords are not relevant to this package

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

.prettierrc.json Outdated
"semi": true,
"singleQuote": true,
"trailingComma": "none"
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's stick to Prettier defaults (eventually we may put printWidth to 100).

Also let's put this config into package.json

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done + also added preetier command to package.json


All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can CHANGELOG generation be automated in anyway? Or is it just simply about agreeing on rules and otherwise updating changelog manually?

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 think as of now it's manual since they can be different from commit messages (like something deprecated/upgrade instructions etc.)

package.json Outdated
@@ -1,62 +1,24 @@
{
"name": "querystring",
"id": "querystring",
"version": "0.2.0",
"version": "0.2.1",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's not bump version in this PR

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 have changed it back to v0.2.0 but current version of package currently ships some wierd binary files, so giving minor bump might be a good thing.

image

I know this will be tree shaken most off time but this will save 15-20 kb on package download

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree.

Whole point is to handle version release outside of this PR (I believe versioning should not be mixed in features/fixes PR's)

package.json Outdated
"test-browser": "node ./node_modules/phantomify/bin/cmd.js ./test/common-index.js",
"test-node": "node ./test/common-index.js",
"test-tap": "node ./test/tap-index.js"
"test": "jest"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This package was tested in browser engines, while if I see correctly it's no longer the case after this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, like earlier browser testing isn't done since jest uses jsdom by default, if not jest then also any suggestion is welcome :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Was testing as setup currently in master broken?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, test-browser command was throwing error, also package phantomify isn't updated in last 8 years

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, it appears it depends on phantomjs to be installed in a system, which on its own is deprecated

@harshzalavadiya
Copy link
Contributor Author

@medikoo I have resolved conflicts let me know if any changes are required from my end

Copy link
Collaborator

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

@harshzalavadiya thanks for update!

I've just realized that to not be breaking we need to ensure that package (and tests that confirms that) still works in Node.js v0.6

At least we should not introduce any breaking changes in v0.2.

For further versions we need to at least maintain support for Node.js v0.12, check the roadmap -> #20

This I believe means that we cannot switch test suite to Jest.

I propose to stick to existing test suite, we may just remove browser testing script as I believe it cannot work now as Testling is no longer in service (putting aside deprecations of various packages)

runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['10.x', '12.x', '14.x']
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to maintain support for Node.js v0.6 in v0.2 of querystring so this version should be in a Matrix.

@harshzalavadiya
Copy link
Contributor Author

harshzalavadiya commented Jan 5, 2021

Okay so as you said earlier I'm going to create seprate PR for the things that can be directly accepted and creating issue for test suites and nodejs support so we can discuss it there

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