-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Angular: Honor --loglevel and --logfile in dev/build #33212
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
Angular: Honor --loglevel and --logfile in dev/build #33212
Conversation
📝 WalkthroughWalkthroughIntroduces a typed LogLevel and a new logfile option, updates schema-allowed loglevel values, wires logfile/loglevel through Angular builders and CLI types, and wraps log file writes in try/catch across several CLI and runner entrypoints. Also removes one unused import. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
✨ Finishing touches
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
code/core/src/types/modules/core-common.ts(1 hunks)code/frameworks/angular/build-schema.json(1 hunks)code/frameworks/angular/src/builders/build-storybook/index.ts(4 hunks)code/frameworks/angular/src/builders/start-storybook/index.ts(4 hunks)code/frameworks/angular/start-schema.json(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js,jsx,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use camelCase for variable and function names
Files:
code/core/src/types/modules/core-common.tscode/frameworks/angular/src/builders/start-storybook/index.tscode/frameworks/angular/src/builders/build-storybook/index.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Enable TypeScript strict mode
Export functions from modules for testing purposes
Files:
code/core/src/types/modules/core-common.tscode/frameworks/angular/src/builders/start-storybook/index.tscode/frameworks/angular/src/builders/build-storybook/index.ts
**/*.{ts,tsx,js,jsx,json,html,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx,js,jsx,json,html,mjs}: Use ESLint and Prettier for code style enforcement
Run 'yarn prettier --write ' to format code after making changes
Run 'yarn lint:js:cmd ' to check for ESLint issues after making changes
Files:
code/core/src/types/modules/core-common.tscode/frameworks/angular/src/builders/start-storybook/index.tscode/frameworks/angular/build-schema.jsoncode/frameworks/angular/src/builders/build-storybook/index.tscode/frameworks/angular/start-schema.json
code/**/!(*.test).{ts,tsx,js,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
code/**/!(*.test).{ts,tsx,js,mjs}: Use 'logger' from 'storybook/internal/node-logger' for server-side (Node.js) logging, not console.log/console.warn/console.error
Use 'logger' from 'storybook/internal/client-logger' for client-side (browser) logging, not console.log/console.warn/console.error
Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size
Files:
code/core/src/types/modules/core-common.tscode/frameworks/angular/src/builders/start-storybook/index.tscode/frameworks/angular/src/builders/build-storybook/index.ts
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.659Z
Learning: Applies to code/**/!(*.test).{ts,tsx,js,mjs} : Use 'logger' from 'storybook/internal/node-logger' for server-side (Node.js) logging, not console.log/console.warn/console.error
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.659Z
Learning: Applies to code/**/!(*.test).{ts,tsx,js,mjs} : Use 'logger' from 'storybook/internal/client-logger' for client-side (browser) logging, not console.log/console.warn/console.error
📚 Learning: 2025-11-24T17:49:47.659Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.659Z
Learning: Applies to code/**/!(*.test).{ts,tsx,js,mjs} : Use 'logger' from 'storybook/internal/node-logger' for server-side (Node.js) logging, not console.log/console.warn/console.error
Applied to files:
code/frameworks/angular/src/builders/start-storybook/index.tscode/frameworks/angular/src/builders/build-storybook/index.ts
📚 Learning: 2025-11-24T17:49:47.659Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.659Z
Learning: Applies to code/**/!(*.test).{ts,tsx,js,mjs} : Use 'logger' from 'storybook/internal/client-logger' for client-side (browser) logging, not console.log/console.warn/console.error
Applied to files:
code/frameworks/angular/src/builders/start-storybook/index.tscode/frameworks/angular/src/builders/build-storybook/index.ts
📚 Learning: 2025-11-24T17:49:47.659Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.659Z
Learning: Applies to code/**/!(*.test).{ts,tsx,js,mjs} : Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size
Applied to files:
code/frameworks/angular/src/builders/start-storybook/index.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: normal
- GitHub Check: Core Unit Tests, windows-latest
🔇 Additional comments (9)
code/core/src/types/modules/core-common.ts (1)
176-177: LGTM! Type narrowing improves API safety.The union type for
loglevelprovides better type safety and IDE autocomplete compared to the previousstringtype. Thelogfileaddition is straightforward and appropriate.code/frameworks/angular/src/builders/build-storybook/index.ts (2)
7-7: LGTM! Import follows coding guidelines.The addition of
logTrackerfromstorybook/internal/node-loggeris appropriate for this server-side Node.js context.
63-63: LGTM! Type extension properly exposes the new logfile option.Adding
'logfile'to thePicktype makes the new CLI option available to the builder, consistent with the core type changes.code/frameworks/angular/start-schema.json (1)
153-156: LGTM! Logfile property is well-defined.The new
logfileproperty is appropriately typed as an optional string with a clear description.code/frameworks/angular/build-schema.json (1)
37-40: LGTM! Logfile property is well-defined.The new
logfileproperty is appropriately typed as an optional string with a clear description, consistent with the start-schema.json definition.code/frameworks/angular/src/builders/start-storybook/index.ts (4)
7-7: LGTM! Import follows coding guidelines.The addition of
logTrackerfromstorybook/internal/node-loggeris appropriate for this server-side Node.js context.
68-68: LGTM! Type extension properly exposes the new logfile option.Adding
'logfile'to thePicktype makes the new CLI option available to the builder, consistent with the core type changes.
199-205: I'll help you verify this review comment about the error handling and type cast issues in the Angular start-storybook builder. Let me gather information about the code context and type definitions.
<function_calls>
shell
#!/bin/bashRead the file to understand the context around lines 199-205
cat -n code/frameworks/angular/src/builders/start-storybook/index.ts | sed -n '190,215p'
</function_calls>
shell
#!/bin/bashFind the logTracker type and writeToFile method signature
rg -n "writeToFile" code/frameworks/angular/src/builders/start-storybook/index.ts -A5 -B5
</function_calls>
<function_calls>
shell
#!/bin/bashSearch for logTracker instantiation and type definition
rg -n "logTracker" code/frameworks/angular/src/builders/start-storybook/index.ts -B3 -A3
</function_calls>
<function_calls>
shell
#!/bin/bashFind imports to understand what logTracker is
head -50 code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls>
84-90: I'll help you verify the logger API compatibility in the start-storybook builder. Let me investigate the logger's setLogLevel method and the options type.
<function_calls>
json
#!/bin/bashFirst, find the logger definition and setLogLevel method
rg -n "setLogLevel" --type=ts -B2 -A5 -g '!.test.'
</function_calls>Let me search for the logger definitions and options types:
<function_calls>
json
#!/bin/bashSearch for node-logger module definition
fd -e ts -e tsx | xargs rg -l "node-logger" | head -20
</function_calls>Let me search more specifically for the logger and options definitions:
<function_calls>
json
#!/bin/bashFind the start-storybook index file and examine its contents
cat code/frameworks/angular/src/builders/start-storybook/index.ts | head -100
</function_calls>Let me also find the node-logger module:
<function_calls>
json
#!/bin/bashFind the node-logger module
fd -name "node-logger*" --type f
</function_calls><function_calls>
json
#!/bin/bashSearch for storybook/internal/node-logger
rg "storybook/internal/node-logger" --type=ts -l | head -5
</function_calls><function_calls>
json
#!/bin/bashSearch for the setLogLevel method implementation
rg -n "setLogLevel\s*(" --type=ts -B3 -A8
</function_calls><function_calls>
json
#!/bin/bashLook for the schema or types for the builder options
find . -name "schema.json" -path "start-storybook" -o -name "*.ts" -path "start-storybook" | grep -E "(schema|types|options)" | head -10
</function_calls><function_calls>
json
#!/bin/bashList files in the start-storybook directory
ls -la code/frameworks/angular/src/builders/start-storybook/
</function_calls>Let me check the schema file:
<function_calls>
json
#!/bin/bashRead the schema.json for start-storybook
cat code/frameworks/angular/src/builders/start-storybook/schema.json
</function_calls>Now let me examine the index.ts file completely to understand the options type:
<function_calls>
json
#!/bin/bashRead the entire index.ts file
wc -l code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls><function_calls>
json
#!/bin/bashRead the entire index.ts file
cat code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls>Now let me find the logger definition:
<function_calls>
json
#!/bin/bashSearch for files in storybook internal
find code -path "internal" -name "logger" -type f | head -20
</function_calls><function_calls>
json
#!/bin/bashLook for node-logger in core
find code/core -name "logger" -type f | head -10
</function_calls><function_calls>
json
#!/bin/bashSearch in core/src for node-logger
find code/core/src -name "logger" -type f 2>/dev/null
</function_calls><function_calls>
json
#!/bin/bashLet's look for the logger module more broadly
find . -type f -name ".ts" -o -name ".tsx" | xargs rg -l "export.*setLogLevel" 2>/dev/null | head -5
</function_calls><function_calls>
json
#!/bin/bashSearch for where logger is imported from in the file we're reviewing
rg -n "import.*logger" code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls><function_calls>
json
#!/bin/bashCheck the build-storybook for comparison (referenced in the scratchpad)
ls -la code/frameworks/angular/src/builders/build-storybook/
</function_calls><function_calls>
json
#!/bin/bashCheck build-storybook's index file for the logger configuration pattern
rg -n "setLogLevel|loglevel" code/frameworks/angular/src/builders/build-storybook/index.ts -B2 -A2
</function_calls><function_calls>
json
#!/bin/bashLook for common node logger patterns
rg "class.*Logger|interface.*Logger" --type=ts -B1 -A3 | head -40
</function_calls><function_calls>
#!/bin/bashLook in the packages directory which typically has internal modules
find . -path "/packages/core/" -name "logger" -type f | head -20
</function_calls><function_calls>
#!/bin/bashSearch more specifically for the logger within node code
rg "node-logger" --type=ts -B2 -A5 | head -100
</function_calls><function_calls>
#!/bin/bashLook for the actual import path resolution
rg "from.*node-logger" --type=ts | head -10
</function_calls>Let me check what's in the packages directory:
<function_calls>
#!/bin/bashList key directories
ls -d code/core/src/common* code/core/src/server* code/core/lib* 2>/dev/null | head -10
</function_calls><function_calls>
#!/bin/bashSearch for the package name resolution
rg "storybook/internal" --type=ts code/frameworks/angular/src/builders/ -l | head -5
</function_calls><function_calls>
#!/bin/bashCheck tsconfig to understand path mappings
find . -name "tsconfig.json" -path "/angular/" | head -3 | xargs cat
</function_calls><function_calls>
#!/bin/bashLook at root tsconfig for path mappings
cat tsconfig.json 2>/dev/null | grep -A 50 '"paths"' | head -70
</function_calls>Based on the search, let me look for the node-logger in the core code using the path mapping:
<function_calls>
#!/bin/bashFind node-logger likely in core/src
find code/core/src -name "*.ts" | xargs rg -l "setLogLevel" | head -5
</function_calls><function_calls>
#!/bin/bashCheck code structure
ls -la code/core/src/ | head -20
</function_calls><function_calls>
#!/bin/bashLook for logger references
find code/core -name "*.ts" -type f | xargs rg -l "logger.*setLogLevel|setLogLevel.*logger" | head -5
</function_calls>Let me try a different approach with Python to analyze the imports:
<function_calls>
#!/bin/bashFirst, read the start-storybook index file and parse its imports
python3 << 'PYTHON_EOF'
import rewith open('code/frameworks/angular/src/builders/start-storybook/index.ts', 'r') as f:
content = f.read()Find all imports
imports = re.findall(r"import\s+.*?\s+from\s+'"['"]", content)
for imp in imports:
print(imp)Also find where logger is used
logger_uses = re.findall(r"logger.", content)
print(f"\nLogger methods used: {set(logger_uses)}")
PYTHON_EOF
</function_calls><function_calls>
#!/bin/bashExtract the logger import specifically
rg -n "import.*logger" code/frameworks/angular/src/builders/start-storybook/index.ts -A1 -B1
</function_calls><function_calls>
#!/bin/bashShow the first 50 lines including imports
head -50 code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls><function_calls>
#!/bin/bashSearch for logger imports anywhere
rg "import.*from.*node-logger" -B1 -A1 --type=ts
</function_calls><function_calls>
#!/bin/bashFind all files that import node-logger
rg "node-logger" --type=ts --type=js -l
</function_calls><function_calls>
#!/bin/bashSearch for build-storybook which has similar code
head -50 code/frameworks/angular/src/builders/build-storybook/index.ts
</function_calls>Let me look for the actual node-logger location in the repo structure:
<function_calls>
#!/bin/bashSearch in all TypeScript files for the logger setLogLevel definition
rg "setLogLevel\s*(" --type=ts -B5 -A10 | head -150
</function_calls>Let me try checking if there's a dist or lib folder:
<function_calls>
#!/bin/bashFind where internal modules are likely defined
find code -type d -name "internal" 2>/dev/null
</function_calls><function_calls>
#!/bin/bashLet me search for where 'logger' object is created or exported
rg "export.logger|logger\s=" --type=ts -B2 -A2 | head -100
</function_calls><function_calls>
#!/bin/bashLet's check the monorepo structure
ls code/
</function_calls><function_calls>
#!/bin/bashCheck what's in core
ls code/core/
</function_calls><function_calls>
#!/bin/bashLook in src directory
ls code/core/src/
</function_calls><function_calls>
#!/bin/bashCheck node-logger might be in common
ls code/core/src/common/
</function_calls><function_calls>
#!/bin/bashLook for logger-related files
find code/core/src -name "logger" -type f
</function_calls><function_calls>
#!/bin/bashSearch for setLogLevel in core
rg "setLogLevel" code/core/ --type=ts -B2 -A5
</function_calls><function_calls>
#!/bin/bashLet me look at what the options type is in the schema
cat code/frameworks/angular/src/builders/start-storybook/schema.json | python3 -m json.tool | grep -A10 -B2 "loglevel|logfile" | head -30
</function_calls>Let me check what version of Node/TypeScript this is and if there's a different project structure:
<function_calls>
#!/bin/bashCheck if node-logger is an external package
rg ""@storybook/.*logger"|"storybook.*logger"" --type=json -l | head -10
</function_calls><function_calls>
#!/bin/bashLook for package.json files that might export node-logger
find code -name "package.json" -exec grep -l "node-logger" {} ;
</function_calls><function_calls>
#!/bin/bashCheck core package.json exports
cat code/core/package.json | python3 -m json.tool | grep -A50 ""exports"" | head -80
</function_calls>Now let me search for where options.loglevel type is defined:
<function_calls>
#!/bin/bashLook at the full schema.json to understand loglevel type
python3 << 'EOF'
import jsonwith open('code/frameworks/angular/src/builders/start-storybook/schema.json', 'r') as f:
schema = json.load(f)Look for loglevel property
if 'properties' in schema:
if 'loglevel' in schema['properties']:
print("loglevel property definition:")
print(json.dumps(schema['properties']['loglevel'], indent=2))
if 'logfile' in schema['properties']:
print("\nlogfile property definition:")
print(json.dumps(schema['properties']['logfile'], indent=2))
EOF
</function_calls>Now let me search for the generated types from this schema:
<function_calls>
#!/bin/bashLook for generated types or interfaces in the start-storybook builder
rg "interface.*Options|type.*Options" code/frameworks/angular/src/builders/start-storybook/ --type=ts
</function_calls><function_calls>
#!/bin/bashLet me search in the entire angular builder for how options are used
rg "options." code/frameworks/angular/src/builders/start-storybook/ --type=ts -B1 -A1 | head -80
</function_calls>Let me check a similar builder to understand the pattern:
<function_calls>
#!/bin/bashCheck web builder which might have the same pattern
ls code/frameworks/web/src/builders/ 2>/dev/null | head -10
</function_calls><function_calls>
#!/bin/bashFind any reference to StoryBookBuilderOptions or similar
rg "BuilderContext|options:" code/frameworks/angular/src/builders/start-storybook/index.ts -B3 -A3
</function_calls>Let me view the full index.ts file again to find the function signature:
<function_calls>
#!/bin/bashExtract just the main function and its parameter types
rg -n "export.*default|function.*export|async.*function" code/frameworks/angular/src/builders/start-storybook/index.ts -A15 | head -40
</function_calls><function_calls>
#!/bin/bashLet me just view lines around 1-30
sed -n '1,35p' code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls><function_calls>
#!/bin/bashLook for the function that has the options parameter
sed -n '1,100p' code/frameworks/angular/src/builders/start-storybook/index.ts | grep -n "options|function|export|async"
</function_calls>Let me search for how the logger behaves with the type:
<function_calls>
#!/bin/bashSearch for where logger is created and how setLogLevel is defined
rg "logger\s*=" code/frameworks/angular/src/builders/ --type=ts -B2 -A2
</function_calls>Let me look at the build-storybook to find the logger import pattern:
<function_calls>
#!/bin/bashFull contents of build-storybook for comparison
cat code/frameworks/angular/src/builders/build-storybook/index.ts | head -100
</function_calls><function_calls>
#!/bin/bashCheck if the logger comes from a common place in angular builders
rg "import" code/frameworks/angular/src/builders/build-storybook/index.ts | head -20
</function_calls><function_calls>
#!/bin/bashLook at build-storybook schema for comparison
python3 << 'EOF'
import jsonwith open('code/frameworks/angular/src/builders/build-storybook/schema.json', 'r') as f:
schema = json.load(f)if 'properties' in schema:
if 'loglevel' in schema['properties']:
print("build-storybook loglevel:")
print(json.dumps(schema['properties']['loglevel'], indent=2))
EOF
</function_calls>Let me try to find where logLevel types are defined:
<function_calls>
#!/bin/bashSearch for log level type definitions
rg "trace.*debug.*info.*warn.*error|LogLevel" --type=ts -B2 -A2 | head -100
</function_calls><function_calls>
#!/bin/bashSearch more specifically for union type with log levels
rg ""trace"\s*|\s*"debug"|"silent"\s*|\s*"error"" --type=ts -B3 -A3
</function_calls>Let me try checking how common/storybook packages work in this repo:
<function_calls>
#!/bin/bashLook at the actual angular builder to understand the imports
sed -n '1,50p' code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls><function_calls>
#!/bin/bashNow let me check where these common builders are sourced from
rg "startStorybook|storybookServer" code/frameworks/angular/ --type=ts -B2 -A2 | head -40
</function_calls>Let me search for common builder files:
<function_calls>
#!/bin/bashFind common builder utilities
find code -name "common" -path "builders" -type d
</function_calls><function_calls>
#!/bin/bashCheck what packages/modules are available
ls code/lib/ 2>/dev/null || ls code/packages/ 2>/dev/null || echo "Checking structure..."
find code -maxdepth 2 -type d | head -30
</function_calls><function_calls>
#!/bin/bashLook at the complete start-storybook file with better formatting
nl -ba code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls><function_calls>
#!/bin/bashSearch for how logger.setLogLevel is handled - check type compatibility
rg "setLogLevel" --type=ts -B10 -A10 code/frameworks/angular/src/builders/
</function_calls><function_calls>
#!/bin/bashLet me search in all frameworks to find where setLogLevel is actually implemented
rg "setLogLevel" --type=ts -B5 -A10 code/frameworks/ | head -80
</function_calls><function_calls>
#!/bin/bashLook for setLogLevel in the core library
rg "setLogLevel" code/core/ --type=ts -B5 -A10 | head -80
</function_calls>Let me try a different approach - search where logger is assigned:
<function_calls>
#!/bin/bashFind where 'logger' variable is assigned in start-storybook
grep -n "logger" code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls><function_calls>
#!/bin/bashShow the context of lines 84-90
sed -n '75,95p' code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls><function_calls>
#!/bin/bashShow context before that to find logger declaration
sed -n '50,95p' code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls><function_calls>
#!/bin/bashNow find the storybook functions being called
grep -n "storybook|fromStorybook" code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls><function_calls>
#!/bin/bashLet me check build-storybook as reference for the common pattern
sed -n '75,95p' code/frameworks/angular/src/builders/build-storybook/index.ts
</function_calls><function_calls>
#!/bin/bashFind where normalize-options is imported
rg "normalize" code/frameworks/angular/src/builders/ --type=ts | head -10
</function_calls><function_calls>
#!/bin/bashLook at entire build-storybook file
wc -l code/frameworks/angular/src/builders/build-storybook/index.ts
</function_calls><function_calls>
#!/bin/bashJust show the full file now
cat code/frameworks/angular/src/builders/build-storybook/index.ts
</function_calls>Perfect! Now I can see the build-storybook pattern. Let me check if there's any type checking or validation happening:
<function_calls>
#!/bin/bashFind where logger is from in build-storybook
grep "^import" code/frameworks/angular/src/builders/build-storybook/index.ts
</function_calls><function_calls>
#!/bin/bashNow find the startStorybook function to see what it returns/provides
rg "startStorybook|buildStorybook" --type=ts -B3 -A10 code/frameworks/ | head -100
</function_calls>Let me search for where these functions are defined:
<function_calls>
#!/bin/bashFind the source of startStorybook and buildStorybook
rg "export.*startStorybook|export.*buildStorybook" --type=ts code/ | head -10
</function_calls><function_calls>
#!/bin/bashLook for the functions in the frameworks/angular/src directory
find code/frameworks/angular/src -name "*.ts" -type f | xargs rg -l "startStorybook|buildStorybook" | head -5
</function_calls><function_calls>
#!/bin/bashCheck the presets file
find code/frameworks/angular -name "preset" -o -name "index" | grep -E "src/index|preset"
</function_calls><function_calls>
#!/bin/bashLook at the main index file in frameworks/angular/src
ls -la code/frameworks/angular/src/
</function_calls><function_calls>
#!/bin/bashFind the builders index or common location
find code/frameworks/angular/src/builders -name "*.ts" | xargs grep -l "startStorybook|buildStorybook|export" | head -10
</function_calls><function_calls>
#!/bin/bashLet's find where these are exported from
rg "startStorybook|buildStorybook" code/frameworks/angular --type=ts -B1 -A3 | head -60
</function_calls>Let me check the @storybook/angular package:
<function_calls>
#!/bin/bashCheck angular package.json
cat code/frameworks/angular/package.json | python3 -m json.tool | grep -A30 '"exports"' | head -50
</function_calls>Now let me search for where startStorybook and buildStorybook would be defined:
<function_calls>
#!/bin/bashSearch across all packages for the actual implementation
rg "export\s+(async\s+)?function\s+(startStorybook|buildStorybook)" --type=ts code/
</function_calls><function_calls>
#!/bin/bashLook in storybook configuration or cli packages
find code -path "storybook/config" -o -path "cli" -name "*.ts" -type f | head -10
</function_calls><function_calls>
#!/bin/bashLook for common storybook/framework integration
ls code/ | grep -i storybook
</function_calls><function_calls>
#!/bin/bashLook at the core module structure
ls code/core/src/
</function_calls><function_calls>
#!/bin/bashCheck server directory
ls code/core/src/server/
</function_calls><function_calls>
#!/bin/bashLook for startStorybook in server
rg "export.*startStorybook" code/core/src/server/ --type=ts
</function_calls><function_calls>
#!/bin/bashList server subdirectories
ls code/core/src/server/
</function_calls><function_calls>
#!/bin/bashSearch for startStorybook function definition
rg "startStorybook" code/core/src/ --type=ts -B2 -A5 | head -40
</function_calls><function_calls>
#!/bin/bashLook for what object has setLogLevel method
rg "setLogLevel.*(|.setLogLevel" code/core/ --type=ts -B5 -A3 | head -80
</function_calls><function_calls>
#!/bin/bashCheck server/common.ts if it exists
find code/core -name "common.ts" -type f | head -5
</function_calls><function_calls>
#!/bin/bashLook at index files in core/src
find code/core/src -name "index.ts" -type f | head -10
</function_calls><function_calls>
#!/bin/bashCheck the server index
head -100 code/core/src/server/index.ts
</function_calls><function_calls>
#!/bin/bashSearch more broadly for startStorybook
rg "startStorybook" code/ --type=ts -l | head -10
</function_calls><function_calls>
#!/bin/bashLook in all index files for startStorybook or buildStorybook
rg "startStorybook|buildStorybook" code/ --type=ts -B3 -A5 code/ | head -150
</function_calls>Let me check if these are in the index files of core:
<function_calls>
#!/bin/bashList what's exported from the root index
wc -l code/core/src/index.ts
</function_calls><function_calls>
#!/bin/bashCheck what's in the core index
grep "startStorybook|buildStorybook|export" code/core/src/index.ts | head -20
</function_calls><function_calls>
#!/bin/bashFind where these functions might be - in cli package
find code -name "cli" -type d
</function_calls>Let me try searching for the logger type definition more directly:
<function_calls>
#!/bin/bashSearch for logger interface or class definition with setLogLevel
rg "interface.[Ll]ogger|class.[Ll]ogger" --type=ts -B1 -A15 | head -100
</function_calls><function_calls>
#!/bin/bashLook for setLogLevel method definition
rg "setLogLevel\s*:\s*|setLogLevel\s*(" --type=ts -B3 -A8 | head -150
</function_calls>Let me try a Python-based analysis to understand the type compatibility:
<function_calls>
#!/bin/bashLet me search for TypeScript files that define log level types
rg "LogLevel|loglevel.*type|type.*LogLevel" --type=ts -B2 -A3 | head -80
</function_calls><function_calls>
#!/bin/bashNow let me check what the actual union values are
rg ""trace"|"debug"|"info"|"warn"|"error"|"silent"" --type=json | grep -E "loglevel|enum" -A2 -B2 | head -30
</function_calls><function_calls>
#!/bin/bashCheck schema.json files for loglevel enum values
find code/frameworks -name "schema.json" -exec grep -H "loglevel" -A10 {} ; | head -50
</function_calls><function_calls>
#!/bin/bashLook at specific schema content
python3 << 'EOF'
import jsonCheck start-storybook schema
with open('code/frameworks/angular/src/builders/start-storybook/schema.json', 'r') as f:
schema = json.load(f)
if 'properties' in schema and 'loglevel' in schema['properties']:
print("start-storybook loglevel enum:")
ll = schema['properties']['loglevel']
print(json.dumps(ll, indent=2))Check build-storybook schema
with open('code/frameworks/angular/src/builders/build-storybook/schema.json', 'r') as f:
schema = json.load(f)
if 'properties' in schema and 'loglevel' in schema['properties']:
print("\nbuild-storybook loglevel enum:")
ll = schema['properties']['loglevel']
print(json.dumps(ll, indent=2))
EOF
</function_calls>Now let me check if there's a discrepancy between what the schema allows and what the function expects:
<function_calls>
#!/bin/bashSearch for any type narrowing or validation of loglevel
rg "options.loglevel" code/frameworks/angular/src/builders/ --type=ts -B2 -A2
</function_calls><function_calls>
#!/bin/bashCheck if there's any conditional type handling
rg "if.*loglevel|loglevel.*if" code/frameworks/angular/src/builders/ --type=ts -B1 -A2
</function_calls>Now let me check what the logger type signature expects - search across the full codebase:
<function_calls>
#!/bin/bashLet me check type definitions more broadly
rg "setLogLevel.string|setLogLevel.LogLevel|LogLevel.=." --type=ts -B3 -A3 | head -100
</function_calls>Let me try to find if there's type checking that might reveal compatibility issues:
<function_calls>
#!/bin/bashCheck if any TypeScript errors or any type assertions are present
rg "as\s+any|as\s+string|?" code/frameworks/angular/src/builders/start-storybook/index.ts -B1 -A1
</function_calls><function_calls>
#!/bin/bashLet me examine the complete start-storybook index again
cat code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls>Now let me check if this file imports from a shared location:
<function_calls>
#!/bin/bashCheck imports from the start-storybook index
head -20 code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls><function_calls>
#!/bin/bashFind what startStorybook does - it's likely from core/server
cat code/core/src/server/index.ts | head -50
</function_calls><function_calls>
#!/bin/bashCheck the core server exports
grep "export" code/core/src/server/index.ts | head -20
</function_calls><function_calls>
#!/bin/bashFind startStorybook in core
find code/core -name "*.ts" | xargs grep -l "export.*startStorybook"
</function_calls><function_calls>
#!/bin/bashVerify by looking at the actual export in core server
rg "export.*startStorybook" code/core/src/server/ -A5
</function_calls><function_calls>
#!/bin/bashLook for the actual start-storybook implementation in core
rg "startStorybook" code/core/src/server/ -B2 -A10 | head -100
</function_calls>Let me find this function more systematically:
<function_calls>
#!/bin/bashList all ts files in core/src/server
find code/core/src/server -name "*.ts" -type f
</function_calls><function_calls>
#!/bin/bashCheck each server file for startStorybook
for f in $(find code/core/src/server -name "*.ts" -type f); do
if grep -q "startStorybook" "$f"; then
echo "Found in: $f"
grep -n "startStorybook" "$f"
fi
done
</function_calls><function_calls>
#!/bin/bashLook at cli package which might have these
ls code/lib/cli-* 2>/dev/null || find code -type d -name "cli" | head -10
</function_calls><function_calls>
#!/bin/bashCheck where the angular build imports from
rg "from.*@storybook|from.*storybook" code/frameworks/angular/src/builders/start-storybook/ --type=ts
</function_calls>Now let me search with a broader approach to find what logger object is returned:
<function_calls>
#!/bin/bashSearch for logger object creation or return
rg "return.*{.logger|logger\s:" code/core/ --type=ts -B3 -A3 | head -80
</function_calls><function_calls>
#!/bin/bashLook for where logger comes from by checking the angular builder more carefully
The pattern seems to be: const { logger } = await startStorybook()
Let's find the return type of startStorybook
rg "function startStorybook|export.*startStorybook|const startStorybook" --type=ts -A20 code/ | head -150
</function_calls>Let me verify by checking if there's an issue report or test file mentioning this:
<function_calls>
#!/bin/bashCheck if there are any test files for start-storybook
find code/frameworks/angular -name "start-storybook.test.*"
</function_calls><function_calls>
#!/bin/bashLook for any existing issues or comments about loglevel
rg "TODO|FIXME|BUG|loglevel" code/frameworks/angular/src/builders/ --type=ts
</function_calls>Now let me approach this by checking what the commit history says or if there's any recent changes:
<function_calls>
#!/bin/bashCheck if there are version constraints in tsconfig for type checking
cat code/tsconfig.json 2>/dev/null | python3 -m json.tool | grep -E "strict|noImplicit" | head -20
</function_calls>Let me now use Python to analyze the type compatibility by checking files more systematically:
<function_calls>
#!/bin/bash
python3 << 'EOF'
import json
import os
import reCheck both schemas for loglevel
schemas = [
'code/frameworks/angular/src/builders/start-storybook/schema.json',
'code/frameworks/angular/src/builders/build-storybook/schema.json'
]for schema_path in schemas:
try:
with open(schema_path, 'r') as f:
schema = json.load(f)builder = schema_path.split('/')[-2] print(f"\n=== {builder} ===") if 'properties' in schema and 'loglevel' in schema['properties']: loglevel_def = schema['properties']['loglevel'] print(f"loglevel definition: {json.dumps(loglevel_def, indent=2)}") # Extract enum values if 'enum' in loglevel_def: print(f"Allowed enum values: {loglevel_def['enum']}") elif '$ref' in loglevel_def: print(f"References: {loglevel_def['$ref']}") except Exception as e: print(f"Error reading {schema_path}: {e}")EOF
</function_calls>Great! Now I have the schema information. Let me search for where the logger.setLogLevel method might be typed:
<function_calls>
#!/bin/bashSearch for logger interface or implementation that has the union type constraint
rg "LogLevel\s*=\s*(|type LogLevel|interface.*LogLevel" --type=ts code/ -B2 -A2 | head -80
</function_calls><function_calls>
#!/bin/bashLook for where the logger.setLogLevel API might be defined by checking function signatures
rg "setLogLevel\s*(.\s:\s*|setLogLevel.*LogLevel" --type=ts code/ | head -20
</function_calls>Let me check if there's a discord between the schema and actual implementation:
<function_calls>
#!/bin/bashCheck the implementation more carefully - search for string to see what values are used
rg ""trace"|"debug"|"silly"" --type=ts --type=json code/ | grep -E "schema|loglevel" | head -20
</function_calls>Now let me check the original review more carefully to understand what the concern is:
<function_calls>
#!/bin/bashThe review mentions a new union type 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent'
Let me search for references to this exact union
rg "trace.*debug.*info.*warn.*error.*silent|silent.*error.*warn" --type=ts code/ | head -20
</function_calls><function_calls>
#!/bin/bashLet's look for where silly log level might be referenced (older convention)
rg "silly" --type=ts --type=json code/ | head -20
</function_calls>Let me check if there's a PR or branch context that might help:
<function_calls>
#!/bin/bashCheck git status to see what branch we're on
cd code && git branch 2>/dev/null || echo "Not a git repo or no branch info"
</function_calls><function_calls>
#!/bin/bashLook for any type definition files that might define the log levels
find code -name "*.d.ts" | xargs grep -l "LogLevel|setLogLevel" 2>/dev/null | head -5
</function_calls><function_calls>
#!/bin/bashLook for a comprehensive check of setLogLevel signatures
rg "setLogLevel" code/ --type=ts -B5 -A15 | grep -E "setLogLevel|string|LogLevel|(" | head -60
</function_calls>Let me examine if the code actually type-checks correctly by looking at any potential type mismatches:
<function_calls>
#!/bin/bashLook at the exact context of the review - lines 84-90
sed -n '80,95p' code/frameworks/angular/src/builders/start-storybook/index.ts | cat -n
</function_calls>Now let me check what the options object type contains:
<function_calls>
#!/bin/bashLook at function signature to understand the options parameter
sed -n '1,80p' code/frameworks/angular/src/builders/start-storybook/index.ts | tail -40 | cat -n
</function_calls>Let me check the common builder or normalize-options patterns:
<function_calls>
#!/bin/bashLook for the typing of options in the start-storybook builder
ast-grep --pattern 'function $FUNC($PARAM: $_) {
$$$
}' code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls><function_calls>
#!/bin/bashLook at the export default function
sed -n '35,65p' code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls>Perfect! Now I can see the function signature. Let me find what type
anyis and check if there's a type definition:
<function_calls>
#!/bin/bashSearch for BuilderContext type which might define options
rg "BuilderContext" code/frameworks/angular/src/ --type=ts -B2 -A5 | head -40
</function_calls><function_calls>
#!/bin/bashThe options is typed as 'any' so there's no strict type checking
Let me verify that the schema defines the allowed enum values
python3 << 'EOF'
import jsonwith open('code/frameworks/angular/src/builders/start-storybook/schema.json', 'r') as f:
schema = json.load(f)print("Schema loglevel enum values:")
print(json.dumps(schema['properties']['loglevel']['enum'], indent=2))
EOF
</function_calls>Now let me verify if logger.setLogLevel would accept these values by checking its implementation:
<function_calls>
#!/bin/bashSearch broadly for any logger implementation that might reveal the expected type
rg "class.*Logger|function.setLogLevel|setLogLevel.=" --type=ts code/core/ code/lib/ 2>/dev/null | head -40
</function_calls>Let me verify by checking if there's a logger module or package:
<function_calls>
#!/bin/bashTry to find any logger-related exports
find code -type f -name "*.ts" | xargs grep -l "export.*logger|export.*Logger" | head -10
</function_calls><function_calls>
#!/bin/bashCheck if there's any validation or type checking happening elsewhere
rg "logLevel|loglevel" code/frameworks/angular/src/builders/ --type=ts -B2 -A2
</function_calls>Let me verify the consistency by comparing both builders:
<function_calls>
#!/bin/bashCompare loglevel definitions in both schemas
python3 << 'EOF'
import jsonschemas = {
'start': 'code/frameworks/angular/src/builders/start-storybook/schema.json',
'build': 'code/frameworks/angular/src/builders/build-storybook/schema.json'
}log_levels = {}
for name, path in schemas.items():
with open(path, 'r') as f:
schema = json.load(f)
log_levels[name] = schema['properties']['loglevel']['enum']print("start-storybook loglevel values:", log_levels['start'])
print("build-storybook loglevel values:", log_levels['build'])
print("Are they identical?", log_levels['start'] == log_levels['build'])
EOF
</function_calls>Now let me check if there's any actual implementation issue by looking for how other parts handle this:
<function_calls>
#!/bin/bashCheck if this logger.setLogLevel call has been type-checked or validated anywhere
rg "setLogLevel.*options.|options.loglevel.*setLogLevel" code/ --type=ts
</function_calls>Let me check what the actual type narrowing is in the review comment, and if the code shows the narrowing:
<function_calls>
#!/bin/bashThe review mentions narrowed union type 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent'
Check if this matches what's in the schema
python3 << 'EOF'
import jsonexpected_narrow_type = ['trace', 'debug', 'info', 'warn', 'error', 'silent']
with open('code/frameworks/angular/src/builders/start-storybook/schema.json', 'r') as f:
schema = json.load(f)
actual_enum = schema['properties']['loglevel']['enum']print(f"Expected union type from review: {expected_narrow_type}")
print(f"Actual schema enum: {actual_enum}")
print(f"Match: {set(expected_narrow_type) == set(actual_enum)}")
print(f"Difference: {set(expected_narrow_type) ^ set(actual_enum)}")
EOF
</function_calls>Perfect! Now I have confirmed the schema values. Let me verify if there might be a type compatibility issue by checking if the logger method signature is defined somewhere:
<function_calls>
#!/bin/bashFinal verification - search for actual logger.setLogLevel implementations
that might have a different signature or restricted type
rg ".setLogLevel(" code/ --type=ts -B10 -A3 | head -150
</function_calls><function_calls>
#!/bin/bashLet me also verify the code in the file has the correct narrowing guard
sed -n '84,90p' code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls>Now let me check if the type of
optionsparameter allows any string or if it's more restricted:
<function_calls>
#!/bin/bashLook at how BuilderContext is used - it comes from @angular-devkit/architect
grep -n "@Angular-devkit|BuilderContext" code/frameworks/angular/src/builders/start-storybook/index.ts
</function_calls>Based on my investigation, let me summarize what I've found:
- The
options.loglevelparameter comes from the schema.json which defines an enum with values:['trace', 'debug', 'info', 'warn', 'error', 'silent']- This matches exactly the narrowed union type mentioned in the review:
'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent'- The code has a proper guard
if (options.loglevel)before callinglogger.setLogLevel(options.loglevel)- The options parameter is typed as
any, so there's no TypeScript compile-time verification- The same pattern exists in build-storybook and appears to work correctly
The verification requested in the review comment is to confirm that
logger.setLogLevel()accepts this union type. Since:
- The schema enforces these exact enum values for loglevel
- The code uses a guard to check if loglevel exists
- The same pattern is used in build-storybook
- No type errors are reported
The code appears to be correct and compatible with the logger API.
Logger.setLogLevel() accepts all schema-defined loglevel values correctly.
The schema.json defines loglevel as an enum with the union type
['trace', 'debug', 'info', 'warn', 'error', 'silent'], which matches the narrowed type expected. The implementation includes proper type guarding withif (options.loglevel)before callinglogger.setLogLevel(), and the same pattern is verified in build-storybook. No compatibility issues detected.
|
View your CI Pipeline Execution ↗ for commit 579c575
☁️ Nx Cloud last updated this comment at |
… NODE_ENV in Angular preset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
code/core/src/core-server/withTelemetry.ts(0 hunks)code/core/src/node-logger/index.ts(1 hunks)code/core/src/types/modules/core-common.ts(2 hunks)code/frameworks/angular/src/server/framework-preset-angular-cli.ts(1 hunks)code/lib/cli-storybook/src/upgrade.ts(2 hunks)
💤 Files with no reviewable changes (1)
- code/core/src/core-server/withTelemetry.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- code/core/src/types/modules/core-common.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js,jsx,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use camelCase for variable and function names
Files:
code/frameworks/angular/src/server/framework-preset-angular-cli.tscode/core/src/node-logger/index.tscode/lib/cli-storybook/src/upgrade.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Enable TypeScript strict mode
Export functions from modules for testing purposes
Files:
code/frameworks/angular/src/server/framework-preset-angular-cli.tscode/core/src/node-logger/index.tscode/lib/cli-storybook/src/upgrade.ts
**/*.{ts,tsx,js,jsx,json,html,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx,js,jsx,json,html,mjs}: Use ESLint and Prettier for code style enforcement
Run 'yarn prettier --write ' to format code after making changes
Run 'yarn lint:js:cmd ' to check for ESLint issues after making changes
Files:
code/frameworks/angular/src/server/framework-preset-angular-cli.tscode/core/src/node-logger/index.tscode/lib/cli-storybook/src/upgrade.ts
code/**/!(*.test).{ts,tsx,js,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
code/**/!(*.test).{ts,tsx,js,mjs}: Use 'logger' from 'storybook/internal/node-logger' for server-side (Node.js) logging, not console.log/console.warn/console.error
Use 'logger' from 'storybook/internal/client-logger' for client-side (browser) logging, not console.log/console.warn/console.error
Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size
Files:
code/frameworks/angular/src/server/framework-preset-angular-cli.tscode/core/src/node-logger/index.tscode/lib/cli-storybook/src/upgrade.ts
🧠 Learnings (4)
📚 Learning: 2025-11-24T17:49:47.659Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.659Z
Learning: Applies to code/**/!(*.test).{ts,tsx,js,mjs} : Use 'logger' from 'storybook/internal/node-logger' for server-side (Node.js) logging, not console.log/console.warn/console.error
Applied to files:
code/frameworks/angular/src/server/framework-preset-angular-cli.tscode/core/src/node-logger/index.tscode/lib/cli-storybook/src/upgrade.ts
📚 Learning: 2025-11-24T17:49:47.659Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.659Z
Learning: Applies to code/**/!(*.test).{ts,tsx,js,mjs} : Use 'logger' from 'storybook/internal/client-logger' for client-side (browser) logging, not console.log/console.warn/console.error
Applied to files:
code/core/src/node-logger/index.tscode/lib/cli-storybook/src/upgrade.ts
📚 Learning: 2025-11-24T17:49:47.659Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.659Z
Learning: Applies to code/**/!(*.test).{ts,tsx,js,mjs} : Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size
Applied to files:
code/core/src/node-logger/index.ts
📚 Learning: 2025-11-05T09:38:47.712Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Select/Select.tsx:200-204
Timestamp: 2025-11-05T09:38:47.712Z
Learning: Repo: storybookjs/storybook — Guidance: Until Storybook 11 is released, do not suggest using React.useId anywhere (e.g., in code/core/src/components/components/Select/Select.tsx) to maintain compatibility with React 17 runtimes. Prefer advising: accept a caller-provided props.id and, if needed, generate a client-only fallback id to minimize SSR hydration issues — but avoid useId. Resume prompting for useId after Storybook 11.
Applied to files:
code/lib/cli-storybook/src/upgrade.ts
🧬 Code graph analysis (1)
code/lib/cli-storybook/src/upgrade.ts (1)
code/core/src/node-logger/index.ts (1)
LogLevel(14-14)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: normal
- GitHub Check: Core Unit Tests, windows-latest
🔇 Additional comments (3)
code/lib/cli-storybook/src/upgrade.ts (2)
10-10: LGTM! Clean type import.The type-only import for
LogLevelis correct and follows TypeScript best practices.
117-129: Theloglevelandlogfileoptions are being utilized correctly—the review comment's concern is unfounded.These options are processed in the CLI layer's
preActionhook (code/lib/cli-storybook/src/bin/run.ts, lines 60–72) before theupgrade()function is called. The hook invokeslogger.setLogLevel(options.loglevel)andlogTracker.enableLogWriting()to configure global logging state. This is the correct architectural pattern: logging configuration happens at the CLI entry point before operations begin, not within individual function logic.The
UpgradeOptionstype correctly includes these properties for consistency with the CLI option structure and type safety, even though theupgrade()function itself doesn't directly reference them—it inherits the configured logging state from the global setup. This design is sound.Likely an incorrect or invalid review comment.
code/core/src/node-logger/index.ts (1)
14-15: LGTM! Clean type export.The type-only export correctly makes
LogLevelpublicly available from the node-logger module, enabling it to be imported by consumers likeupgrade.ts. The blank line improves readability.
code/frameworks/angular/src/server/framework-preset-angular-cli.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (6)
code/lib/create-storybook/src/commands/FinalizationCommand.ts (1)
71-74: Silent error swallowing in log file writing.The empty catch block silently suppresses any errors that occur during log file writing. While this prevents log-writing failures from disrupting the installation flow, it provides no feedback to users when logging fails, which could make debugging harder.
Consider logging a warning when the catch block is triggered, or at minimum, add a comment explaining why errors are intentionally swallowed.
Apply this diff to add minimal error feedback:
try { const logFile = await logTracker.writeToFile(this.logfile); logger.warn(`Debug logs are written to: ${logFile}`); - } catch {} + } catch { + // Swallow log-writing errors to prevent disrupting the finalization flow + }code/lib/cli-storybook/src/bin/run.ts (2)
39-42: Silent error swallowing in error-path log writing.The empty catch block prevents log-writing failures from cascading, which is appropriate in an error handler. However, consider adding a comment to clarify this is intentional.
Apply this diff:
try { const logFile = await logTracker.writeToFile(logFilePath); logger.log(`Debug logs are written to: ${logFile}`); - } catch {} + } catch { + // Swallow log-writing errors to prevent cascading failures in error path + }
84-87: Silent error swallowing in success-path log writing.The empty catch block silently suppresses log-writing failures in the success path. Consider adding a comment to document this intentional behavior.
Apply this diff:
try { const logFile = await logTracker.writeToFile(command.getOptionValue('logfile')); logger.log(`Debug logs are written to: ${logFile}`); - } catch {} + } catch { + // Swallow log-writing errors to preserve success flow + }code/lib/create-storybook/src/bin/run.ts (1)
107-109: Silent error swallowing in log file writing.The empty catch block silently suppresses log-writing failures. While this prevents logging errors from disrupting the initialization flow, adding a comment would clarify this is intentional behavior.
Apply this diff:
try { await logTracker.writeToFile(command.getOptionValue('logfile')); - } catch {} + } catch { + // Swallow log-writing errors to preserve initialization flow + }code/core/src/bin/core.ts (2)
30-33: Silent error swallowing in error-path log writing.The empty catch block prevents log-writing failures from cascading in the error handler. Consider adding a comment to make this intentional behavior explicit.
Apply this diff:
try { const logFile = await logTracker.writeToFile(logFilePath); logger.log(`Debug logs are written to: ${logFile}`); - } catch {} + } catch { + // Swallow log-writing errors to prevent cascading failures in error path + }
71-74: Silent error swallowing in success-path log writing.The empty catch block silently suppresses log-writing failures. Adding a comment would clarify this intentional behavior.
Apply this diff:
try { const logFile = await logTracker.writeToFile(command.getOptionValue('logfile')); logger.outro(`Debug logs are written to: ${logFile}`); - } catch {} + } catch { + // Swallow log-writing errors to preserve command completion flow + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
code/core/src/bin/core.ts(2 hunks)code/frameworks/angular/src/builders/start-storybook/index.ts(4 hunks)code/lib/cli-storybook/src/bin/run.ts(2 hunks)code/lib/create-storybook/src/bin/run.ts(1 hunks)code/lib/create-storybook/src/commands/FinalizationCommand.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- code/frameworks/angular/src/builders/start-storybook/index.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{js,jsx,json,html,ts,tsx,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use ESLint and Prettier configurations that are enforced in the codebase
Files:
code/lib/cli-storybook/src/bin/run.tscode/lib/create-storybook/src/bin/run.tscode/lib/create-storybook/src/commands/FinalizationCommand.tscode/core/src/bin/core.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Enable TypeScript strict mode
Files:
code/lib/cli-storybook/src/bin/run.tscode/lib/create-storybook/src/bin/run.tscode/lib/create-storybook/src/commands/FinalizationCommand.tscode/core/src/bin/core.ts
code/**/*.{ts,tsx,js,jsx,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
code/**/*.{ts,tsx,js,jsx,mjs}: Use server-side logger from 'storybook/internal/node-logger' for Node.js code
Use client-side logger from 'storybook/internal/client-logger' for browser code
Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size
Files:
code/lib/cli-storybook/src/bin/run.tscode/lib/create-storybook/src/bin/run.tscode/lib/create-storybook/src/commands/FinalizationCommand.tscode/core/src/bin/core.ts
code/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Export functions that need to be tested from their modules
Files:
code/lib/cli-storybook/src/bin/run.tscode/lib/create-storybook/src/bin/run.tscode/lib/create-storybook/src/commands/FinalizationCommand.tscode/core/src/bin/core.ts
code/**/*.{js,jsx,json,html,ts,tsx,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
code/**/*.{js,jsx,json,html,ts,tsx,mjs}: Run Prettier with --write flag to format code before committing
Run ESLint with yarn lint:js:cmd to check for linting issues and fix errors before committing
Files:
code/lib/cli-storybook/src/bin/run.tscode/lib/create-storybook/src/bin/run.tscode/lib/create-storybook/src/commands/FinalizationCommand.tscode/core/src/bin/core.ts
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-28T14:50:24.872Z
Learning: Applies to code/**/*.{ts,tsx,js,jsx,mjs} : Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size
📚 Learning: 2025-11-28T14:50:24.872Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-28T14:50:24.872Z
Learning: Applies to code/**/*.{ts,tsx,js,jsx,mjs} : Use server-side logger from 'storybook/internal/node-logger' for Node.js code
Applied to files:
code/lib/cli-storybook/src/bin/run.tscode/lib/create-storybook/src/bin/run.ts
📚 Learning: 2025-11-28T14:50:24.872Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-28T14:50:24.872Z
Learning: Applies to code/**/*.{ts,tsx,js,jsx,mjs} : Use client-side logger from 'storybook/internal/client-logger' for browser code
Applied to files:
code/lib/cli-storybook/src/bin/run.tscode/lib/create-storybook/src/bin/run.ts
📚 Learning: 2025-09-24T09:39:39.233Z
Learnt from: ndelangen
Repo: storybookjs/storybook PR: 32507
File: code/core/src/manager/globals/globals-module-info.ts:25-33
Timestamp: 2025-09-24T09:39:39.233Z
Learning: In Storybook, storybook/actions/decorator is a preview-only entrypoint and should not be included in manager globals configuration. The duplicatedKeys array in code/core/src/manager/globals/globals-module-info.ts is specifically for manager-side externalization, not preview entrypoints.
Applied to files:
code/lib/create-storybook/src/bin/run.ts
📚 Learning: 2025-11-05T09:38:47.712Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Select/Select.tsx:200-204
Timestamp: 2025-11-05T09:38:47.712Z
Learning: Repo: storybookjs/storybook — Guidance: Until Storybook 11 is released, do not suggest using React.useId anywhere (e.g., in code/core/src/components/components/Select/Select.tsx) to maintain compatibility with React 17 runtimes. Prefer advising: accept a caller-provided props.id and, if needed, generate a client-only fallback id to minimize SSR hydration issues — but avoid useId. Resume prompting for useId after Storybook 11.
Applied to files:
code/lib/create-storybook/src/bin/run.ts
📚 Learning: 2025-11-28T14:50:24.872Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-28T14:50:24.872Z
Learning: Applies to code/**/*.{ts,tsx,js,jsx,mjs} : Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size
Applied to files:
code/core/src/bin/core.ts
🧬 Code graph analysis (4)
code/lib/cli-storybook/src/bin/run.ts (2)
code/core/src/node-logger/index.ts (2)
logTracker(8-8)logger(51-76)code/core/src/node-logger/logger/log-tracker.ts (1)
logTracker(95-95)
code/lib/create-storybook/src/bin/run.ts (1)
code/core/src/node-logger/logger/log-tracker.ts (1)
logTracker(95-95)
code/lib/create-storybook/src/commands/FinalizationCommand.ts (2)
code/core/src/node-logger/index.ts (2)
logTracker(8-8)logger(51-76)code/core/src/node-logger/logger/log-tracker.ts (1)
logTracker(95-95)
code/core/src/bin/core.ts (1)
code/core/src/node-logger/logger/log-tracker.ts (1)
logTracker(95-95)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: normal
- GitHub Check: nx
- GitHub Check: Core Unit Tests, windows-latest
| try { | ||
| const logFile = await logTracker.writeToFile(logFilePath); | ||
| logger.log(`Debug logs are written to: ${logFile}`); | ||
| } catch {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move the try/catch block inside of writeToFile so that this is applied globally and if we end up introducing this call elsewhere, we don't have to think about wrapping it in a try/catch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about it, but then we also have to move logger.log inside of it (which we can't because sometimes we use logger.info and sometimes logger.outro), otherwise we introduce an if block.
…logfile-handling Angular: Honor --loglevel and --logfile in dev/build (cherry picked from commit 7782cf7)
Closes #
What I did
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.