Skip to content

Commit 592cdc1

Browse files
feat(migration-recipe): webpack/v5/migration-recipe
1 parent f97dd6d commit 592cdc1

File tree

7 files changed

+112
-0
lines changed

7 files changed

+112
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Dependencies
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
7+
# Build artifacts
8+
target/
9+
dist/
10+
build/
11+
12+
# Temporary files
13+
*.tmp
14+
*.temp
15+
.cache/
16+
17+
# Environment files
18+
.env
19+
.env.local
20+
21+
# IDE files
22+
.vscode/
23+
.idea/
24+
*.swp
25+
*.swo
26+
27+
# OS files
28+
.DS_Store
29+
Thumbs.db
30+
31+
# Package bundles
32+
*.tar.gz
33+
*.tgz
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# migration-recipe
2+
3+
Transform legacy code patterns
4+
5+
## Installation
6+
7+
```bash
8+
# Install from registry
9+
codemod run webpack/v5/migration-recipe
10+
11+
# Or run locally
12+
codemod run -w workflow.yaml
13+
```
14+
15+
## Usage
16+
17+
This codemod transforms typescript code by:
18+
19+
- Converting `var` declarations to `const`/`let`
20+
- Removing debug statements
21+
- Modernizing syntax patterns
22+
23+
## Development
24+
25+
```bash
26+
# Test the transformation
27+
bash scripts/transform.sh
28+
29+
# Validate the workflow
30+
codemod validate -w workflow.yaml
31+
32+
# Publish to registry
33+
codemod login
34+
codemod publish
35+
```
36+
37+
## License
38+
39+
MIT
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
schema_version: "1.0"
2+
3+
name: "webpack/v5/migration-recipe"
4+
version: "0.1.0"
5+
description: "Transform legacy code patterns"
6+
author: "Akash <[email protected]>"
7+
license: "MIT"
8+
workflow: "workflow.yaml"
9+
category: "migration"
10+
11+
targets:
12+
languages: ["typescript"]
13+
14+
keywords: ["transformation", "migration", "webpack"]
15+
16+
registry:
17+
access: "public"
18+
visibility: "public"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
echo "Cleaning up..."
3+
# Add your cleanup logic here
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
echo "Setting up transformation environment..."
3+
# Add your setup logic here
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
echo "Applying transformations..."
3+
# Add your transformation logic here
4+
# Example: find . -name "*.js" -exec sed -i 's/var /const /g' {} \;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: "1"
2+
nodes:
3+
- id: migrate
4+
name: Migration Recipe
5+
type: automatic
6+
steps:
7+
- name: Step 1
8+
run: npx -y codemod@latest webpack/v5/json-imports-to-default-imports
9+
- name: Step 2
10+
run: npx -y codemod@latest webpack/v5/migrate-library-target-to-library-object
11+
- name: Step 3
12+
run: npx -y codemod@latest webpack/v5/set-target-to-false-and-update-plugins

0 commit comments

Comments
 (0)