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

optimize: build the frontend at the same time as the maven build #6246

Merged
merged 5 commits into from
Jan 17, 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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ Thumbs.db

#h2
*.db
/console/src/main/resources/static/css/
slievrly marked this conversation as resolved.
Show resolved Hide resolved
/console/src/main/resources/static/img/
/console/src/main/resources/static/js/
/console/src/main/resources/static/saga-statemachine-designer/
/console/src/main/resources/static/index.html
6 changes: 6 additions & 0 deletions build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
<maven-assembly-plugin.version>3.0.0</maven-assembly-plugin.version>
<jib-maven-plugin.version>3.2.0</jib-maven-plugin.version>
<git-commit-id-plugin.version>4.9.10</git-commit-id-plugin.version>
<frontend-maven-plugin.version>1.15.0</frontend-maven-plugin.version>
<!-- Deploy && GPG -->
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
<nexus-staging-maven-plugin.version>1.6.7</nexus-staging-maven-plugin.version>
Expand Down Expand Up @@ -230,6 +231,11 @@
</includeOnlyProperties>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${frontend-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>

Expand Down
1 change: 1 addition & 0 deletions changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6247](https://github.com/apache/incubator-seata/pull/6247)] optimize asf.yml
- [[#6259](https://github.com/apache/incubator-seata/pull/6259)] modify error message which is global session size more than config
- [[#6264](https://github.com/apache/incubator-seata/pull/6264)] fix jib-maven-plugin build failed
- [[#6246](https://github.com/apache/incubator-seata/pull/6246)] build the frontend at the same time as the maven build

### security:
- [[#6069](https://github.com/apache/incubator-seata/pull/6069)] Upgrade Guava dependencies to fix security vulnerabilities
Expand Down
2 changes: 1 addition & 1 deletion changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
- [[#6247](https://github.com/apache/incubator-seata/pull/6247)] 优化 asf.yml 配置
- [[#6259](https://github.com/apache/incubator-seata/pull/6259)] 修改全局会话大小超过配置的错误消息
- [[#6264](https://github.com/apache/incubator-seata/pull/6264)] 修复 jib-maven-plugin 编译失败问题

- [[#6246](https://github.com/apache/incubator-seata/pull/6246)] 在maven打包的同时打包前端资源

### security:
- [[#6069](https://github.com/apache/incubator-seata/pull/6069)] 升级Guava依赖版本,修复安全漏洞
Expand Down
73 changes: 73 additions & 0 deletions console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,84 @@
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<configuration>
<workingDirectory>src/main/resources/static/console-fe</workingDirectory>
</configuration>
<executions>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any phase here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any phase here ?

Added phase here.

<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<nodeVersion>v12.22.12</nodeVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>update caniuse db</id>
<goals>
<goal>npx</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>browserslist@latest --update-db</arguments>
slievrly marked this conversation as resolved.
Show resolved Hide resolved
</configuration>
</execution>
<execution>
<id>npm build</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is unreasonable to set it in the generate-resources phase.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering online IDE debugging, maintain the status quo.

<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources-static</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>src/main/resources/static</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/static/console-fe/dist</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/node_modules/**</exclude>
<exclude>static/console-fe</exclude>
</excludes>
</resource>
</resources>
Expand Down
1 change: 1 addition & 0 deletions console/src/main/resources/static/console-fe/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ test/uirecorder.log
test/reports
test/screenshots/*
/public/saga-statemachine-designer/
/node
Loading
Loading