Skip to content

Commit

Permalink
feat: update for Node >=10
Browse files Browse the repository at this point in the history
BREAKING CHANGE: updates for Node >=10, no longer compatible with Node <10
  • Loading branch information
icopp committed Sep 12, 2020
1 parent ff2e0a7 commit 545be79
Show file tree
Hide file tree
Showing 10 changed files with 3,553 additions and 4,279 deletions.
11 changes: 0 additions & 11 deletions .babelrc

This file was deleted.

18 changes: 15 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"standard",
"plugin:unicorn/recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/babel",
"prettier/standard",
"prettier/unicorn",
"prettier/@typescript-eslint"
Expand All @@ -19,7 +19,19 @@
{
"files": ["*.test.ts", "__tests__/**/*.ts"],
"env": { "jest": true }
},
{
"files": ["webpack.config.js"],
"rules": {
"@typescript-eslint/no-var-requires": "off"
}
}
],
"rules": { "import/export": "off" }
"rules": {
"camelcase": "off",
"import/export": "off",
"no-redeclare": "off",
"unicorn/no-null": "off",
"unicorn/no-reduce": "off"
}
}
3 changes: 1 addition & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
"proseWrap": "always",
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5"
"tabWidth": 2
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"editor.formatOnSave": true,
"eslint.validate": [
"javascript",
Expand Down
83 changes: 42 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
"dist"
],
"engines": {
"node": ">=4"
"node": ">=10"
},
"scripts": {
"lint": "eslint \"src/**/*.ts\"",
"lint": "eslint --ext js,ts src",
"test": "jest",
"prebuild": "tsc --emitDeclarationOnly",
"build": "parcel build --experimental-scope-hoisting -t node src/index.ts",
"prepublishOnly": "run-s build",
"build": "run-s build:*",
"build:1-clean": "rimraf dist",
"build:2-declarations": "tsc --emitDeclarationOnly",
"build:3-webpack": "webpack",
"prepublishOnly": "run-s build:*",
"semantic-release": "semantic-release"
},
"husky": {
Expand All @@ -32,7 +34,7 @@
}
},
"lint-staged": {
".{babelrc,eslintrc,prettierrc}": [
".{eslintrc,prettierrc}": [
"prettier --write",
"git add"
],
Expand All @@ -47,48 +49,47 @@
]
},
"devDependencies": {
"@babel/core": "^7.7.0",
"@babel/plugin-proposal-class-properties": "^7.7.0",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@semantic-release/changelog": "^3.0.0",
"@semantic-release/commit-analyzer": "^6.3.0",
"@semantic-release/git": "^7.0.0",
"@semantic-release/github": "^5.5.0",
"@semantic-release/npm": "^5.3.0",
"@semantic-release/release-notes-generator": "^7.3.0",
"@types/ffi": "^0.2.0",
"@types/jest": "^24.0.0",
"@types/ref": "^0.0.28",
"@types/yargs": "^13.0.0",
"@typescript-eslint/eslint-plugin": "^2.12.0",
"@typescript-eslint/parser": "^2.12.0",
"babel-eslint": "^10.0.0",
"eslint": "^6.7.0",
"eslint-config-prettier": "^6.7.0",
"@commitlint/cli": "^9.1.0",
"@commitlint/config-conventional": "^9.1.0",
"@semantic-release/changelog": "^5.0.0",
"@semantic-release/commit-analyzer": "^8.0.0",
"@semantic-release/git": "^9.0.0",
"@semantic-release/github": "^7.1.0",
"@semantic-release/npm": "^7.0.0",
"@semantic-release/release-notes-generator": "^9.0.0",
"@types/ffi-napi": "^2.4.0",
"@types/jest": "^26.0.0",
"@types/ref-napi": "^1.4.0",
"@types/yargs": "^15.0.0",
"@typescript-eslint/eslint-plugin": "^4.1.0",
"@typescript-eslint/parser": "^4.1.0",
"eslint": "^7.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.19.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.0",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-unicorn": "^14.0.0",
"husky": "^3.1.0",
"jest": "^24.9.0",
"lint-staged": "^9.5.0",
"eslint-plugin-unicorn": "^21.0.0",
"husky": "^4.3.0",
"jest": "^26.4.0",
"lint-staged": "^10.3.0",
"npm-run-all": "^4.1.0",
"parcel-bundler": "^1.12.0",
"prettier": "^1.19.0",
"semantic-release": "^15.13.0",
"ts-jest": "^24.2.0",
"ts-node": "^8.5.0",
"typescript": "^3.7.0"
"prettier": "^2.1.0",
"rimraf": "^3.0.2",
"semantic-release": "^17.1.0",
"ts-jest": "^26.3.0",
"ts-loader": "^8.0.3",
"ts-node": "^9.0.0",
"typescript": "^4.0.0",
"webpack": "^5.0.0-beta.30",
"webpack-cli": "^3.3.12"
},
"dependencies": {
"core-js": "^3.6.0",
"ffi": "^2.3.0",
"ref": "^1.3.0",
"regenerator-runtime": "0.13.0"
"ffi-napi": "^3.0.0",
"ref-napi": "^3.0.0",
"regenerator-runtime": "^0.13.0"
},
"release": {
"plugins": [
Expand Down
2 changes: 0 additions & 2 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */

export enum Platform {
AIX = 'aix',
Android = 'android',
Expand Down
8 changes: 4 additions & 4 deletions src/lib/util/get-windows-known-folder-path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import parseWindowsGuid from './parse-windows-guid'
// them more than one in any way makes all tests fail with `RangeError`s. To
// work around that we use a dummy instead if it's not Windows.

const ffi: typeof import('ffi') =
os.platform() === Platform.Windows ? require('ffi') : {}
const ffi: typeof import('ffi-napi') =
os.platform() === Platform.Windows ? require('ffi-napi') : {}

// eslint-disable-next-line unicorn/prevent-abbreviations
const ref: typeof import('ref') =
os.platform() === Platform.Windows ? require('ref') : {}
const ref: typeof import('ref-napi') =
os.platform() === Platform.Windows ? require('ref-napi') : {}

const shell32: {
/**
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"target": "es5",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"downlevelIteration": true,
"esModuleInterop": true,
"declaration": true,
"outDir": "dist",
"sourceMap": true,
"declarationDir": "dist",

"alwaysStrict": true,
Expand Down
27 changes: 27 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var path = require('path')

module.exports = {
entry: path.resolve(__dirname, 'src', 'index.ts'),
devtool: 'inline-source-map',
target: 'node',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
},
mode: 'production',
optimization: {
usedExports: true,
},
}
Loading

0 comments on commit 545be79

Please sign in to comment.