From 59bf99d274c95e04ab34a4a3f8ac4fe99383dcb0 Mon Sep 17 00:00:00 2001 From: Daryl Ronningen Date: Tue, 6 Jul 2021 13:18:38 -0500 Subject: [PATCH] fix: istg typings better work --- package.json | 8 +++----- terser.js | 55 --------------------------------------------------- tsconfig.json | 11 ++++------- yarn.lock | 38 +---------------------------------- 4 files changed, 8 insertions(+), 104 deletions(-) delete mode 100644 terser.js diff --git a/package.json b/package.json index d564cd6..964b9c9 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "0.0.1", "description": "Discord API Wrapper", "license": "MIT", - "main": "dist/src/index.js", - "types": "dist/src/index.d.ts", + "main": "dist/index.js", + "types": "dist/index.d.ts", "repository": "https://code.relms.dev/NeonJS/library", "bugs": "https://code.relms.dev/NeonJS/library/issues", "homepage": "https://code.relms.dev/NeonJS/library/src/branch/master/README.md", @@ -26,7 +26,7 @@ "dist/*" ], "scripts": { - "build": "tsc && node terser.js", + "build": "tsc", "commit": "cz", "lint": "eslint --format=pretty src", "postinstall": "husky install", @@ -39,7 +39,6 @@ "async": "^3.2.0", "form-data": "^4.0.0", "node-fetch": "^2.6.1", - "tslib": "^2.3.0", "ws": "^7.5.2" }, "devDependencies": { @@ -83,7 +82,6 @@ "semantic-release": "^17.4.4", "sinon": "^11.1.1", "source-map-support": "^0.5.19", - "terser": "^5.7.1", "ts-node": "^10.0.0", "tsconfig-paths": "^3.9.0", "typescript": "^4.3.5" diff --git a/terser.js b/terser.js deleted file mode 100644 index fcff75c..0000000 --- a/terser.js +++ /dev/null @@ -1,55 +0,0 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ -const { minify } = require('terser'); -const { readFile, readdir, writeFile, stat, mkdir, rm } = require('fs'); -const { resolve, sep, dirname } = require('path'); - -const walk = function(dir, done) { - let results = []; - readdir(dir, function(err, list) { - if(err) return done(err); - let pending = list.length; - if(!pending) return done(null, results); - list.forEach(function(file) { - file = resolve(dir, file); - stat(file, function(err, stat) { - if(stat && stat.isDirectory()) { - walk(file, function(err, res) { - results = results.concat(res); - if(!--pending) done(null, results); - }); - } else { - results.push(file); - if(!--pending) done(null, results); - } - }); - }); - }); -}; - -walk('dist', (err, files) => { - if(err) throw err; - - files.forEach((file) => { - if(file.endsWith('js')) { - readFile(file, async (err, fileBuf) => { - if(err) throw err; - - const minifyCode = (await minify(fileBuf.toString('utf8'), { ecma: 5, compress: true, mangle: false })).code; - - writeFile(file, minifyCode, { encoding: 'utf8' }, (err) => { - if(err && err.message.includes('ENOENT')) { - mkdir(`dist/${dirname(file).split(sep).pop()}`, (err) => { - if(err) throw err; - }); - - writeFile(file, minifyCode, { encoding: 'utf8' }, (err) => { - if(err) throw err; - }); - } else if(err) { - throw err; - } - }); - }); - } - }); -}); diff --git a/tsconfig.json b/tsconfig.json index 457bdfa..48415c0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,19 +1,15 @@ { "compilerOptions": { "declaration": true, - "composite": true, - "tsBuildInfoFile": ".tsbuildinfo", "downlevelIteration": true, - "importHelpers": true, - "incremental": true, "lib": [ "ESNext", "DOM" ], "module": "CommonJS", "outDir": "dist", - "removeComments": true, - "target": "ES2015", + "removeComments": false, + "target": "ES2019", "alwaysStrict": true, "noImplicitAny": true, "noImplicitThis": true, @@ -45,7 +41,8 @@ "noEmitOnError": false, "preserveConstEnums": true, "traceResolution": false, - "moduleResolution": "Node" + "moduleResolution": "Node", + "baseUrl": "." }, "include": [ "src/**/*.ts" diff --git a/yarn.lock b/yarn.lock index 93d0576..94b1499 100644 --- a/yarn.lock +++ b/yarn.lock @@ -581,10 +581,8 @@ __metadata: semantic-release: ^17.4.4 sinon: ^11.1.1 source-map-support: ^0.5.19 - terser: ^5.7.1 ts-node: ^10.0.0 tsconfig-paths: ^3.9.0 - tslib: ^2.3.0 typescript: ^4.3.5 utf-8-validate: ^5.0.5 ws: ^7.5.2 @@ -2452,13 +2450,6 @@ __metadata: languageName: node linkType: hard -"commander@npm:^2.20.0": - version: 2.20.3 - resolution: "commander@npm:2.20.3" - checksum: ab8c07884e42c3a8dbc5dd9592c606176c7eb5c1ca5ff274bcf907039b2c41de3626f684ea75ccf4d361ba004bbaff1f577d5384c155f3871e456bdf27becf9e - languageName: node - linkType: hard - "commander@npm:^7.2.0": version: 7.2.0 resolution: "commander@npm:7.2.0" @@ -7678,7 +7669,7 @@ fsevents@~2.3.2: languageName: node linkType: hard -"source-map-support@npm:^0.5.17, source-map-support@npm:^0.5.19, source-map-support@npm:~0.5.19": +"source-map-support@npm:^0.5.17, source-map-support@npm:^0.5.19": version: 0.5.19 resolution: "source-map-support@npm:0.5.19" dependencies: @@ -7702,13 +7693,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"source-map@npm:~0.7.2": - version: 0.7.3 - resolution: "source-map@npm:0.7.3" - checksum: cd24efb3b8fa69b64bf28e3c1b1a500de77e84260c5b7f2b873f88284df17974157cc88d386ee9b6d081f08fdd8242f3fc05c953685a6ad81aad94c7393dedea - languageName: node - linkType: hard - "spawn-error-forwarder@npm:~1.0.0": version: 1.0.0 resolution: "spawn-error-forwarder@npm:1.0.0" @@ -8105,19 +8089,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"terser@npm:^5.7.1": - version: 5.7.1 - resolution: "terser@npm:5.7.1" - dependencies: - commander: ^2.20.0 - source-map: ~0.7.2 - source-map-support: ~0.5.19 - bin: - terser: bin/terser - checksum: 9354af5c22ade95004c103893606968cbd5390824c9d89df540f9e578c6e6559a5e9c56a1bf23ed055cdb61c60defdbc2c29e773514f9f2fbc7fd7ed335f1f58 - languageName: node - linkType: hard - "test-exclude@npm:^6.0.0": version: 6.0.0 resolution: "test-exclude@npm:6.0.0" @@ -8299,13 +8270,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"tslib@npm:^2.3.0": - version: 2.3.0 - resolution: "tslib@npm:2.3.0" - checksum: 8869694c26e4a7b56d449662fd54a4f9ba872c889d991202c74462bd99f10e61d5bd63199566c4284c0f742277736292a969642cc7b590f98727a7cae9529122 - languageName: node - linkType: hard - "tsutils@npm:^3.21.0": version: 3.21.0 resolution: "tsutils@npm:3.21.0"