-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from ty-ras/issue/12-update-to-2-0
#12 Updating the Koa server package to 2.0.0.
- Loading branch information
Showing
29 changed files
with
2,470 additions
and
901 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// ESLint config for formatting the resulting .d.ts files (<project name>/dist-ts/**/*.d.ts) that end up in NPM package for typing information. | ||
const { extends: extendsArray, plugins, rules } = require("./.eslintrc.cjs"); | ||
module.exports = { | ||
root: true, | ||
extends: extendsArray.filter((ext) => ext.startsWith("plugin:jsdoc/") || ext.startsWith("plugin:prettier/")), | ||
plugins: plugins.filter((plugin) => plugin === "jsdoc" || plugin === "prettier"), | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
project: "./tsconfig.out.json", | ||
sourceType: "module", | ||
ecmaVersion: "latest", | ||
tsconfigRootDir: __dirname, | ||
}, | ||
rules: Object.fromEntries(Object.entries(rules).filter(([ruleKey]) => ruleKey.startsWith("jsdoc/") || ruleKey.startsWith("prettier/"))), | ||
// So we won't get errors on comments disable e.g. @typescript-eslint/xyz rules. | ||
noInlineConfig: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// ESLint config for formatting the resulting .[m]js files (<project name>/dist-(cjs|mjs)/**/*.[m]js) that end up in NPM package. | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
"plugin:path-import-extension/recommended", | ||
"plugin:prettier/recommended", | ||
], | ||
plugins: [ | ||
"path-import-extension", | ||
"prettier" | ||
], | ||
parser: "@babel/eslint-parser", | ||
parserOptions: { | ||
requireConfigFile: false | ||
}, | ||
rules: { | ||
"prettier/prettier": "error", | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,6 @@ build | |
dist* | ||
coverage | ||
.yarn | ||
yarn-*.log | ||
*/.eslintrc*.cjs | ||
*/tsconfig*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require("fs"); | ||
const { version } = JSON.parse(fs.readFileSync("package.json")); | ||
fs.writeFileSync( | ||
"dist-cjs/package.json", | ||
// Just version is enough | ||
JSON.stringify({ version }) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require("fs"); | ||
const glob = require("glob"); | ||
|
||
glob | ||
// Find all CommonJS files | ||
.sync("dist-cjs/**/*.js") | ||
// Read their contents while remembering the file path | ||
.map((file) => ({ file, contents: fs.readFileSync(file, "utf8") })) | ||
// Check whether the contents match what is emitted by a file without anything runtime-living to export | ||
.filter(({ contents }) => contents === '"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\n') | ||
// Delete the files | ||
.map(({ file }) => fs.unlinkSync(file)) | ||
; | ||
|
||
glob | ||
// Find all ESM files | ||
.sync("dist-esm/**/*.js") | ||
// Read their contents while remembering the file path | ||
.map((file) => ({ file, contents: fs.readFileSync(file, "utf8") })) | ||
// Check whether the contents match what is emitted by a file without anything runtime-living to export | ||
.filter(({ contents }) => contents === 'export {};\n') | ||
// Delete the files | ||
.map(({ file }) => fs.unlinkSync(file)) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@ty-ras/server-koa", | ||
"version": "0.10.0", | ||
"version": "2.0.0", | ||
"author": { | ||
"name": "Stanislav Muhametsin", | ||
"email": "[email protected]", | ||
|
@@ -13,59 +13,76 @@ | |
}, | ||
"files": [ | ||
"./src", | ||
"./dist-mjs", | ||
"./dist-ts", | ||
"./dist-esm", | ||
"./dist-cjs", | ||
"README.md", | ||
"LICENSE.txt" | ||
], | ||
"type": "module", | ||
"main": "./dist-cjs/index.js", | ||
"module": "./dist-mjs/index.mjs", | ||
"types": "./src/index.ts", | ||
"module": "./dist-esm/index.js", | ||
"types": "./dist-ts/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./src/index.ts", | ||
"import": "./dist-mjs/index.mjs", | ||
"types": "./dist-ts/index.d.ts", | ||
"import": "./dist-esm/index.js", | ||
"require": "./dist-cjs/index.js" | ||
} | ||
}, | ||
"dependencies": { | ||
"@ty-ras/server": "0.10.1", | ||
"@ty-ras/endpoint-prefix": "0.10.1" | ||
}, | ||
"peerDependencies": { | ||
"koa": "^2.13.4" | ||
"koa": "^2.14.2" | ||
}, | ||
"dependencies": { | ||
"@ty-ras/server": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.19.3", | ||
"@babel/eslint-parser": "7.19.1", | ||
"@types/koa": "2.13.5", | ||
"@types/node": "18.7.18", | ||
"@typescript-eslint/eslint-plugin": "5.38.0", | ||
"@typescript-eslint/parser": "5.38.0", | ||
"@ty-ras/server-test-support": "0.10.5", | ||
"ava": "4.3.3", | ||
"@ava/get-port": "2.0.0", | ||
"c8": "7.12.0", | ||
"eslint": "8.23.1", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"eslint-plugin-sonarjs": "0.15.0", | ||
"koa": "2.13.4", | ||
"prettier": "2.7.1", | ||
"raw-body": "2.5.1", | ||
"@babel/core": "7.22.10", | ||
"@babel/eslint-parser": "7.22.10", | ||
"@ty-ras/server-test-support": "2.0.0", | ||
"@typescript-eslint/eslint-plugin": "6.3.0", | ||
"@typescript-eslint/parser": "6.3.0", | ||
"@types/koa": "2.13.8", | ||
"@types/node": "18.16.3", | ||
"@types/node-forge": "1.3.4", | ||
"ava": "5.3.1", | ||
"c8": "8.0.1", | ||
"eslint": "8.47.0", | ||
"eslint-plugin-jsdoc": "46.4.6", | ||
"eslint-plugin-path-import-extension": "0.9.0", | ||
"eslint-plugin-type-only-import": "0.9.0", | ||
"eslint-config-prettier": "9.0.0", | ||
"eslint-plugin-prettier": "5.0.0", | ||
"eslint-plugin-sonarjs": "0.20.0", | ||
"koa": "2.14.2", | ||
"madge": "6.1.0", | ||
"node-forge": "1.3.1", | ||
"prettier": "3.0.1", | ||
"ts-node": "10.9.1", | ||
"typescript": "4.8.3" | ||
"typescript": "5.1.6" | ||
}, | ||
"scripts": { | ||
"build:run": "yarn run lint && yarn run tsc", | ||
"build:ci": "yarn run clear-build-artifacts && yarn run tsc --outDir ./dist-mjs && yarn run rename-js-to-mjs && yarn run tsc --module CommonJS --outDir ./dist-cjs && yarn run format-output-files", | ||
"clear-build-artifacts": "rm -rf dist dist-cjs dist-mjs build", | ||
"format-output-files": "eslint --no-eslintrc --config '.eslintrc.output.cjs' --fix 'dist-cjs/*js' 'dist-mjs/*js'", | ||
"lint": "eslint ./src --ext .ts,.tsx", | ||
"rename-js-to-mjs": "find dist-mjs -name '*.js' -type f -exec sh -c 'for f in \"$@\"; do mv -- \"$f\" \"${f%.js}.mjs\"; done' -- {} +", | ||
"build:ci": "yarn run clear-build-artifacts && yarn run compile-d-ts-files && yarn run tsc --outDir ./dist-esm && yarn run tsc --module CommonJS --outDir ./dist-cjs && yarn run remove-empty-js-files && yarn run generate-stub-package-json-for-cjs && yarn run format-output-files", | ||
"clear-build-artifacts": "rm -rf dist dist-ts dist-cjs dist-esm build", | ||
"compile-d-ts-files": "yarn run tsc --removeComments false --emitDeclarationOnly --declaration --declarationDir ./dist-ts && yarn run tsc:plain --project tsconfig.out.json", | ||
"format-output-files": "yarn run format-output-files-ts && yarn run format-output-files-js", | ||
"format-output-files-ts": "eslint --no-eslintrc --config '.eslintrc.out-ts.cjs' --fix --fix-type layout './dist-ts/**/*.ts'", | ||
"format-output-files-js": "eslint --no-eslintrc --config '.eslintrc.out.cjs' --fix 'dist-cjs/**/*js' 'dist-esm/**/*js'", | ||
"generate-stub-package-json-for-cjs": "../scripts/generate-stub-package-json.cjs", | ||
"lint": "yarn run lint:eslint && yarn run lint:circular", | ||
"lint:circular": "madge --circular --no-color --no-spinner --extensions ts --warning ./src", | ||
"lint:eslint": "eslint ./src --ext .ts,.tsx", | ||
"remove-empty-js-files": "../scripts/remove-empty-js-files.cjs", | ||
"tsc": "tsc --project tsconfig.build.json", | ||
"test:coverage": "c8 ava", | ||
"test:run": "ava" | ||
"tsc:plain": "tsc", | ||
"test:coverage": "c8 --temp-directory /tmp ava", | ||
"test:run": "c8 --temp-directory /tmp --reporter text ava" | ||
}, | ||
"resolutions": { | ||
"detective-typescript": "11.1.0", | ||
"dependency-tree": "10.0.9", | ||
"precinct": "11.0.5" | ||
} | ||
} |
Oops, something went wrong.