Skip to content

Conversation

alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Jan 30, 2024

This change implements the capability to display JSON build logs in the terminal instead of a format readable by humans. This is particularly useful for hosting providers, as it allows them to effortlessly access the necessary information without having to parse the JSON configuration.

To enable this output, set the NG_BUILD_LOGS_JSON=1 environment variable. Additionally, warnings, errors, and logs are automatically colorized when the standard output is a WritableStream. You can disable the colors by using the FORCE_COLOR=0 environment variable.

FORCE_COLOR=0 NG_BUILD_LOGS_JSON=1 ng b
{
  "errors": [],
  "warnings": [],
  "outputPaths": {
    "base": "file:///usr/local/test/home//test-project/dist/test-project",
    "browser": "file:///usr/local/test/home//test-project/dist/test-project/browser",
    "server": "file:///usr/local/test/home//test-project/dist/test-project/server"
  },
  "serverEntryFile": "file:///usr/local/test/home//test-project/dist/test-project/server/server.mjs",
  "prerenderedRoutes": [
    "/"
  ]
}
NG_BUILD_LOGS_JSON=1 ng b
{
  "errors": [],
  "warnings": [],
  "outputPaths": {
    "base": "file:///usr/local/test/home//test-project/dist/test-project",
    "browser": "file:///usr/local/test/home//test-project/dist/test-project/browser",
    "server": "file:///usr/local/test/home//test-project/dist/test-project/server"
  },
  "serverEntryFile": "file:///usr/local/test/home//test-project/dist/test-project/server/server.mjs",
  "prerenderedRoutes": [
    "/"
  ]
}

@alan-agius4 alan-agius4 requested a review from clydin January 30, 2024 13:13
@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Jan 30, 2024
@alan-agius4 alan-agius4 added the target: minor This PR is targeted for the next minor release label Jan 30, 2024
This can be used by users to determine where the output path is located without needing to read the angular.json.
@alan-agius4 alan-agius4 changed the title feat(@angular-devkit/build-angular): generate a build manifest feat(@angular-devkit/build-angular): add JSON build logs when using the application builder Jan 31, 2024
@alan-agius4 alan-agius4 force-pushed the manifest-file branch 2 times, most recently from a513be5 to 2522683 Compare January 31, 2024 10:46
@alan-agius4 alan-agius4 marked this pull request as ready for review January 31, 2024 10:46
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jan 31, 2024
…he application builder

This change implements the capability to display JSON build logs in the terminal instead of a format readable by humans. This is particularly useful for hosting providers, as it allows them to effortlessly access the necessary information without having to parse the JSON configuration.

To enable this output, set the `NG_BUILD_LOGS_JSON=1` environment variable. Additionally, warnings, errors, and logs are automatically colorized when the standard output is a WritableStream. You can disable the colors by using the `FORCE_COLOR=0` environment variable.

```
FORCE_COLOR=0 NG_BUILD_LOGS_JSON=1 ng b
{
  "errors": [],
  "warnings": [],
  "outputPaths": {
    "root": "file:///usr/local/test/home//test-project/dist/test-project",
    "browser": "file:///usr/local/test/home//test-project/dist/test-project/browser",
    "server": "file:///usr/local/test/home//test-project/dist/test-project/server"
  },
  "prerenderedRoutes": [
    "/"
  ]
}
```

```
NG_BUILD_LOGS_JSON=1 ng b
{
  "errors": [],
  "warnings": [],
  "outputPaths": {
    "root": "file:///usr/local/test/home//test-project/dist/test-project",
    "browser": "file:///usr/local/test/home//test-project/dist/test-project/browser",
    "server": "file:///usr/local/test/home//test-project/dist/test-project/server"
  },
  "prerenderedRoutes": [
    "/"
  ]
}
```
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jan 31, 2024
@alan-agius4 alan-agius4 merged commit f4f5356 into angular:main Jan 31, 2024
@alan-agius4 alan-agius4 deleted the manifest-file branch January 31, 2024 16:51
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants