Skip to content

Commit

Permalink
feat: First release
Browse files Browse the repository at this point in the history
  • Loading branch information
unlight committed Jun 23, 2019
0 parents commit 6ab1176
Show file tree
Hide file tree
Showing 15 changed files with 433 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.json]
indent_size = 2
57 changes: 57 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
module.exports = {
"root": true,
"env": {
"node": true,
"jest": true,
"jest/globals": true,
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2019,
"sourceType": "module",
"ecmaFeatures": {
"jsx": false,
},
"project": "tsconfig.json",
},
"plugins": [
"wix-editor",
"unicorn",
"import",
"jest",
"@typescript-eslint/tslint",
"only-warn",
],
"extends": [
"eslint:recommended",
"plugin:unicorn/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:jest/recommended",
],
"rules": {
"quotes": [1, "single", { "allowTemplateLiterals": true }],
"semi": [1, "always"],
// wix-editor
"wix-editor/augmented-assignment": 1,
"wix-editor/no-instanceof-array": 1,
"wix-editor/no-not-not": 1,
"wix-editor/no-unneeded-match": 1,
"wix-editor/prefer-filter": 1,
"wix-editor/prefer-ternary": 1,
"wix-editor/return-boolean": 1,
"wix-editor/simplify-boolean-expression": 1,
// unicorn
"unicorn/import-index": 0,
"unicorn/catch-error-name": 0,
// import
"import/newline-after-import": 0,
"import/no-duplicates": 1,
"import/max-dependencies": [1, { "max": 10 }],
// tslint
"@typescript-eslint/tslint/config": [1, {
lintFile: "./tslint.json",
}],
}
};
52 changes: 52 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
dist/
### https://raw.github.com/github/gitignore/5d896f6791c4257b74696714c66b2530b8d95a51/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# Custom
~*
.idea
.awcache
.vscode
.rts2_cache_*
.stryker-tmp
reports
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock = false
15 changes: 15 additions & 0 deletions .releaserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/npm",
{
"pkgRoot": "dist"
}
],
"@semantic-release/github",
"@semantic-release/git",
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# onn
17 changes: 17 additions & 0 deletions Taskfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
PATH="$PWD/node_modules/.bin":$PATH

build() {
ng-packagr
}

eslint_run() {
eslint src --ext ts
}

lint_watch() {
npm run tsclint:w 2>&1 &
npm run eslint:w 2>&1 &
}

"$@"
38 changes: 38 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = {
testEnvironment: 'node',
transform: {
'^.+\\.tsx?$': 'ts-jest'
},
collectCoverage: false,
coverageDirectory: 'coverage',
coverageReporters: [
// 'lcov',
'text',
],
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.spec.ts',
],
testMatch: [
'<rootDir>/src/**/*.spec.ts'
],
moduleFileExtensions: [
'ts',
'tsx',
'js',
'jsx',
'json',
],
modulePathIgnorePatterns: [
'<rootDir>/dist',
],
globals: {
'ts-jest': {
diagnostics: false,
isolatedModules: true,
tsConfig: {
target: 'esnext',
}
},
},
};
6 changes: 6 additions & 0 deletions ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"whitelistedNonPeerDependencies": [],
"lib": {
"entryFile": "src/index.ts"
}
}
85 changes: 85 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"name": "onn",
"version": "0.0.0-dev",
"license": "MIT",
"description": "",
"main": "index.js",
"typings": "index.d.ts",
"author": "2019",
"keywords": [],
"engines": {
"node": ">=6"
},
"repository": {
"type": "git"
},
"scripts": {
"test": "npm run eslint && npm run tscheck && npm run test:cov && npm run typecov",
"test:r": "node node_modules/jest/bin/jest --runInBand --verbose",
"test:w": "npm run test:r -- --watch",
"test:cov": "npm run test:r -- --collectCoverage",
"test:d": "node --inspect-brk node_modules/jest/bin/jest --runInBand --testMatch \"<rootDir>/src/**/*.spec.ts\"",
"test:m": "node node_modules/stryker-cli/bin/stryker-cli run",
"typecov": "node node_modules/type-coverage/bin/type-coverage --detail",
"tscheck": "echo tscheck... && tsc --noEmit",
"tscheck:w": "npm run tscheck -- --watch",
"tsclint": "tsc --noEmit --strict --forceConsistentCasingInFileNames --noImplicitReturns --noImplicitThis --noUnusedLocals --noUnusedParameters",
"tsclint:w": "npm run tsclint -- --watch",
"eslint:w": "watchexec -w src \"npm run eslint\"",
"eslint": "node node_modules/eslint/bin/eslint src --ext ts",
"eslint:fix": "npm run eslint -- --fix",
"tslint:fix": "node node_modules/tslint/bin/tslint -p tsconfig.json --fix",
"lint:w": "sh Taskfile lint_watch",
"semantic-release": "semantic-release",
"prepublishOnly": "sed -i -e 's/devDependencies/_devDependencies/g' package.json",
"copySource": "cp -rv src dist && find dist/src -name '*.spec.ts' | xargs rm -f",
"dev": "node node_modules/webpack-dev-server/bin/webpack-dev-server",
"build": "sh Taskfile build",
"commit": "git-cz"
},
"devDependencies": {
"@angular/compiler": "^8.0.2",
"@angular/compiler-cli": "^8.0.2",
"@angular/core": "^8.0.2",
"@semantic-release/changelog": "^3.0.4",
"@semantic-release/commit-analyzer": "^7.0.0-beta.2",
"@semantic-release/git": "^7.1.0-beta.3",
"@semantic-release/github": "^5.4.0-beta.1",
"@semantic-release/npm": "^5.2.0-beta.6",
"@semantic-release/release-notes-generator": "^7.2.0",
"@types/jest": "^24.0.15",
"@types/node": "^12.0.10",
"@typescript-eslint/eslint-plugin-tslint": "^1.10.2",
"@typescript-eslint/parser": "^1.10.2",
"eslint": "^5.16.0",
"eslint-import-resolver-node": "^0.3.2",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-jest": "^22.7.1",
"eslint-plugin-only-warn": "^1.0.1",
"eslint-plugin-unicorn": "^9.1.1",
"eslint-plugin-wix-editor": "^2.0.0",
"jest": "^24.8.0",
"ng-packagr": "^5.3.0",
"remark": "^10.0.1",
"remark-cli": "^6.0.1",
"remark-license": "^5.1.0",
"remark-toc": "^5.1.1",
"semantic-release": "^16.0.0-beta.19",
"simplytyped": "^3.2.0",
"stryker-cli": "^1.0.0",
"ts-jest": "^24.0.2",
"tsickle": "^0.35.0",
"tslint": "^5.18.0",
"tslint-clean-code": "^0.2.9",
"tslint-microsoft-contrib": "^6.2.0",
"tslint-sonarts": "^1.9.0",
"type-coverage": "^2.0.2",
"typescript": "3.4.X",
"watchexec-bin": "^1.0.0"
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
}
}
10 changes: 10 additions & 0 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable @typescript-eslint/tslint/config */
import * as lib from './index';

it('smoke', () => {
expect(lib).toBeTruthy();
});

it('hello test', () => {
expect(lib.hello()).toBe('Hello world');
});
33 changes: 33 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { PlainObject } from 'simplytyped';

export function on(node: Element , type, fn) {
el.addEventListener(type, fn, false)
return function off() {
el.removeEventListener(type, fn, false)
}
}



// const dict: PlainObject = {};

// /**
// * Hello function whithout parameter
// * @returns result string
// */
// export function hello(): string;

// *
// * This is hello function
// * @returns result string

// export function hello(greet: string = 'Hello') {
// return `${greet} world`;
// }

// export class X {

// constructor(
// private readonly o: PlainObject,
// ) { }
// }
29 changes: 29 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"moduleResolution": "node",
"importHelpers": true,
"strict": true,
"noImplicitAny": false,
"experimentalDecorators": false,
"emitDecoratorMetadata": false,
"outDir": "dist",
"pretty": true,
"removeComments": false,
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"skipLibCheck": true,
"lib": [
"dom",
"esnext"
]
},
"include": [
"src/**/*.ts"
],
"exclude": [
"src/**/*.spec.ts"
]
}
Loading

0 comments on commit 6ab1176

Please sign in to comment.