From 6dfa144017e11943132fb13d648827a49b1811d2 Mon Sep 17 00:00:00 2001 From: John-Michael O'Brien Date: Tue, 1 Oct 2024 18:12:07 -0600 Subject: [PATCH 1/4] First cut at adding CI to the system --- .github/workflows/fmt-lint-test.yml | 56 +++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/fmt-lint-test.yml diff --git a/.github/workflows/fmt-lint-test.yml b/.github/workflows/fmt-lint-test.yml new file mode 100644 index 0000000..779a977 --- /dev/null +++ b/.github/workflows/fmt-lint-test.yml @@ -0,0 +1,56 @@ +name: Check the Program +run-name: Check the formatting and code +on: [push] +jobs: + prep: + runs-on: ubuntu-24.04 + container: + image: node:20 + steps: + - uses: actions/checkout@v4 + - name: Install the App + run: yarn install + shell: bash + - uses: actions/upload-artifact@v3 + with: + name: installed-app-${{ github.run_id }} + path: ${{ github.workspace }}/**/* + format: + runs-on: ubuntu-24.04 + container: + image: node:20 + needs: prep + steps: + - name: Get Installed App + uses: actions/download-artifact@v3 + with: + name: installed-app-${{ github.run_id }} + - name: Check the formatting + run: yarn run prettier --check + shell: bash + lint: + runs-on: ubuntu-24.04 + container: + image: node:20 + needs: prep + steps: + - name: Get Installed App + uses: actions/download-artifact@v3 + with: + name: installed-app-${{ github.run_id }} + - name: Lint the App + run: yarn lint + shell: bash + test: + runs-on: ubuntu-24.04 + container: + image: node:20 + needs: prep + steps: + - name: Get Installed App + uses: actions/download-artifact@v3 + with: + name: installed-app-${{ github.run_id }} + - name: Test the App + run: yarn test + shell: bash From 5f1745609bc37055132dd0462a070edc51b7a8dd Mon Sep 17 00:00:00 2001 From: John-Michael O'Brien Date: Tue, 1 Oct 2024 18:23:34 -0600 Subject: [PATCH 2/4] Second pass, all at once. --- .github/workflows/fmt-lint-test.yml | 44 ++++++----------------------- 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/.github/workflows/fmt-lint-test.yml b/.github/workflows/fmt-lint-test.yml index 779a977..6d14e65 100644 --- a/.github/workflows/fmt-lint-test.yml +++ b/.github/workflows/fmt-lint-test.yml @@ -2,55 +2,29 @@ name: Check the Program run-name: Check the formatting and code on: [push] jobs: - prep: + check: runs-on: ubuntu-24.04 container: image: node:20 steps: - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' - name: Install the App run: yarn install shell: bash - - uses: actions/upload-artifact@v3 - with: - name: installed-app-${{ github.run_id }} - path: ${{ github.workspace }}/**/* - format: - runs-on: ubuntu-24.04 - container: - image: node:20 - needs: prep - steps: - - name: Get Installed App - uses: actions/download-artifact@v3 - with: - name: installed-app-${{ github.run_id }} - name: Check the formatting run: yarn run prettier --check shell: bash - lint: - runs-on: ubuntu-24.04 - container: - image: node:20 - needs: prep - steps: - - name: Get Installed App - uses: actions/download-artifact@v3 - with: - name: installed-app-${{ github.run_id }} - name: Lint the App run: yarn lint shell: bash - test: - runs-on: ubuntu-24.04 - container: - image: node:20 - needs: prep - steps: - - name: Get Installed App - uses: actions/download-artifact@v3 - with: - name: installed-app-${{ github.run_id }} + - name: Build the App + run: yarn build + shell: bash - name: Test the App run: yarn test shell: bash From 3533ddcdd0b55450a5e3914c1e0392534928bb99 Mon Sep 17 00:00:00 2001 From: John-Michael O'Brien Date: Tue, 1 Oct 2024 18:30:10 -0600 Subject: [PATCH 3/4] Improved prettier and eslint * Give prettier full reign * Made eslint more aggressive --- .github/workflows/fmt-lint-test.yml | 2 +- .prettierignore | 1 + package.json | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/fmt-lint-test.yml b/.github/workflows/fmt-lint-test.yml index 6d14e65..ac82a3d 100644 --- a/.github/workflows/fmt-lint-test.yml +++ b/.github/workflows/fmt-lint-test.yml @@ -17,7 +17,7 @@ jobs: run: yarn install shell: bash - name: Check the formatting - run: yarn run prettier --check + run: yarn run prettier --check . shell: bash - name: Lint the App run: yarn lint diff --git a/.prettierignore b/.prettierignore index 7f99912..e7cf364 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,2 @@ specs/ccapi_*.json +.yarn/ diff --git a/package.json b/package.json index 1de28d9..e0e7b3b 100644 --- a/package.json +++ b/package.json @@ -50,9 +50,9 @@ "start": "node ./dist/src/index.js", "dev": "ts-node ./src/index.ts", "watch": "nodemon src/index.ts", - "lint": "eslint --max-warnings=0 ./src", + "lint": "eslint --max-warnings=0 ./src ./eslint.config.mjs ./jest.config.ts", "clean": "tsc --build --clean", - "fmt": "prettier --write src/.", + "fmt": "prettier --write .", "postinstall": "husky", "test": "jest" }, From c3d51b5ee6223ecb4e68f7bf6408a9212086650b Mon Sep 17 00:00:00 2001 From: John-Michael O'Brien Date: Tue, 1 Oct 2024 18:35:30 -0600 Subject: [PATCH 4/4] Format Pass: Making it right --- .github/workflows/fmt-lint-test.yml | 42 ++++++++++++++--------------- .github/workflows/lint-spec.yml | 27 +++++++++---------- CONTRIBUTING.md | 11 +++----- README.md | 2 +- eslint.config.mjs | 2 +- 5 files changed, 40 insertions(+), 44 deletions(-) diff --git a/.github/workflows/fmt-lint-test.yml b/.github/workflows/fmt-lint-test.yml index ac82a3d..ccd3a92 100644 --- a/.github/workflows/fmt-lint-test.yml +++ b/.github/workflows/fmt-lint-test.yml @@ -7,24 +7,24 @@ jobs: container: image: node:20 steps: - - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - cache: 'yarn' - - name: Install the App - run: yarn install - shell: bash - - name: Check the formatting - run: yarn run prettier --check . - shell: bash - - name: Lint the App - run: yarn lint - shell: bash - - name: Build the App - run: yarn build - shell: bash - - name: Test the App - run: yarn test - shell: bash + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "yarn" + - name: Install the App + run: yarn install + shell: bash + - name: Check the formatting + run: yarn run prettier --check . + shell: bash + - name: Lint the App + run: yarn lint + shell: bash + - name: Build the App + run: yarn build + shell: bash + - name: Test the App + run: yarn test + shell: bash diff --git a/.github/workflows/lint-spec.yml b/.github/workflows/lint-spec.yml index e1f0945..3470d83 100644 --- a/.github/workflows/lint-spec.yml +++ b/.github/workflows/lint-spec.yml @@ -1,4 +1,4 @@ -name: Vacuum open API linting +name: Vacuum open API linting run-name: Linting OpenAPI spec with Vacuum on: [push] jobs: @@ -6,16 +6,15 @@ jobs: runs-on: ubuntu-24.04 container: dshanley/vacuum:v0.13.1 steps: - - uses: actions/checkout@v4 - - name: Generate Vacuum HTML Reports - run: mkdir -p reports; for FILEPATH in specs/ccapi*.json; do FILE="$(echo $FILEPATH | cut -d '/' -f2 | cut -d '.' -f1)"; vacuum html-report "${FILEPATH}" "reports/report-${FILE}.html"; done - shell: bash - - name: Archive Vacuum HTML Reports - uses: actions/upload-artifact@v3 - with: - name: Vacuum HTML Reports - path: reports/*.html - - name: Lint with Vaccum - run: vacuum lint specs/ccapi* || true - shell: bash - + - uses: actions/checkout@v4 + - name: Generate Vacuum HTML Reports + run: mkdir -p reports; for FILEPATH in specs/ccapi*.json; do FILE="$(echo $FILEPATH | cut -d '/' -f2 | cut -d '.' -f1)"; vacuum html-report "${FILEPATH}" "reports/report-${FILE}.html"; done + shell: bash + - name: Archive Vacuum HTML Reports + uses: actions/upload-artifact@v3 + with: + name: Vacuum HTML Reports + path: reports/*.html + - name: Lint with Vaccum + run: vacuum lint specs/ccapi* || true + shell: bash diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3e5c04a..af6bcb0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,12 +42,11 @@ As you look to contribute here, please bear in mind our values, the 5 S's, and h - Stateless: Be adaptable. Be open minded, and willing to try new things. Be willing to iterate, and comfortable with getting started when things are still ambiguous. Be informed and passionate, but flexible - strong opinions, weakly held. - ## Reporting an Issue There are a few types of issues you can file here: -- bug: Something doesn't work the way it should? That's probably a bug. Please include a careful, step-by-step guide to reproducing the bug, if possible. If reproducing the bug is hard to do without access to your environment, leave a note to that effect and we'll try to reach out for a private and secure conversation. If you have a security-sensitive ticket that you don't want to file publicly, please email ***insert security email address here*** instead of opening a ticket. +- bug: Something doesn't work the way it should? That's probably a bug. Please include a careful, step-by-step guide to reproducing the bug, if possible. If reproducing the bug is hard to do without access to your environment, leave a note to that effect and we'll try to reach out for a private and secure conversation. If you have a security-sensitive ticket that you don't want to file publicly, please email **_insert security email address here_** instead of opening a ticket. - enhancement: Also known as Feature Requests, Enhancement tickets are for when you have something in mind that the Console Connect API Sandbox does not do but that you would like it to. Before filling out a feature request, we recommend you check our roadmap for features already planned.  If you don’t see it on there, go ahead and fill in a request.  Depending on your project and timelines, this may also be a great opportunity to try your hand at contributing to this project. @@ -55,7 +54,6 @@ There are a few types of issues you can file here: - feedback: Not quite a feature request or a bug, but not really a question either? Feel free to leave general feedback here. We don't guarantee we'll act on all feedback, but we'll certainly read it. - ## Writing Code If you've got a pet peeve you want fixed, or a great idea for something to improve, here's your best bet for fixing it! We recommend you file a ticket according to reporting an issue above so there's a record of exactly what you're looking to fix, but once that's done we follow a fairly standard fork -> merge request model for community contributions. @@ -70,12 +68,11 @@ Once you're ready to start, here are the steps to follow: 1. Fork the repo into your own namespace. -2. Make a branch for your work. We recommend using the Github "Open Pull Request" button  +2. Make a branch for your work. We recommend using the Github "Open Pull Request" button 3. Fill out the pull request template according to the steps in it - we're not ultra strict here, but it helps make our review process smoother. -4. Once you're ready for review, remove the  - +4. Once you're ready for review, remove the ### What to expect from our code reviews @@ -87,7 +84,7 @@ Testing deserves a special callout. In general, we don't want merge requests to ## What if I just have a question? -Great! We'll do our best to answer, you can reach us by ***input link or email address or other method for open source community to use for asking questions***. +Great! We'll do our best to answer, you can reach us by **_input link or email address or other method for open source community to use for asking questions_**. ## Thanks! diff --git a/README.md b/README.md index 89d63aa..e45e815 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ cc-api-sandbox is a mock server for the Console Connect API. -*Please, be aware that this repo is under heavy development, and should be expected to change rapidly.* +_Please, be aware that this repo is under heavy development, and should be expected to change rapidly._ ## Installation diff --git a/eslint.config.mjs b/eslint.config.mjs index c0b5cf6..21384f4 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -70,7 +70,7 @@ export default tseslint.config( "@typescript-eslint/no-unsafe-argument": "off", "@typescript-eslint/no-unsafe-member-access": "off", "@typescript-eslint/no-unsafe-assignment": "off", - } + }, }, // And specific rules for test code {