Skip to content

Commit

Permalink
refactor: complete rewrite & upgrade all deps (#467)
Browse files Browse the repository at this point in the history
* refactor: use new project setup

- biome instead of eslint and prettier
- pnpm instead of yarn
- lint-staged and commitlint up-to-date
- update all dependencies

* refactor: complete rewrite with classes, better naming & better encapsulation

as a basis for additional fixes and features
  • Loading branch information
pantajoe committed Jun 2, 2024
1 parent 19124fb commit 39383cb
Show file tree
Hide file tree
Showing 69 changed files with 6,072 additions and 6,683 deletions.
8 changes: 0 additions & 8 deletions .editorconfig

This file was deleted.

56 changes: 0 additions & 56 deletions .eslintrc.js

This file was deleted.

32 changes: 0 additions & 32 deletions .github/dependabot.yml

This file was deleted.

10 changes: 10 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>pantajoe/.github",
"regexManagers:biomeVersions"
],
"ignorePaths": [
"**/node_modules/**"
]
}
42 changes: 21 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@ name: Continuous Integration

on: [push, pull_request]

env:
NODE_VERSION:

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository 🛎️
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get Node.js Version
id: nvm
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
- name: Setup pnpm 🏗
uses: pnpm/action-setup@v2
- name: Get Node.js Version 📖
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Setup Node.js 🏗
uses: actions/setup-node@v3.5.1
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Yarn Cache 📦
uses: actions/cache@v3.2.2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
uses: actions/setup-node@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: ${{ env.NODE_VERSION }}
cache: pnpm

- name: Install NPM Packages 👨🏻‍💻
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Run Biome 👀
run: pnpm run lint

- name: Check Types 🧐
run: pnpm run typecheck

- name: Run TS Compilation, ESLint, and Tests 👀
run: xvfb-run -a yarn test
- name: Run TS Compilation, Linter, and Tests 👀
run: xvfb-run -a pnpm run test
40 changes: 20 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ on:
release:
types: [published]

env:
NODE_VERSION:

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository 🛎️
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get Node.js Version
id: nvm
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
- name: Setup pnpm 🏗
uses: pnpm/action-setup@v2
- name: Get Node.js Version 📖
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Setup Node.js 🏗
uses: actions/setup-node@v3.5.1
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Yarn Cache 📦
uses: actions/cache@v3.2.2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
uses: actions/setup-node@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: ${{ env.NODE_VERSION }}
cache: pnpm

- name: Install NPM Packages 👨🏻‍💻
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Run Biome 👀
run: pnpm run lint

- name: Check Types 🧐
run: pnpm run typecheck

- name: Publish Extension to VS Code Marketplace 🚀
env:
Expand All @@ -42,4 +42,4 @@ jobs:
- name: Publish Extension to Open VSX Marketplace 🚀
env:
OVSX_TOKEN: ${{ secrets.OVSX_TOKEN }}
run: npx ovsx publish -p $OVSX_TOKEN --yarn
run: npx ovsx publish -p $OVSX_TOKEN
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
out
dist/
out/
node_modules
.vscode-test/
*.vsix

yarn-error.log

.envrc
.DS_Store

TODO
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit "$1"
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- lint-staged
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

9 changes: 0 additions & 9 deletions .prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 18.15.0
nodejs 20.13.0
15 changes: 8 additions & 7 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
Expand All @@ -24,12 +24,13 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
Expand Down
33 changes: 22 additions & 11 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
// Disable the default formatter, use biome instead
"prettier.enable": false,
"eslint.enable": false,
"deno.enable": false,

"biome.enabled": true,

"[jsonc]": {
"editor.defaultFormatter": "biomejs.biome"
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},

"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.format.enable": true
}
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
}
}
15 changes: 7 additions & 8 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"label": "Build",
"type": "shell",
"command": "pnpm",
"args": ["run", "compile"],
"group": {
"kind": "build",
"isDefault": true
}
},
"problemMatcher": [],
"detail": "tsc -p ./"
}
]
}
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.vscode/**
.vscode-test/**
out/test/**
dist/test/**
src/**
.gitignore
vsc-extension-quickstart.md
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

None.
### Changed

- Complete rewrite of the extension

## [0.8.3] - 2023-04-17

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Development Setup

* Run `yarn install` (Please use `yarn` and not `npm` for this one)
* Run `pnpm install` (Please use `pnpm` and not `npm` for this one)
* Open VS Code
* Run and debug the extension by launching the extension via the menu or by pressing F5

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2021 Joe Pantazidis
Copyright (c) 2020-2023 Joe Pantazidis

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit 39383cb

Please sign in to comment.