Skip to content

Commit

Permalink
Merge pull request #531 from rtfpessoa/use-npm
Browse files Browse the repository at this point in the history
use npm instead of yarn
  • Loading branch information
rtfpessoa committed Apr 19, 2024
2 parents 4de87bf + dea1d30 commit b517e40
Show file tree
Hide file tree
Showing 7 changed files with 17,766 additions and 8,931 deletions.
30 changes: 11 additions & 19 deletions .github/workflows/test-and-publish.yml
Expand Up @@ -61,17 +61,17 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache: 'npm'
- name: Log environment setup
run: |
node -v
yarn -v
npm -v
- name: Install dependencies
run: yarn install --ignore-engines
run: npm install
- name: Build templates
run: yarn run build:templates
run: npm run build:templates
- name: Build library
run: yarn run build
run: npm run build

publish:
runs-on: ubuntu-latest
Expand All @@ -97,12 +97,12 @@ jobs:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
tag: "${{ env.version }}"
- name: Install dependencies
run: yarn
run: npm install
- uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
node-version: '18.x'
- name: Configure Yarn version
- name: Configure NPM version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
Expand All @@ -112,19 +112,17 @@ jobs:
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "access=public" >> .npmrc
echo "save-exact=true" >> .npmrc
yarn config set version-tag-prefix ""
yarn config set version-git-message "Release version %s"
- name: Version package
run: |
# Update version in packages to publish
yarn version --non-interactive --new-version $(cat .version)
npm version $(cat .version) -m "Release version %s"
- name: Publish to NPM
run: yarn publish --tag $(cat .tag) --non-interactive --new-version $(cat .version)
run: npm publish --tag $(cat .tag)
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://npm.pkg.github.com'
- name: Configure Yarn version
- name: Configure NPM version
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -134,18 +132,12 @@ jobs:
echo "@rtfpessoa:registry=https://npm.pkg.github.com/" >> .npmrc
echo "access=public" >> .npmrc
echo "save-exact=true" >> .npmrc
yarn config set version-tag-prefix ""
yarn config set version-git-message "Release version %s"
- name: Version package
run: |
# Update version in packages to publish
yarn version --non-interactive --new-version $(cat .version)
- name: Publish to GPR
run: |
# HACK: Override npm package name to be able to publish in GitHub
sed -i 's/^ "name":.*/ "name": "@rtfpessoa\/diff2html",/g' package.json
echo "Going to publish version $(cat .version) to GitHub"
yarn publish --tag $(cat .tag) --non-interactive --new-version $(cat .version)
npm publish --tag $(cat .tag)
# HACK: Restore npm package name
sed -i 's/^ "name":.*/ "name": "diff2html",/g' package.json
- name: Upload docs
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
npm run lint:staged
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Expand Up @@ -10,9 +10,9 @@

- Before sending a pull request make sure your code is tested.

- Before sending a pull request for a feature, be sure to run tests with `yarn test`.
- Before sending a pull request for a feature, be sure to run tests with `npm run test`.

- Use the same coding style as the rest of the codebase, most of the check can be performed with `yarn run lint`.
- Use the same coding style as the rest of the codebase, most of the check can be performed with `npm run run lint`.

- Use `git rebase` (not `git merge`) to sync your work from time to time with the master branch.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -321,7 +321,7 @@ import { Controller } from '@hotwired/stimulus';

import { Diff2HtmlUI, Diff2HtmlUIConfig } from 'diff2html/lib/ui/js/diff2html-ui-slim.js';

// Requires `yarn add highlight.js`
// Requires `npm install highlight.js`
import 'highlight.js/styles/github.css';
import 'diff2html/bundles/css/diff2html.min.css';

Expand Down

0 comments on commit b517e40

Please sign in to comment.