Skip to content

Commit

Permalink
Use npm workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
viktor-podzigun committed Nov 17, 2023
1 parent 06c8e18 commit ab75ae4
Show file tree
Hide file tree
Showing 103 changed files with 115 additions and 105 deletions.
106 changes: 55 additions & 51 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,72 @@ name: CI
on:
push:
paths-ignore:
- '*.md'
branches: [ main ]
- "*.md"
branches: [main]
tags:
- '*'
- "*"
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Git checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Cache node_modules
uses: actions/cache@v3
with:
path: |
~/.npm
~/.nvm
~/work/farjs-ui/farjs-ui/node_modules
~/work/farjs-ui/farjs-ui/package-lock.json
key: ${{ runner.os }}-node_modules-cache-v3-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node_modules-cache-v3-
- name: Cache node_modules
uses: actions/cache@v3
with:
path: |
~/.npm
~/.nvm
~/work/farjs-ui/farjs-ui/node_modules
~/work/farjs-ui/farjs-ui/package-lock.json
key: ${{ runner.os }}-node_modules-cache-v3-${{ hashFiles('package.json') }}
restore-keys: |
${{ runner.os }}-node_modules-cache-v3-
- name: Extract Tag Name
run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
if: ${{ startsWith(github.ref, 'refs/tags') }}

- name: Extract Tag Name
run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
if: ${{ startsWith(github.ref, 'refs/tags') }}
- name: Run tests
run: |
npm i
npm run formatCheck --workspaces
npx tsc
NODE_V8_COVERAGE=coverage0 npx c8 -r lcovonly --all --src ./packages/ui/src node --experimental-test-coverage ./packages/ui/test/all.mjs
if: ${{ env.TAG_NAME == '' }}

- name: Run tests
run: |
npm i
npm run formatCheck
npx tsc
NODE_V8_COVERAGE=coverage0 npx c8 -r lcovonly --all --src ./src node --experimental-test-coverage ./test/all.mjs
if: ${{ env.TAG_NAME == '' }}
- name: Report coverage to Coveralls
uses: coverallsapp/github-action@v2
if: ${{ env.TAG_NAME == '' }}

- name: Report coverage to Coveralls
uses: coverallsapp/github-action@v2
if: ${{ env.TAG_NAME == '' }}
- name: Build SNAPSHOT
run: |
cd ./packages/ui
npm pack
if: ${{ env.TAG_NAME == '' }}

- name: Build SNAPSHOT
run: npm pack
if: ${{ env.TAG_NAME == '' }}

- name: Publish RELEASE
run: |
VERSION="$(echo "$TAG_NAME" | cut -d'v' -f 2)"
echo "Publish a release version=$VERSION for tag $TAG_NAME"
npm --no-git-tag-version --allow-same-version version $VERSION
npm pack
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
npm publish farjs-ui-${VERSION}.tgz
if: ${{ env.TAG_NAME != '' }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish RELEASE
run: |
cp ./README.md ./packages/ui
cp ./LICENSE.txt ./packages/ui
cd ./packages/ui
VERSION="$(echo "$TAG_NAME" | cut -d'v' -f 2)"
echo "Publish a release version=$VERSION for tag $TAG_NAME"
npm --no-git-tag-version --allow-same-version version $VERSION
npm pack
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
npm publish farjs-ui-${VERSION}.tgz
if: ${{ env.TAG_NAME != '' }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/ci_bun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
path: |
~/.bun/install/cache
~/work/farjs-ui/farjs-ui/bun.lockb
key: ${{ runner.os }}-bun-cache-v4-${{ hashFiles('package.json') }}
key: ${{ runner.os }}-bun-cache-v4-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-bun-cache-v4-
Expand Down
57 changes: 4 additions & 53 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,6 @@
{
"name": "@farjs/ui",
"author": "viktor-podzigun",
"version": "0.0.0",
"license": "MIT",
"description": "Terminal UI React.js components library",
"scripts": {
"test": "tsc && bun test && node ./test/all.mjs",
"format": "prettier **/*.mjs **/*.ts --write",
"formatCheck": "prettier **/*.mjs **/*.ts --check"
},
"type": "module",
"exports": {
"./*": "./src/*"
},
"private": false,
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/farjs/farjs-ui.git"
},
"homepage": "https://github.com/farjs/farjs-ui",
"bugs": {
"url": "http://github.com/farjs/farjs-ui/issues"
},
"keywords": [
"react",
"cli-ui",
"tui",
"terminalui"
],
"engines": {
"node": ">=14.16",
"bun": ">=0.8"
},
"dependencies": {
"@farjs/blessed": "0.2.6",
"react": "^17.0.1",
"react-blessed": "0.7.2"
},
"devDependencies": {
"@types/node": "^16.6.2",
"@types/react": "^17.0.1",
"@types/react-blessed": "^0.7.3",
"@types/react-test-renderer": "^17.0.1",
"c8": "^7.13.0",
"mock-fn": "^1.0.0",
"prettier": "^2.8.8",
"react-assert": "^1.0.3",
"react-test-renderer": "^17.0.1",
"typescript": "^4.9.5"
}
"name": "farjs-ui-monorepo",
"workspaces": [
"packages/ui"
]
}
File renamed without changes.
55 changes: 55 additions & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "@farjs/ui",
"author": "viktor-podzigun",
"version": "0.0.0",
"license": "MIT",
"description": "Terminal UI React.js components library",
"scripts": {
"test": "tsc && bun test && node ./test/all.mjs",
"format": "prettier **/*.mjs **/*.ts --write",
"formatCheck": "prettier **/*.mjs **/*.ts --check"
},
"type": "module",
"exports": {
"./*": "./src/*"
},
"private": false,
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/farjs/farjs-ui.git"
},
"homepage": "https://github.com/farjs/farjs-ui",
"bugs": {
"url": "http://github.com/farjs/farjs-ui/issues"
},
"keywords": [
"react",
"cli-ui",
"tui",
"terminalui"
],
"engines": {
"node": ">=14.16",
"bun": ">=0.8"
},
"dependencies": {
"@farjs/blessed": "0.2.6",
"react": "^17.0.1",
"react-blessed": "0.7.2"
},
"devDependencies": {
"@types/node": "^16.6.2",
"@types/react": "^17.0.1",
"@types/react-blessed": "^0.7.3",
"@types/react-test-renderer": "^17.0.1",
"c8": "^7.13.0",
"mock-fn": "^1.0.0",
"prettier": "^2.8.8",
"react-assert": "^1.0.3",
"react-test-renderer": "^17.0.1",
"typescript": "^4.9.5"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ab75ae4

Please sign in to comment.