-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Flavio Stutz
committed
Jan 10, 2024
0 parents
commit ad415fd
Showing
33 changed files
with
2,409 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
name: Bug report | ||
about: Report a bug that happened while using/developing this project | ||
title: '' | ||
labels: 'bug' | ||
assignees: '' | ||
--- | ||
|
||
## What's broken? | ||
<!-- Ex.: "Undefined" message when querying a repo with "npx monotag@latest tag" --> | ||
<!-- Attach screenshots if necessary --> | ||
|
||
## Version used | ||
|
||
<!-- Ex.: 1.4.3 --> | ||
|
||
## Context | ||
|
||
<!-- Ex.: We are using this in a monorepo with 300 modules and thousands of tags --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: 'enhancement' | ||
assignees: '' | ||
--- | ||
|
||
## Problem being solved | ||
<!-- Ex.: When I am using large repos, it takes 60min for doing queries --> | ||
|
||
## Proposal | ||
<!-- Ex.: Use git filtering for tags to lower the time processing tags --> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request: --> | ||
<!-- For more information, see the `CONTRIBUTING` guide. --> | ||
|
||
## Summary | ||
|
||
<!-- Summary of the PR --> | ||
|
||
This PR fixes/implements the following **bugs/features** | ||
|
||
- [ ] Bug 1 | ||
- [ ] Feature 1 | ||
|
||
<!-- You can skip this if you're fixing a typo or adding an app to the Showcase. --> | ||
|
||
Explain the **motivation** for making this change. What existing problem does the pull request solve? | ||
|
||
<!-- Example: When "Adding a function to do X", explain why it is necessary to have a way to do X. --> | ||
|
||
## Breaking changes | ||
|
||
<!-- If you are already aware of any (possible) breaking changes, list them here --> | ||
|
||
- [ ] Breaking change 1 | ||
|
||
## Closing issues | ||
|
||
<!-- Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if such). --> | ||
|
||
Fixes # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: create-next-tag | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
create-tag: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
# this is needed if you want the tag push to trigger another workflow | ||
# create a personal token and set a secret with name GH_PERSONAL_TOKEN | ||
# https://github.com/orgs/community/discussions/27028 | ||
token: ${{ secrets.GH_PERSONAL_TOKEN }} | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18.x' | ||
- name: Create tag and push to repo | ||
run: | | ||
corepack enable | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Flávio Stutz" | ||
pnpm dlx [email protected] tag-push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: master-build | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
|
||
jobs: | ||
build: | ||
name: Build master | ||
uses: flaviostutz/gh-makefile/.github/workflows/make-ci.yml@main | ||
with: | ||
working-directory: ./ | ||
tooling: node | ||
tooling-version: 18 | ||
target-build: true | ||
target-lint: true | ||
target-unit-tests: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: pr-build | ||
|
||
on: | ||
pull_request: | ||
branches: ['main'] | ||
|
||
jobs: | ||
build: | ||
name: Build PRs | ||
uses: flaviostutz/gh-makefile/.github/workflows/make-ci.yml@main | ||
with: | ||
working-directory: ./ | ||
tooling: node | ||
tooling-version: 18 | ||
target-build: true | ||
target-lint: true | ||
target-unit-tests: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: tag-publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
name: Check package | ||
uses: flaviostutz/gh-makefile/.github/workflows/make-ci.yml@main | ||
with: | ||
working-directory: ./ | ||
tooling: node | ||
tooling-version: 18 | ||
stage: prd | ||
target-build: true | ||
target-lint: true | ||
target-unit-tests: true | ||
|
||
publish: | ||
name: Publish to npmjs.org | ||
runs-on: ubuntu-latest | ||
needs: build | ||
environment: npmjs-registry | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: make build | ||
- run: make publish | ||
env: | ||
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
lib-cov | ||
coverage | ||
*.lcov | ||
dist | ||
.cache/ | ||
.serverless/ | ||
node_modules | ||
.tmp | ||
testcases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
"Orta.vscode-jest" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"key": "shift+cmd+a", | ||
"command": "eslint.executeAutofix" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit" | ||
}, | ||
"eslint.validate": ["javascript"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# CONTRIBUTING | ||
|
||
Thank you for being interested in helping with Practical CDK Constructs! | ||
|
||
## The best way to start | ||
|
||
- Look at the "Issues" and choose something to implement | ||
|
||
* Fork this project to your account | ||
|
||
- Implement it, create unit tests and run `make rules-doc` to update documentation | ||
- Create a PR after you complete it to master branch | ||
- Use make targets for common tasks (they are the same that are run during pipelines) | ||
|
||
```sh | ||
make build | ||
make lint | ||
make test | ||
make rules-doc | ||
``` | ||
|
||
## Questions and discussions | ||
|
||
- Discuss design or implementation details of a specific feature in the related Issue comments | ||
- If you have more generic question, create a new Issue | ||
|
||
## Bugs and feature requests | ||
|
||
- If you find any bug, create a new Issue describing what is the structure of your monorepo and what kind of error you had. If possible, send a link of your repo, or a screenshot of its structure. | ||
|
||
- If you want a new feature, open an Issue and explain your real use case, the kind of problems you have nowadays and how you think Monolint could help you in practice. | ||
|
||
## When creating a new rule | ||
|
||
- Create the new rule under folder 'rules' | ||
- Create unit tests for it based on test monorepo at 'rules/test-monorepo' | ||
- Register the new rule in file 'rules/registry.ts' | ||
- Add the rule as default in 'src/defaultConfig.ts' if it is a generic enough rule | ||
|
||
## Prepare your development environment | ||
|
||
- Install npm and "make" on your machine | ||
- Git clone this repo | ||
- Type `make run` to see a first run with success and errors examples | ||
- Use preferrebly VSCode with ESLint plugin installed so linting with auto fix will be available | ||
|
||
## Pipeline and Publishing to NPM | ||
|
||
- Everytime a PR or a commit is made to "master" branch linting and building will be run. Your PR will only be analysed with a successfull GH pipeline run | ||
- When a new tag is created a GH pipeline will publish a release to NPM registry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Flavio Stutz | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
SHELL := /bin/bash | ||
|
||
build: install | ||
rm -rf dist | ||
pnpm exec esbuild src/index.ts --bundle --platform=node --minify --outfile=dist/index.js | ||
pnpm exec tsc --emitDeclarationOnly --outDir dist | ||
|
||
lint: | ||
pnpm exec eslint . --ext .ts | ||
pnpm exec tsc -noEmit --skipLibCheck | ||
pnpm audit | ||
|
||
test: unit-tests | ||
|
||
unit-tests: | ||
pnpm exec jest --verbose | ||
|
||
clean: | ||
rm -rf node_modules | ||
rm -rf dist | ||
|
||
all: build lint test | ||
|
||
install: | ||
corepack enable | ||
pnpm install --frozen-lockfile --config.dedupe-peer-dependents=false | ||
|
||
publish: | ||
@if [ "$${NPM_ACCESS_TOKEN}" == "" ]; then \ | ||
echo "env NPM_ACCESS_TOKEN is required"; \ | ||
exit 1; \ | ||
fi | ||
|
||
git config --global user.email "[email protected]" | ||
git config --global user.name "Flávio Stutz" | ||
npm version from-git --no-git-tag-version | ||
|
||
echo "" >> .npmrc | ||
echo "//registry.npmjs.org/:_authToken=$${NPM_ACCESS_TOKEN}" >> .npmrc | ||
pnpm publish --no-git-checks |
Oops, something went wrong.