Skip to content

Commit

Permalink
add api jssdk
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Mineev committed Jun 19, 2022
1 parent fa7d5ce commit 1b70fa9
Show file tree
Hide file tree
Showing 27 changed files with 4,664 additions and 0 deletions.
11 changes: 11 additions & 0 deletions frontend/packages/api/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
charset = utf-8
indent_style = tab
end_of_line = lf
insert_final_newline = true

[{*.json,.prettierrc}]
indent_style = space

29 changes: 29 additions & 0 deletions frontend/packages/api/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json',
},
plugins: ['@typescript-eslint'],
overrides: [
{
files: ['*.spec.ts'],
rules: {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
},
},
],
}
3 changes: 3 additions & 0 deletions frontend/packages/api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
coverage
dist
2 changes: 2 additions & 0 deletions frontend/packages/api/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/*
!dist
6 changes: 6 additions & 0 deletions frontend/packages/api/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"printWidth": 100,
"quoteProps": "consistent",
"singleQuote": true
}
11 changes: 11 additions & 0 deletions frontend/packages/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# @remark42/api

Implementation of API methods for Remark42

## Development

- If you don't have `pnpm` installed run `npm i -g pnpm`
- Install dependencies `pnpm i`
- Run development mode with `pnpm run dev`
- Build lib with `pnpm run build`
- Run tests with `pnpm run test`
15 changes: 15 additions & 0 deletions frontend/packages/api/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Config } from '@jest/types'

const config: Config.InitialOptions = {
testEnvironment: 'jsdom',
transform: {
'^.+\\.ts$': '@swc/jest',
},
collectCoverageFrom: ['src/**/*.ts'],
extensionsToTreatAsEsm: ['.ts', '.tsx'],
moduleNameMapper: {
'^@test/(.*)$': '<rootDir>/test/$1',
},
}

export default config
45 changes: 45 additions & 0 deletions frontend/packages/api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "@remark42/api",
"version": "0.1.0-alpha.0",
"description": "Implementation of API methods for Remark42",
"repository": {
"type": "git",
"url": "git+https://github.com/umputun/remark42.git#master"
},
"bugs": {
"url": "https://github.com/umputun/remark42/issues"
},
"homepage": "https://github.com/umputun/remark42/tree/master/frontend/packages/api#readme",
"keywords": [
"remark42",
"comments"
],
"author": "Paul Mineev",
"license": "MIT",
"scripts": {
"dev": "tsc -w -p tsconfig.dev.json",
"build": "tsc",
"prebuild": "rm -rf dist",
"test": "jest",
"coverage": "jest --coverage",
"lint": "eslint src --ext=.ts,.js",
"type-check": "tsc --noEmit",
"format": "prettier --write '**/*.{ts,js,json}'"
},
"devDependencies": {
"@jest/types": "^28.1.1",
"@swc/core": "^1.2.203",
"@swc/jest": "^0.2.21",
"@types/jest": "^28.1.2",
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28.0",
"eslint": "^8.18.0",
"eslint-config-prettier": "^8.5.0",
"jest": "^28.1.1",
"jest-environment-jsdom": "^28.1.1",
"prettier": "^2.7.1",
"ts-node": "^10.8.1",
"typescript": "^4.7.4"
}
}
Loading

0 comments on commit 1b70fa9

Please sign in to comment.