Skip to content
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

chore: change to monorepo #94

Merged
merged 12 commits into from
Dec 6, 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
17 changes: 12 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ jobs:
with:
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Copy license and readme
run: |
cp README.md packages/electron-typed-ipc-bridge/
cp LICENSE packages/electron-typed-ipc-bridge/

- name: Build
working-directory: packages/electron-typed-ipc-bridge
run: pnpm run build

- name: Publish
working-directory: packages/electron-typed-ipc-bridge
run: pnpm publish --provenance --no-git-checks --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -45,6 +51,7 @@ jobs:

- name: Run tests with coverage
id: test
working-directory: packages/electron-typed-ipc-bridge
env:
TEST_RESULT: 'coverage/junit.xml'
run: |
Expand All @@ -63,21 +70,21 @@ jobs:
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/coverage-final.json
files: packages/electron-typed-ipc-bridge/coverage/coverage-final.json
verbose: true

- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ${{ steps.test.outputs.file-name }}
file: packages/electron-typed-ipc-bridge/${{ steps.test.outputs.file-name }}

- name: Upload coverage report to the code climate
uses: paambaati/codeclimate-action@v9
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: ${{ github.workspace }}/coverage/clover.xml:clover
coverageLocations: ${{ github.workspace }}/packages/electron-typed-ipc-bridge/coverage/clover.xml:clover

create-release:
name: Create Release
Expand Down Expand Up @@ -110,8 +117,8 @@ jobs:
- name: Download tarball
id: download
run: |
APP_NAME="$(cat ./package.json |jq .name|sed -e 's/"//g'| head -n1)"
APP_VERSION="$(cat ./package.json |jq .version|sed -e 's/"//g'| head -n1)"
APP_NAME="$(cat ./package.json |jq -r .name)"
APP_VERSION="$(cat ./package.json |jq -r .version)"
TAR_URL="$(pnpm view "${APP_NAME}@${APP_VERSION}" dist.tarball)"
TAR_NAME="${TAR_URL##*/}"
echo "URL: ${TAR_URL}"
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: ./.github/workflows/test.yml

get-version:
name: Get versioon from package.json
name: Get version from package.json
runs-on: ubuntu-latest
needs:
- check-release
Expand All @@ -59,8 +59,9 @@ jobs:

- name: Parse package.json
id: identify-version
working-directory: packages/electron-typed-ipc-bridge
run: |
APP_VERSION="$(cat ./package.json |jq .version|sed -e 's/"//g'| head -n1)"
APP_VERSION="$(cat ./package.json |jq -r .version)"
if [ ! -n "${APP_VERSION}" ]; then
exit 255
fi
Expand All @@ -84,7 +85,7 @@ jobs:
private-key: ${{ secrets.PRIVATE_KEY }}
owner: ${{ github.repository_owner }}

- name: Configration for git
- name: Configuration for git
run: |
git config --global user.name "${GH_USER}"
git config --global user.email "${GH_EMAIL}"
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/create-rlease-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:

# You can add your own logic here based on the selected version type
- name: Bump version based on input
working-directory: packages/electron-typed-ipc-bridge
run: |
case "${VERSION_TYPE}" in
major)
Expand All @@ -68,8 +69,9 @@ jobs:

- name: Parse package.json
id: identify-version
working-directory: packages/electron-typed-ipc-bridge
run: |
APP_VERSION="$(cat ./package.json |jq .version|sed -e 's/"//g'| head -n1)"
APP_VERSION="$(cat ./package.json |jq -r .version)"
if [ ! -n "${APP_VERSION}" ]; then
exit 255
fi
Expand Down Expand Up @@ -119,7 +121,7 @@ jobs:
git commit -F-<<EOF
chore: update the CHANGELOG.md for ${APP_VERSION_TEXT}

[AUTO] this commit is created by github actions automatialy.
[AUTO] this commit is created by github actions automatically.
EOF

- name: Commit package.json
Expand All @@ -131,7 +133,7 @@ jobs:
git commit -F-<<EOF
chore: update version of package.json for ${APP_VERSION_TEXT}

[AUTO] this commit is created by github actions automatialy.
[AUTO] this commit is created by github actions automatically.
EOF
- name: Push commits
env:
Expand Down
26 changes: 16 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ jobs:
cache: 'pnpm'

- name: Type check
working-directory: packages/electron-typed-ipc-bridge
run: pnpm run typecheck

- name: Run the test
working-directory: packages/electron-typed-ipc-bridge
run: pnpm run test

- name: Build
id: build
shell: bash
working-directory: packages/electron-typed-ipc-bridge
run: |
pnpm run build
TAR_INFO="$(pnpm pack --json)"
Expand All @@ -52,33 +55,33 @@ jobs:
- name: Setup playground
env:
TAR_NAME: ${{ steps.build.outputs.tar-name }}
working-directory: ./playground
working-directory: packages/sample-app
shell: bash
run: |
pnpm install "../${TAR_NAME}"
pnpm add "../electron-typed-ipc-bridge/${TAR_NAME}"

- name: Type check
working-directory: ./playground
working-directory: packages/sample-app
run: pnpm run typecheck

- name: Build (Windows)
if: runner.os == 'Windows'
working-directory: ./playground
working-directory: packages/sample-app
run: pnpm build:win

- name: Test (E2E) on Windows
if: runner.os == 'Windows'
working-directory: ./playground
working-directory: packages/sample-app
run: pnpm test:e2e

- name: Build (Linux)
if: runner.os == 'Linux'
working-directory: ./playground
working-directory: packages/sample-app
run: pnpm build:linux

- name: Test (E2E) on Linux
if: runner.os == 'Linux'
working-directory: ./playground
working-directory: packages/sample-app
run: |
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
Expand All @@ -104,6 +107,7 @@ jobs:
id: test
env:
TEST_RESULT: 'coverage/junit.xml'
working-directory: packages/electron-typed-ipc-bridge
run: |
pnpm exec vitest run --coverage \
--coverage.reportOnFailure \
Expand All @@ -118,14 +122,14 @@ jobs:
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/coverage-final.json
files: packages/electron-typed-ipc-bridge/coverage/coverage-final.json
verbose: true

- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage/junit.xml
file: packages/electron-typed-ipc-bridge/coverage/junit.xml
verbose: true

- name: Upload coverage report to the code climate
Expand All @@ -134,8 +138,10 @@ jobs:
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: ${{ github.workspace }}/coverage/clover.xml:clover
coverageLocations: packages/electron-typed-ipc-bridge/coverage/clover.xml:clover

- name: Write coverage report to pull request
if: ${{ github.event_name == 'pull_request' }}
uses: davelosert/vitest-coverage-report-action@v2
with:
working-directory: packages/electron-typed-ipc-bridge/
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpx lint-staged
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true,
"editor.tabSize": 2,
"eslint.useFlatConfig": true,
"cSpell.words": ["codecov", "culc", "onwarn", "typecheck", "typeof"]
Expand Down
7 changes: 4 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default [
],
settings: {
'import/internal-regex': ['^@/'],
'import/extensions': ['error', 'never', { png: 'always' }],
},
plugins: {
unicorn: eslintPluginUnicorn,
Expand Down Expand Up @@ -80,12 +81,12 @@ export default [
},
{
ignores: [
'node_modules/*',
'**/node_modules/*',
'dist/*',
'**/*/.gitignore',
'coverage/*',
'playground/dist/*',
'playground/out/*',
'packages/**/dist/**/*',
'packages/sample-app/out/*',
],
},
]
78 changes: 11 additions & 67 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,16 @@
"version": "2.1.2",
"description": "Fully type-safe Electron context bridge generator for IPC (Inter-Process Communication).",
"type": "module",
"main": "./dist/cjs/index.js",
"module": "./dist/es/index.js",
"exports": {
".": {
"import": {
"types": "./dist/types/index.d.ts",
"default": "./dist/es/index.js"
},
"require": {
"types": "./dist/types/index.d.ts",
"default": "./dist/cjs/index.js"
}
},
"./main": {
"import": {
"types": "./dist/types/main.d.ts",
"default": "./dist/es/main.js"
},
"require": {
"types": "./dist/types/main.d.ts",
"default": "./dist/cjs/main.js"
}
},
"./preload": {
"import": {
"types": "./dist/types/preload.d.ts",
"default": "./dist/es/preload.js"
},
"require": {
"types": "./dist/types/preload.d.ts",
"default": "./dist/cjs/preload.js"
}
},
"./package.json": "./package.json"
},
"types": "./dist/types/index.d.ts",
"typesVersions": {
"*": {
"*": [
"dist/types/index.d.ts"
],
"main": [
"dist/types/main.d.ts"
],
"preload": [
"dist/types/preload.d.ts"
]
}
},
"scripts": {
"format": "prettier --write .",
"lint": "eslint . --fix",
"test": "vitest --run",
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"changelog": "git-cliff -o CHANGELOG.md",
"typecheck": "tsc --noEmit -p tsconfig.json --composite false",
"build": "tsc --noEmit && rollup --config rollup.config.ts --configPlugin typescript"
"prepare": "husky"
},
"lint-staged": {
"**/*.{yml,json,md,ts,js}": [
"prettier --write --cache .",
"eslint --fix --cache --cache-location node_modules/.cache/eslint/ ."
]
},
"repository": {
"type": "git",
Expand All @@ -78,27 +30,19 @@
},
"devDependencies": {
"@eslint/js": "^9.16.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-typescript": "^12.1.1",
"@types/eslint-config-prettier": "^6.11.3",
"@types/eslint__js": "^8.42.3",
"@types/node": "^22.10.1",
"@vitest/coverage-v8": "^2.1.6",
"electron": "^33.2.1",
"eslint": "^9.16.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-unicorn": "^56.0.1",
"git-cliff": "^2.7.0",
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"prettier": "^3.4.1",
"rollup": "^4.28.0",
"rollup-plugin-delete": "^2.1.0",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-node-externals": "^7.1.3",
"tslib": "^2.8.1",
"typescript": "^5.7.2",
"typescript-eslint": "^8.16.0",
"vitest": "^2.1.6"
"typescript": "~5.6.3",
"typescript-eslint": "^8.16.0"
},
"keywords": [
"electron",
Expand Down
Loading
Loading