Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(typescript|ci): convert js to ts #29

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Node.js CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Install dependencies
if: steps.yarn-cache-dir-path.outputs.cache-hit != 'true'
run: yarn install
- run: yarn lint
- run: yarn check-fmt
- run: yarn tsc
- run: yarn test-cover
env:
CI: true
- name: Coveralls Parallel
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.github_token }}
parallel: true
coverall:
needs: build
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage
.coveralls.yml

# nyc test coverage
.nyc_output
Expand All @@ -25,6 +26,7 @@ coverage

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

# Dependency directories
node_modules
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ printWidth: 140
semi: false
tabWidth: 4
singleQuote: true
bracketSpacing: true
bracketSpacing: true
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions examples/example1.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const logger = require('../index')
const logger = require('../src/index')

logger.setNamespaces('root:*')
logger.setLevel('debug')

const log = logger('root:testing')
const log = logger.createLogger('root:testing')
log.debug('sample message', {
foo: 'bar',
})
})
6 changes: 3 additions & 3 deletions examples/example2.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const logger = require('../index')
const logger = require('../src/index')

logger.setNamespaces('root:*')
logger.setLevel('debug')

const log = logger('root:testing')
const log = logger.createLogger('root:testing')
log.debug('ctxId', 'log with predefined context ID', {
foo: 'bar',
})
})
6 changes: 3 additions & 3 deletions examples/example3.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const logger = require('../index')
const logger = require('../src/index')

logger.setNamespaces('namespace:*')
logger.setLevel('debug')
//logger.setOutput(logger.outputs.json)

const log = logger('namespace:subNamespace')
log.debug('ctxId', 'Will be logged',{someData: 'someValue', someData2: 'someValue'})
const log = logger.createLogger('namespace:subNamespace')
log.debug('ctxId', 'Will be logged', { someData: 'someValue', someData2: 'someValue' })
6 changes: 3 additions & 3 deletions examples/example_context.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const logger = require('../index')
const logger = require('../src/index')

logger.setOutput(logger.outputs.pretty)
logger.setNamespaces('*')
logger.setLevel('info')
logger.setGlobalContext({ version: '2.0.0', env: 'dev' })

const log = logger('namespace')
const log = logger.createLogger('namespace')

log.warn('message', { someData: 'someValue' })
log.warn('message', { someData: 'someValue' })
6 changes: 3 additions & 3 deletions examples/example_data.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const logger = require('../index')
const logger = require('../src/index')

logger.setOutput(logger.outputs.pretty)
logger.setNamespaces('namespace:*')
logger.setLevel('info')

const log = logger('namespace:subNamespace')
const log = logger.createLogger('namespace:subNamespace')

log.warn('message', { someData: 'someValue' })
log.warn('message', { someData: 'someValue' })
6 changes: 3 additions & 3 deletions examples/example_pretty.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const logger = require('../index')
const logger = require('../src/index')

logger.setNamespaces('namespace:*')
logger.setLevel('debug')
logger.setOutput(logger.outputs.pretty)

const log = logger('namespace:subNamespace')
log.debug('ctxId', 'Will be logged',{someData: 'someValue', someData2: 'someValue'})
const log = logger.createLogger('namespace:subNamespace')
log.debug('ctxId', 'Will be logged', { someData: 'someValue', someData2: 'someValue' })
1 change: 1 addition & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'prettyoutput'
53 changes: 0 additions & 53 deletions index.d.ts

This file was deleted.

12 changes: 12 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testRegex: '.*\\.test\\.ts$',
transform: {
'^.+\\.(t|j)s$': 'ts-jest',
},
collectCoverageFrom: ['src/**/*.(t|j)s'],
coverageDirectory: './coverage',
}
84 changes: 0 additions & 84 deletions output_adapters.js

This file was deleted.

53 changes: 0 additions & 53 deletions output_utils.js

This file was deleted.

Loading