diff --git a/CHANGELOG.md b/CHANGELOG.md index 2732a47..da8a02b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.0.3](https://github.com/Itee/itee-leveldb/compare/v1.0.2...v1.0.3) (2021-07-21) + + +### Bug Fixes + +* **readme:** add simple readme content ([5542a72](https://github.com/Itee/itee-leveldb/commit/5542a72798ccc91ffd6fcccf95b40e3ef33cdae5)) + ## [1.0.2](https://github.com/Itee/itee-leveldb/compare/v1.0.1...v1.0.2) (2021-07-08) diff --git a/builds/itee-leveldb.cjs.js b/builds/itee-leveldb.cjs.js index 01ae831..f9ede95 100644 --- a/builds/itee-leveldb.cjs.js +++ b/builds/itee-leveldb.cjs.js @@ -1,4 +1,4 @@ -console.log('Itee.Database.Level v1.0.2 - CommonJs') +console.log('Itee.Database.Level v1.0.3 - CommonJs') 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/builds/itee-leveldb.esm.js b/builds/itee-leveldb.esm.js index ee81498..cc44389 100644 --- a/builds/itee-leveldb.esm.js +++ b/builds/itee-leveldb.esm.js @@ -1,4 +1,4 @@ -console.log('Itee.Database.Level v1.0.2 - EsModule') +console.log('Itee.Database.Level v1.0.3 - EsModule') import * as LevelUpDriver from 'levelup'; import { TAbstractDatabase } from 'itee-database'; diff --git a/docs/configs_eslint.conf.js.html b/docs/configs_eslint.conf.js.html new file mode 100644 index 0000000..11383c9 --- /dev/null +++ b/docs/configs_eslint.conf.js.html @@ -0,0 +1,281 @@ + + + + + + + Itee-LevelDB Source: configs/eslint.conf.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: configs/eslint.conf.js

+ +
+
+
/**
+ * @author [Tristan Valcke]{@link https://github.com/Itee}
+ * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
+ *
+ * @module Config-EsLint
+ * @description The configuration file of the eslint plugin
+ */
+
+/**
+ * Will create an appropriate configuration object for eslint
+ *
+ * @generator
+ * @returns {object} The eslint configuration
+ */
+function CreateEslintConfiguration () {
+
+    return {
+        env: {
+            'browser': true,
+            'node':    true,
+            'es6':     true
+        },
+        globals: {
+            'BigInt64Array':  'readonly',
+            'BigUint64Array': 'readonly'
+        },
+        parserOptions: {
+            ecmaVersion: 2018,
+            sourceType:  'module'
+        },
+        extends: [
+            'eslint:recommended'
+        ],
+        plugins: [
+            'mocha'
+        ],
+        rules: {
+            'no-multiple-empty-lines':  [ 1, { 'max': 2 } ],
+            'no-mixed-spaces-and-tabs': 'off',
+            'mocha/no-exclusive-tests': 'error',
+            'no-console':               'warn',
+            'no-multi-spaces':          [
+                'error', {
+                    exceptions: {
+                        'Property':             true,
+                        'ImportDeclaration':    true,
+                        'VariableDeclarator':   true,
+                        'AssignmentExpression': true
+                    }
+                }
+            ],
+            'key-spacing': [
+                'error', {
+                    'align': {
+                        'beforeColon': false,
+                        'afterColon':  true,
+                        'on':          'value'
+                    }
+                }
+            ]
+
+        }
+    }
+
+}
+
+module.exports = CreateEslintConfiguration()
+
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/configs_jsdoc.conf.js.html b/docs/configs_jsdoc.conf.js.html new file mode 100644 index 0000000..87c2777 --- /dev/null +++ b/docs/configs_jsdoc.conf.js.html @@ -0,0 +1,293 @@ + + + + + + + Itee-LevelDB Source: configs/jsdoc.conf.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: configs/jsdoc.conf.js

+ +
+
+
/**
+ * @author [Tristan Valcke]{@link https://github.com/Itee}
+ * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
+ *
+ * @module Config-JsDoc
+ * @description The configuration file of the jsdoc plugin
+ */
+
+/**
+ * Will create an appropriate configuration object for jsdoc
+ *
+ * @generator
+ * @returns {object} The jsdoc configuration
+ */
+function CreateJsdocConfiguration () {
+
+    return {
+        tags: {
+            allowUnknownTags: false,
+            dictionaries:     [ 'jsdoc', 'closure' ]
+        },
+        source: {
+            include:        [ 'README.md' ],
+            includePattern: '.+\\.js(doc|x)?$',
+            excludePattern: '(node_modules|docs|builds|tests)',
+            exclude:        []
+        },
+        sourceType:   'module',
+        plugins:      [],
+        recurseDepth: 5,
+        opts:         {
+            access:      'all',
+            debug:       false,
+            encoding:    'utf8',
+            destination: 'docs',
+            recurse:     true,
+            verbose:     true,
+            private:     true
+        },
+        templates: {
+            cleverLinks:    false,
+            monospaceLinks: false,
+            navType:        'inline',
+            theme:          [
+                                   'cerulean',
+                                   'cosmo',
+                                   'darkly',
+                                   'cyborg',
+                                   'flatly',
+                                   'journal',
+                                   'lumen',
+                                   'paper',
+                                   'readable',
+                                   'sandstone',
+                                   'simplex',
+                                   'slate',
+                                   'spacelab',
+                                   'superhero',
+                                   'united',
+                                   'yeti'
+                               ][ 3 ],
+            syntaxTheme:       'dark',
+            linenums:          true,
+            collapseSymbols:   false,
+            sort:              'longname, version, since',
+            search:            true,
+            systemName:        'Itee-LevelDB',
+            footer:            '',
+            copyright:         'Copyright 2015-Present <a href="https://github.com/Itee">Itee</a> (Tristan Valcke)',
+            includeDate:       false,
+            inverseNav:        false,
+            outputSourceFiles: true,
+            outputSourcePath:  true
+        }
+    }
+
+}
+
+module.exports = CreateJsdocConfiguration()
+
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/configs_karma.benchs.conf.js.html b/docs/configs_karma.benchs.conf.js.html new file mode 100644 index 0000000..50b7db8 --- /dev/null +++ b/docs/configs_karma.benchs.conf.js.html @@ -0,0 +1,325 @@ + + + + + + + Itee-LevelDB Source: configs/karma.benchs.conf.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: configs/karma.benchs.conf.js

+ +
+
+
/**
+ * @author [Tristan Valcke]{@link https://github.com/Itee}
+ * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
+ *
+ * @module Config-Karma-Benchs
+ * @description The file manage the karma configuration for run benchmarks that are under `tests/benchmarks` folder
+ */
+
+const packageInfos = require( '../package' )
+
+/**
+ * Will assign an appropriate configuration object about benchmarks for karma.
+ *
+ * @generator
+ * @param {object} config - The karma configuration object to extend
+ */
+function CreateKarmaBenchmarkConfiguration ( config ) {
+
+    config.set( {
+
+        // base path that will be used to resolve all patterns (eg. files, exclude)
+        basePath: '../tests/',
+
+        // frameworks to use
+        // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+        frameworks: [ 'benchmark' ],
+
+        // list of files / patterns to load in the browser
+        files: [ `builds/${packageInfos.name}.benchs.js` ],
+
+        // list of files to exclude
+        exclude: [],
+
+        // preprocess matching files before serving them to the browser
+        // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
+        preprocessors: {},
+
+        // test results reporter to use
+        // possible values: 'dots', 'progress'
+        // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+        reporters:         [ 'benchmark' ],
+        benchmarkReporter: {
+            colors:           true,
+            //            style: {
+            //                benchmark: chalk.stripColor,
+            //                summaryBenchmark: chalk.underline,
+            //                summaryEmphasis: chalk.bold.underline,
+            //                browser: chalk.blue,
+            //                decorator: chalk.cyan,
+            //                hz: chalk.green,
+            //                hzUnits: chalk.italic.dim,
+            //                suite: chalk.bold.magenta
+            //            },
+            decorator:        '*',
+            terminalWidth:    60,
+            hzWidth:          4,
+            hzUnits:          'ops/sec',
+            browserWidth:     40,
+            showBrowser:      false,
+            showSuiteSummary: true
+            //            formatBenchmark: formatBenchmark,
+            //            formatSuiteHeading: formatSuiteHeading,
+            //            formatSuiteSummary: formatSuiteSummary
+        },
+
+        // 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,
+
+        // enable / disable watching file and executing tests whenever any file changes
+        autoWatch: false,
+
+        // start these browsers
+        // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+        browsers: [ 'Firefox' ],
+        //        browsers: [ 'Chrome' ],
+        //        browsers: [ 'Edge' ],
+        //        browsers: [ 'Firefox', 'Chrome', 'Edge' ],
+
+        // Format assertion errors and stack traces. Useful for removing vendors and compiled sources. Return an empty line '' to remove it.
+        formatError: () => '',
+
+        // Continuous Integration mode
+        // if true, Karma captures browsers, runs the tests and exits
+        singleRun: true,
+
+        // Concurrency level
+        // how many browser should be started simultaneous
+        concurrency: 4,
+
+        // If, during test execution, Karma does not receive any message from a browser
+        browserNoActivityTimeout: 60000,
+        browserDisconnectTimeout: 60000,
+
+        // If browser does not capture in given timeout [ms], kill it
+        captureTimeout: 60000,
+
+        // How long will Karma wait for browser process to terminate before sending a SIGKILL signal.
+        processKillTimeout: 360000
+
+    } )
+
+}
+
+module.exports = CreateKarmaBenchmarkConfiguration
+
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/configs_karma.units.conf.js.html b/docs/configs_karma.units.conf.js.html new file mode 100644 index 0000000..6c0c1fa --- /dev/null +++ b/docs/configs_karma.units.conf.js.html @@ -0,0 +1,314 @@ + + + + + + + Itee-LevelDB Source: configs/karma.units.conf.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: configs/karma.units.conf.js

+ +
+
+
/**
+ * @author [Tristan Valcke]{@link https://github.com/Itee}
+ * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
+ *
+ * @module Config-Karma-Units
+ * @description The file manage the karma configuration for run units tests that are under `tests/units` folder
+ */
+
+const packageInfos = require( '../package' )
+
+/**
+ * Will assign an appropriate configuration object about unit tests for karma.
+ *
+ * @generator
+ * @param {object} config - The karma configuration object to extend
+ */
+function CreateKarmaUnitsConfiguration ( config ) {
+
+    config.set( {
+
+        // base path that will be used to resolve all patterns (eg. files, exclude)
+        basePath: '../tests/',
+
+        // frameworks to use
+        // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+        frameworks: [ 'mocha', 'chai' ],
+
+        // list of files / patterns to load in the browser
+        files: [ `builds/${packageInfos.name}.units.js` ],
+
+        // list of files to exclude
+        exclude: [],
+
+        // preprocess matching files before serving them to the browser
+        // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
+        preprocessors: {},
+
+        // test results reporter to use
+        // possible values: 'dots', 'progress'
+        // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+        reporters: [ 'mocha', 'html' ],
+
+        htmlReporter: {
+            outputFile: '../docs/unit-tests-report.html',
+
+            // Optional
+            pageTitle:       'Unit Tests',
+            subPageTitle:    'Result of unit testing for Itee-Database.',
+            groupSuites:     true,
+            useCompactStyle: false,
+            useLegacyStyle:  false,
+            showOnlyFailed:  false
+        },
+
+        // 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,
+
+        // enable / disable watching file and executing tests whenever any file changes
+        autoWatch: false,
+
+        // start these browsers
+        // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+        browsers: [ 'Firefox' ],
+        //        browsers: [ 'Chrome' ],
+        //        browsers: [ 'Edge' ],
+        //        browsers: [ 'Firefox', 'Chrome', 'Edge' ],
+
+        // Format assertion errors and stack traces. Useful for removing vendors and compiled sources. Return an empty line '' to remove it.
+        formatError: () => '',
+
+        // Continuous Integration mode
+        // if true, Karma captures browsers, runs the tests and exits
+        singleRun: true,
+
+        // Concurrency level
+        // how many browser should be started simultaneous
+        concurrency: 4,
+
+        // If, during test execution, Karma does not receive any message from a browser
+        browserNoActivityTimeout: 60000,
+        browserDisconnectTimeout: 60000,
+
+        // If browser does not capture in given timeout [ms], kill it
+        captureTimeout: 60000,
+
+        // How long will Karma wait for browser process to terminate before sending a SIGKILL signal.
+        processKillTimeout: 360000
+
+    } )
+
+}
+
+module.exports = CreateKarmaUnitsConfiguration
+
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/configs_rollup.conf.js.html b/docs/configs_rollup.conf.js.html new file mode 100644 index 0000000..33b1d5b --- /dev/null +++ b/docs/configs_rollup.conf.js.html @@ -0,0 +1,364 @@ + + + + + + + Itee-LevelDB Source: configs/rollup.conf.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: configs/rollup.conf.js

+ +
+
+
/**
+ * @author [Tristan Valcke]{@link https://github.com/Itee}
+ * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
+ *
+ * @module Config-Rollup
+ * @description The file manage the rollup configuration for build the library using differents arguments. It allow to build with two type of environment (dev and prod), and differents output format.
+ * Use npm run help to display all available build options.
+ *
+ * @requires {@link module: [path]{@link https://nodejs.org/api/path.html}}
+ * @requires {@link module: [rollup-plugin-commonjs]{@link https://github.com/rollup/rollup-plugin-commonjs}}
+ * @requires {@link module: [rollup-plugin-node-resolve]{@link https://github.com/rollup/rollup-plugin-node-resolve}}
+ * @requires {@link module: [rollup-plugin-terser]{@link https://github.com/TrySound/rollup-plugin-terser}}
+ *
+ */
+
+/* eslint-env node */
+
+const packageInfos    = require( '../package' )
+const path            = require( 'path' )
+const commonjs        = require( '@rollup/plugin-commonjs' )
+const { nodeResolve } = require( '@rollup/plugin-node-resolve' )
+const terser          = require( 'rollup-plugin-terser' ).terser
+
+function _computeBanner ( name, format ) {
+
+    const packageName = name || packageInfos.name
+    let prettyFormat  = ''
+
+    switch ( format ) {
+
+        case 'cjs':
+            prettyFormat = 'CommonJs'
+            break
+
+        case 'esm':
+            prettyFormat = 'EsModule'
+            break
+
+        case 'iife':
+            prettyFormat = 'Standalone'
+            break
+
+        case 'umd':
+            prettyFormat = 'Universal'
+            break
+
+        default:
+            throw new RangeError( `Invalid switch parameter: ${ format }` )
+
+    }
+
+    return `console.log('${ packageName } v${ packageInfos.version } - ${ prettyFormat }')`
+
+}
+
+/**
+ * Will create an appropriate configuration object for rollup, related to the given arguments.
+ *
+ * @generator
+ * @param options
+ * @return {Array.<json>} An array of rollup configuration
+ */
+function CreateRollupConfigs ( options ) {
+    'use strict'
+
+    const name      = options.name
+    const input     = options.input
+    const output    = options.output
+    const formats   = options.format.split( ',' )
+    const envs      = options.env.split( ',' )
+    const treeshake = options.treeshake
+    const fileName  = path.basename( input, '.js' )
+
+    const configs = []
+
+    for ( let formatIndex = 0, numberOfFormats = formats.length ; formatIndex < numberOfFormats ; ++formatIndex ) {
+
+        for ( let envIndex = 0, numberOfEnvs = envs.length ; envIndex < numberOfEnvs ; envIndex++ ) {
+
+            const env        = envs[ envIndex ]
+            const isProd     = ( env.includes( 'prod' ) )
+            const format     = formats[ formatIndex ]
+            const outputPath = ( isProd ) ? path.join( output, `${ fileName }.${ format }.min.js` ) : path.join( output, `${ fileName }.${ format }.js` )
+
+            configs.push( {
+                input:    input,
+                external: [
+                    'itee-validators',
+                    'itee-utils',
+                    'levelup',
+                    'level',
+                    'leveldown'
+                ],
+                plugins: [
+                    commonjs( {
+                        include: 'node_modules/**'
+                    } ),
+                    nodeResolve( {
+                        preferBuiltins: true
+                    } ),
+                    isProd && terser()
+                ],
+                onwarn: ( {
+                    loc,
+                    frame,
+                    message
+                } ) => {
+
+                    if ( loc ) {
+                        process.stderr.write( `/!\\ ${ loc.file } (${ loc.line }:${ loc.column }) ${ frame } ${ message }\n` )
+                    } else {
+                        process.stderr.write( `/!\\ ${ message }\n` )
+                    }
+
+                },
+                treeshake: treeshake,
+                output:    {
+                    // core options
+                    file:    outputPath,
+                    format:  format,
+                    name:    name,
+                    globals: {},
+
+                    // advanced options
+                    paths:     {},
+                    banner:    ( isProd ) ? '' : _computeBanner( name, format ),
+                    footer:    '',
+                    intro:     '',
+                    outro:     '',
+                    sourcemap: !isProd,
+                    interop:   true,
+
+                    // danger zone
+                    exports: 'auto',
+                    amd:     {},
+                    indent:  '\t',
+                    strict:  true
+                }
+            } )
+
+        }
+
+    }
+
+    return configs
+
+}
+
+module.exports = CreateRollupConfigs
+
+
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/configs_rollup.test.conf.js.html b/docs/configs_rollup.test.conf.js.html new file mode 100644 index 0000000..6ca1852 --- /dev/null +++ b/docs/configs_rollup.test.conf.js.html @@ -0,0 +1,261 @@ + + + + + + + Itee-LevelDB Source: configs/rollup.test.conf.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: configs/rollup.test.conf.js

+ +
+
+
/**
+ * @author [Tristan Valcke]{@link https://github.com/Itee}
+ * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
+ *
+ * @module Config-Rollup-Test
+ * @description The file manage the rollup configuration for build tests
+ */
+
+const packageInfos = require( '../package' )
+
+/**
+ * Will create an appropriate configuration object for rollup, related to the given arguments.
+ *
+ * @generator
+ * @return {Array.<json>} An array of rollup configuration
+ */
+function CreateTestsRollupConfigs ( /*options*/ ) {
+    'use strict'
+
+    return [
+        {
+            input:     `tests/units/units.js`,
+            plugins:   [],
+            treeshake: true,
+            output:    {
+                indent: '\t',
+                format: 'iife',
+                name:   'Itee.Units',
+                file:   `tests/builds/${packageInfos.name}.units.js`
+            }
+        },
+        {
+            input:     `tests/benchmarks/benchs.js`,
+            plugins:   [],
+            treeshake: true,
+            output:    {
+                indent: '\t',
+                format: 'iife',
+                name:   'Itee.Benchs',
+                file:   `tests/builds/${packageInfos.name}.benchs.js`
+            }
+        }
+    ]
+
+}
+
+module.exports = CreateTestsRollupConfigs
+
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/global.html b/docs/global.html index 0102f3f..7764b5d 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,14 +4,14 @@ - Documentation Global + Itee-LevelDB Global - + - + @@ -20,7 +20,7 @@ + + +
+
+ + +
+ +
+ + +

Source: gulpfile.js

+ +
+
+
/**
+ * @author [Tristan Valcke]{@link https://github.com/Itee}
+ * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
+ *
+ * @module Building
+ *
+ * @description The gulp tasks file. It allow to run some tasks from command line interface.<br>
+ * The available tasks are:
+ * <ul>
+ * <li>help</li>
+ * <li>clean</li>
+ * <li>lint</li>
+ * <li>doc</li>
+ * <li>unit</li>
+ * <li>bench</li>
+ * <li>test</li>
+ * <li>build-test</li>
+ * <li>build</li>
+ * <li>release</li>
+ * </ul>
+ * You could find a complet explanation about these tasks using: <b>npm run help</b>.
+ *
+ * @requires {@link module: [gulp]{@link https://github.com/gulpjs/gulp}}
+ * @requires {@link module: [gulp-jsdoc3]{@link https://github.com/mlucool/gulp-jsdoc3}}
+ * @requires {@link module: [gulp-eslint]{@link https://github.com/adametry/gulp-eslint}}
+ * @requires {@link module: [del]{@link https://github.com/sindresorhus/del}}
+ * @requires {@link module: [minimist]{@link https://github.com/substack/minimist}}
+ * @requires {@link module: [rollup]{@link https://github.com/rollup/rollup}}
+ * @requires {@link module: [path]{@link https://nodejs.org/api/path.html}}
+ * @requires {@link module: [karma]{@link https://github.com/karma-runner/karma}}
+ * @requires {@link module: [fancy-log]{@link https://github.com/js-cli/fancy-log}}
+ * @requires {@link module: [ansi-colors]{@link https://github.com/doowb/ansi-colors}}
+ *
+ *
+ */
+
+/* eslint-env node */
+
+const packageInfos = require( './package.json' )
+const gulp         = require( 'gulp' )
+const jsdoc        = require( 'gulp-jsdoc3' )
+const eslint       = require( 'gulp-eslint' )
+//const replace      = require( 'gulp-replace' )
+const del          = require( 'del' )
+const parseArgs    = require( 'minimist' )
+const rollup       = require( 'rollup' )
+const path         = require( 'path' )
+const karma        = require( 'karma' )
+const log          = require( 'fancy-log' )
+const colors       = require( 'ansi-colors' )
+const red          = colors.red
+const green        = colors.green
+const blue         = colors.blue
+const cyan         = colors.cyan
+const yellow       = colors.yellow
+const magenta      = colors.magenta
+
+/**
+ * @method npm run help ( default )
+ * @global
+ * @description Will display the help in console
+ */
+gulp.task( 'help', ( done ) => {
+
+    log( '' )
+    log( '====================================================' )
+    log( '|                      HELP                        |' )
+    log( '|                Itee Level Database               |' )
+    log( `|                     v${packageInfos.version}                       |` )
+    log( '====================================================' )
+    log( '' )
+    log( 'Available commands are:' )
+    log( '\t', blue( 'npm run' ), cyan( 'help' ), ' - Display this help.' )
+    log( '\t', blue( 'npm run' ), cyan( 'patch' ), ' - Will apply some patch/replacements in dependencies.', red( '(Apply only once after run "npm install")' ) )
+    log( '\t', blue( 'npm run' ), cyan( 'clean' ), ' - Will delete builds and temporary folders.' )
+    log( '\t', blue( 'npm run' ), cyan( 'lint' ), ' - Will run the eslint in pedantic mode with auto fix when possible.' )
+    log( '\t', blue( 'npm run' ), cyan( 'doc' ), ' - Will run jsdoc, and create documentation under `documentation` folder, using the docdash theme' )
+    log( '\t', blue( 'npm run' ), cyan( 'test' ), ' - Will run the test framworks (unit and bench), and create reports under `documentation/report` folder, using the mochawesome theme' )
+    log( '\t', blue( 'npm run' ), cyan( 'unit' ), ' - Will run the karma server for unit tests.' )
+    log( '\t', blue( 'npm run' ), cyan( 'bench' ), ' - Will run the karma server for benchmarks.' )
+    log( '\t', blue( 'npm run' ), cyan( 'build' ), yellow( '--' ), green( '<options>' ), ' - Will build the application for development and/or production environments.', yellow( 'Note: The two dash are only required if you provide options !' ) )
+    log( '\t\t The available', green( '<options>' ), 'are:' )
+    log( '\t\t\t', green( '-n' ), 'or', green( '--name' ), ' - The export name of the builded application', red( '(required for UMD module)' ), cyan( '[Default: ""]' ), '.' )
+    log( '\t\t\t', green( '-i' ), 'or', green( '--input' ), ' - The main file path to build', cyan( '[Default: "sources/main.js"]' ), '.' )
+    log( '\t\t\t', green( '-o' ), 'or', green( '--output' ), ' - The folder where output the build', cyan( '[Default: "builds"]' ), '.' )
+    log( '\t\t\t', green( '-f:' ), magenta( '<format>' ), 'or', green( '--format:' ), magenta( '<format>' ), ' - to specify the output build type. Where format could be any of:', magenta( 'amd' ), magenta( 'cjs' ), magenta( 'es' ), magenta( 'iife' ), magenta( 'umd' ), cyan( '[Default: "amd,cjs,es,iife,umd"]' ), '.' )
+    log( '\t\t\t', green( '-e:' ), magenta( '<env>' ), 'or', green( '--env:' ), magenta( '<env>' ), ' - to specify the build environment. Where env could be any of:', magenta( 'dev' ), magenta( 'prod' ), cyan( '[Default: "dev"]' ), '.' )
+    log( '\t\t\t', green( '-s' ), 'or', green( '--sourcemap' ), ' - to build with related source map', cyan( '[Default: true]' ), '.' )
+    log( '\t\t\t', green( '-t' ), 'or', green( '--treeshake' ), ' - allow to perform treeshaking when building', cyan( '[Default: true]' ), '.' )
+    log( '\t', blue( 'npm run' ), cyan( 'release' ), ' - Will run all the lint, test stuff, and if succeed will build the application.' )
+    log( '' )
+    log( 'In case you have', blue( 'gulp' ), 'installed globally, you could use also:' )
+    log( '\t', blue( 'gulp' ), cyan( 'command' ), ' - It will perform the command like using "npm run" but with less characters to type... Because you\'re a developer, right ?' )
+    log( '' )
+
+    done()
+
+} )
+
+/**
+ * @method npm run patch
+ * @global
+ * @description Will apply some patch/replacements in dependencies
+ */
+gulp.task( 'patch', ( done ) => {
+
+    // No patch for this package
+    done()
+
+} )
+
+/**
+ * @method npm run clean
+ * @global
+ * @description Will delete builds and temporary folders
+ */
+gulp.task( 'clean', () => {
+
+    const filesToClean = [
+        './builds',
+        './tests/builds',
+        './docs'
+    ]
+
+    return del( filesToClean )
+
+} )
+
+/**
+ * @method npm run lint
+ * @global
+ * @description Will lint the sources files and try to fix the style when possible
+ */
+gulp.task( 'lint', () => {
+
+    const filesToLint = [
+        'gulpfile.js',
+        'configs/**/*.js',
+        'sources/**/*.js',
+        'tests/**/*.js',
+        '!tests/builds/*.js'
+    ]
+
+    return gulp.src( filesToLint, { base: './' } )
+               .pipe( eslint( {
+                   allowInlineConfig: true,
+                   globals:           [],
+                   fix:               true,
+                   quiet:             false,
+                   envs:              [],
+                   configFile:        './configs/eslint.conf.js',
+                   parserOptions:     {},
+                   plugins:           [],
+                   rules:             {},
+                   useEslintrc:       false
+               } ) )
+               .pipe( eslint.format( 'stylish' ) )
+               .pipe( gulp.dest( '.' ) )
+               .pipe( eslint.failAfterError() )
+
+} )
+
+/**
+ * @method npm run doc
+ * @global
+ * @description Will generate this documentation
+ */
+gulp.task( 'doc', ( done ) => {
+
+    const config     = require( './configs/jsdoc.conf' )
+    const filesToDoc = [
+        'README.md',
+        'gulpfile.js',
+        './configs/*.js',
+        './sources/**/*.js',
+        './tests/**/*.js'
+    ]
+
+    gulp.src( filesToDoc, { read: false } )
+        .pipe( jsdoc( config, done ) )
+
+} )
+
+/**
+ * @method npm run unit
+ * @global
+ * @description Will run unit tests using karma
+ */
+gulp.task( 'unit', ( done ) => {
+
+    const karmaServer = new karma.Server( {
+        configFile: `${__dirname}/configs/karma.units.conf.js`,
+        singleRun:  true
+    }, ( exitCode ) => {
+
+        if ( exitCode !== 0 ) {
+            done( `Karma server exit with code ${exitCode}` )
+        } else {
+            log( `Karma server exit with code ${exitCode}` )
+            done()
+        }
+
+    } )
+
+    karmaServer.on( 'browser_error', ( browser, error ) => {
+        log( red( error.message ) )
+    } )
+
+    karmaServer.start()
+
+} )
+
+/**
+ * @method npm run bench
+ * @global
+ * @description Will run benchmarks using karma
+ */
+gulp.task( 'bench', ( done ) => {
+
+    const karmaServer = new karma.Server( {
+        configFile: `${__dirname}/configs/karma.benchs.conf.js`,
+        singleRun:  true
+    }, ( exitCode ) => {
+
+        if ( exitCode !== 0 ) {
+            done( `Karma server exit with code ${exitCode}` )
+        } else {
+            log( `Karma server exit with code ${exitCode}` )
+            done()
+        }
+
+    } )
+
+    karmaServer.on( 'browser_error', ( browser, error ) => {
+        log( red( error.message ) )
+    } )
+
+    karmaServer.start()
+
+} )
+
+/**
+ * @method npm run test
+ * @global
+ * @description Will run unit tests and benchmarks using karma
+ */
+gulp.task( 'test', gulp.series( 'unit', 'bench' ) )
+
+/**
+ * @method npm run build-test
+ * @global
+ * @description Will build itee client tests.
+ */
+gulp.task( 'build-test', ( done ) => {
+
+    const configs = require( './configs/rollup.test.conf' )()
+
+    nextBuild()
+
+    function nextBuild ( error ) {
+        'use strict'
+
+        if ( error ) {
+
+            done( error )
+
+        } else if ( configs.length === 0 ) {
+
+            done()
+
+        } else {
+
+            const config = configs.pop()
+            log( `Building ${config.output.file}` )
+
+            rollup.rollup( config )
+                  .then( ( bundle ) => { return bundle.write( config.output ) } )
+                  .then( () => { nextBuild() } )
+                  .catch( nextBuild )
+
+        }
+
+    }
+
+} )
+
+/**
+ * @method npm run build
+ * @global
+ * @description Will build itee client module using optional arguments. See help to further informations.
+ */
+gulp.task( 'build', ( done ) => {
+
+    const options = parseArgs( process.argv, {
+        string:  [ 'n', 'i', 'f', 'e' ],
+        boolean: [ 's', 't' ],
+        default: {
+            n: 'Itee.Database.Level',
+            i: path.join( __dirname, 'sources', `${packageInfos.name}.js` ),
+            o: path.join( __dirname, 'builds' ),
+            f: 'esm,cjs',
+            e: 'dev,prod',
+            s: true,
+            t: true
+        },
+        alias: {
+            n: 'name',
+            i: 'input',
+            o: 'output',
+            f: 'format',
+            e: 'env',
+            s: 'sourcemap',
+            t: 'treeshake'
+        }
+    } )
+
+    const configs = require( './configs/rollup.conf' )( options )
+
+    nextBuild()
+
+    function nextBuild ( error ) {
+        'use strict'
+
+        if ( error ) {
+
+            done( error )
+
+        } else if ( configs.length === 0 ) {
+
+            done()
+
+        } else {
+
+            const config = configs.pop()
+            log( `Building ${config.output.file}` )
+
+            rollup.rollup( config )
+                  .then( ( bundle ) => { return bundle.write( config.output ) } )
+                  .then( () => { nextBuild() } )
+                  .catch( nextBuild )
+
+        }
+
+    }
+
+} )
+
+/**
+ * @method npm run release
+ * @global
+ * @description Will perform a complet release of the library including 'clean', 'lint', 'doc', 'build-test', 'test' and finally 'build'.
+ */
+gulp.task( 'release', gulp.series( 'clean', 'lint', 'doc', 'build-test', 'test', 'build' ) )
+
+//---------
+
+gulp.task( 'default', gulp.series( 'help' ) )
+
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/index.html b/docs/index.html index 6b06fc2..a13105d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,14 +4,14 @@ - Documentation Index + Itee-LevelDB Index - + - + @@ -20,7 +20,7 @@ + + +
+
+ + +
+ +
+ + +

Source: sources/itee-leveldb.js

+ +
+
+
/**
+ * @author [Tristan Valcke]{@link https://github.com/Itee}
+ * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
+ *
+ * @file Todo
+ *
+ * @example Todo
+ *
+ */
+
+export * from './TLevelDBDatabase'
+
+
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/package.json b/package.json index de02866..14ac810 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "itee-leveldb", - "version": "1.0.2", + "version": "1.0.3", "description": "The LevelDB database implementation for Itee projects", "keywords": [ "itee",