-
Notifications
You must be signed in to change notification settings - Fork 1.4k
build(nx): add basic-lib generator for streamlined library creation #14992
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
Conversation
New Issues (1)Checkmarx found the following issues in this Pull Request
|
585fc18
to
4be315c
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #14992 +/- ##
==========================================
- Coverage 36.77% 36.76% -0.01%
==========================================
Files 3201 3201
Lines 92661 92661
Branches 13931 13931
==========================================
- Hits 34076 34069 -7
- Misses 57179 57186 +7
Partials 1406 1406 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5f13a97
to
2346fd7
Compare
1a1523a
to
f22d097
Compare
@@ -7,7 +7,6 @@ | |||
"target": "ES2016", | |||
"module": "ES2020", | |||
"lib": ["es5", "es6", "es7", "dom", "ES2021", "ESNext.Disposable"], | |||
"sourceMap": true, |
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.
This is a duplicate line and is still present in the file below
@@ -210,6 +214,7 @@ | |||
"simplelog", | |||
"style-loader", | |||
"sysinfo", | |||
"ts-node", |
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.
ts-node is used by nx/js
@@ -34,3 +34,4 @@ | |||
./apps/browser/src/safari/safari/Info.plist | |||
./apps/browser/src/safari/desktop.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | |||
./SECURITY.md | |||
./libs/nx-plugin/src/generators/files/README.md__tmpl__ |
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.
We might need a better way to do this in the future as we add more READMEs, more generators, other languages, etc. Maybe the no-capital-letters rule in general doesn't fit our project structure? I've let this be for now.
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.
README.md
are generally exempt this one isn't because of the alternate suffix. I would agree that it is fine for now but if we need we could probably change that to README.md*
if we need to.
@@ -1,6 +1,6 @@ | |||
const { pathsToModuleNameMapper } = require("ts-jest"); | |||
|
|||
const { compilerOptions } = require("../../../../tsconfig.base"); | |||
const { compilerOptions } = require("../../../tsconfig.base"); |
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.
This started throwing errors on me. Not sure how it's not failing on main.
db83dff
to
56ca956
Compare
This adds a new nx-plugin library with a generator for creating "common" type Bitwarden libs. It is set up to accept a lib name, description, team, and directory. It then - Creates a folder in the directory (default to libs) - Sets up complete library scaffolding: - README with team ownership - Build, lint and test task configuration - Test infrastructure - Configures TypeScript path mapping - Updates CODEOWNERS with team ownership - Runs npm i This will make library creation more consistent and reduce manual boilerplate setup. The plugin design itself was generated by `npx nx g plugin`. This means we used a plugin to generate a plugin that exports generators. To create our generator generator, we first needed a generator.
Fix the relative path to tsconfig.base in the dirt/card library's Jest config. The path was incorrectly using four parent directory traversals (../../../../) when only three (../../../) were needed to reach the project root.
|
@@ -34,3 +34,4 @@ | |||
./apps/browser/src/safari/safari/Info.plist | |||
./apps/browser/src/safari/desktop.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | |||
./SECURITY.md | |||
./libs/nx-plugin/src/generators/files/README.md__tmpl__ |
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.
README.md
are generally exempt this one isn't because of the alternate suffix. I would agree that it is fine for now but if we need we could probably change that to README.md*
if we need to.
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-22353
The tooling implemented in this PR is demonstrated on #15064
📔 Objective
@bitwarden/nx-plugin
) to house our custom generators, executors, etc.@bitwarden/nx-plugin:basic-lib
) for constructing basic libraries inlibs
. This generator will be useful for allcommon
type libs that are just typescript projects with services, models, and tests.See commit messages and some contributing docs on the subject at bitwarden/contributing-docs#603 for more info
💣 Side Effects
jest.preset.js
in project root. This aligns with our plans to centralize jest config.@nx/js
as a dependency, which will be needed for building libs.📸 Screenshots
Screen.Recording.2025-06-03.at.12.11.08.PM.mov
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes