-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: @janhq/plugin-core module & plugins update (janhq#321)
* @janhq/plugin-core module * refactor web to use exported services from module * refactor data-plugin to provide DAL & move model logics to model management plugin * model-management in TS * add ci auto package, increate version, and publish to npm repository * chore: storage operations * chore: hybrid data-plugin esm & cjs module * chore: PouchDB Driver * chore: documentation --------- Co-authored-by: Hien To <[email protected]> Co-authored-by: Service Account <[email protected]>
- Loading branch information
1 parent
5732cce
commit 5fc1ba7
Showing
68 changed files
with
2,633 additions
and
2,328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Publish Plugin-core Package to npmjs | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "plugin-core/**" | ||
- ".github/workflows/publish-plugin-core.yml" | ||
- "!plugin-core/package.json" | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
environment: production | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: "0" | ||
token: ${{ secrets.PAT_SERVICE_ACCOUNT }} | ||
|
||
- name: Install jq | ||
uses: dcarbone/[email protected] | ||
|
||
- name: "Auto Increase package Version" | ||
run: | | ||
# Extract current version | ||
current_version=$(jq -r '.version' plugin-core/package.json) | ||
# Break the version into its components | ||
major_version=$(echo $current_version | cut -d "." -f 1) | ||
minor_version=$(echo $current_version | cut -d "." -f 2) | ||
patch_version=$(echo $current_version | cut -d "." -f 3) | ||
# Increment the patch version by one | ||
new_patch_version=$((patch_version+1)) | ||
# Construct the new version | ||
new_version="$major_version.$minor_version.$new_patch_version" | ||
# Replace the old version with the new version in package.json | ||
jq --arg version "$new_version" '.version = $version' plugin-core/package.json > /tmp/package.json && mv /tmp/package.json plugin-core/package.json | ||
# Print the new version | ||
echo "Updated package.json version to: $new_version" | ||
# Setup .npmrc file to publish to npm | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20.x" | ||
registry-url: "https://registry.npmjs.org" | ||
- run: npm install && npm run build | ||
working-directory: ./plugin-core | ||
- run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
working-directory: ./plugin-core | ||
|
||
- name: "Commit new version to main and create tag" | ||
run: | | ||
version=$(jq -r '.version' plugin-core/package.json) | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Service Account" | ||
git add plugin-core/package.json | ||
git commit -m "${GITHUB_REPOSITORY}: Update tag build $version" | ||
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:feat/#306-plugin-core-module | ||
git tag -a plugin-core-$version -m "${GITHUB_REPOSITORY}: Update tag build $version for plugin-core" | ||
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin plugin-core-$version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ build | |
electron/renderer | ||
|
||
*.log | ||
plugin-core/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./../dist/cjs", | ||
"module": "commonjs" | ||
}, | ||
"files": ["../module.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./../dist/esm", | ||
"module": "esnext" | ||
}, | ||
"files": ["../index.ts"] | ||
} |
Oops, something went wrong.