Skip to content

Commit

Permalink
Add TypeScript support. Drop support for Node 10 and 12. (#584)
Browse files Browse the repository at this point in the history
* TS conversion part 1 (#564)

* TS Part 2 (#565)

* Bump prismjs from 1.25.0 to 1.27.0 in /website (#562)

Bumps [prismjs](https://github.com/PrismJS/prism) from 1.25.0 to 1.27.0.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](PrismJS/prism@v1.25.0...v1.27.0)

---
updated-dependencies:
- dependency-name: prismjs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* TS Part 2

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ts part 3 (#566)

* Ts part 5 (#567)

* ts part 3

* part 5

* Ts part 6 (#568)

* ts part 3

* part 5

* Imports

* Round 7 (#569)

* severity (#570)

* Convert more files (#571)

* Ts part 10 (#572)

* Update .gitignore

* Part 10

* Part 11 (#573)

* TS Part 12 (#574)

* Accept current state for ESLint (#575)

* Ts part  14 (#576)

* Update esbuild.config.js

* Add @types/node

* Reporter

* Update tsconfig.json

* Tests

* Define more types

* Add build to github workflows

* Update tsconfig.json

* Bump some deps and rule file path for different file systems (#577)

* TS part 16 (#578)

* file name formats

* lint issues

* Update ci.yml

* Ts part 16 (#580)

* file name formats

* lint issues

* Update ci.yml

* Move docs folder to website

* Delete Footer.js

* Delete help.js

* Delete index.js

* Delete versions.js

* Convert to v2 config

* Update languages.js

* Create .gitignore

* Upgrade to v2 of docusaurus

* Delete versioned docs

* Delete main.css

* Create styles.module.css

* Create index.js

* Create help.js

* Create custom.css

* Update sidebars.json

* Update docusaurus.config.js

* Update docusaurus.config.js

* Update types ref. Remove source from files directory (#582)

* Drop support for node 12 (#581)

* Add migration docs (#583)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
tclindner and dependabot[bot] authored Mar 5, 2022
1 parent 9a0ef3f commit ccd1514
Show file tree
Hide file tree
Showing 691 changed files with 13,737 additions and 30,399 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
website
coverage/
index.d.ts
dist/
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: ['eslint-config-tc', 'eslint-config-typescript-tc'],
rules: {
'no-prototype-builtins': 'off',
'unicorn/filename-case': 'off',
},
};
7 changes: 0 additions & 7 deletions .eslintrc.json

This file was deleted.

6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3.0.0
with:
node-version: '12.x'
node-version: '14'
- run: npm ci --no-progress
- run: npm run build
- run: npm run lint

test:
Expand All @@ -27,7 +28,7 @@ jobs:

strategy:
matrix:
node: [10, 12, 14]
node: [14, 16]
# TODO: Add windows-latest
os: [ubuntu-latest, macos-latest]

Expand All @@ -38,4 +39,5 @@ jobs:
with:
node-version: ${{ matrix.node }}
- run: npm ci --no-progress
- run: npm run build
- run: npm run test:ci
3 changes: 2 additions & 1 deletion .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3.0.0
with:
node-version: '12.x'
node-version: '14'
registry-url: 'https://registry.npmjs.org'
- run: npm ci --no-progress --production
- run: npm run build
- run: npm version --no-push --no-git-tag-version --yes ${{ github.event.release.tag_name }}
- run: npm publish --tag next
env:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3.0.0
with:
node-version: '12.x'
node-version: '14'
registry-url: 'https://registry.npmjs.org'
- run: npm ci --no-progress --production
- run: npm run build
- run: npm version --no-push --no-git-tag-version --yes ${{ github.event.release.tag_name }}
- run: npm publish --tag latest
env:
Expand Down
28 changes: 2 additions & 26 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ coverage
# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

Expand Down Expand Up @@ -59,30 +53,12 @@ typings/
# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
# compile output
dist
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Node

* [Node.js](https://nodejs.org/) - v10.0.0+
* [Node.js](https://nodejs.org/) - v14.0.0+
* [npm](https://www.npmjs.com/) - v6.0.0+

## Install project dependencies
Expand Down
64 changes: 64 additions & 0 deletions esbuild.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* eslint-disable @typescript-eslint/no-var-requires, import/no-extraneous-dependencies */

const esbuild = require('esbuild');
// Automatically exclude all node_modules from the bundled version
const {nodeExternalsPlugin} = require('esbuild-node-externals');
const {readdirSync} = require('fs');
const path = require('path');

const rulesDirectory = path.join(__dirname, 'src', 'rules');
const bundle = true;
const minify = true;
const platform = 'node';
const sourcemap = true;
const target = 'node14';
const plugins = [nodeExternalsPlugin()];

readdirSync(rulesDirectory).forEach((file) => {
const ruleFilePath = path.join(rulesDirectory, file);
const beginIndex = 0;
const endIndex = -3;
const ruleFileNameWithoutExtension = file.slice(beginIndex, endIndex);

esbuild
.build({
entryPoints: [ruleFilePath],
outfile: `dist/rules/${ruleFileNameWithoutExtension}.js`,
bundle,
minify,
platform,
sourcemap: false,
target,
plugins,
})
// eslint-disable-next-line unicorn/no-process-exit
.catch(() => process.exit(1));
});

esbuild
.build({
entryPoints: ['./src/api.ts'],
outfile: 'dist/api.js',
bundle,
minify,
platform,
sourcemap,
target,
plugins,
})
// eslint-disable-next-line unicorn/no-process-exit
.catch(() => process.exit(1));

esbuild
.build({
entryPoints: ['./src/cli.ts'],
outfile: 'dist/cli.js',
bundle,
minify,
platform,
sourcemap,
target,
plugins,
})
// eslint-disable-next-line unicorn/no-process-exit
.catch(() => process.exit(1));
72 changes: 0 additions & 72 deletions index.d.ts

This file was deleted.

11 changes: 10 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const {defaults: tsjPreset} = require('ts-jest/presets');

module.exports = {
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js', '!src/cli.js'],
collectCoverageFrom: ['src/**/*.ts', '!src/cli.ts'],
coverageThreshold: {
global: {
branches: 97,
Expand All @@ -10,9 +13,15 @@ module.exports = {
statements: 99,
},
},
moduleFileExtensions: ['js', 'ts'],
restoreMocks: true,
resetMocks: true,
resetModules: true,
testEnvironment: 'node',
testPathIgnorePatterns: ['<rootDir>/node_modules/'],
transform: {
...tsjPreset.transform,
},
transformIgnorePatterns: ['/node_modules'],
testMatch: ['<rootDir>/**/*.test.(js|ts)'],
};
Loading

0 comments on commit ccd1514

Please sign in to comment.