Skip to content

Commit

Permalink
chore: initial repo setup
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Oct 1, 2019
1 parent c45dd23 commit 1c45c7c
Show file tree
Hide file tree
Showing 17 changed files with 9,728 additions and 36 deletions.
66 changes: 32 additions & 34 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,49 @@ pids
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
# Coverage
flow-coverage
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
# Bundle
build
dist
lib
target

# node-waf configuration
.lock-wscript
#Docs
docs
doc

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
# Deps
node_modules/
jspm_packages/
flow-typed/npm/

# 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

# next.js build output
.next
# IDE
.idea
*.iml

# Libdefs
flow-typed
typings

# Temp
temp
*.tmp

# Typescript
*.tsbuildinfo
.tsbuildinfo
buildcache
.buildcache
.rts2_cache_cjs
.rts2_cache_es
.rts2_cache_umd
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
language: node_js
node_js:
- '12'

before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build

after_script:
- ./cc-test-reporter format-coverage -t lcov ./coverage/lcov.info
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT

install:
- yarn cache clean
- yarn

script:
- yarn run build
- yarn test:report

deploy:
provider: script
skip_cleanup: true
script:
- npx semantic-release
34 changes: 34 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"preset": "ts-jest",
"collectCoverage": true,
"coveragePathIgnorePatterns": [
"types.ts"
],
"collectCoverageFrom": [
"<rootDir>/src/main/ts/**/*.ts"
],
"testMatch": [
"<rootDir>/src/test/ts/**/*.ts",
"<rootDir>/src/test/js/**/*.js"
],
"testPathIgnorePatterns": [
"/node_modules/",
"<rootDir>/src/test/stub"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"transform": {
"^.+\\.(ts|tsx)$": "ts-jest"
},
"globals": {
"ts-jest": {
"tsConfig": "tsconfig.test.json"
}
}
}
114 changes: 114 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"name": "@qiwi/license",
"version": "0.0.0",
"description": "QIWI OSS License",
"source": "src/main/ts/index.ts",
"main": "target/bundle/license.js",
"module": "target/bundle/license.mjs",
"unpkg": "target/bundle/license.umd.js",
"types": "typings/index.d.ts",
"typescript": {
"definition": "typings/index.d.ts"
},
"files": [
"README.md",
"CHANGELOG.md",
"target",
"typings",
"flow-typed"
],
"scripts": {
"jest": "jest -w 2 --config=jest.config.json",
"lint": "tslint -p tsconfig.test.json src/**/*.ts",
"lint:fix": "yarn lint --fix",
"test": "yarn lint && yarn jest",
"clean": "rimraf target typings",
"build": "yarn clean && yarn build:es5 && yarn build:es6 && yarn build:ts && yarn libdef && yarn docs && yarn uglify && yarn build:bundle",
"build:es5": "mkdir -p target/es5 && tsc -p tsconfig.es5.json",
"build:es6": "mkdir -p target/es6 && tsc -p tsconfig.es6.json",
"build:ts": "cp -r src/main/ts/ target/ts/",
"build:bundle": "microbundle build src/main/ts/index.ts -o target/bundle",
"dtsgen": "dts-generator --project ./ --out typings/index.d.ts --prefix license/target/es5 --name license --main license/target/es5/index --moduleResolution node",
"flowgen": "flowgen typings/index.d.ts --output-file flow-typed/index.flow.js",
"libdef": "yarn dtsgen && yarn libdeffix && yarn flowgen",
"libdeffix": "node -r esm ./src/gen/js/libdef-fix.js --dts=./typings/index.d.ts",
"test:report": "yarn test && yarn push:report",
"push:report": "yarn coveralls:push",
"coveralls:push": "cat ./coverage/lcov.info | coveralls",
"docs": "typedoc --readme README.md --tsconfig tsconfig.json src/main --ignoreCompilerErrors || exit 0",
"uglify": "for f in $(find target -name '*.js'); do short=${f%.js}; terser -c -m -o $short.js -- $f; done",
"postupdate": "yarn && yarn build && yarn test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/qiwi/license.git"
},
"keywords": [
"license",
"oss",
"mit"
],
"bugs": {
"url": "https://github.com/qiwi/license/issues"
},
"homepage": "https://github.com/qiwi/license#readme",
"dependencies": {
"@qiwi/substrate": "^1.11.2",
"lodash": "^4.17.15",
"tslib": "^1.10.0"
},
"devDependencies": {
"@qiwi/semantic-release-gh-pages-plugin": "^1.10.6",
"@semantic-release/changelog": "^3.0.4",
"@semantic-release/git": "^7.0.16",
"@semantic-release/github": "^5.4.3",
"@semantic-release/npm": "^5.1.15",
"@types/jest": "^24.0.18",
"@types/jest-json-schema": "^1.2.1",
"coveralls": "^3.0.6",
"dts-generator": "^3.0.0",
"eslint-plugin-typescript": "^0.14.0",
"esm": "^3.2.25",
"flowgen": "1.10.0",
"jest": "^24.9.0",
"lodash": "^4.17.15",
"microbundle": "^0.12.0-next.3",
"replace-in-file": "^4.1.3",
"rimraf": "^3.0.0",
"semantic-release": "^15.13.24",
"terser": "^4.3.0",
"ts-jest": "^24.0.2",
"tslint": "^5.19.0",
"tslint-config-qiwi": "^1.1.1",
"typedoc": "^0.15.0",
"typedoc-plugin-external-module-name": "^2.1.0",
"typescript": "^3.6.2",
"typescript-eslint-parser": "^22.0.0"
},
"release": {
"branch": "master",
"verifyConditions": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git",
"@qiwi/semantic-release-gh-pages-plugin"
],
"prepare": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
],
"publish": [
"@semantic-release/npm",
"@semantic-release/github",
"@qiwi/semantic-release-gh-pages-plugin"
]
},
"author": "QIWI <orensource@qiwi.com>",
"contributors": [
"Anton Golub <a.golub@qiwi.com>",
"Osipova Evgeniya <e.osipova@qiwi.com>"
],
"license": "MIT",
"private": false
}
5 changes: 5 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"config:base"
]
}
41 changes: 41 additions & 0 deletions src/gen/js/libdef-fix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {resolve} from 'path'
import { argv } from 'yargs'
import assert from 'assert'
import {sync as replaceSync} from 'replace-in-file'

const {flow, dts} = argv
const DTS = resolve(dts)
const IMPORT_MAIN_PATTERN = /\timport main = require\('(.+)'\);/g
const IMPORT_MAIN_LINE_PATTERN = /^\timport main = require\('(.+)'\);$/
const BROKEN_MODULE_NAME = /(declare module '.+\/target\/es5\/)[^/]*\/src\/main\/index'.+/
const REFERENCE = /\/\/\/.+/

assert(!!dts, ' `dts` file path should be specified')

const options = {
files: DTS,
from: [
'\texport = main;',
IMPORT_MAIN_PATTERN,
BROKEN_MODULE_NAME,
REFERENCE,
/^\s*[\r\n]/gm
],
to: [
'',
line => {
const [, name] = IMPORT_MAIN_LINE_PATTERN.exec(line)
return ` export * from '${name}';`
},
line => {
const [, module] = BROKEN_MODULE_NAME.exec(line)
return `${module}index' {`
},
'',
''
],
}

const changes = replaceSync(options);
console.log('Modified files:', changes);

2 changes: 1 addition & 1 deletion src/tpl/license_en.tpl → src/main/tpl/license_en.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Licensor:
QIWI JSC
(TIN 7707510721)

___________ ___, 20___
<%= year %>

According to Art. 1286.1 of the Civil Code of the Russian Federation, the Licensor provides an open license for the software product “__________” and related associated documentation files (hereinafter referred to as the “Software”).

Expand Down
2 changes: 1 addition & 1 deletion src/tpl/license_ru.tpl → src/main/tpl/license_ru.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Акционерное общество «КИВИ»
(ИНН 7707510721)

«___» ____________ 20___ г.
<%= year %>

Настоящим, согласно ст. 1286.1 Гражданского кодекс Российской Федерации, Лицензиар предоставляет открытую лицензию на программный продукт «__________» и сопутствующую документацию (в дальнейшем именуемые «Программное обеспечение»).

Expand Down
1 change: 1 addition & 0 deletions src/main/ts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const render = () => { /*noop*/ }
5 changes: 5 additions & 0 deletions src/test/ts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('index', () => {
it('', () => {
expect(true).toBeTruthy()
})
})
7 changes: 7 additions & 0 deletions tsconfig.es5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "es6",
"outDir": "target/es6"
}
}
7 changes: 7 additions & 0 deletions tsconfig.es6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "es5",
"outDir": "target/es5"
}
}
32 changes: 32 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"compilerOptions": {
"rootDir": "./src/main/ts/",
"baseUrl": "./src/main/ts/",
"moduleResolution": "node",
"target": "es5",
"lib": [
"esnext"
],
"strict": true,
"sourceMap": false,
"declaration": false,
"noEmitHelpers": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"importHelpers": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"experimentalDecorators": true,

"incremental": true,
"tsBuildInfoFile": "./buildcache/.tsbuildinfo"
},
"include": [
"src/main/**/*"
],
"exclude": [
"node_modules",
"src/test"
]
}
9 changes: 9 additions & 0 deletions tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"include": [
"src/**/*"
],
"exclude": [
"node_modules"
]
}
Loading

0 comments on commit 1c45c7c

Please sign in to comment.