eduolalo / moment-business-days

This is a momentJS plugin that allows you to use only business days (Monday to Friday)
MIT License
240 stars 67 forks source link

Release for NPM #99

Closed GaborTorma closed 1 year ago

GaborTorma commented 2 years ago

Please create a new release for NPM with forcedBusinessDays support. NPM has an old, 2 years version. Thanx!

GaborTorma commented 2 years ago

Please create a new release.

mcdado commented 2 years ago

@kalmecak if you want I can help you setup GitHub Actions so that when we create a release on here, a new release is published to npm. I've had some experience in this regard so it wouldn't require you much ongoing work if at all.

eduolalo commented 2 years ago

It would be nice, how can we do that?

mcdado commented 2 years ago

There's an official guide on GitHub: Publishing Node.js packages

I did it for another package that I publish, first you need to add a NPM Token as a Repository secret in the Repository Settings:

Screenshot 2021-11-22 at 11 03 52

Then add an action file. Here's the one from another project of mine:
https://github.com/mcdado/node-helpscout/blob/3ca7f5148428208a2212c25cbea63563142008d6/.github/workflows/publish_on_release.yml

name: publish node package to npm
on:
  release:
    types: [created]
jobs:
  publish_to_npm:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      # Setup .npmrc file to publish to npm
      - uses: actions/setup-node@v2
        with:
          node-version: '16'
          registry-url: 'https://registry.npmjs.org'
      - run: npm install
      - run: npm publish --access public
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

When you create a release it will automatically publish a new version to NPM. You have to make sure to bump the version in package.json.

mcdado commented 2 years ago

@kalmecak I just added the Github action. You need to add a repository secret called NPM_TOKEN as explained above.

elupanov commented 2 years ago

It would be great if you release a new version with forced business days feature. Thanks!

mcdado commented 2 years ago

@kalmecak please, can you provide the NPM token to the project?

GaborTorma commented 2 years ago

Temporary solution, install directly from git:

npm install --save https://github.com/kalmecak/moment-business-days.git

GaborTorma commented 1 year ago

I created a published fork with updated dependecies: https://github.com/GaborTorma/moment-working-days

GervinFung commented 1 year ago

Temporary solution, install directly from git:

npm install --save https://github.com/kalmecak/moment-business-days.git

Or it can be done by doing

npm i https://github.com/kalmecak/moment-business-days.git#git-commit-hash

to install a specific version, rather than default to main/master branch which can introduce breaking changes