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

fix(readme-parser): rewrite readme parsing pipeline #552

Merged
merged 34 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
165f314
rewrite readme parsing pipeline
r4zendev Dec 20, 2023
4d8d0d0
use cjs
r4zendev Dec 20, 2023
e2116bc
custom build script
r4zendev Dec 20, 2023
1c7652d
fix
r4zendev Dec 20, 2023
a319ab7
master
r4zendev Dec 20, 2023
20fb4ea
masterx2
r4zendev Dec 20, 2023
ec4a230
handle cat-file throw
r4zendev Dec 20, 2023
ab3c7e7
cat-file -p
r4zendev Dec 20, 2023
f67df3b
mkdir
r4zendev Dec 20, 2023
d77b245
await
r4zendev Dec 20, 2023
6c5874c
checkout website
r4zendev Dec 20, 2023
022fa47
bug
r4zendev Dec 20, 2023
479c654
fix prettier errors
r4zendev Dec 20, 2023
4550341
fix
r4zendev Dec 20, 2023
61ee17f
remove status, fix bullmq estimation to single line
r4zendev Dec 20, 2023
9b30c06
small change to bullmq readme (test)
r4zendev Dec 20, 2023
afe6377
cover edge case
r4zendev Dec 20, 2023
8ecedff
test msw imports
r4zendev Dec 20, 2023
68c55ae
update one field in msw readme (test granular update)
r4zendev Dec 20, 2023
8f771f3
try fixing yaml.dump
r4zendev Dec 20, 2023
10c0369
try again
r4zendev Dec 20, 2023
ccc6343
try again x2
r4zendev Dec 20, 2023
e715b09
try again x3
r4zendev Dec 20, 2023
892f9fb
try again x4
r4zendev Dec 20, 2023
bef8a54
multiple fixes to parsing logic
r4zendev Dec 20, 2023
04f1f46
add one more readme
r4zendev Dec 20, 2023
c326a6b
try updating existing ones
r4zendev Dec 21, 2023
772a07f
trigger pipeline
r4zendev Dec 21, 2023
17b377d
trigger
r4zendev Dec 21, 2023
3c1567f
trigger with logs
r4zendev Dec 21, 2023
b5093ea
trigger with more logs
r4zendev Dec 21, 2023
1daa2bb
msw 2 imports codemod version change
r4zendev Dec 21, 2023
9f2f75e
msw 2 imports applicability criteria change
r4zendev Dec 21, 2023
181ff39
final marks
r4zendev Dec 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading