use npm instead of yarn

This commit is contained in:
Rodrigo Fernandes 2024-04-19 21:17:22 +01:00
parent 4de87bf099
commit dea1d300b3
No known key found for this signature in database
7 changed files with 17766 additions and 8931 deletions

View file

@ -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
@ -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: |
@ -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: |
@ -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

View file

@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged
npm run lint:staged

View file

@ -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.

View file

@ -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';

17737
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -36,32 +36,33 @@
},
"scripts": {
"eslint": "eslint --ignore-path .gitignore \"**/*.{js,jsx,ts,tsx,json}\"",
"lint:check": "yarn run eslint",
"lint:fix": "yarn run eslint --fix",
"lint:staged": "lint-staged",
"lint:check": "eslint",
"lint:fix": "eslint --fix",
"prettier": "prettier --ignore-path .gitignore '**/*.+(js|jsx|ts|tsx|json|css|html|md|mdx)'",
"format:check": "yarn run prettier --check",
"format:fix": "yarn run prettier --write",
"build": "yarn run build:css && yarn run build:templates && yarn run build:commonjs && yarn run build:esm && yarn run build:bundles && yarn run build:website",
"format:check": "npm run prettier --check",
"format:fix": "npm run prettier --write",
"build": "npm run build:css && npm run build:templates && npm run build:commonjs && npm run build:esm && npm run build:bundles && npm run build:website",
"build:commonjs": "rm -rf lib; tsc -p tsconfig.json --outDir lib",
"build:esm": "rm -rf lib-esm; tsc -p tsconfig.json -m ESNext --outDir lib-esm",
"build:bundles": "rm -rf ./bundles/js; webpack --mode production --config webpack.bundles.ts",
"build:css": "rm -rf ./bundles/css; postcss --config ./postcss.config.js --no-map -o ./bundles/css/diff2html.min.css ./src/ui/css/diff2html.css",
"build:templates": "ts-node ./scripts/hulk.ts --wrapper ts --variable 'defaultTemplates' ./src/templates/*.mustache > ./src/diff2html-templates.ts",
"build:website": "rm -rf docs; webpack --mode production --config webpack.website.ts",
"gen": "yarn run gen:toc",
"gen": "npm run gen:toc",
"gen:toc-base": "markdown-toc --maxdepth 3 --bullets='-' -i",
"gen:toc": "yarn run gen:toc-base README.md",
"gen:toc": "npm run gen:toc-base README.md",
"test": "is-ci 'test:coverage' 'test:watch'",
"test:coverage": "jest --coverage",
"test:watch": "jest --watch",
"test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch",
"coverage:open": "yarn run test:coverage && open ./coverage/index.html",
"coverage:open": "npm run test:coverage && open ./coverage/index.html",
"coverage:push": "curl -Ls https://coverage.codacy.com/get.sh | bash",
"validate": "yarn run build:templates && yarn run format:check && yarn run lint:check && yarn run build && yarn run test:coverage",
"fix": "yarn run format:fix && yarn run lint:fix",
"start": "yarn run start:website",
"validate": "npm run build:templates && npm run format:check && npm run lint:check && npm run build && npm run test:coverage",
"fix": "npm run format:fix && npm run lint:fix",
"start": "npm run start:website",
"start:website": "webpack serve --mode development --config webpack.website.ts",
"preversion": "yarn run validate",
"preversion": "npm run validate",
"version": "git add -A package.json",
"prepare": "husky install"
},
@ -77,7 +78,7 @@
"prettier --write"
],
"README.md": [
"yarn run gen:toc-base"
"npm run gen:toc-base"
]
},
"dependencies": {

8895
yarn.lock

File diff suppressed because it is too large Load diff