jdomainapp / jda

the root source code project of the JDA framework
MIT License
3 stars 1 forks source link

Feature: Chạy tự động front-end trên Node.js/React.js #14

Closed ducmle closed 2 years ago

ducmle commented 3 years ago
ducmle commented 3 years ago

@troibk

Anh gặp lỗi này khi chạy trên Eclipse máy Ubuntu:

Exception in thread "Thread-0" java.lang.RuntimeException: java.io.FileNotFoundException: /home/ducmle/tmp/restfstool-fe/fe-courseman/public/index.html (No such file or directory)
    at jda.modules.restfstool.frontend.utils.FileUtils.writeFile(FileUtils.java:49)
    at jda.modules.restfstool.frontend.FERun.runFEInLinux(FERun.java:198)
    at jda.modules.restfstool.frontend.FERun.run(FERun.java:33)
Caused by: java.io.FileNotFoundException: /home/ducmle/tmp/restfstool-fe/fe-courseman/public/index.html (No such file or directory)
    at java.base/java.io.FileOutputStream.open0(Native Method)
    at java.base/java.io.FileOutputStream.open(FileOutputStream.java:292)
    at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:235)
    at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:156)
    at java.base/java.io.FileWriter.<init>(FileWriter.java:82)
    at jda.modules.restfstool.frontend.utils.FileUtils.writeFile(FileUtils.java:44)
    ... 2 more

Cấu hình liên quan

@RFSGenDesc(
    stackSpec = StackSpec.FS, // for production
    genMode = GenerationMode.SOURCE_CODE, 
    beLangPlatform = LangPlatform.SPRING,
    feProjPath = "/home/ducmle/tmp/restfstool-fe",
    feProjName = "fe-courseman",
    feProjResource = "src/main/resources/react",
    feOutputPath = "src/example/java/com/hanu/courseman/frontend",
    bePackage = "com.hanu.courseman",
    beOutputPath = "src/example/java", 
    beTargetPackage = "com.hanu.courseman.backend"
    ,beAppClass = CourseManBESpringApp.class
    )
troibk commented 3 years ago

@ducmle: Do nó ko ăn lệnh cd, nên em đã fix bỏ hết lệnh cd rồi. Anh pull rồi test lại cho em với.

ducmle commented 3 years ago

@ducmle: Do nó ko ăn lệnh cd, nên em đã fix bỏ hết lệnh cd rồi. Anh pull rồi test lại cho em với.

@troibk Em kiểm tra lại commit, anh pull ko thấy gì mới. Last commit của em vẫn là lần cập nhật đầu.

ducmle commented 3 years ago

@ducmle: Do nó ko ăn lệnh cd, nên em đã fix bỏ hết lệnh cd rồi. Anh pull rồi test lại cho em với.

@troibk Em kiểm tra lại commit, anh pull ko thấy gì mới. Last commit của em vẫn là lần cập nhật đầu.

@troibk

ducmle commented 3 years ago

@ducmle: Do nó ko ăn lệnh cd, nên em đã fix bỏ hết lệnh cd rồi. Anh pull rồi test lại cho em với.

@troibk Em kiểm tra lại commit, anh pull ko thấy gì mới. Last commit của em vẫn là lần cập nhật đầu.

@troibk

* Bổ sung thêm dưới đây kết quả chạy test hàm `executeCommandInLinux(String)` của em. Như vậy, một số lệnh có chạy và in ra console. Nhưng lệnh `cd` không có hiệu lực.

* Tuy nhiên tại sao các lệnh sau (v.d. `npx create-react-app...`)  cũng ko chạy?
--> Executing command: pwd
/data/projects/jda/modules/restfstool
--> Executing command: ls -l 
total 56
drwxrwxr-x  4 ducmle ducmle 4096 Thg 6  10 08:57 bin
drwxrwxr-x  3 ducmle ducmle 4096 Thg 6  10 09:26 data
-rw-rw-r--  1 ducmle ducmle  731 Thg 8  14 16:18 derby.log
drwxrwxr-x  5 ducmle ducmle 4096 Thg 8   1 07:49 docs
drwxrwxr-x  3 ducmle ducmle 4096 Thg 6   9 17:08 lib
-rw-rw-r--  1 ducmle ducmle 1295 Thg 8  14 16:21 package.json
drwxrwxr-x  2 ducmle ducmle 4096 Thg 6   9 17:08 poms
-rw-rw-r--  1 ducmle ducmle 9825 Thg 8   7 11:42 pom.xml
-rw-rw-r--  1 ducmle ducmle 4101 Thg 8   4 17:31 README.md
drwxrwxr-x 12 ducmle ducmle 4096 Thg 8  14 16:18 src
drwxrwxr-x  8 ducmle ducmle 4096 Thg 7  29 21:09 target
--> Executing command: cd /home/ducmle/tmp/restfstool-fe
--> Executing command: pwd
/data/projects/jda/modules/restfstool

@troibk

ducmle commented 3 years ago

Fixed issue with executing Linux command

Result output for ExecuteCmdTest.java

--> Executing command: pwd; Dir: null
/data/projects/jda/modules/restfstool
...result: true
--> Executing command: ls -l; Dir: null
total 56
drwxrwxr-x  4 ducmle ducmle 4096 Thg 6  10 08:57 bin
drwxrwxr-x  3 ducmle ducmle 4096 Thg 6  10 09:26 data
-rw-rw-r--  1 ducmle ducmle  731 Thg 8  14 16:18 derby.log
drwxrwxr-x  5 ducmle ducmle 4096 Thg 8   1 07:49 docs
drwxrwxr-x  3 ducmle ducmle 4096 Thg 6   9 17:08 lib
-rw-rw-r--  1 ducmle ducmle 1295 Thg 8  14 16:21 package.json
drwxrwxr-x  2 ducmle ducmle 4096 Thg 6   9 17:08 poms
-rw-rw-r--  1 ducmle ducmle 9825 Thg 8   7 11:42 pom.xml
-rw-rw-r--  1 ducmle ducmle 4101 Thg 8   4 17:31 README.md
drwxrwxr-x 12 ducmle ducmle 4096 Thg 8  14 16:18 src
drwxrwxr-x  8 ducmle ducmle 4096 Thg 7  29 21:09 target
...result: true
--> Executing command: touch test; Dir: /home/ducmle/tmp/restfstool-fe
...result: true
--> Executing command: npx create-react-app courseman-fe; Dir: /home/ducmle/tmp/restfstool-fe

Creating a new React app in /home/ducmle/tmp/restfstool-fe/courseman-fe.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

added 1919 packages, and audited 1920 packages in 30s

147 packages are looking for funding
  run `npm fund` for details

10 moderate severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

Initialized a git repository.

Installing template dependencies using npm...

added 56 packages, and audited 1976 packages in 4s

148 packages are looking for funding
  run `npm fund` for details

10 moderate severity vulnerabilities

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
Removing template package using npm...

removed 1 package, and audited 1975 packages in 3s

148 packages are looking for funding
  run `npm fund` for details

10 moderate severity vulnerabilities

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

Created git commit.

Success! Created courseman-fe at /home/ducmle/tmp/restfstool-fe/courseman-fe
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd courseman-fe
  npm start

Happy hacking!
...result: true