-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(zbpack): implement handle raw html static build
Signed-off-by: hackerchai <[email protected]>
- Loading branch information
1 parent
73b9e75
commit 17e3e04
Showing
8 changed files
with
91 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.idea | ||
bin | ||
.DS_Store | ||
tests/*/.zeabur | ||
.tmp |
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
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,41 @@ | ||
package utils | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
"strings" | ||
) | ||
|
||
func CopyFromSource(dirInSrc, destOnHost string) error { | ||
if err := os.MkdirAll(".tmp", 0755); err != nil { | ||
return fmt.Errorf("create directory: %w", err) | ||
} | ||
defer func() { | ||
removeCmd := exec.Command("rm", "-rf", ".tmp") | ||
removeCmd.Stderr = os.Stderr | ||
if err := removeCmd.Run(); err != nil { | ||
fmt.Println(err) | ||
} | ||
}() | ||
var stderr strings.Builder | ||
tempCopyCmd := exec.Command("cp", "-r", dirInSrc, ".tmp") | ||
tempCopyCmd.Stderr = &stderr | ||
err := tempCopyCmd.Run() | ||
if err != nil { | ||
return fmt.Errorf("copy from source code: %s: %w", stderr.String(), err) | ||
} | ||
|
||
if err := os.MkdirAll(destOnHost, 0o755); err != nil { | ||
return fmt.Errorf("create directory: %w", err) | ||
} | ||
copyCmd := exec.Command("cp", "-r", ".tmp/.", destOnHost) | ||
|
||
copyCmd.Stderr = &stderr | ||
err = copyCmd.Run() | ||
if err != nil { | ||
return fmt.Errorf("copy from source code: %s: %w", stderr.String(), err) | ||
} | ||
|
||
return nil | ||
} |
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
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,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Hello world</title> | ||
</head> | ||
<body> | ||
<h1>Hello world</h1> | ||
</body> | ||
</html> |