Skip to content

Commit

Permalink
Copy configuration from aws-sdk-js-v2-to-v3 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored Mar 2, 2022
1 parent 372f263 commit 91ec885
Show file tree
Hide file tree
Showing 24 changed files with 8,566 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/mean-cats-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"aws-sdk-js-codemod": patch
---

Copy configuration from trivikr/aws-sdk-js-v2-to-v3
11 changes: 11 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "simple-import-sort"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"rules": {
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error"
},
"ignorePatterns": ["__testfixtures__"]
}
76 changes: 76 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Bug Report
description: Create a report to help us improve
title: "[Bug?]: "
labels: ["bug", "triage"]

body:
- type: checkboxes
id: selfservice
attributes:
label: Self-service
description: "Fixing bugs is always a great way to give back to open-source projects, and we're more than happy to answer questions and provide context."
options:
- label: "I'd be willing to implement a fix"

- type: textarea
attributes:
label: Describe the bug
description: |
A clear and concise description of what the bug is. A bug is **unintended**. A feature not being implemented is **not a bug**.
placeholder: |
eg: Running aws-sdk-js-v2-to-v3 transform on provided input causes it to crash.
validations:
required: true

- type: textarea
attributes:
label: Steps to reproduce
description: |
The _minimal_ information needed to reproduce your issue (ideally provided input, and expected output).
placeholder: |
### Input
```ts
import AWS from "aws-sdk";
const region = "us-west-2";
const client = new AWS.DynamoDB({ region });
const response = await client.listTables({}).promise();
```
### Observed Output
```ts
```
### Expected Output
```ts
import { DynamoDB } from "@aws-sdk/client-dynamodb";
const region = "us-west-2";
const client = new DynamoDB({ region });
const response = await client.listTables({});
```
validations:
required: true

- type: textarea
attributes:
label: Environment
render: shell
description: |
Run `node -v` and `jscodeshift -v` and paste the result into the form
placeholder: |
node version: v16.14.0
jscodeshift: 0.13.1
- babel: 7.17.5
- babylon: 7.17.3
- flow: 0.172.0
- recast: 0.20.5
validations:
required: true

- type: textarea
attributes:
label: Additional context
description: |
Add any other context about the problem here. Or a screenshot if applicable.
50 changes: 50 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Feature Request
description: These issues are for **concrete and actionable proposals**. If you just have
a general problem that you would like to brainstorm, open a Discussion instead.
title: "[Feature]: "
labels: ["enhancement"]

body:
- type: checkboxes
id: selfservice
attributes:
label: Self-service
description: "Adding features is a great way to give back to open-source projects, and we're more than happy to answer questions and provide context."
options:
- label: "I'd be willing to implement this feature"

- type: textarea
attributes:
label: Provide a minimal code for which transform does not work
description: |
A clear and concise description along with the code snippet for which the transform does not work.
placeholder: |
```ts
import AWS from "aws-sdk";
const region = "us-west-2";
const client = new AWS.DynamoDB({ region });
const response = await client.listTables({}).promise();
```
validations:
required: true

- type: textarea
attributes:
label: Expected Output
description: |
The expected output of the provided code snippet.
placeholder: |
```ts
import { DynamoDB } from "@aws-sdk/client-dynamodb";
const region = "us-west-2";
const client = new DynamoDB({ region });
const response = await client.listTables({});
```
- type: textarea
attributes:
label: Additional context
description: |
Add any other context about the problem here. Or a screenshot if applicable.
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: build

on:
workflow_call:

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn
- run: yarn build
- run: yarn lint
- run: yarn test
9 changes: 9 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: pull_request

on:
pull_request:
branches: [main]

jobs:
call-build:
uses: ./.github/workflows/build.yml
35 changes: 35 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: push

on:
push:
branches: [main]

jobs:
call-build:
uses: ./.github/workflows/build.yml
release:
needs: call-build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: "16"

- name: Install Dependencies
run: yarn

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,11 @@ dist

# TernJS port file
.tern-port

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__testfixtures__
3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"printWidth": 100
}
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["arcanis.vscode-zipfs"]
}
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.rulers": [80, 120],
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
}
}
785 changes: 785 additions & 0 deletions .yarn/releases/yarn-3.2.0.cjs

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .yarn/sdks/integrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file is automatically generated by @yarnpkg/sdks.
# Manual changes might be lost!

integrations:
- vscode
3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.2.0.cjs
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
testMatch: ["**/*.spec.ts"]
};
65 changes: 60 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,65 @@
{
"name": "aws-sdk-js-codemod",
"version": "0.0.1",
"description": "Codemods for AWS SDK for JavaScript",
"main": "dist/index.js",
"repository": "[email protected]:trivikr/aws-sdk-js-codemod.git",
"author": "Kamat, Trivikram <[email protected]>",
"description": "Collection of codemod scripts that help update AWS SDK for JavaScript APIs",
"keywords": [
"jscodeshift",
"transform",
"aws",
"sdk",
"javascript",
"v2",
"v3",
"migration"
],
"homepage": "https://github.com/trivikr/aws-sdk-js-codemod",
"license": "MIT",
"private": false
"author": "Kamat, Trivikram <[email protected]>",
"files": [
"dist"
],
"main": "dist/index.js",
"repository": {
"type": "git",
"url": "https://github.com/trivikr/aws-sdk-js-codemod.git"
},
"scripts": {
"build": "tsc",
"lint": "eslint 'src/*.ts'",
"release": "yarn build && changeset publish",
"test": "jest",
"postinstall": "simple-git-hooks"
},
"dependencies": {
"jscodeshift": "0.13.1",
"jscodeshift-find-imports": "2.0.4"
},
"devDependencies": {
"@changesets/cli": "2.21.0",
"@tsconfig/node12": "1.0.2",
"@types/jest": "27.4.1",
"@types/jscodeshift": "0.11.3",
"@types/node": "16.11.26",
"@typescript-eslint/eslint-plugin": "5.13.0",
"@typescript-eslint/parser": "5.13.0",
"eslint": "8.10.0",
"eslint-plugin-simple-import-sort": "7.0.0",
"jest": "27.5.1",
"lint-staged": "12.3.4",
"prettier": "2.5.1",
"simple-git-hooks": "2.7.0",
"ts-jest": "27.1.3",
"typescript": "4.5.5"
},
"engines": {
"node": ">=12.0.0"
},
"packageManager": "[email protected]",
"lint-staged": {
"*.ts": [
"eslint --fix",
"prettier --write"
],
"*.{json,md}": "prettier --write"
}
}
3 changes: 3 additions & 0 deletions simple-git-hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pre-commit": "npx lint-staged"
}
5 changes: 5 additions & 0 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { answer } from "./index";

it("answer is 42", () => {
expect(answer).toBe(42);
});
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const answer = 42;
10 changes: 10 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "@tsconfig/node12/tsconfig.json",
"compilerOptions": {
"declaration": true,
"esModuleInterop": true,
"outDir": "dist",
"rootDir": "src"
},
"exclude": ["**/dist/**", "**/__tests__/**", "**/__testfixtures__/**"]
}
Loading

0 comments on commit 91ec885

Please sign in to comment.