Skip to content

Commit

Permalink
Convert module code from JS to TypeScript (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
mangs authored Jan 24, 2023
1 parent 9d0bf3a commit e5c0869
Show file tree
Hide file tree
Showing 22 changed files with 6,030 additions and 15,166 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/publishWorkflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ jobs:

# Task execution
- run: npm run validate:environment
- run: npm run build:only
- run: npm run build:vite
- run: npm run build:types
# - run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{ github.token }}
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/pullRequestWorkflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
# Task execution
- run: npm run validate:environment
- run: npm run validate:linting:eslint
- run: npm run lint:javascript
- run: npm run test:only
- run: npm run build:only
- run: npm run lint:typescript
- run: npm run test:unit
- run: npm run build:vite
- run: npm run build:types
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
.vscode
build
dist
jestCodeCoverage
node_modules
vitestCodeCoverage
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 2.0.0

- Convert code to TypeScript
- Convert code building from Rollup to Vite v4
- Convert unit testing from Jest to Vitest

## 1.0.0

- Initial package publish
31 changes: 19 additions & 12 deletions config/eslint/eslintConfig.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,47 @@
{
"root": true,
"extends": ["./config/eslint/eslintBaseConfig.json", "eslint-config-prettier"],
"extends": [
"./config/eslint/eslintBaseConfig.json",
"./config/eslint/eslintTypescriptConfig.json",
"eslint-config-prettier"
],
"env": {
"browser": false,
"node": true
},
"rules": {
"no-console": "off"
"no-console": "off",
"@typescript-eslint/lines-between-class-members": "off"
},

"overrides": [
{
"files": ["src/**/*.test.js"],
"extends": ["./config/eslint/eslintJestConfig.json"]
"files": ["src/*.mts"],
"rules": {
"import/extensions": "off"
}
},
{
"files": ["src/RollbarClient*.js"],
"files": ["src/RollbarClient*.mts"],
"env": {
"browser": true
},
"rules": {
"@typescript-eslint/unbound-method": "off",
"no-console": ["error", { "allow": ["debug", "error", "info", "warn"] }],
"unicorn/filename-case": ["error", { "case": "pascalCase" }]
}
},
{
"files": ["./src/**/*.test.js"],
"files": ["./src/**/*.test.mts"],
"parserOptions": {
"project": ["./tsconfig.test.json"]
},
"rules": {
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off",
"unicorn/filename-case": "off"
}
},
{
"files": ["./config/rollup/rollup.config.mjs"],
"rules": {
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }]
}
}
]
}
2 changes: 1 addition & 1 deletion config/eslint/eslintIgnore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dist
jestCodeCoverage
node_modules
vitestCodeCoverage
18 changes: 0 additions & 18 deletions config/eslint/eslintJestConfig.json

This file was deleted.

14 changes: 14 additions & 0 deletions config/eslint/eslintTypescriptConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json"]
},
"plugins": ["@typescript-eslint/eslint-plugin"],
"extends": [
"./eslintBaseConfig.json",
"eslint-config-airbnb-typescript/base",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"eslint-config-prettier"
]
}
25 changes: 0 additions & 25 deletions config/jest/jest.config.mjs

This file was deleted.

2 changes: 1 addition & 1 deletion config/prettier/prettierIgnore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dist
jestCodeCoverage
node_modules
vitestCodeCoverage
59 changes: 0 additions & 59 deletions config/rollup/rollup.config.mjs

This file was deleted.

29 changes: 29 additions & 0 deletions config/vite/vite.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/// <reference types="vitest" />

import { defineConfig } from 'vite'; // eslint-disable-line import/no-extraneous-dependencies -- this is a dev-only dependency
import { fileURLToPath } from 'node:url';

// eslint-disable-next-line import/no-default-export -- default export is a Vite requirement
export default defineConfig({
build: {
emptyOutDir: true,
lib: {
entry: fileURLToPath(new URL('/src/RollbarClient.mts', import.meta.url)),
fileName: 'RollbarClient',
formats: ['es'],
},
minify: 'esbuild',
modulePreload: false,
outDir: 'dist',
sourcemap: true,
target: 'modules',
},
test: {
clearMocks: true,
coverage: {
provider: 'c8',
reportsDirectory: './vitestCodeCoverage',
},
environment: 'happy-dom',
},
});
Loading

0 comments on commit e5c0869

Please sign in to comment.