Skip to content

use npm instead of yarn #531

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

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 11 additions & 19 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading