Skip to content

Commit

Permalink
Conversion to Typescript - WIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrizagidulin committed Jul 15, 2023
1 parent 5d9b778 commit 5df3b96
Show file tree
Hide file tree
Showing 23 changed files with 531 additions and 417 deletions.
30 changes: 14 additions & 16 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
/*!
* Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved.
*/
module.exports = {
root: true,
extends: [
'eslint-config-digitalbazaar',
'eslint-config-digitalbazaar/jsdoc'
],
env: {
node: true
},
extends: ['standard-with-typescript', 'prettier', 'eslint-config-prettier'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'prettier'],
parserOptions: {
// this is required for dynamic import()
ecmaVersion: 2020
project: './tsconfig.json'
},
ignorePatterns: ['node_modules', 'dist'],
ignorePatterns: ['dist/', 'test', 'index.d.ts'],
rules: {
'jsdoc/check-examples': 0,
'jsdoc/require-description-complete-sentence': 0
'prettier/prettier': 'off',
'arrow-body-style': 'off',
'prefer-arrow-callback': 'off',
'@typescript-eslint/consistent-type-assertions': 'off',
'@typescript-eslint/prefer-ts-expect-error': 'off',
'@typescript-eslint/return-await': 'off',
'@typescript-eslint/strict-boolean-expressions': 'off',
'no-empty-pattern': 'off'
}
};
}
19 changes: 12 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
package-lock.json
yarn-lock.json

# Logs
logs
*.log
Expand All @@ -9,6 +6,9 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*

package-lock.json
yarn.lock

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

Expand All @@ -26,7 +26,8 @@ coverage
*.lcov

# nyc test coverage
.nyc_output
/.nyc_output
/coverage

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
Expand All @@ -45,7 +46,7 @@ node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/
types/

# TypeScript cache
*.tsbuildinfo
Expand Down Expand Up @@ -109,6 +110,10 @@ dist
# Editor files
*~
*.sw[nop]
/.vscode

# Output
dist

# VSCode
.vscode
# MacOS
.DS_Store
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
tsconfig.json
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
trailingComma: 'none',
tabWidth: 2,
semi: false,
singleQuote: true,
bracketSpacing: true
}
2 changes: 1 addition & 1 deletion LICENSE → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2021, Digital Bazaar, Inc.
Copyright (c) 2021-2022, Digital Bazaar, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
74 changes: 20 additions & 54 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,78 +1,44 @@
/*
* Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved.
*/
module.exports = function(config) {

module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai'],
frameworks: ['mocha', 'chai', 'karma-typescript'],

// list of files / patterns to load in the browser
files: [
'test/*.spec.js'
'src/**/*.ts',
'test/**/*.ts' // *.tsx for React Jsx
],

// list of files to exclude
exclude: [],

// preprocess matching files before serving them to the browser
// preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/*.js': ['webpack', 'sourcemap']
karmaTypescriptConfig: {
reports: {} // Disables the code coverage report
},

webpack: {
//mode: 'production',
mode: 'development',
devtool: 'inline-source-map'
preprocessors: {
'**/*.ts': 'karma-typescript' // *.tsx for React Jsx
},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
//reporters: ['progress'],
reporters: ['mocha'],

// web server port
port: 9876,

// enable / disable colors in the output (reporters and logs)
colors: true,

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR ||
// config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
reporters: ['mocha', 'karma-typescript'],

// enable / disable watching file and executing tests whenever any
// file changes
autoWatch: false,

// start these browsers
// browser launchers: https://npmjs.org/browse/keyword/karma-launcher
//browsers: ['ChromeHeadless', 'Chrome', 'Firefox', 'Safari'],
browsers: ['ChromeHeadless'],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
// if true, Karma captures browsers, runs the test and exits
singleRun: true,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,

// Mocha
client: {
mocha: {
// increase from default 2s
timeout: 10000,
reporter: 'html'
//delay: true
timeout: 10000
// reporter: 'html'
}
}
});
};
},

colors: true
})
}
Loading

0 comments on commit 5df3b96

Please sign in to comment.