Skip to content

Commit

Permalink
Enforce Rush rules for package.json files
Browse files Browse the repository at this point in the history
Add rules for managing `package.json` files in the `monorepo-one` repository.

* **rush.json**: Add a note in the comments section to explicitly state that `package.json` files should not be in the root directory.
* **.github/copilot-instructions.md**: Add instructions about the rule regarding `package.json` files in the root directory.
* **.github/workflows/ci.yml**: Add a step to verify that no `package.json` file exists in the root directory.
  • Loading branch information
Luxcium committed Feb 2, 2025
1 parent 1aecd38 commit 29ad892
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,3 +441,8 @@ This guide makes sure that GitHub Copilot writes code that is easy to read and f
## Conclusion

By following these rules, GitHub Copilot will create code that is easier to understand and maintain. Keeping things simple and using good practices will help make the code strong and reliable for everyone.

## Rules for Managing `package.json` Files

- **No `package.json` in Root Directory**: Ensure that no `package.json` file exists in the root directory of the `monorepo-one` repository. This rule is essential for maintaining the integrity of the Rush stack and avoiding conflicts.
- **Subdirectory `package.json` Files**: `package.json` files should only be present in the appropriate subdirectories where individual projects are located. This ensures that each project is managed independently and follows the Rush stack guidelines.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ jobs:
exit 0
fi
- name: Verify no package.json in root directory
run: |
if [ -f "package.json" ]; then
echo "Error: package.json found in the root directory"
exit 1
fi
- name: Install dependencies
run: rush update
working-directory: ${{ github.workspace }}
Expand Down
2 changes: 1 addition & 1 deletion rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
* before they get started.
*
* Define a list of regular expressions describing allowable e-mail patterns for Git commits.
* They are case-insensitive anchored JavaScript RegExps. Example: ".*@example\.com"
* They are case-insensitive anchored JavaScript RegExps. Example: ".*@example\\.com"
*
* IMPORTANT: Because these are regular expressions encoded as JSON string literals,
* RegExp escapes need two backslashes, and ordinary periods should be "\\.".
Expand Down

0 comments on commit 29ad892

Please sign in to comment.