mirror of
https://github.com/hanzoai/pack.git
synced 2026-09-30 23:43:13 +00:00
fix: --verbose enables mise verbose logging (#248)
* build: add bin/ to $PATH for local railpack usage this is helpful when needing or run a local `railpack` build, without mise, to avoid injecting mise environment variables. * fix: support NO_COLOR * fix: enable MISE_VERBOSE when --verbose is enabled * fix: case insensitive truthy environment vars * docs: helpful railpack dev tips
This commit is contained in:
@@ -66,6 +66,12 @@ func GenerateBuildResultForCommand(cmd *cli.Command) (*core.BuildResult, *a.App,
|
||||
return nil, nil, nil, fmt.Errorf("error creating env: %w", err)
|
||||
}
|
||||
|
||||
// if --verbose is passed as a CLI global argument, enable verbose mise logging so the user don't have to understand
|
||||
// the railpack build system deeply to get this debugging information.
|
||||
if cmd.Bool("verbose") && env.GetVariable("MISE_VERBOSE") == "" {
|
||||
env.SetVariable("MISE_VERBOSE", "1")
|
||||
}
|
||||
|
||||
previousVersions := utils.ParsePackageWithVersion(cmd.StringSlice("previous"))
|
||||
|
||||
generateOptions := &core.GenerateBuildPlanOptions{
|
||||
|
||||
@@ -30,6 +30,11 @@ func main() {
|
||||
lipgloss.SetColorProfile(termenv.TrueColor)
|
||||
}
|
||||
|
||||
// https://no-color.org
|
||||
if os.Getenv("NO_COLOR") != "" {
|
||||
lipgloss.SetColorProfile(termenv.Ascii)
|
||||
}
|
||||
|
||||
commands := []*urfave.Command{
|
||||
cli.BuildCommand,
|
||||
cli.PrepareCommand,
|
||||
|
||||
@@ -76,7 +76,8 @@ func (e *Environment) GetConfigVariable(name string) (string, string) {
|
||||
// IsConfigVariableTruthy checks if a RAILPACK_ prefixed variable is set to "1" or "true"
|
||||
func (e *Environment) IsConfigVariableTruthy(name string) bool {
|
||||
if val, _ := e.GetConfigVariable(name); val != "" {
|
||||
return val == "1" || val == "true"
|
||||
lowerVal := strings.ToLower(val)
|
||||
return lowerVal == "1" || lowerVal == "true"
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ func TestFromEnvs(t *testing.T) {
|
||||
"VAR2=value2",
|
||||
"RAILPACK_APT_PACKAGES=apt1,apt2",
|
||||
"COMMA=this has, a comma",
|
||||
"RAILPACK_TRUTHY_CASE=True ",
|
||||
})
|
||||
|
||||
require.NoError(t, err)
|
||||
@@ -19,4 +20,5 @@ func TestFromEnvs(t *testing.T) {
|
||||
require.Equal(t, env.GetVariable("VAR2"), "value2")
|
||||
require.Equal(t, env.GetVariable("RAILPACK_APT_PACKAGES"), "apt1,apt2")
|
||||
require.Equal(t, env.GetVariable("COMMA"), "this has, a comma")
|
||||
require.Equal(t, env.IsConfigVariableTruthy("TRUTHY_CASE"), true)
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ Install and use all versions of tools needed for Railpack
|
||||
mise run setup
|
||||
```
|
||||
|
||||
This command will also start a buildkit container (check out `mise.toml` in the root directory for more information).
|
||||
|
||||
Use the `cli` task to run the railpack CLI (this is like `railpack --help`)
|
||||
|
||||
```bash
|
||||
@@ -47,6 +49,13 @@ order to build the generated LLB.
|
||||
mise run cli --verbose build examples/node-bun
|
||||
```
|
||||
|
||||
Remember, `mise run` runs the cli in the root project directory. So, if you are in a specific project example directory, you'll want to specify the path to the example directory as an absolute path:
|
||||
|
||||
```bash
|
||||
cd examples/node-angular/
|
||||
mise run cli build $(pwd)
|
||||
```
|
||||
|
||||
You need to have a BuildKit instance running (see below).
|
||||
|
||||
## Custom frontend
|
||||
@@ -102,3 +111,12 @@ mise run test
|
||||
# Start the docs dev server
|
||||
mise run docs-dev
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
Here's some helpful debugging tricks:
|
||||
|
||||
* `URFAVE_CLI_TRACING=on` for debugging CLI argument parsing
|
||||
* `mise run cli --verbose build --show-plan --progress plain examples/node-bun`
|
||||
* `mise run build`, add `./bin/` to your `$PATH`, and then run `railpack` in a separate local directory
|
||||
* `NO_COLOR=1`
|
||||
Reference in New Issue
Block a user