Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
fix(readme-parser): rewrite readme parsing pipeline (#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
r4zendev authored Dec 21, 2023
1 parent 129a524 commit d87ab4c
Show file tree
Hide file tree
Showing 16 changed files with 671 additions and 137 deletions.
49 changes: 2 additions & 47 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,54 +23,9 @@ jobs:
run: pnpm install
- name: Build the CJS files
run: pnpm build
- name: Fetch top commit from website repository
- name: Add new READMEs to website
run: |
git remote add website https://github.com/intuita-inc/website.git
git fetch website master
- name: Push commit to master in website repository
run: |
git config --local user.email "[email protected]"
git config --local user.name "Intuita Team"
git fetch origin main
# Get the list of changed files between the current commit and origin/main
changed_files=$(git diff --name-only origin/main)
# Filter for README files in the 'codemods' directory
readme_files=$(echo "$changed_files" | grep '^codemods/.*README\.md$' || true)
if [ -z "$readme_files" ]; then
echo "No README.md file in 'codemods' directory changed."
exit 0
fi
# Prepare to store parsed README contents and paths
declare -A parsed_readmes
pnpm --filter @codemod-registry/readme-parser build
# Iterate over the filtered README files
while IFS= read -r path_to_readme; do
generated_slug=$(echo "$path_to_readme" | sed 's/^[^/]*\///' | sed 's/\/README\.md$//' | tr '/' '-')
website_file_path="cms/automations/$generated_slug.md"
# Parse the README and store the output with its path
parsed_readme=$("$PWD"/readme-parser/dist/index.js "$path_to_readme")
parsed_readmes["$website_file_path"]="$parsed_readme"
done <<< "$readme_files"
# Checkout a new branch from the website master
git checkout -b update-codemods website/master
# Iterate over parsed_readmes and create files
for website_file_path in "${!parsed_readmes[@]}"; do
echo "${parsed_readmes[$website_file_path]}"
echo $(git status)
echo "${parsed_readmes[$website_file_path]}" > "$website_file_path"
git add "$website_file_path"
git commit -m "$website_file_path"
echo $(ls "$website_file_path" -la)
done
git push website HEAD:master
"$PWD"/readme-parser/dist/sync.js
- name: Upload to S3
uses: jakejarvis/s3-sync-action@master
with:
Expand Down
32 changes: 16 additions & 16 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Expand Down Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ The Intuita team may send a response indicating the next steps in handling your

| Version | Supported |
| ------- | ------------------ |
| >=1.0.0 | :white_check_mark: |
| >=1.0.0 | :white_check_mark: |
5 changes: 2 additions & 3 deletions codemods/bull/bullmq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const worker = new Worker("unknown-name", async function (job) {

## Applicability Criteria

`bull` >= 1.0.0
`bullmq` >= 1.0.0

## Other Metadata

Expand All @@ -129,8 +129,7 @@ v1.0.0

### Estimated Time Saving

Up to 5 minutes per queue with one single job.
Another 5 minutes for changing the job startup in bullmq.
~10 minutes per occurence

### Owner

Expand Down
4 changes: 2 additions & 2 deletions codemods/msw/2/imports/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Description

Following the original msw [upgrade guide](https://mswjs.io/docs/migrations/1.x-to-2.x/#imports), there are certain imports that changed their location and/or naming. This codemod will import correct objects from appropriate paths to start your msw migration path.
Following the original msw [upgrade guide](https://mswjs.io/docs/migrations/1.x-to-2.x/#imports), there are certain imports that changed their location and/or naming. This codemod will adjust your imports to the new location and naming.

- `setupWorker` is now imported from `msw/browser`
- `rest` from `msw` is now named `http`
Expand Down Expand Up @@ -55,7 +55,7 @@ v1.0.0

### Estimated Time Saving

Up to 10 minutes per occurrence
~10 minutes per occurrence

### Owner

Expand Down
4 changes: 2 additions & 2 deletions codemods/msw/2/type-args/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Description

There is a change to generic type interface of rest.method() calls. This codemod puts the generic arguments in the correct order to keep type safety.
There is a change to generic type interface of `rest.method()` calls. This codemod puts the generic arguments in the correct order to keep type safety.

### WARNING

Expand Down Expand Up @@ -112,7 +112,7 @@ v1.0.0

### Estimated Time Saving

Up to 15 minutes per occurrence
~15 minutes per occurrence

### Owner

Expand Down
12 changes: 6 additions & 6 deletions codemods/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ Insert codemod version [e.g. v1.0.0]

Can be:

- **Assistive**: The automation partially completes changes. Human involvement is needed to make changes ready to be pushed and merged.
- **Autonomous**: Changes can safely be pushed and merged without further human involvement.
- **Assistive**: The automation partially completes changes. Human involvement is needed to make changes ready to be pushed and merged.
- **Autonomous**: Changes can safely be pushed and merged without further human involvement.

### **Codemod Engine**

Can be:

- [jscodeshift](https://github.com/facebook/jscodeshift)
- [ts-morph](https://github.com/dsherret/ts-morph)
- [filemod](https://github.com/intuita-inc/filemod/)
- [Uber Piranha](https://github.com/uber/piranha)
- [jscodeshift](https://github.com/facebook/jscodeshift)
- [ts-morph](https://github.com/dsherret/ts-morph)
- [filemod](https://github.com/intuita-inc/filemod/)
- [Uber Piranha](https://github.com/uber/piranha)

### Estimated Time Saving

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "Intuita",
"packageManager": "[email protected]",
"scripts": {
"build": "turbo run build:cjs && pnpm --filter @codemod-registry/builder build",
"build": "turbo run build:cjs && pnpm --filter @codemod-registry/builder build && pnpm --filter @codemod-registry/readme-parser build",
"build:homedir": "turbo run build:cjs && pnpm --filter @codemod-registry/builder build:homedir",
"build:cjs": "turbo run build:cjs --no-daemon",
"create": "turbo run create",
Expand Down
Loading

0 comments on commit d87ab4c

Please sign in to comment.