Sut up dev environment

This commit is contained in:
Dmitriy Shishkov 2021-08-03 10:06:21 +03:00
parent a1b47a38cc
commit cc2e81e648
No known key found for this signature in database
GPG Key ID: 14358F96FCDD8060
7 changed files with 63 additions and 5 deletions

14
.github/workflows/test.yaml vendored Normal file
View File

@ -0,0 +1,14 @@
name: Test CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14"
- run: npm install
- run: npm test

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
node_modules/
package-lock.json
pnpm-lock.yaml
/lib/

6
README.md Normal file
View File

@ -0,0 +1,6 @@
# HTML pagination
![Test workflow](https://github.com/dm1sh/html-pagination/actions/workflows/test.yaml/badge.svg)
It is a plugin for HTML document pagination to fit fixed-sized container.
This operation is rather time-consuming, so, please, use this module carefully.

7
jestconfig.json Normal file
View File

@ -0,0 +1,7 @@
{
"transform": {
"^.+\\.(t|j)sx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"]
}

View File

@ -2,9 +2,19 @@
"name": "html-pagination", "name": "html-pagination",
"version": "1.0.0", "version": "1.0.0",
"description": "Package for html document pagination to fit container with fixed width", "description": "Package for html document pagination to fit container with fixed width",
"main": "index.js", "main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"./lib/**/*"
],
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "build": "tsc",
"test": "jest --config jestconfig.json --passWithNoTests",
"prepare": "npm run build",
"prepublishOnly": "npm test && npm run lint",
"preversion": "npm run lint",
"version": "npm run format && git add -A src",
"postversion": "git push && git push --tags"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -19,5 +29,11 @@
"bugs": { "bugs": {
"url": "https://github.com/dm1sh/html-pagination/issues" "url": "https://github.com/dm1sh/html-pagination/issues"
}, },
"homepage": "https://github.com/dm1sh/html-pagination#readme" "homepage": "https://github.com/dm1sh/html-pagination#readme",
"devDependencies": {
"@types/jest": "^26.0.24",
"jest": "^27.0.6",
"ts-jest": "^27.0.4",
"typescript": "^4.3.5"
}
} }

View File

@ -1,4 +1,4 @@
export abstract class CacheInterface { export declare abstract class CacheInterface {
abstract g(key: string): string; abstract g(key: string): string;
abstract s(key: string, value: string): void; abstract s(key: string, value: string): void;
} }
@ -15,7 +15,7 @@ declare function getPage(n: number): string;
* @param container HTML element which will store content to display * @param container HTML element which will store content to display
* @param cache Class implementing `g` and `s` methods for getting and setting elements of KV storage * @param cache Class implementing `g` and `s` methods for getting and setting elements of KV storage
*/ */
export function setup( export declare function setup(
content: HTMLElement, content: HTMLElement,
container: HTMLElement, container: HTMLElement,
cache: CacheInterface cache: CacheInterface

11
tsconfig.json Normal file
View File

@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": true,
"outDir": "./lib",
"strict": true
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/*"]
}