From f2acaabe3a41d88b05e0d6adf7de8074fb8c613d Mon Sep 17 00:00:00 2001 From: Semyon Levin Date: Tue, 2 Mar 2021 22:00:54 +0300 Subject: [PATCH] Cleanup base files --- .eslintignore | 9 ++++----- .eslintrc.json | 3 +-- .gitignore | 18 ++++++------------ dist/index.js | 25 +++++++------------------ jest.config.js | 8 ++++---- package.json | 7 ++++--- tsconfig.app.json | 4 +--- tsconfig.json | 6 +----- yarn.lock | 5 +++++ 9 files changed, 33 insertions(+), 52 deletions(-) diff --git a/.eslintignore b/.eslintignore index 145978a4..7b0125d1 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,4 @@ -build/ -dist/ -node_modules/ -/*.js -/*.ts +* + +!src/ +!src/** diff --git a/.eslintrc.json b/.eslintrc.json index 6bbde50e..9bac4db8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -11,8 +11,7 @@ ], "parser": "@typescript-eslint/parser", "parserOptions": { - "ecmaVersion": 9, - "sourceType": "module", + "ecmaVersion": 2019, "project": "./tsconfig.json" }, "env": { diff --git a/.gitignore b/.gitignore index f9018658..c46949b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,4 @@ -log/ -*.log -hs_err_pid* -java_pid*.hprof - -# Maven: -target/ - -# Gradle: -build/ -build-cache/ -.gradle/ +/build # NodeJS /node_modules @@ -17,6 +6,11 @@ build-cache/ # Jest /coverage +log/ +*.log +hs_err_pid* +java_pid*.hprof + # Intellij /.idea/* !/.idea/.editorconfig diff --git a/dist/index.js b/dist/index.js index 2aafcc2e..7bc3c80b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -26,27 +26,16 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); const core = __importStar(__nccwpck_require__(186)); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -function run() { - return __awaiter(this, void 0, void 0, function* () { - try { - core.info('action logic'); - } - catch (error) { - core.setFailed(error); - } - }); +async function run() { + try { + core.info('action logic'); + } + catch (error) { + core.setFailed(error); + } } //noinspection JSIgnoredPromiseFromCall run(); diff --git a/jest.config.js b/jest.config.js index 1697cbd4..41485011 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,23 +1,23 @@ module.exports = { clearMocks: true, - moduleFileExtensions: ['js', 'ts'], + moduleFileExtensions: ['ts', 'js', 'mjs'], testEnvironment: 'node', testRunner: 'jest-circus/runner', transform: { '^.+\\.ts$': 'ts-jest' }, testMatch: [ - '**/*.spec.js', - '**/*.spec.ts', + '**/*.spec.(ts|js|mjs)', ], testPathIgnorePatterns: [ - '/node_modules/', '/build/', '/dist/', + '/node_modules/', ], collectCoverage: true, collectCoverageFrom: [ 'src/**', ], + errorOnDeprecated: true, verbose: true } diff --git a/package.json b/package.json index a7c4bb95..3f08c110 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,10 @@ }, "main": "dist/main.js", "scripts": { - "tsconfig-generate-app": "node tsconfig-generate-app", - "lint": "npm run tsconfig-generate-app && eslint --fix src/**/*.[jt]s", + "lint": "eslint --fix", "test": "jest --passWithNoTests", - "compile": "npm run lint && rimraf build && tsc --rootDir src --outDir build", + "tsconfig-generate-app": "node tsconfig-generate-app", + "compile": "npm run lint && rimraf build && node tsconfig-generate-app && tsc -project tsconfig.app.json --rootDir src --outDir build", "dist": "npm run compile && rimraf dist && ncc build build/main.js --out dist", "build": "npm run dist && npm run test" }, @@ -22,6 +22,7 @@ "@octokit/plugin-throttling": "3.4.1" }, "devDependencies": { + "@tsconfig/node12": "1.0.7", "@types/jest": "26.0.20", "@types/node": "14.14.31", "@typescript-eslint/eslint-plugin": "4.16.1", diff --git a/tsconfig.app.json b/tsconfig.app.json index 9569ce00..d9785deb 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -1,8 +1,7 @@ { "$schema": "https://json.schemastore.org/tsconfig", + "extends": "@tsconfig/node12/tsconfig.json", "compilerOptions": { - "target": "ES6", - "module": "CommonJS", "alwaysStrict": true, "strict": true, "strictNullChecks": true, @@ -17,7 +16,6 @@ "src/**/*.ts" ], "exclude": [ - "node_modules", "**/*.spec.*" ] } diff --git a/tsconfig.json b/tsconfig.json index 59b61013..5536bfdb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,7 @@ { "$schema": "https://json.schemastore.org/tsconfig", + "extends": "@tsconfig/node12/tsconfig.json", "compilerOptions": { - "target": "ES6", - "module": "CommonJS", "alwaysStrict": true, "strict": true, "strictNullChecks": true, @@ -16,8 +15,5 @@ }, "include": [ "src/**/*.ts" - ], - "exclude": [ - "node_modules" ] } diff --git a/yarn.lock b/yarn.lock index fb87dd8c..61412cd0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -675,6 +675,11 @@ dependencies: "@sinonjs/commons" "^1.7.0" +"@tsconfig/node12@1.0.7": + version "1.0.7" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.7.tgz#677bd9117e8164dc319987dd6ff5fc1ba6fbf18b" + integrity sha512-dgasobK/Y0wVMswcipr3k0HpevxFJLijN03A8mYfEPvWvOs14v0ZlYTR4kIgMx8g4+fTyTFv8/jLCIfRqLDJ4A== + "@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7": version "7.1.12" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.12.tgz#4d8e9e51eb265552a7e4f1ff2219ab6133bdfb2d"