-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
191 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#root = true | ||
|
||
[*] | ||
indent_style = space | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
max_line_length = 100 | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
node_modules | ||
coverage | ||
.nyc_output | ||
.DS_Store | ||
*.log | ||
.vscode | ||
.idea | ||
dist | ||
compiled | ||
.awcache | ||
.rpt2_cache | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,28 +8,84 @@ | |
], | ||
"homepage": "https://jan.ai", | ||
"license": "AGPL-3.0", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"directories": { | ||
"lib": "lib", | ||
"test": "__tests__" | ||
}, | ||
"exports": { | ||
".": "./lib/index.js" | ||
}, | ||
"main": "dist/core.umd.js", | ||
"module": "dist/core.es5.js", | ||
"typings": "dist/types/index.d.ts", | ||
"files": [ | ||
"lib", | ||
"README.md", | ||
"LICENSE.md", | ||
"package.json", | ||
"!.DS_Store" | ||
"dist" | ||
], | ||
"author": "Jan <[email protected]>", | ||
"repository": { | ||
"type": "git", | ||
"url": "" | ||
}, | ||
"engines": { | ||
"node": ">=6.0.0" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: run tests from root\" && exit 1", | ||
"build": "tsc" | ||
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'", | ||
"prebuild": "rimraf dist", | ||
"build": "tsc --module commonjs && rollup -c rollup.config.ts", | ||
"start": "rollup -c rollup.config.ts -w" | ||
}, | ||
"lint-staged": { | ||
"{src,test}/**/*.ts": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "node_modules/cz-conventional-changelog" | ||
} | ||
}, | ||
"jest": { | ||
"transform": { | ||
".(ts|tsx)": "ts-jest" | ||
}, | ||
"testEnvironment": "node", | ||
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js" | ||
], | ||
"coveragePathIgnorePatterns": [ | ||
"/node_modules/", | ||
"/test/" | ||
], | ||
"coverageThreshold": { | ||
"global": { | ||
"branches": 90, | ||
"functions": 95, | ||
"lines": 95, | ||
"statements": 95 | ||
} | ||
}, | ||
"collectCoverageFrom": [ | ||
"src/*.{js,ts}" | ||
] | ||
}, | ||
"prettier": { | ||
"semi": false, | ||
"singleQuote": true | ||
}, | ||
"commitlint": { | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^12.0.2", | ||
"typescript": "^5.2.2" | ||
} | ||
"@types/node": "^10.11.0", | ||
"rollup": "^2.38.5", | ||
"rollup-plugin-commonjs": "^9.1.8", | ||
"rollup-plugin-json": "^3.1.0", | ||
"rollup-plugin-node-resolve": "^3.4.0", | ||
"rollup-plugin-sourcemaps": "^0.4.2", | ||
"rollup-plugin-typescript2": "^0.29.0", | ||
"ts-node": "^7.0.1", | ||
"typescript": "^3.0.3", | ||
"tslib": "^2.6.2" | ||
}, | ||
"dependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import resolve from 'rollup-plugin-node-resolve' | ||
import commonjs from 'rollup-plugin-commonjs' | ||
import sourceMaps from 'rollup-plugin-sourcemaps' | ||
import typescript from 'rollup-plugin-typescript2' | ||
import json from 'rollup-plugin-json' | ||
|
||
const pkg = require('./package.json') | ||
|
||
const libraryName = 'core' | ||
|
||
export default { | ||
input: `src/index.ts`, | ||
output: [ | ||
{ file: pkg.main, name: libraryName, format: 'umd', sourcemap: true }, | ||
{ file: pkg.module, format: 'es', sourcemap: true }, | ||
], | ||
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash') | ||
external: [], | ||
watch: { | ||
include: 'src/**', | ||
}, | ||
plugins: [ | ||
// Allow json resolution | ||
json(), | ||
// Compile TypeScript files | ||
typescript({ useTsconfigDeclarationDir: true }), | ||
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs) | ||
commonjs(), | ||
// Allow node_modules resolution, so you can use 'external' to control | ||
// which external modules to include in the bundle | ||
// https://github.com/rollup/rollup-plugin-node-resolve#usage | ||
resolve(), | ||
|
||
// Resolve source maps to the original source | ||
sourceMaps(), | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
export {}; | ||
export {} | ||
|
||
declare global { | ||
interface Window { | ||
core?: any; | ||
namespace NodeJS { | ||
interface Global { | ||
core: any | ||
} | ||
} | ||
var core: any | undefined | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.