Skip to content

Commit

Permalink
Merge pull request #166 from technote-space/release/next-v0.1.15
Browse files Browse the repository at this point in the history
release: v0.2.0
  • Loading branch information
technote-space authored Apr 13, 2022
2 parents fd4620c + ad72e67 commit 1323f6a
Show file tree
Hide file tree
Showing 10 changed files with 1,009 additions and 2,126 deletions.
50 changes: 8 additions & 42 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"plugin:@typescript-eslint/eslint-recommended"
],
"plugins": [
"@typescript-eslint"
"@typescript-eslint",
"import"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand All @@ -30,29 +31,6 @@
"properties": "always"
}
],
"require-jsdoc": [
"error",
{
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true
}
}
],
"valid-jsdoc": [
"error",
{
"requireReturn": false,
"preferType": {
"String": "string",
"Object": "object",
"Number": "number",
"Function": "function",
"Void": "void"
}
}
],
"quotes": [
"error",
"single",
Expand All @@ -71,12 +49,6 @@
}
}
],
"no-magic-numbers": [
"error",
{
"ignoreArrayIndexes": true
}
],
"eqeqeq": "error",
"block-scoped-var": "error",
"complexity": [
Expand All @@ -85,7 +57,6 @@
"maximum": 20
}
],
"curly": "error",
"default-case": "error",
"dot-location": [
"error",
Expand All @@ -102,16 +73,6 @@
"after": true
}
],
"id-length": [
"error",
{
"min": 2,
"properties": "never",
"exceptions": [
"$"
]
}
],
"indent": [
"error",
2,
Expand Down Expand Up @@ -144,6 +105,11 @@
],
"semi": [
"error"
]
],
"sort-imports": 0,
"import/order": [2, {
"groups": ["type", "builtin", "external", "internal", "parent", "sibling", "index", "object"],
"alphabetize": { "order": "asc", "caseInsensitive": true },
}]
}
}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
node: ['12', '14', '16']
node: ['14', '16', '17']
steps:
- name: Set running flag
run: echo "RUNNING=1" >> $GITHUB_ENV
Expand Down
13 changes: 0 additions & 13 deletions jest.config.js

This file was deleted.

3 changes: 0 additions & 3 deletions jest.setup.ts

This file was deleted.

36 changes: 17 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"name": "@technote-space/ts-package-template",
"version": "0.1.15",
"version": "0.2.0",
"description": "Template for npm package.",
"keywords": [
"github",
"github actions"
"template"
],
"homepage": "https://github.com/technote-space/ts-package-template",
"bugs": {
Expand All @@ -27,10 +26,10 @@
],
"scripts": {
"build": "tsc",
"cover": "jest --coverage",
"cover": "vitest run --coverage",
"postinstall": "[ -n \"$CI\" ] || [ ! -f node_modules/.bin/husky ] || husky install",
"lint": "eslint 'src/**/*.ts' '__tests__/**/*.ts' --cache",
"lint:fix": "eslint --fix 'src/**/*.ts' '__tests__/**/*.ts'",
"lint": "eslint 'src/**/*.ts' --cache",
"lint:fix": "eslint --fix 'src/**/*.ts'",
"prepublishOnly": "[ -n \"$CI\" ] || [ ! -f node_modules/.bin/pinst ] || pinst --disable",
"postpublish": "[ -n \"$CI\" ] || [ ! -f node_modules/.bin/pinst ] || pinst --enable",
"setup": "if [[ $(uname -s) == 'Darwin' ]]; then BASH_ENV=~/.bashrc bash -O expand_aliases bin/setup.sh; else bash bin/setup.sh; fi && if [[ -f __DELETE__ ]]; then rm -rdf bin __DELETE__; fi",
Expand All @@ -39,20 +38,19 @@
},
"dependencies": {},
"devDependencies": {
"@commitlint/cli": "^16.1.0",
"@commitlint/config-conventional": "^16.0.0",
"@types/jest": "^27.4.0",
"@types/node": "^17.0.14",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"eslint": "^8.8.0",
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"@types/node": "^17.0.23",
"@typescript-eslint/eslint-plugin": "^5.19.0",
"@typescript-eslint/parser": "^5.19.0",
"c8": "^7.11.0",
"eslint": "^8.13.0",
"eslint-plugin-import": "^2.26.0",
"husky": "^7.0.4",
"jest": "^27.4.7",
"jest-circus": "^27.4.6",
"lint-staged": "^12.3.3",
"pinst": "^2.1.6",
"ts-jest": "^27.1.3",
"typescript": "^4.5.5"
"lint-staged": "^12.3.7",
"pinst": "^3.0.0",
"typescript": "^4.6.3",
"vitest": "^0.9.3"
},
"publishConfig": {
"access": "public"
Expand Down
7 changes: 4 additions & 3 deletions __tests__/index.test.ts → src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-magic-numbers */
import {add, repeat} from '../src';
import { describe, expect, it, vi } from 'vitest';
import { add, repeat } from '../src';

describe('add', () => {
it('should add number', () => {
Expand All @@ -9,15 +10,15 @@ describe('add', () => {

describe('repeat', () => {
it('should not call callback', async() => {
const callback = jest.fn();
const callback = vi.fn();

await repeat(callback, 0);

expect(callback).not.toBeCalled();
});

it('should call callback 3 times', async() => {
const callback = jest.fn();
const callback = vi.fn();

await repeat(callback, 3);

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {WAIT_MS} from './constant';
import { WAIT_MS } from './constant';

export const add = (num1: number, num2: number): number => num1 + num2;

Expand Down
5 changes: 5 additions & 0 deletions src/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { vi } from 'vitest';

vi.mock('./src/constant', () => Object.assign(vi.importActual('./src/constant'), {
INTERVAL_MS: 0,
}));
11 changes: 11 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/// <reference types="vitest" />

import { defineConfig } from 'vite';

// https://vitejs.dev/config/
export default defineConfig({
test: {
globals: true,
setupFiles: './src/setup.ts',
},
});
Loading

0 comments on commit 1323f6a

Please sign in to comment.