Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
with:
node-version: "24"
java-version: "21"
pnpm-version: ""
pnpm-version: "12.4.2"
app-id: app-YXyaD
ui-path: "."
ui-path: "packages"
14 changes: 10 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,24 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v5
with:
package_json_file: packages/package.json
- uses: actions/setup-node@v6
with:
node-version: "24"
cache: pnpm
cache-dependency-path: packages/pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
- run: pnpm -C packages/comment-widget exec playwright install --with-deps chromium
- run: pnpm -C packages/comment-widget test
working-directory: packages
- run: pnpm -C comment-widget exec playwright install --with-deps chromium
working-directory: packages
- run: pnpm -C comment-widget test
working-directory: packages

ci:
uses: halo-sigs/reusable-workflows/.github/workflows/plugin-ci.yaml@v4
with:
node-version: "24"
java-version: "21"
pnpm-version: ""
ui-path: "."
pnpm-version: "12.4.2"
ui-path: "packages"
4 changes: 4 additions & 0 deletions .github/workflows/release-npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ jobs:
node-version: "24"
registry-url: https://registry.npmjs.org/
- uses: pnpm/action-setup@v5
with:
package_json_file: packages/package.json
- run: pnpm install --frozen-lockfile
working-directory: packages
- name: Upgrade npm
run: npm i -g npm@latest
- name: Publish to NPM
run: pnpm run publish
working-directory: packages
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lint-staged
pnpm -C packages exec lint-staged
33 changes: 16 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'java'
id "io.freefair.lombok" version "9.2.0"
id "com.github.node-gradle.node" version "7.1.0"
id "com.github.node-gradle.node" version "7.1.0" apply false
id "run.halo.plugin.devtools" version "0.8.0"
}

Expand Down Expand Up @@ -37,25 +37,24 @@ test {
useJUnitPlatform()
}

node {
pnpmVersion = '12.4.2'
nodeProjectDir = file("${project.projectDir}")
}

tasks.register('buildFrontend', PnpmTask) {
args = ['build']
dependsOn('installDepsForUI')
}
sourceSets.main.resources.exclude 'ui/**', 'static/**'

tasks.register('installDepsForUI', PnpmTask) {
args = ['install']
tasks.named('processResources', Copy) {
dependsOn project(':packages').tasks.named('pnpmBuild')
from(project(':packages').layout.projectDirectory.dir('ui/build/dist')) {
into 'ui'
}
from(project(':packages').layout.projectDirectory.dir('widget/build/dist')) {
into 'static'
}
doFirst {
delete layout.buildDirectory.dir('resources/main/ui'),
layout.buildDirectory.dir('resources/main/static')
}
}

build {
// build frontend before build
tasks.named('compileJava').configure {
dependsOn('buildFrontend')
}
tasks.named('clean') {
dependsOn project(':packages').tasks.named('clean')
}

halo {
Expand Down
5 changes: 3 additions & 2 deletions biome.json → packages/biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
"useIgnoreFile": true,
"root": "../"
},
"files": {
"ignoreUnknown": false,
"includes": ["**", "!**/generated", "!src/main/resources"]
"includes": ["**", "!**/generated"]
},
"formatter": {
"enabled": true,
Expand Down
32 changes: 32 additions & 0 deletions packages/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
plugins {
id 'base'
id 'com.github.node-gradle.node'
}

node {
pnpmVersion = '12.4.2'
nodeProjectDir = projectDir
}

tasks.register('pnpmBuild', PnpmTask) {
group = 'build'
args = ['run', 'build']
dependsOn tasks.named('pnpmInstall')
inputs.files(fileTree(projectDir) {
include 'comment-widget/**', 'ui/**', 'widget/**'
include 'package.json', 'pnpm-lock.yaml', 'pnpm-workspace.yaml', 'tsconfig.json'
exclude '**/node_modules/**', '**/dist/**', '**/build/**', '**/coverage/**'
})
inputs.file(rootProject.layout.projectDirectory.file('src/main/resources/plugin.yaml'))
outputs.dir('comment-widget/dist')
outputs.dir('ui/build/dist')
outputs.dir('widget/build/dist')
}

tasks.named('assemble') {
dependsOn tasks.named('pnpmBuild')
}

tasks.named('clean') {
delete 'comment-widget/dist', 'ui/build', 'widget/build'
}
12 changes: 6 additions & 6 deletions packages/comment-widget/tests/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Tests

Run from the repository root:
Run from the `packages` directory:

```sh
pnpm install
pnpm -C packages/comment-widget exec playwright install chromium
pnpm -C packages/comment-widget test
pnpm -C comment-widget exec playwright install chromium
pnpm -C comment-widget test
```

Vitest runs unit tests in Node and `*.browser.test.js` in headless Chromium.
Expand All @@ -14,9 +14,9 @@ Browser tests import the widget source directly; no build or manual HTTP server
To run only one project:

```sh
pnpm -C packages/comment-widget test --project unit
pnpm -C packages/comment-widget test --project browser
pnpm -C comment-widget test --project unit
pnpm -C comment-widget test --project browser
```

On Linux CI, install browser system dependencies with
`pnpm -C packages/comment-widget exec playwright install --with-deps chromium`.
`pnpm -C comment-widget exec playwright install --with-deps chromium`.
2 changes: 1 addition & 1 deletion packages/example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "../../tsconfig.json",
"extends": "../tsconfig.json",
"include": ["env.d.ts", "src"]
}
4 changes: 2 additions & 2 deletions package.json → packages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"scripts": {
"build": "pnpm -r run build",
"check": "biome check --write",
"example:dev": "pnpm -C packages/example dev",
"prepare": "husky",
"example:dev": "pnpm -C example dev",
"prepare": "cd .. && packages/node_modules/.bin/husky",
"publish": "pnpm -r publish --access public --no-git-checks"
},
"lint-staged": {
Expand Down
21 changes: 7 additions & 14 deletions pnpm-lock.yaml → packages/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion pnpm-workspace.yaml → packages/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
packages:
- packages/**
- comment-widget
- example
- ui
- widget
allowBuilds:
core-js: true
esbuild: true
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/ui/vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'node:path';
import { viteConfig } from '@halo-dev/ui-plugin-bundler-kit/vite';

const MANIFEST_PATH = '../../src/main/resources/plugin.yaml';
const OUT_DIR_PROD = '../../src/main/resources/ui';
const OUT_DIR_PROD = 'build/dist';
const OUT_DIR_DEV = '../../build/resources/main/ui';

export default viteConfig({
Expand Down
4 changes: 1 addition & 3 deletions packages/widget/rslib.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ export default defineConfig({
},
publicPath: `/plugins/${PLUGIN_NAME}/assets/static/`,
distPath: {
root: fileURLToPath(
new URL('../../src/main/resources/static', import.meta.url)
),
root: fileURLToPath(new URL('./build/dist', import.meta.url)),
},
},
});
2 changes: 1 addition & 1 deletion packages/widget/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "../../tsconfig.json",
"extends": "../tsconfig.json",
"include": ["src"]
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
rootProject.name = 'plugin-comment-widget'
include 'packages'
Loading