Skip to content

Commit

Permalink
feat: Build hybryd
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman_Vasilev committed Apr 2, 2022
1 parent d00233f commit 43c3adc
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 40 deletions.
5 changes: 2 additions & 3 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
module.exports = {
extends: ['@commitlint/config-conventional'],



rules: {
'subject-case': [2, 'always', ['sentence-case']],
'scope-case': [2, 'always', ['lower-case', 'upper-case']],
'body-max-line-length': [1, 'never'],
'footer-max-line-length': [1, 'never'],
},
};
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
ecmaVersion: 2022,
project: 'tsconfig.json',
sourceType: 'module',
ecmaFeatures: {
Expand Down Expand Up @@ -81,6 +81,7 @@ module.exports = {
// typescript-eslint
'@typescript-eslint/no-floating-promises': 1,
'@typescript-eslint/no-unnecessary-condition': 1,
'@typescript-eslint/no-explicit-any': [1, { ignoreRestArgs: true }],
// sort-class-members
'sort-class-members/sort-class-members': [
1,
Expand Down
2 changes: 1 addition & 1 deletion .swcrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"jsc": {
"externalHelpers": true,
"keepClassNames": true,
"target": "es2019",
"target": "es2020",
"parser": {
"syntax": "typescript",
"tsx": false,
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021
Copyright (c) 2022

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ npm i -D stryker-cli @stryker-mutator/core @stryker-mutator/typescript @stryker-
npm i -D karma @types/karma karma-chrome-launcher karma-jasmine karma-coverage-istanbul-reporter karma-sourcemap-loader karma-webpack @types/jasmine
# setupmocha
npm i -D mocha @types/mocha c8
# ultra
npm install -g ultra-runner@latest
```

## TODO
Expand Down
12 changes: 12 additions & 0 deletions Taskfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ build_cp() {
set +x
}

build_hybrid() {
set -x
rm -rfv dist
npx tsup src/index.ts -d=dist/mjs --keep-names --format=esm --target=es2020 --external=reflect-metadata --sourcemap
npx tsup src/index.ts -d=dist/cjs --keep-names --format=cjs --target=es2020 --external=reflect-metadata --sourcemap
npx tsup src/index.ts -d=dist --dts-only
echo {\"type\": \"module\"} >dist/mjs/package.json
echo {\"type\": \"commonjs\"} >dist/cjs/package.json
cp -fv README.md LICENSE dist
cat package.json | jq "del(.type)" >dist/package.json
}

generate_liense() {
npx license-generator install MIT
}
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const getJestMappersFromTSConfig = require('tsconfig-paths-jest-mapper');

/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
testEnvironment: 'node',
setupFiles: ['<rootDir>/jest.setup.ts'],
Expand Down
54 changes: 26 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
"types": "index.d.ts",
"author": "2020",
"keywords": [],
"exports": {
".": {
"import": "./mjs/index.mjs",
"require": "./cjs/index.js"
}
},
"scripts": {
"test": "npm run eslint && npm run tscheck && npm run test:cov",
"test:p": "ultra test",
"test:r": "npm run mocha -- src/**/*.spec.ts",
"test:cov": "c8 --reporter text --exclude \"**/*.spec.ts\" --exclude \"**/testing/**\" npm run test:r -- --no-timeouts",
"test:w": "npm run test:r -- --watch-files src --watch",
Expand All @@ -27,64 +32,57 @@
"commit": "cz",
"semantic-release": "semantic-release",
"dev": "node node_modules/webpack-dev-server/bin/webpack-dev-server",
"build": "sh Taskfile build",
"bundle": "sh Taskfile bundle",
"build": "sh Taskfile build_hybrid",
"lint:w": "run-p tscheck:w eslint:w",
"test:m": "node node_modules/@stryker-mutator/core/bin/stryker run",
"mocha": "node -r @swc/register node_modules/mocha/bin/_mocha",
"mocha": "node -r tsconfig-paths/register -r @swc/register node_modules/mocha/bin/_mocha",
"test:d": "ndb -r @swc/register node_modules/mocha/bin/_mocha --no-timeouts --watch-files src/**/*.ts --watch src/**/*.spec.ts"
},
"ultra": {
"concurrent": [
"lint",
"test"
]
},
"config": {
"ghooks": {
"pre-commit": "precise-commits",
"commit-msg": "sh Taskfile commit_lint",
"pre-push": "ultra test"
"pre-push": "npm run test"
}
},
"devDependencies": {
"@commitlint/cli": "^16.1.0",
"@commitlint/config-conventional": "^16.0.0",
"@commitlint/cli": "16.2.3",
"@commitlint/config-conventional": "16.2.1",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"@swc/cli": "^0.1.55",
"@swc/core": "^1.2.137",
"@swc/helpers": "^0.3.2",
"@swc/jest": "^0.2.17",
"@swc/cli": "^0.1.57",
"@swc/core": "1.2.162",
"@swc/helpers": "0.3.8",
"@swc/jest": "0.2.20",
"@swc/register": "^0.1.10",
"@types/mocha": "^9.1.0",
"@types/node": "^17.0.16",
"@typescript-eslint/eslint-plugin": "^5.11.0",
"@typescript-eslint/parser": "^5.11.0",
"@types/node": "17.0.23",
"@typescript-eslint/eslint-plugin": "5.17.0",
"@typescript-eslint/parser": "5.17.0",
"c8": "^7.11.0",
"commitizen": "^4.2.4",
"conventional-changelog-conventionalcommits": "^4.6.3",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"eslint": "8.12.0",
"eslint-config-prettier": "8.5.0",
"eslint-import-resolver-node": "^0.3.6",
"eslint-plugin-etc": "^2.0.2",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-only-warn": "^1.0.3",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-regexp": "^1.5.1",
"eslint-plugin-regexp": "^1.6.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-sort-class-members": "^1.14.1",
"eslint-plugin-unicorn": "^40.1.0",
"eslint-plugin-unicorn": "42.0.0",
"eslint-plugin-wix-editor": "^3.3.0",
"expect": "^27.5.1",
"ghooks": "^2.0.4",
"git-branch-is": "^4.0.0",
"jest": "^27.5.1",
"mocha": "^9.2.0",
"mocha": "9.2.2",
"npm-run-all": "^4.1.5",
"precise-commits": "^1.0.2",
"prettier": "^2.5.1",
"prettier": "^2.6.1",
"reflect-metadata": "^0.1.13",
"remark": "^14.0.2",
"remark-cli": "^10.0.1",
Expand All @@ -95,8 +93,8 @@
"simplytyped": "^3.3.0",
"tsconfig-paths-jest-mapper": "^1.4.0",
"tslib": "^2.3.1",
"typescript": "^4.5.5",
"ultra-runner": "^3.10.5",
"tsup": "^5.12.2",
"typescript": "4.6.3",
"watchexec-bin": "^1.0.0"
}
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'reflect-metadata';

import { PlainObject } from 'simplytyped';
type PlainObject = Record<string, any>;

const dict: PlainObject = {};

Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"ts-node": {
"transpileOnly": true,
"transpiler": "ts-node/transpilers/swc-experimental"
"swc": true,
"transpileOnly": true
},
"compilerOptions": {
"target": "es2018",
"target": "ES2020",
"module": "commonjs",
"moduleResolution": "node",
"importHelpers": true,
Expand Down

0 comments on commit 43c3adc

Please sign in to comment.