Skip to content

Commit

Permalink
Initial plugin project structure (#1)
Browse files Browse the repository at this point in the history
Co-authored-by: chs <“[email protected]>
  • Loading branch information
CaiHaosen and chs authored Jun 28, 2024
1 parent c0a9759 commit a5e22b0
Show file tree
Hide file tree
Showing 30 changed files with 5,690 additions and 1 deletion.
510 changes: 510 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ci:
uses: halo-sigs/reusable-workflows/.github/workflows/plugin-ci.yaml@v1
with:
ui-path: "ui"
75 changes: 75 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
### Maven
target/
logs/
!.mvn/wrapper/maven-wrapper.jar

### Gradle
.gradle
/build/
/out/
!gradle/wrapper/gradle-wrapper.jar
bin/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
log/

### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/

### Mac
.DS_Store
*/.DS_Store

### VS Code ###
*.project
*.factorypath

### Compiled class file
*.class

### Log file
*.log

### BlueJ files
*.ctxt

### Mobile Tools for Java (J2ME)
.mtj.tmp/

### Package Files
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

### VSCode
.vscode

### Local file
application-local.yml
application-local.yaml
application-local.properties

/ui/node_modules/
/workplace/
/src/main/resources/console/
4 changes: 3 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.

You should have received a copy of the GNU General Public License

along with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.
Expand All @@ -666,9 +667,10 @@ if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.


The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.n
10 changes: 10 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
reviewers:
- ruibaby
- guqing
- JohnNiang


approvers:
- ruibaby
- guqing
- JohnNiang
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# plugin-injection

基于Halo 2.0 插件开发快速开始模板开发的代码注入管理插件。
用户可以添加、编辑、删除和启用/禁用HTML代码片段,并通过特定规则匹配页面和注入位置。

## 开发环境

所需环境:

1. Java 17
2. Node 18
3. pnpm 8
4. Docker (可选)

克隆项目:

```bash
git clone [email protected]:halo-sigs/plugin-injection.git

# 或者当你 fork 之后

git clone [email protected]:{your_github_id}/plugin-injection.git
```

```bash
cd path/to/plugin-injection
```

```bash
# macOS / Linux
./gradlew build

# Windows
./gradlew.bat build
```
## 使用方式

1. 在 Releases 下载最新的 JAR 文件。
2. 在 Halo 后台的插件管理上传 JAR 文件进行安装。
3. ...
56 changes: 56 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
plugins {
id 'java'
id "com.github.node-gradle.node" version "5.0.0"
id "io.freefair.lombok" version "8.0.1"
id "run.halo.plugin.devtools" version "0.0.9"
}

group 'run.halo.injection'
sourceCompatibility = JavaVersion.VERSION_17

repositories {
mavenCentral()
maven { url 'https://s01.oss.sonatype.org/content/repositories/releases' }
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://repo.spring.io/milestone' }
}

dependencies {
implementation platform('run.halo.tools.platform:plugin:2.11.0-SNAPSHOT')
compileOnly 'run.halo.app:api'

testImplementation 'run.halo.app:api'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
useJUnitPlatform()
}

tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
}

node {
nodeProjectDir = file("${project.projectDir}/ui")
}

tasks.register('buildFrontend', PnpmTask) {
args = ['build']
dependsOn('installDepsForUI')
}

tasks.register('installDepsForUI', PnpmTask) {
args = ['install']
}

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

halo {
version = '2.11'
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version=1.0.0-SNAPSHOT
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Wed May 10 13:57:01 CST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit a5e22b0

Please sign in to comment.