Archived
0
0
Fork 0

chore: lots of small nits

This commit is contained in:
Daryl Ronningen 2021-07-05 17:06:11 -05:00
parent 786a90fb7d
commit 5c5799546f
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B
28 changed files with 799 additions and 3606 deletions

87
.eslintrc Normal file
View file

@ -0,0 +1,87 @@
{
"root": true,
"env": {
"es2021": true,
"node": true,
"commonjs": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"unicorn"
],
"rules": {
// Base Eslint Rules
"indent": [
"error",
"tab",
{
"SwitchCase": 1,
"CallExpression": {
"arguments": 1
}
}
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"eol-last": [
"error",
"always"
],
"object-curly-spacing": [
"error",
"always"
],
"default-case": "error",
"comma-dangle": [
"error",
"always-multiline"
],
"no-case-declarations": "off",
"camelcase": "off",
// TypeScript Rules
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "default",
"format": [
"camelCase"
]
}
],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "explicit"
}
],
// Unicorn Rules
"unicorn/filename-case": [
"error",
{
"case": "camelCase"
}
]
},
"reportUnusedDisableDirectives": true
}

4
.gitignore vendored
View file

@ -674,6 +674,4 @@ DerivedData/
# ---> Project
!.yarn/releases
.size-snapshot.json
stats.html
types
types

8
.idea/.gitignore vendored
View file

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -1,216 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</value>
</option>
<option name="LINE_SEPARATOR" value="&#10;" />
<option name="SOFT_MARGINS" value="80,120" />
<CssCodeStyleSettings>
<option name="HEX_COLOR_UPPER_CASE" value="true" />
<option name="HEX_COLOR_LONG_FORMAT" value="true" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="ENFORCE_QUOTES_ON_FORMAT" value="true" />
</CssCodeStyleSettings>
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="upper" />
<option name="FUNCTION_CASE" value="upper" />
<option name="PARAMETER_CASE" value="upper" />
<option name="DATATYPE_CASE" value="upper" />
<option name="OBJECT_CASE" value="upper" />
</case-options>
<formatting-settings enabled="true" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="upper" />
<option name="FUNCTION_CASE" value="upper" />
<option name="PARAMETER_CASE" value="upper" />
<option name="DATATYPE_CASE" value="upper" />
<option name="OBJECT_CASE" value="upper" />
</case-options>
<formatting-settings enabled="true">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
<HTMLCodeStyleSettings>
<option name="HTML_UNIFORM_INDENT" value="true" />
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
<option name="HTML_DO_NOT_INDENT_CHILDREN_OF" value="" />
</HTMLCodeStyleSettings>
<JSCodeStyleSettings version="0">
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACKETS" value="true" />
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
<option name="IMPORT_SORT_MODULE_NAME" value="true" />
<option name="BLACKLIST_IMPORTS" value="" />
<option name="IMPORT_PREFER_ABSOLUTE_PATH" value="TRUE" />
</JSCodeStyleSettings>
<Markdown>
<option name="MAX_LINES_AROUND_HEADER" value="0" />
<option name="MAX_LINES_AROUND_BLOCK_ELEMENTS" value="0" />
<option name="MAX_LINES_BETWEEN_PARAGRAPHS" value="0" />
</Markdown>
<ScssCodeStyleSettings>
<option name="HEX_COLOR_UPPER_CASE" value="true" />
<option name="HEX_COLOR_LONG_FORMAT" value="true" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="ENFORCE_QUOTES_ON_FORMAT" value="true" />
</ScssCodeStyleSettings>
<SqlCodeStyleSettings version="5">
<option name="DISABLE_FORMATTING" value="true" />
<option name="KEYWORD_CASE" value="2" />
<option name="IDENTIFIER_CASE" value="1" />
</SqlCodeStyleSettings>
<TypeScriptCodeStyleSettings version="0">
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACKETS" value="true" />
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
<option name="USE_PUBLIC_MODIFIER" value="true" />
<option name="PREFER_AS_TYPE_CAST" value="true" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
<option name="IMPORT_SORT_MODULE_NAME" value="true" />
<option name="BLACKLIST_IMPORTS" value="" />
<option name="IMPORT_PREFER_ABSOLUTE_PATH" value="TRUE" />
</TypeScriptCodeStyleSettings>
<codeStyleSettings language="CSS">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<NAME>.*</NAME>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="HTML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JSON">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="SPACE_BEFORE_IF_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_WHILE_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_FOR_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_CATCH_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_SWITCH_PARENTHESES" value="false" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Markdown">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="SASS">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="SCSS">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<NAME>.*</NAME>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="SQL">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="SPACE_BEFORE_IF_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_WHILE_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_FOR_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_CATCH_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_SWITCH_PARENTHESES" value="false" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Vue">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

View file

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
</component>
</project>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8" />
</project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GraphQLSettings">
<option name="enableRelayModernFrameworkSupport" value="true" />
</component>
</project>

View file

@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<file url="file://$PROJECT_DIR$" libraries="{ArgonLibrary/node_modules}" />
<file url="PROJECT" libraries="{ArgonLibrary/node_modules}" />
<includedPredefinedLibrary name="Node.js Core" />
</component>
</project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EslintConfiguration">
<option name="fix-on-save" value="true" />
</component>
</project>

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectResources">
<xml-schema-version>XMLSchema_1_1</xml-schema-version>
</component>
</project>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ArgonLibrary.iml" filepath="$PROJECT_DIR$/.idea/ArgonLibrary.iml" />
</modules>
</component>
</project>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="StylelintConfiguration" allowJS="true" />
</project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

2
.nvmrc
View file

@ -1 +1 @@
lts/fermium
lts/fermium

11
.nycrc
View file

@ -2,6 +2,11 @@
"extends": "@istanbuljs/nyc-config-typescript",
"all": true,
"check-coverage": true,
"include": ["src/lib/**/*.ts"],
"reporter": ["html", "text"]
}
"include": [
"src/lib/**/*.ts"
],
"reporter": [
"html",
"text"
]
}

View file

@ -1,30 +1,53 @@
{
"branches": ["stable"],
"branches": [
"stable"
],
"repositoryUrl": "https://code.relms.dev/NeonJS/library",
"ci": true,
"plugins": [
["@semantic-release/commit-analyzer", {
"preset": "conventional-changelog",
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
[
"@semantic-release/commit-analyzer",
{
"preset": "conventional-changelog",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES"
]
}
}
}],
["@semantic-release/release-notes-generator", {
"preset": "conventional-changelog",
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventional-changelog",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES"
]
}
}
}],
],
"@semantic-release/changelog",
["@semantic-release/npm", {
"tarballDir": "dist"
}],
["@saithodev/semantic-release-gitea", {
"assets": "dist/*.tgz"
}],
["@semantic-release/git", {
"message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}",
"assets": false
}]
[
"@semantic-release/npm",
{
"tarballDir": "dist"
}
],
[
"@saithodev/semantic-release-gitea",
{
"assets": "dist/*.tgz"
}
],
[
"@semantic-release/git",
{
"message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}",
"assets": false
}
]
]
}
}

File diff suppressed because one or more lines are too long

View file

@ -1,13 +1,13 @@
nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"
yarnPath: .yarn/releases/yarn-sources.cjs

View file

@ -23,11 +23,10 @@
"node": ">=14.*"
},
"files": [
"dist/index.js",
"types/*"
"dist/*"
],
"scripts": {
"build": "rollup -c --compact",
"build": "tsc && node terser.js",
"commit": "cz",
"postinstall": "husky install",
"prepublishOnly": "pinst --disable",
@ -35,14 +34,15 @@
"release": "semantic-release"
},
"dependencies": {
"tslib": "^2.3.0"
"node-fetch": "^2.6.1",
"tslib": "^2.3.0",
"ws": "^7.5.2"
},
"devDependencies": {
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"@commitlint/cz-commitlint": "^12.1.4",
"@istanbuljs/nyc-config-typescript": "^1.0.1",
"@rollup/plugin-strip": "^2.0.1",
"@saithodev/semantic-release-gitea": "^2.1.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/commit-analyzer": "^8.0.1",
@ -53,11 +53,11 @@
"@types/eslint": "^7.2.13",
"@types/mocha": "^8.2.2",
"@types/node": "^15.14.0",
"@types/rollup-plugin-progress": "^1.1.0",
"@types/rollup-plugin-size-snapshot": "^0.10.0",
"@types/semantic-release": "^17",
"@types/node-fetch": "^2.5.10",
"@types/semantic-release": "^17.2.0",
"@types/sinon": "^10.0.2",
"@types/source-map-support": "^0.5.3",
"@types/ws": "^7.4.6",
"@typescript-eslint/eslint-plugin": "^4.28.1",
"@typescript-eslint/parser": "^4.28.1",
"@typescript-eslint/typescript-estree": "^4.28.1",
@ -66,6 +66,7 @@
"eslint": "^7.29.0",
"eslint-formatter-pretty": "^4.1.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-unicorn": "^34.0.1",
"husky": "^7.0.0",
"inquirer": "^8.1.1",
"lint-staged": "^11.0.0",
@ -73,82 +74,19 @@
"nyc": "^15.1.0",
"pinst": "^2.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.52.7",
"rollup-plugin-analyzer": "^4.0.0",
"rollup-plugin-multi-input": "^1.3.1",
"rollup-plugin-progress": "^1.1.2",
"rollup-plugin-size-snapshot": "^0.12.0",
"rollup-plugin-sizes": "^1.0.4",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"rollup-plugin-visualizer": "^5.5.1",
"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"
},
"eslintConfig": {
"root": true,
"env": {
"es2021": true,
"node": true,
"commonjs": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"indent": [
"error",
"tab",
{
"SwitchCase": 1,
"CallExpression": {
"arguments": 1
}
}
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"eol-last": [
"error",
"always"
],
"object-curly-spacing": [
"error",
"always"
],
"default-case": "error",
"comma-dangle": [
"error",
"always-multiline"
],
"no-case-declarations": "off",
"@typescript-eslint/no-non-null-assertion": "off"
},
"reportUnusedDisableDirectives": true
"optionalDependencies": {
"bufferutil": "^4.0.3",
"erlpack": "^0.1.3",
"utf-8-validate": "^5.0.5",
"zlib-sync": "^0.1.7"
},
"lint-staged": {
"src/**/*": [
@ -165,4 +103,4 @@
"path": "@commitlint/cz-commitlint"
}
}
}
}

View file

@ -1,32 +0,0 @@
import { defineConfig } from 'rollup';
import analyze from 'rollup-plugin-analyzer';
import multiInput from 'rollup-plugin-multi-input';
import progress from 'rollup-plugin-progress';
import { sizeSnapshot } from 'rollup-plugin-size-snapshot';
import sizes from 'rollup-plugin-sizes';
import { terser } from 'rollup-plugin-terser';
import typescript from 'rollup-plugin-typescript2';
import visualizer from 'rollup-plugin-visualizer';
export default defineConfig({
input: [ 'src/index.ts' ],
output: [{
dir: 'dist/src',
format: 'cjs',
}],
plugins: [
typescript({ useTsconfigDeclarationDir: true }),
multiInput(),
progress(),
analyze(),
sizeSnapshot(),
sizes({
details: true,
}),
terser(),
visualizer({
gzipSize: true,
brotliSize: true,
}),
],
});

0
src/client/client.ts Normal file
View file

View file

@ -1,3 +0,0 @@
export default () => {
return 'Hello World';
};

55
terser.js Normal file
View file

@ -0,0 +1,55 @@
/* 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;
}
});
});
}
});
});

View file

@ -1,8 +1,8 @@
{
"compilerOptions": {
"declaration": true,
"declarationDir": "types",
"composite": true,
"tsBuildInfoFile": ".tsbuildinfo",
"downlevelIteration": true,
"importHelpers": true,
"incremental": true,
@ -10,7 +10,7 @@
"ESNext",
"DOM"
],
"module": "ESNext",
"module": "CommonJS",
"outDir": "dist",
"removeComments": true,
"target": "ESNext",
@ -44,14 +44,9 @@
"newLine": "lf",
"noEmitOnError": false,
"preserveConstEnums": true,
"traceResolution": false,
"baseUrl": ".",
"moduleResolution": "Node"
"traceResolution": false
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
]
}
}

3348
yarn.lock

File diff suppressed because it is too large Load diff