0.2.0 • Published 15 days ago

jsthermalcomfort v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
15 days ago

Overview

docsdocs
buildbuild
teststest
page deploymentpage deployment
snyk securitysynk
licenselicense
npm versionnpm

Package to calculate thermophysiological, thermal comfort, thermal stress indices, in JavaScript.

Please cite us if you use this package: Tartarini, F., Schiavon, S., 2020. pythermalcomfort: A Python package for thermal comfort research. SoftwareX 12, 100578. https://doi.org/10.1016/j.softx.2020.100578

Official Documentation Website

https://federicotartarini.github.io/jsthermalcomfort/

Installation

npm install jsthermalcomfort

If you want to use jsthermalcomfort package without installing it on your local machine, you can import with:

https://cdn.jsdelivr.net/gh/FedericoTartarini/jsthermalcomfort/lib/esm/

Example:

import {
  models,
  utilities,
  pschymetrics,
} from "https://cdn.jsdelivr.net/gh/FedericoTartarini/jsthermalcomfort/lib/esm/index.js";

You can also import it in the website directly, and caution that you need to mark the script as module:

<script type="module">
  import {
    models,
    utilities,
    pschymetrics,
  } from "https://cdn.jsdelivr.net/gh/FedericoTartarini/jsthermalcomfort/lib/esm/index.js";
</script>

Examples and Tutorials

We developed a few examples files on how to use some of the functions.

Here is a list of examples running in the browser:

Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

Bug reports

When reporting a bug please include:

  • Your operating system name and version.
  • Any details about your local setup that might be helpful in troubleshooting.
  • Detailed steps to reproduce the bug.

Documentation improvements

If you find any issue in our online documentation please open an issue.

jsthermalcomfort could always use more documentation, whether as part of the official jsthermalcomfort docs, in JSDocs, or even on the web in blog posts, articles, and such.

Feature requests and feedback

The best way to send feedback is to file an issue at https://github.com/FedericoTartarini/jsthermalcomfort/issues

If you are proposing a feature:

  • Explain in detail how it would work.
  • Keep the scope as narrow as possible, to make it easier to implement.
  • Remember that this is a volunteer-driven project, and that code contributions are welcome :)

Local development

To set up jsthermalcomfort for local development:

  1. Fork jsthermalcomfort (look for the “Fork” button).
  2. Clone your fork locally. Fetch and pull all the updates from the master branch before you do anything:

    git clone git@github.com:FedericoTartarini/jsthermalcomfort.git

    We use git submodules to pull validation data for the tests, to ensure tests are successful please run:

    git submodule update --init --recursive
  3. Create a branch for local development. The naming rule for new branch are, as follows:

    • If this update is for a new feature Feature/feature_name_here
    • If this update is for bug fix Fix/bug_name_here
    • If this update is for documentation Documentation/doc_name_here

    You can create a branch locally using the following command. Make sure you only push updates to this new branch only:

    git checkout -b name-of-your-bugfix-or-feature

    Now you can make your changes locally.

  4. When you’re done making changes run all tests using Jest:

    • Install dependencies
    npm install
    npm run test
    • Run prettier to format your code:
    npm run format
    • Commit your changes:
    git add .
    git commit -m "Your detailed description of your changes."
    • Update the docs:
    npm run docs
    • Commit your documentation changes:
    git add .
    git commit -m "Your detailed description of your changes."
    • Push your branch to GitHub:
    git push origin name-of-your-bugfix-or-feature
  5. Submit a pull request after you have done all your modifications and tested your work. The pull request should include a detailed description of your work:

    • What this pull request is about
    • Have you tested your work
    • Will this work affect other component in the product

Pull Request Guidelines

If you need some code review or feedback while you’re developing the code just make the pull request.

For merging, you should:

  • Include passing tests (run npm run test).
  • Update documentation when there’s new API, functionality etc.

Documentation

We are using JSDoc and documentation.js to automatically build the documentation.

All the files needed to generate the documentation can be found in the docs_theme repository. After updating the Markdown files, please run the command:

npm run docs

Please ignore the docs folder, this folder contains all the files generated by the above command.

How to add a new model to jsthermalcomfort

  1. Add a file under src/models/ with the name of the function/model and document it.
  2. Add any related functions that are used by your function either in src/utilities/utilities.js or src/psychrometrics/. See existing code as example.
    • In order to add a new function/API to the library you should mark that function as @public, add it to its corresponding category, for example for models you should do @memberof models, and lastly you should give it a proper name for the documentation with @docname, for example: @docname Clothing prediction. It is important to note that you should also add the @public tag to any types the function exposes/uses.
  3. Test your function by writing a test in tests/models/<name_of_model>.test.js.
  4. To run a subset of tests you can do the following:

    npm run test -- '<path_to_test_file>' -t '<test_pattern/name>'

If you are using VSCode you can use the Jest Runner extension to easily run subset of tests.

How to publish a new version of jsthermalcomfort

To create a new release do the following:

  1. Update the package.json version to the new version (we use the semantic release system for versioning)
  2. Run npm run build to update the lib directory (output with types of the library that gets published to NPM)
  3. Commit the updates
  4. In GitHub go to Releases -> click Draft a new release
  5. Click Choose a tag and type the new version, for example v0.1.1
  6. Write the title and description and click Publish release
  7. This will trigger a GitHub action that will publish the new version to NPM
0.2.0

15 days ago

0.1.2

6 months ago

0.1.4

6 months ago

0.1.3

6 months ago

0.1.5

6 months ago

0.1.1

7 months ago

0.0.2

1 year ago

0.0.1

1 year ago