@wise/wds-codemods 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/config.json +13 -0
- package/.github/CODEOWNERS +1 -0
- package/.github/actions/bootstrap/action.yml +26 -0
- package/.github/actions/commitlint/action.yml +34 -0
- package/.github/workflows/cd-cd.yml +82 -0
- package/.github/workflows/renovate.yml +16 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +1 -0
- package/.nvmrc +1 -0
- package/.prettierignore +1 -0
- package/.prettierrc.js +5 -0
- package/README.md +13 -0
- package/commitlint.config.js +3 -0
- package/eslint.config.js +10 -0
- package/jest.config.js +5 -0
- package/mkdocs.yml +4 -0
- package/package.json +53 -0
- package/renovate.json +9 -0
- package/src/__tests__/index.test.ts +10 -0
- package/src/index.ts +2 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
|
|
3
|
+
"changelog": ["@changesets/changelog-github", { "repo": "transferwise/wds-codemods" }],
|
|
4
|
+
"commit": false,
|
|
5
|
+
"fixed": [],
|
|
6
|
+
"linked": [],
|
|
7
|
+
"access": "public",
|
|
8
|
+
"baseBranch": "main",
|
|
9
|
+
"updateInternalDependencies": "minor",
|
|
10
|
+
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
|
|
11
|
+
"onlyUpdatePeerDependentsWhenOutOfRange": true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @transferwise/design-system-web
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Bootstrap
|
|
2
|
+
description: 'Install dependencies and setup cache for the project.'
|
|
3
|
+
|
|
4
|
+
inputs:
|
|
5
|
+
github-token:
|
|
6
|
+
required: true
|
|
7
|
+
description: 'secrets.GITHUB_TOKEN'
|
|
8
|
+
|
|
9
|
+
runs:
|
|
10
|
+
using: composite
|
|
11
|
+
steps:
|
|
12
|
+
- name: 🔐 Mark repo directory as safe for git # https://github.blog/2022-04-12-git-security-vulnerability-announced/
|
|
13
|
+
run: git config --global --add safe.directory $GITHUB_WORKSPACE
|
|
14
|
+
shell: bash
|
|
15
|
+
|
|
16
|
+
- uses: pnpm/action-setup@v2
|
|
17
|
+
|
|
18
|
+
- name: 📦 Setup cache for dependencies
|
|
19
|
+
uses: actions/setup-node@v4
|
|
20
|
+
with:
|
|
21
|
+
node-version-file: .nvmrc
|
|
22
|
+
cache: pnpm
|
|
23
|
+
|
|
24
|
+
- name: 📦 Install dependencies
|
|
25
|
+
run: pnpm install --frozen-lockfile
|
|
26
|
+
shell: bash
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Commitlint
|
|
2
|
+
description: 'Lint commit messages'
|
|
3
|
+
|
|
4
|
+
inputs:
|
|
5
|
+
github-token:
|
|
6
|
+
required: true
|
|
7
|
+
description: 'secrets.GITHUB_TOKEN'
|
|
8
|
+
|
|
9
|
+
runs:
|
|
10
|
+
using: composite
|
|
11
|
+
steps:
|
|
12
|
+
- name: 🔐 Mark repo directory as safe for git # https://github.blog/2022-04-12-git-security-vulnerability-announced/
|
|
13
|
+
run: git config --global --add safe.directory $GITHUB_WORKSPACE
|
|
14
|
+
shell: bash
|
|
15
|
+
|
|
16
|
+
- uses: pnpm/action-setup@v2
|
|
17
|
+
|
|
18
|
+
- name: 📦 Setup cache for dependencies
|
|
19
|
+
uses: actions/setup-node@v4
|
|
20
|
+
with:
|
|
21
|
+
node-version-file: .nvmrc
|
|
22
|
+
cache: pnpm
|
|
23
|
+
|
|
24
|
+
- name: 📦 Install dependencies
|
|
25
|
+
run: pnpm install --frozen-lockfile
|
|
26
|
+
shell: bash
|
|
27
|
+
|
|
28
|
+
- name: Fetch full commit history
|
|
29
|
+
run: git fetch --unshallow
|
|
30
|
+
shell: bash
|
|
31
|
+
|
|
32
|
+
- name: Run Commitlint
|
|
33
|
+
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
|
|
34
|
+
shell: bash
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
name: '🚀 CI/CD'
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
setup:
|
|
11
|
+
name: 🏗 Setup packages
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- name: 🛒 Check out repository
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: ⚙️ Bootstrap
|
|
19
|
+
uses: ./.github/actions/bootstrap
|
|
20
|
+
with:
|
|
21
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
22
|
+
|
|
23
|
+
- name: 📝 Lint
|
|
24
|
+
run: pnpm run lint
|
|
25
|
+
|
|
26
|
+
commitlint:
|
|
27
|
+
name: 📝 Commitlint
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
needs: [setup]
|
|
30
|
+
|
|
31
|
+
steps:
|
|
32
|
+
- name: 🛒 Check out repository
|
|
33
|
+
uses: actions/checkout@v4
|
|
34
|
+
|
|
35
|
+
- name: 📝 Run Commitlint
|
|
36
|
+
uses: ./.github/actions/commitlint
|
|
37
|
+
with:
|
|
38
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
39
|
+
|
|
40
|
+
publish:
|
|
41
|
+
name: 🚀 Publish
|
|
42
|
+
if: ${{ github.ref == 'refs/heads/main' }}
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
needs: [setup]
|
|
45
|
+
|
|
46
|
+
steps:
|
|
47
|
+
- name: 🛒 Check out repository
|
|
48
|
+
uses: actions/checkout@v4
|
|
49
|
+
with:
|
|
50
|
+
token: ${{ secrets.GH_ACCESS_TOKEN }}
|
|
51
|
+
|
|
52
|
+
- name: ⚙️ Bootstrap
|
|
53
|
+
uses: ./.github/actions/bootstrap
|
|
54
|
+
with:
|
|
55
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
56
|
+
|
|
57
|
+
- name: 👩💻 Set GitHub credentials
|
|
58
|
+
run: |
|
|
59
|
+
mkdir -p ~/.ssh
|
|
60
|
+
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
|
61
|
+
git config --global user.name "tw-actions"
|
|
62
|
+
git config --global user.email circle@circle.tw.ee
|
|
63
|
+
|
|
64
|
+
- name: 🔐 Set up commit signing
|
|
65
|
+
uses: crazy-max/ghaction-import-gpg@v5
|
|
66
|
+
with:
|
|
67
|
+
gpg_private_key: ${{ secrets.GPG_SIGN_KEY }}
|
|
68
|
+
git_config_global: true
|
|
69
|
+
git_user_signingkey: true
|
|
70
|
+
git_commit_gpgsign: true
|
|
71
|
+
|
|
72
|
+
- name: Create changesets release PR
|
|
73
|
+
id: changesets
|
|
74
|
+
uses: changesets/action@v1
|
|
75
|
+
with:
|
|
76
|
+
publish: pnpm release
|
|
77
|
+
commit: 'chore: release'
|
|
78
|
+
title: 'chore: release new version and update changelog'
|
|
79
|
+
setupGitUser: false
|
|
80
|
+
env:
|
|
81
|
+
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
|
|
82
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN_AUTOMATION }}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Renovate
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths:
|
|
8
|
+
- pnpm-lock.yaml
|
|
9
|
+
schedule:
|
|
10
|
+
- cron: '0 2 * * 1' # Run every Monday at 2AM
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
renovate:
|
|
15
|
+
uses: transferwise/renovate-workflows/.github/workflows/run.yaml@v1
|
|
16
|
+
secrets: inherit
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx --no -- commitlint --edit $1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pnpm lint
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lts/*
|
package/.prettierignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pnpm-lock.yaml
|
package/.prettierrc.js
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# wds-codemods
|
|
2
|
+
|
|
3
|
+
Owner: design-system-web
|
|
4
|
+
|
|
5
|
+
Slack channels: #design-system-web
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Overview](#overview)
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Codemods for migrating and upgrading Wise Design System components. Automates transformations with safety checks, reporting, and linting enforcement.
|
package/eslint.config.js
ADDED
package/jest.config.js
ADDED
package/mkdocs.yml
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wise/wds-codemods",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"author": "Wise Payments Ltd.",
|
|
7
|
+
"repository": {
|
|
8
|
+
"fullname": "transferwise/neptune-tokens",
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/transferwise/neptune-tokens.git"
|
|
11
|
+
},
|
|
12
|
+
"description": "Codemods for Wise Design System",
|
|
13
|
+
"main": "dist/index.js",
|
|
14
|
+
"bin": {
|
|
15
|
+
"wds-codemods": "dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"jscodeshift": "^17.3"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@changesets/changelog-github": "^0.5.1",
|
|
22
|
+
"@changesets/cli": "^2.29.2",
|
|
23
|
+
"@commitlint/cli": "^19.8.0",
|
|
24
|
+
"@commitlint/config-conventional": "^19.8.0",
|
|
25
|
+
"@types/jest": "^29.5.14",
|
|
26
|
+
"@types/node": "^22.15.3",
|
|
27
|
+
"@wise/eslint-config": "^12.3.0",
|
|
28
|
+
"babel-jest": "^29.7.0",
|
|
29
|
+
"husky": "^9.1.7",
|
|
30
|
+
"jest": "^29.7.0",
|
|
31
|
+
"prettier": "^3.5.3",
|
|
32
|
+
"ts-jest": "^29.3.2",
|
|
33
|
+
"tsup": "^8.4.0",
|
|
34
|
+
"typescript": "^5.8.3"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsup src/index.ts --format cjs,esm",
|
|
41
|
+
"changeset": "changeset",
|
|
42
|
+
"lint": "pnpm run lint:js+ts && pnpm run lint:format",
|
|
43
|
+
"lint:js+ts": "eslint '**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}'",
|
|
44
|
+
"lint:format": "prettier \"**/*\" --check --ignore-unknown",
|
|
45
|
+
"lint:types": "tsc --noEmit",
|
|
46
|
+
"lint:fix": "pnpm run lint:fix:js+ts && pnpm run lint:fix:format",
|
|
47
|
+
"lint:fix:js+ts": "pnpm run lint:js+ts --fix",
|
|
48
|
+
"lint:fix:format": "prettier \"**/*\" --write --ignore-unknown",
|
|
49
|
+
"release": "changeset publish",
|
|
50
|
+
"test": "pnpm run build && jest",
|
|
51
|
+
"test:watch": "jest --watch"
|
|
52
|
+
}
|
|
53
|
+
}
|
package/renovate.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
describe('wds-codemods CLI', () => {
|
|
5
|
+
it('should output the correct message', () => {
|
|
6
|
+
const scriptPath = path.resolve(__dirname, '../../dist/index.js');
|
|
7
|
+
const output = execSync(`npx ts-node ${scriptPath}`).toString().trim();
|
|
8
|
+
expect(output).toBe('Wise Design System Codemod CLI');
|
|
9
|
+
});
|
|
10
|
+
});
|
package/src/index.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true
|
|
11
|
+
},
|
|
12
|
+
"include": ["src/**/*"],
|
|
13
|
+
"exclude": ["node_modules", "dist"]
|
|
14
|
+
}
|