diff --git a/.codacy.yml b/.codacy.yml new file mode 100644 index 0000000..554bdae --- /dev/null +++ b/.codacy.yml @@ -0,0 +1,6 @@ +languages: + JavaScript: true +exclude_paths: +- "doc/**" +- "lib/**" +- "test/**" diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 0000000..554bdae --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,6 @@ +languages: + JavaScript: true +exclude_paths: +- "doc/**" +- "lib/**" +- "test/**" diff --git a/.esdoc.json b/.esdoc.json new file mode 100644 index 0000000..ec4948a --- /dev/null +++ b/.esdoc.json @@ -0,0 +1,47 @@ +{ + "source": "./src", + "destination": "./gh-pages", + "debug": false, + "index": "./README.md", + "package": "./package.json", + "plugins": [ + { + "name": "esdoc-standard-plugin", + "option": { + "accessor": { + "access": ["public", "protected", "private"], + "autoPrivate": true + }, + "brand": { + "title": "@aureooms/js-insertion-sort" + }, + "test": { + "type": "ava", + "source": "./test/src" + }, + "manual": { + "files":[ + "./doc/manual/overview.md", + "./doc/manual/installation.md", + "./doc/manual/usage.md", + "./doc/manual/example.md" + ] + } + } + }, + { + "name": "esdoc-inject-style-plugin", + "option": { + "enable": true, + "styles": ["./doc/css/style.css"] + } + }, + { + "name": "esdoc-inject-script-plugin", + "option": { + "enable": true, + "scripts": ["./doc/scripts/header.js"] + } + } + ] +} diff --git a/.gitignore b/.gitignore index 6704566..da100c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,104 +1,16 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* +# lock file +!yarn.lock -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json +# Generated files +/lib -# Runtime data -pids -*.pid -*.seed -*.pid.lock +# Dependency directory +node_modules +jspm_packages -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov +# Coverage directory used by nyc +/coverage +/.nyc_output -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# Next.js build output -.next - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and *not* Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port +# Documentation +/gh-pages diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..bc3f97c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +language: node_js + +node_js: + - node + +install: + - npm install + +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 + +script: + - npm run travis + +after_script: + - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT + +after_success: + - bash <(curl -s https://codecov.io/bash) || true + - coveralls < coverage/lcov.info || true diff --git a/README.md b/README.md index 5a4528d..c847383 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,25 @@ -# js-insertion-sort -Insertion sorting algorithms for JavaScript +[@aureooms/js-insertion-sort](https://aureooms.github.io/js-insertion-sort) +== + +Insertion sorting algorithms for JavaScript. +See [docs](https://aureooms.github.io/js-insertion-sort/index.html). + +> :warning: The code requires `regeneratorRuntime` to be defined, for instance by importing +> [regenerator-runtime/runtime](https://www.npmjs.com/package/regenerator-runtime). + +[![License](https://img.shields.io/github/license/aureooms/js-insertion-sort.svg)](https://raw.githubusercontent.com/aureooms/js-insertion-sort/master/LICENSE) +[![Version](https://img.shields.io/npm/v/@aureooms/js-insertion-sort.svg)](https://www.npmjs.org/package/@aureooms/js-insertion-sort) +[![Build](https://img.shields.io/travis/aureooms/js-insertion-sort/master.svg)](https://travis-ci.org/aureooms/js-insertion-sort/branches) +[![Dependencies](https://img.shields.io/david/aureooms/js-insertion-sort.svg)](https://david-dm.org/aureooms/js-insertion-sort) +[![Dev dependencies](https://img.shields.io/david/dev/aureooms/js-insertion-sort.svg)](https://david-dm.org/aureooms/js-insertion-sort?type=dev) +[![GitHub issues](https://img.shields.io/github/issues/aureooms/js-insertion-sort.svg)](https://github.com/aureooms/js-insertion-sort/issues) +[![Downloads](https://img.shields.io/npm/dm/@aureooms/js-insertion-sort.svg)](https://www.npmjs.org/package/@aureooms/js-insertion-sort) + +[![Code issues](https://img.shields.io/codeclimate/issues/aureooms/js-insertion-sort.svg)](https://codeclimate.com/github/aureooms/js-insertion-sort/issues) +[![Code maintainability](https://img.shields.io/codeclimate/maintainability/aureooms/js-insertion-sort.svg)](https://codeclimate.com/github/aureooms/js-insertion-sort/trends/churn) +[![Code coverage (cov)](https://img.shields.io/codecov/c/gh/aureooms/js-insertion-sort/master.svg)](https://codecov.io/gh/aureooms/js-insertion-sort) + + +[![Code technical debt](https://img.shields.io/codeclimate/tech-debt/aureooms/js-insertion-sort.svg)](https://codeclimate.com/github/aureooms/js-insertion-sort/trends/technical_debt) +[![Documentation](https://aureooms.github.io/js-insertion-sort/badge.svg)](https://aureooms.github.io/js-insertion-sort/source.html) +[![Package size](https://img.shields.io/bundlephobia/minzip/@aureooms/js-insertion-sort)](https://bundlephobia.com/result?p=@aureooms/js-insertion-sort) diff --git a/doc/css/style.css b/doc/css/style.css new file mode 100644 index 0000000..ed56934 --- /dev/null +++ b/doc/css/style.css @@ -0,0 +1,52 @@ +h1, +h2, +.navigation, +.layout-container > header, +footer +{ + border: none; +} + +.project-name { + color: #FC913A; + font-weight: bold; +} + +.layout-container > header > a.repo-url-github { + font-size: inherit; + display: inline; + background: none; + vertical-align: inherit; +} + +.search-box img { + display: none; +} + +.search-box::before{ + content: "search"; +} + +.search-input-edge { + height: 0px; +} + +.search-result { + width: 300px; + margin-left: 42px; + box-shadow: 1px 1px 13px rgba(0,0,0,0.2); +} + +.search-input { + visibility: visible; +} + +.search-result li.search-separator { + text-transform: capitalize; + background-color: #ccc; +} + +span[data-ice="signature"] > span { + /*font-weight: bold;*/ + font-style: italic; +} diff --git a/doc/manual/example.md b/doc/manual/example.md new file mode 100644 index 0000000..8723dad --- /dev/null +++ b/doc/manual/example.md @@ -0,0 +1,3 @@ +# Examples + +> More examples in [the test files](https://github.com/aureooms/js-insertion-sort/tree/master/test/src). diff --git a/doc/manual/installation.md b/doc/manual/installation.md new file mode 100644 index 0000000..0be462a --- /dev/null +++ b/doc/manual/installation.md @@ -0,0 +1,22 @@ +# Installation + +Can be managed using +[yarn](https://yarnpkg.com/en/docs), +[npm](https://docs.npmjs.com), +or [jspm](https://jspm.org/docs). + + +### yarn +```terminal +yarn add @aureooms/js-insertion-sort +``` + +### npm +```terminal +npm install @aureooms/js-insertion-sort --save +``` + +### jspm +```terminal +jspm install npm:@aureooms/js-insertion-sort +``` diff --git a/doc/manual/overview.md b/doc/manual/overview.md new file mode 100644 index 0000000..07dd0c5 --- /dev/null +++ b/doc/manual/overview.md @@ -0,0 +1 @@ +# Overview diff --git a/doc/manual/usage.md b/doc/manual/usage.md new file mode 100644 index 0000000..51e8eab --- /dev/null +++ b/doc/manual/usage.md @@ -0,0 +1,18 @@ +# Usage + +> :warning: The code requires `regeneratorRuntime` to be defined, for instance by importing +> [regenerator-runtime/runtime](https://www.npmjs.com/package/regenerator-runtime). + +First, require the polyfill at the entry point of your application +```js +require( 'regenerator-runtime/runtime' ); +// or +import 'regenerator-runtime/runtime.js' ; +``` + +Then, import the library where needed +```js +const insertionsort = require( '@aureooms/js-insertion-sort' ) ; +// or +import * as insertionsort from '@aureooms/js-insertion-sort' ; +``` diff --git a/doc/scripts/header.js b/doc/scripts/header.js new file mode 100644 index 0000000..73d0abe --- /dev/null +++ b/doc/scripts/header.js @@ -0,0 +1,34 @@ +var domReady = function(callback) { + var state = document.readyState ; + if ( state === 'interactive' || state === 'complete' ) { + callback() ; + } + else { + document.addEventListener('DOMContentLoaded', callback); + } +} ; + + +domReady(function(){ + + var projectname = document.createElement('a'); + projectname.classList.add('project-name'); + projectname.text = 'aureooms/js-insertion-sort'; + projectname.href = './index.html' ; + + var header = document.getElementsByTagName('header')[0] ; + header.insertBefore(projectname,header.firstChild); + + var testlink = document.querySelector('header > a[data-ice="testLink"]') ; + testlink.href = 'https://coveralls.io/github/aureooms/js-insertion-sort' ; + testlink.target = '_BLANK' ; + + var searchBox = document.querySelector('.search-box'); + var input = document.querySelector('.search-input'); + + // active search box when focus on searchBox. + input.addEventListener('focus', function(){ + searchBox.classList.add('active'); + }); + +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..e234fd7 --- /dev/null +++ b/package.json @@ -0,0 +1,144 @@ +{ + "name": "@aureooms/js-insertion-sort", + "description": "Insertion sorting algorithms for JavaScript", + "version": "0.0.0", + "author": "aureooms", + "ava": { + "files": [ + "test/src/**/*" + ], + "require": [ + "regenerator-runtime/runtime", + "@babel/register" + ], + "timeout": "1m" + }, + "babel": { + "presets": [ + "@babel/preset-env" + ], + "env": { + "test": { + "presets": [ + "babel-preset-power-assert" + ], + "plugins": [ + [ + "transform-remove-console", + { + "exclude": [ + "log", + "error", + "warn" + ] + } + ] + ], + "sourceMaps": "inline" + }, + "development": { + "presets": [ + "babel-preset-power-assert" + ], + "plugins": [ + [ + "transform-remove-console", + { + "exclude": [ + "log", + "error", + "warn" + ] + } + ] + ], + "sourceMaps": "inline" + }, + "production": { + "plugins": [ + "babel-plugin-unassert", + [ + "transform-remove-console", + { + "exclude": [ + "log", + "error", + "warn" + ] + } + ] + ], + "sourceMaps": "inline" + } + } + }, + "bugs": { + "url": "https://github.com/aureooms/js-insertion-sort/issues" + }, + "dependencies": {}, + "devDependencies": { + "@babel/cli": "7.11.6", + "@babel/core": "7.11.6", + "@babel/preset-env": "7.11.5", + "@babel/register": "7.11.5", + "ava": "3.12.1", + "babel-plugin-transform-remove-console": "6.9.4", + "babel-plugin-unassert": "3.0.1", + "babel-preset-power-assert": "3.0.0", + "coveralls": "3.1.0", + "esdoc": "1.1.0", + "esdoc-ecmascript-proposal-plugin": "1.0.0", + "esdoc-inject-script-plugin": "1.0.0", + "esdoc-inject-style-plugin": "1.0.0", + "esdoc-standard-plugin": "1.0.0", + "np": "6.5.0", + "nyc": "15.1.0", + "power-assert": "1.6.1", + "regenerator-runtime": "0.13.7", + "xo": "0.33.1" + }, + "files": [ + "lib" + ], + "homepage": "https://aureooms.github.io/js-insertion-sort", + "keywords": ["agpl", "algorithms", "insertion", "insertion-sort", "javascript", "quadratic-time", "sorting", "sorting-algorithms"], + "license": "AGPL-3.0", + "main": "lib/index.js", + "prettier": { + "trailingComma": "all" + }, + "repository": { + "type": "git", + "url": "https://github.com/aureooms/js-insertion-sort" + }, + "scripts": { + "build": "babel --delete-dir-on-start --env-name production src -d lib", + "cover": "nyc --reporter=lcov npm test", + "esdoc": "esdoc", + "prepare": "npm run build", + "release": "np", + "test": "ava", + "lint": "xo", + "dev": "npm run lint -- --fix && npm run cover -- -- -st --fail-fast", + "travis": "npm run lint && npm run cover" + }, + "sideEffects": false, + "xo": { + "prettier": true, + "ignore": [ + "lib", + "doc" + ], + "plugins": [ + "unicorn" + ], + "rules": { + "unicorn/filename-case": [ + "error", + { + "case": "camelCase" + } + ] + } + } +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..04b95fd --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "extends": [ + "config:base" + ], + "automerge": true +}