From 8418b147ae8fea5e5ff0eb76391c80ea7caf255d Mon Sep 17 00:00:00 2001 From: "J. Abbott" Date: Tue, 6 Aug 2019 09:36:08 -0230 Subject: [PATCH] refactor: organize files and code --- .eslintignore | 1 - .eslintrc | 142 -- .eslintrc.js | 1 + .gitignore | 56 +- .nvmrc | 2 +- .travis.yml | 27 +- CONTRIBUTING.md | 14 +- README.md | 28 +- bower.json | 23 - dev/cfg/eslint.es5.js | 54 + dev/cfg/eslint.es6.js | 27 + dev/cfg/jsdoc/container.tmpl | 183 +++ jsdoc.json => dev/cfg/jsdoc/jsdoc.json | 5 +- .../cfg/jsdoc/jsdoc.teleprint.css | 1 + dev/cfg/jsdoc/layout.tmpl | 45 + dev/cfg/jsdoc/method.tmpl | 106 ++ dev/cfg/karma.js | 41 + dev/cfg/uglify.json | 25 + dev/tool/build.sh | 35 + dev/tool/doc.sh | 40 + dev/tool/include.js | 33 + dev/tool/lint.sh | 11 + dev/tool/test.sh | 8 + docs/fonts/glyphicons-halflings-regular.eot | Bin 20127 -> 0 bytes docs/fonts/glyphicons-halflings-regular.svg | 288 ---- docs/fonts/glyphicons-halflings-regular.ttf | Bin 45404 -> 0 bytes docs/fonts/glyphicons-halflings-regular.woff | Bin 23424 -> 0 bytes docs/fonts/glyphicons-halflings-regular.woff2 | Bin 18028 -> 0 bytes docs/img/glyphicons-halflings-white.png | Bin 8777 -> 0 bytes docs/img/glyphicons-halflings.png | Bin 12799 -> 0 bytes docs/index.html | 248 ---- docs/namespaces.list.html | 295 ----- docs/quicksearch.html | 31 - docs/scripts/docstrap.lib.js | 11 - docs/scripts/fulltext-search-ui.js | 89 -- docs/scripts/fulltext-search.js | 36 - docs/scripts/lunr.min.js | 6 - docs/scripts/prettify/Apache-License-2.0.txt | 202 --- docs/scripts/prettify/jquery.min.js | 6 - docs/scripts/prettify/lang-css.js | 21 - docs/scripts/prettify/prettify.js | 496 ------- docs/scripts/sunlight.js | 1157 ----------------- docs/scripts/toc.js | 203 --- docs/styles/sunlight.dark.css | 345 ----- docs/teleprint.html | 711 ---------- gulpfile.js | 64 - license.md | 21 - package.json | 50 +- src/.eslintrc.js | 1 + src/component/inject-script.js | 10 + src/component/inject-stylesheet.js | 10 + src/component/print-job.js | 182 +++ src/component/scrape-asset.js | 12 + src/components/print.js | 201 --- src/module.js | 67 +- teleprint.js | 250 +--- teleprint.min.js | 1 - test/components/inject.scripts.js | 15 - test/components/inject.stylesheets.js | 15 - test/components/inject.template.element.js | 13 - test/components/inject.template.html.js | 12 - test/components/inject.template.url.js | 18 - test/components/print.template.js | 12 - test/setup.js | 43 - test/spec/inject.scripts.spec.js | 15 + test/spec/inject.stylesheets.spec.js | 18 + test/spec/inject.template.element.spec.js | 13 + test/spec/inject.template.html.spec.js | 12 + test/spec/inject.template.url.spec.js | 18 + test/spec/print.template.spec.js | 12 + test/tasks.js | 7 - 71 files changed, 1040 insertions(+), 5105 deletions(-) delete mode 100644 .eslintrc create mode 100644 .eslintrc.js delete mode 100644 bower.json create mode 100644 dev/cfg/eslint.es5.js create mode 100644 dev/cfg/eslint.es6.js create mode 100644 dev/cfg/jsdoc/container.tmpl rename jsdoc.json => dev/cfg/jsdoc/jsdoc.json (87%) rename docs/styles/site.teleprint.css => dev/cfg/jsdoc/jsdoc.teleprint.css (99%) create mode 100644 dev/cfg/jsdoc/layout.tmpl create mode 100644 dev/cfg/jsdoc/method.tmpl create mode 100644 dev/cfg/karma.js create mode 100644 dev/cfg/uglify.json create mode 100755 dev/tool/build.sh create mode 100755 dev/tool/doc.sh create mode 100644 dev/tool/include.js create mode 100755 dev/tool/lint.sh create mode 100755 dev/tool/test.sh delete mode 100644 docs/fonts/glyphicons-halflings-regular.eot delete mode 100644 docs/fonts/glyphicons-halflings-regular.svg delete mode 100644 docs/fonts/glyphicons-halflings-regular.ttf delete mode 100644 docs/fonts/glyphicons-halflings-regular.woff delete mode 100644 docs/fonts/glyphicons-halflings-regular.woff2 delete mode 100644 docs/img/glyphicons-halflings-white.png delete mode 100644 docs/img/glyphicons-halflings.png delete mode 100644 docs/index.html delete mode 100644 docs/namespaces.list.html delete mode 100644 docs/quicksearch.html delete mode 100644 docs/scripts/docstrap.lib.js delete mode 100644 docs/scripts/fulltext-search-ui.js delete mode 100644 docs/scripts/fulltext-search.js delete mode 100644 docs/scripts/lunr.min.js delete mode 100644 docs/scripts/prettify/Apache-License-2.0.txt delete mode 100644 docs/scripts/prettify/jquery.min.js delete mode 100644 docs/scripts/prettify/lang-css.js delete mode 100644 docs/scripts/prettify/prettify.js delete mode 100644 docs/scripts/sunlight.js delete mode 100644 docs/scripts/toc.js delete mode 100644 docs/styles/sunlight.dark.css delete mode 100644 docs/teleprint.html delete mode 100644 gulpfile.js delete mode 100644 license.md create mode 100644 src/.eslintrc.js create mode 100644 src/component/inject-script.js create mode 100644 src/component/inject-stylesheet.js create mode 100644 src/component/print-job.js create mode 100644 src/component/scrape-asset.js delete mode 100644 src/components/print.js delete mode 100644 teleprint.min.js delete mode 100644 test/components/inject.scripts.js delete mode 100644 test/components/inject.stylesheets.js delete mode 100644 test/components/inject.template.element.js delete mode 100644 test/components/inject.template.html.js delete mode 100644 test/components/inject.template.url.js delete mode 100644 test/components/print.template.js delete mode 100644 test/setup.js create mode 100644 test/spec/inject.scripts.spec.js create mode 100644 test/spec/inject.stylesheets.spec.js create mode 100644 test/spec/inject.template.element.spec.js create mode 100644 test/spec/inject.template.html.spec.js create mode 100644 test/spec/inject.template.url.spec.js create mode 100644 test/spec/print.template.spec.js delete mode 100644 test/tasks.js diff --git a/.eslintignore b/.eslintignore index ed06c21..de29dd0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1 @@ -dist/**/* node_modules/**/* \ No newline at end of file diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index a5fe3ac..0000000 --- a/.eslintrc +++ /dev/null @@ -1,142 +0,0 @@ -{ - "env": { - "browser": true, - "node": true, - "es6": true - }, - "globals": { - "teleprint": 1 - }, - "rules": { - // use double-quotes for strings - "quotes": [2, "double"], - // enforce tabular indentation - // https://www.youtube.com/watch?v=SsoOG6ZeyUI - "indent": ["error", "tab"], - // enforces getter/setter pairs in objects - "accessor-pairs": 0, - // treat var statements as if they were block scoped - "block-scoped-var": 2, - // specify the maximum cyclomatic complexity allowed in a program - "complexity": [ 0, 11 ], - // require return statements to either always or never specify values - // "consistent-return": 2, - // specify curly brace conventions for all control statements - "curly": [ 2, "multi-line" ], - // require default case in switch statements - "default-case": 2, - // enforces consistent newlines before or after dots - "dot-location": 0, - // encourages use of dot notation whenever possible - "dot-notation": [2, { "allowKeywords": true }], - // require the use of === and !== - "eqeqeq": 2, - // make sure for-in loops have an if statement - "guard-for-in": 2, - // disallow the use of alert, confirm, and prompt - "no-alert": 1, - // disallow use of arguments.caller or arguments.callee - "no-caller": 2, - // disallow lexical declarations in case clauses - "no-case-declarations": 2, - // disallow division operators explicitly at beginning of regular expression - "no-div-regex": 0, - // disallow else after a return in an if - "no-else-return": 2, - // disallow use of empty destructuring patterns - "no-empty-pattern": 0, - // disallow comparisons to null without a type-checking operator - "no-eq-null": 0, - // disallow use of eval() - "no-eval": 2, - // disallow adding to native types - "no-extend-native": 2, - // disallow unnecessary function binding - "no-extra-bind": 2, - // disallow fallthrough of case statements - "no-fallthrough": 2, - // disallow the use of leading or trailing decimal points in numeric literals - "no-floating-decimal": 2, - // disallow the type conversions with shorter notations - "no-implicit-coercion": 0, - // disallow use of eval()-like methods - "no-implied-eval": 2, - // disallow this keywords outside of classes or class-like objects - "no-invalid-this": 0, - // disallow usage of __iterator__ property - "no-iterator": 2, - // disallow use of labeled statements - "no-labels": [2, { "allowLoop": true, "allowSwitch": true }], - // disallow unnecessary nested blocks - "no-lone-blocks": 2, - // disallow creation of functions within loops - "no-loop-func": 2, - // disallow the use of magic numbers - "no-magic-numbers": 0, - // disallow use of multiple spaces - "no-multi-spaces": 2, - // disallow use of multiline strings - "no-multi-str": 2, - // disallow reassignments of native objects - "no-native-reassign": 2, - // disallow use of new operator for Function object - "no-new-func": 2, - // disallows creating new instances of String,Number, and Boolean - "no-new-wrappers": 2, - // disallow use of new operator when not part of the assignment or comparison - "no-new": 2, - // disallow use of octal escape sequences in string literals, such as - // var foo = "Copyright \251"; - "no-octal-escape": 2, - // disallow use of (old style) octal literals - "no-octal": 2, - // disallow reassignment of function parameters - "no-param-reassign": [0, { "props": false }], - // disallow use of process.env - "no-process-env": 0, - // disallow usage of __proto__ property - "no-proto": 2, - // disallow declaring the same variable more then once - "no-redeclare": 2, - // disallow use of assignment in return statement - "no-return-assign": 2, - // disallow use of `javascript:` urls. - "no-script-url": 2, - // disallow comparisons where both sides are exactly the same - "no-self-compare": 2, - // disallow use of comma operator - "no-sequences": 2, - // restrict what can be thrown as an exception - "no-throw-literal": 2, - // disallow usage of expressions in statement position - "no-unused-expressions": 2, - // disallow unnecessary .call() and .apply() - "no-useless-call": 0, - // disallow unnecessary concatenation of literals or template literals - "no-useless-concat": 0, - // disallow use of void operator - "no-void": 0, - // disallow usage of configurable warning terms in comments: e.g. todo - "no-warning-comments": [ - 0, - { - "terms": [ - "todo", - "fixme", - "xxx" - ], - "location": "start" - } - ], - // disallow use of the with statement - "no-with": 2, - // require use of the second argument for parseInt() - "radix": 2, - // requires to declare all vars on top of their containing scope - "vars-on-top": 0, - // require immediate function invocation to be wrapped in parentheses - "wrap-iife": [2, "outside"], - // require or disallow Yoda conditions - "yoda": 2 - } -} \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..858941e --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1 @@ +module.exports = require('./dev/cfg/eslint.es6.js'); \ No newline at end of file diff --git a/.gitignore b/.gitignore index 036527e..6b5b1b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,61 +1,23 @@ -# Blacklist Everything +# Ignore Everything * # Whitelist items -!.nvmrc +!.eslintignore +!.eslintrc.js !.gitignore +!.nvmrc !.travis.yml -!gulpfile.js -!bower.json -!package.json -!jsdoc.json -!license.md !CONTRIBUTING.md +!LICENSE.md !README.md -!.eslintrc -!.eslintignore +!package.json !teleprint.js -!teleprint.min.js + +!/dev +!/dev/**/* !/src !/src/**/* -!/dist -!/dist/**/* - !/test !/test/**/* - -# Documentation exceptions -!/docs -!/doc/**/* -/docs/styles/*.* -!/docs -!/docs/styles -!/docs/styles/sunlight.dark.css -!/docs/styles/site.teleprint.css - -# Blacklist items -.DS_Store -/test/test.js -darkstrap.css -sunlight.default.css -prettify-tomorrow.css -site.darkly.css -site.lumen.css -site.slate.css -site.yeti.css -site.darkstrap.css -site.paper.css -site.spacelab.css -site.cerulean.css -site.dibs-bootstrap.css -site.readable.css -site.superhero.css -site.cosmo.css -site.flatly.css -site.sandstone.css -site.cyborg.css -site.journal.css -site.simplex.css -site.united.css diff --git a/.nvmrc b/.nvmrc index 301160a..f599e28 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -8 \ No newline at end of file +10 diff --git a/.travis.yml b/.travis.yml index 8622fb0..33cb18d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,35 @@ language: node_js +notifications: + email: false + +sudo: required + node_js: - - "6.10" + - "8.9" + +env: + - CXX=g++-4.8 + +addons: + apt: + sources: + - google-chrome + packages: + - chromium-browser + +cache: + directories: + - node_modules branches: only: - master +before_install: +- export CHROME_BIN=chromium-browser + script: + - npm i - npm start - - npm test \ No newline at end of file + - npm test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cebeb8b..91f494d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,9 @@ # Contributing +## Licensing + +All code contributions will be accepted under the [MIT Software License](https://raw.githubusercontent.com/abbotto/elemint/master/LICENSE.md) + ## Bug Reports A good bug report should contain some or all of the following information: @@ -32,14 +36,14 @@ A good bug report should contain some or all of the following information: ### Use semantic commit messages - `build`: Changes to the build system and external dependencies. -- `ci`: Changes to the CI files. +- `deploy`: Changes to the deployment files. - `doc`: Changes to the documentation. -- `feat`: Add new behaviour to the code. +- `feat`: Introduce new behaviour in the code. - `fix`: Fix malfunctioning code. - `perf`: Changes that improve code performance. -- `refactor`: Restructure code without changing the behaviour. +- `refactor`: Change code without altering the external behaviour. - `style`: Changes based on project conventions and linting rules. -- `test`: Add or edit tests. +- `test`: Changes to the testing files and environemnt. ``` feat: do all the things @@ -58,3 +62,5 @@ feat: do all the things - Linux - Mac OS - Windows (via [WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10)) + +##### Thank you for reading this document - please feel free to contribute \ No newline at end of file diff --git a/README.md b/README.md index 881ffca..ec948b3 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,28 @@ # Teleprint +[![GitHub version](https://badge.fury.io/gh/abbotto%2Fteleprint.svg)](https://badge.fury.io/gh/abbotto%2Fteleprint) +[![NPM version](https://badge.fury.io/js/teleprint.svg)](http://badge.fury.io/js/teleprint) [![Build Status](https://travis-ci.org/abbotto/teleprint.svg?branch=master)](https://travis-ci.org/abbotto/teleprint) +[![David](https://img.shields.io/david/expressjs/express.svg)](https://david-dm.org/abbotto/teleprint.svg) +[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](LICENSE.md) + -### What does it do? -- It can print HTML from a URL, from the DOM, or from a string. -- It can apply the current document's styles and scripts to the printed HTML. -- It can apply custom styles and scripts to the printed HTML. - -## Package Information -[![NPM version](https://badge.fury.io/js/teleprint.svg)](http://badge.fury.io/js/teleprint) -[![GitHub version](https://badge.fury.io/gh/abbotto%2Fteleprint.svg)](https://badge.fury.io/gh/abbotto%2Fteleprint) -[![Bower version](https://badge.fury.io/bo/teleprint.svg)](http://badge.fury.io/bo/teleprint) +## Overview +- Print HTML from a URL, from the DOM, or from a string. +- Apply the current document's styles and scripts to the printed HTML. +- Apply custom styles and scripts to the printed HTML. ## Build Requirements -### Install NPM packages +Install NPM packages nvm use && npm i -### Build the distribution +Build the distribution npm start ## Documentation -- [https://abbotto.github.io/teleprint/teleprint.html](https://abbotto.github.io/teleprint/teleprint.html) +- [https://abbotto.github.io/teleprint/index.html](https://abbotto.github.io/teleprint/index.html) ## Demonstration - [http://codepen.io/abbotto/pen/JRGzyo](http://codepen.io/abbotto/pen/JRGzyo) - -## License -[![MIT](https://badges.frapsoft.com/os/mit/mit.svg?v=102)](https://github.com/abbotto/teleprint) -[![Semver](http://img.shields.io/SemVer/2.0.0.png)](http://semver.org/spec/v2.0.0.html) \ No newline at end of file diff --git a/bower.json b/bower.json deleted file mode 100644 index ee61385..0000000 --- a/bower.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "teleprint", - "description": "Print HTML like a boss", - "version": "2.1.0", - "authors": [ - "Jared Abbott " - ], - "homepage": "https://github.com/abbotto/teleprint", - "keywords": [ - "dom", - "print", - "html", - "javascript", - "plugin" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test" - ] -} diff --git a/dev/cfg/eslint.es5.js b/dev/cfg/eslint.es5.js new file mode 100644 index 0000000..82b2014 --- /dev/null +++ b/dev/cfg/eslint.es5.js @@ -0,0 +1,54 @@ +module.exports = { + env: { + browser: true + }, + extends: ['eslint-config-airbnb-base/legacy'].map(require.resolve), + rules: { + 'block-scoped-var': 0, + 'brace-style': 0, + 'consistent-return': 0, + 'func-names': 0, + 'max-len': 0, + 'new-cap': 0, + 'no-bitwise': 0, + 'no-cond-assign': 0, + 'no-console': 0, + 'no-continue': 0, + 'no-empty': 0, + 'no-mixed-operators': 0, + 'no-multi-assign': 0, + 'no-nested-ternary': 0, + 'no-new': 0, + 'no-param-reassign': 0, + 'no-plusplus': 0, + 'no-prototype-builtins': 0, + 'no-restricted-globals': 0, + 'no-restricted-syntax': 0, + 'no-return-assign': 0, + 'no-shadow': 0, + 'no-tabs': 0, + 'no-throw-literal': 0, + 'no-undef': 0, + 'no-underscore-dangle': 0, + 'no-unused-expressions': 0, + 'no-unused-vars': 0, + 'no-use-before-define': 0, + 'no-useless-concat': 0, + 'no-useless-escape': 0, + 'no-var': 0, + 'object-shorthand': 0, + 'one-var': 0, + 'prefer-arrow-callback': 0, + 'prefer-const': 0, + 'prefer-destructuring': 0, + 'prefer-rest-params': 0, + 'prefer-template': 0, + 'semi-style': 0, + 'spaced-comment': 0, + 'vars-on-top': 0, + 'curly': 0, + 'eqeqeq': 0, + 'indent': ['error', 'tab'], + 'radix': 0 + } +}; diff --git a/dev/cfg/eslint.es6.js b/dev/cfg/eslint.es6.js new file mode 100644 index 0000000..02fb0e3 --- /dev/null +++ b/dev/cfg/eslint.es6.js @@ -0,0 +1,27 @@ +module.exports = { + env: { + es6: true, + node: true + }, + extends: ['airbnb-base'], + globals: { + "teleprint": "writable" + }, + rules: { + 'comma-dangle': 0, + 'func-names': 0, + 'function-paren-newline': 0, + 'global-require': 0, + 'import/no-dynamic-require': 0, + 'no-console': 0, + 'no-param-reassign': 0, + 'no-path-concat': 0, + 'no-tabs': 0, + 'no-undef': 0, + 'no-unused-expressions': 0, + 'prefer-template': 0, + 'semi-style': 0, + 'vars-on-top': 0, + indent: ['error', 'tab'], + } +}; diff --git a/dev/cfg/jsdoc/container.tmpl b/dev/cfg/jsdoc/container.tmpl new file mode 100644 index 0000000..2c93113 --- /dev/null +++ b/dev/cfg/jsdoc/container.tmpl @@ -0,0 +1,183 @@ + + + + + + + + + +
+

The teleprint function

+
+ +

+ + + + + + + (, ) +

+ +
+ + + + +
+ + + +
+ +
+
+ + +
+ + + + + + + + + + +

+ + + + + + +
+ + +

Extends

+ + + + + +

Requires

+ +
    +
  • +
+ + + +

Classes

+ +
+
+
+
+ + + +

Mixins

+ +
+
+
+
+ + + +

Namespaces

+ +
+
+
+
+ + + +

Members

+ + + + + + + +

The teleprint object

+ + + + + + + +

Type Definitions

+ + + + + + + + + +

Events

+ + + + + +
+ +
+ + + diff --git a/jsdoc.json b/dev/cfg/jsdoc/jsdoc.json similarity index 87% rename from jsdoc.json rename to dev/cfg/jsdoc/jsdoc.json index 49170f9..d1069dc 100644 --- a/jsdoc.json +++ b/dev/cfg/jsdoc/jsdoc.json @@ -8,7 +8,8 @@ "opts": { "destination": "./docs", "readme": "./README.md", - "encoding": "utf8" + "encoding": "utf8", + "template": "node_modules/docdash" }, "plugins": [ "plugins/markdown" @@ -29,6 +30,6 @@ "dateFormat": "MMMM Do YYYY, h:mm:ss a", "systemName": "Teleprint", "footer": "  Teleprint", - "copyright": "2016" + "copyright": "2016-2019" } } diff --git a/docs/styles/site.teleprint.css b/dev/cfg/jsdoc/jsdoc.teleprint.css similarity index 99% rename from docs/styles/site.teleprint.css rename to dev/cfg/jsdoc/jsdoc.teleprint.css index 898d5f6..04895f5 100644 --- a/docs/styles/site.teleprint.css +++ b/dev/cfg/jsdoc/jsdoc.teleprint.css @@ -6898,6 +6898,7 @@ code { max-height: calc(100vh - 62px); } @media (max-width: 768px) { + .dropdown-menu { max-height: none; } diff --git a/dev/cfg/jsdoc/layout.tmpl b/dev/cfg/jsdoc/layout.tmpl new file mode 100644 index 0000000..0e6b57e --- /dev/null +++ b/dev/cfg/jsdoc/layout.tmpl @@ -0,0 +1,45 @@ + + + + + <?js= title ?> - Documentation + + + + + + + + + + + + + + + + +
+ +

Teleprint

+ + + +
+ +
+ +
+ Documentation generated on . +
+ + + + + diff --git a/dev/cfg/jsdoc/method.tmpl b/dev/cfg/jsdoc/method.tmpl new file mode 100644 index 0000000..aae1557 --- /dev/null +++ b/dev/cfg/jsdoc/method.tmpl @@ -0,0 +1,106 @@ + + + +

Constructor

+ + +

+ (, ) +

+ + + + + + + + + + + + + +

+ + + + + Extends: + + + + + Type: + + + + + This: + + + + + Arguments: + + + + +Requires: + + + + +Fires: + + + + +Listens to Events: + + + + +Listeners of This Event: + + + + +Throws: + 1) { ?> + + + + +Returns: + + 1) { ?>
    +
  • +
+ + +
diff --git a/dev/cfg/karma.js b/dev/cfg/karma.js new file mode 100644 index 0000000..97d381b --- /dev/null +++ b/dev/cfg/karma.js @@ -0,0 +1,41 @@ +const files = [ + '../../teleprint.js', + '../../test/spec/inject.scripts.spec.js', + '../../test/spec/inject.stylesheets.spec.js', + '../../test/spec/inject.template.element.spec.js', + '../../test/spec/inject.template.html.spec.js', + '../../test/spec/inject.template.url.spec.js', + '../../test/spec/print.template.spec.js' +]; + +const specReporter = { + failFast: false, + showSpecTiming: true, + suppressErrorSummary: false, + suppressFailed: false, + suppressPassed: false, + suppressSkipped: true, +}; + +const settings = { + autoWatch: false, + browserNoActivityTimeout: 100000, + browsers: ['ChromiumHeadless'], + captureTimeout: 30000, + colors: true, + concurrency: Infinity, + frameworks: [ + 'chai', + 'mocha' + ], + logLevel: 'INFO', + port: 9876, + reporters: [ + 'spec' + ], + singleRun: true, + files, + specReporter, +}; + +module.exports = (config) => config.set(settings); diff --git a/dev/cfg/uglify.json b/dev/cfg/uglify.json new file mode 100644 index 0000000..3bf9539 --- /dev/null +++ b/dev/cfg/uglify.json @@ -0,0 +1,25 @@ +{ + "mangle": true, + "sourceMap": true, + "compress": { + "booleans": true, + "comparisons": true, + "conditionals": true, + "dead_code": true, + "drop_console": true, + "drop_debugger": true, + "evaluate": true, + "hoist_funs": false, + "hoist_vars": false, + "if_return": true, + "join_vars": true, + "loops": true, + "negate_iife": true, + "properties": true, + "sequences": true, + "side_effects": true, + "unsafe": true, + "unused": true, + "warnings": false + } +} diff --git a/dev/tool/build.sh b/dev/tool/build.sh new file mode 100755 index 0000000..992d2e1 --- /dev/null +++ b/dev/tool/build.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env sh + +set -eu + +# Cleanup +rm -f teleprint.js + +node dev/tool/include.js + +if [ "${1:-}" != "test" ]; then + # Minify the build + node_modules/.bin/uglifyjs --config-file dev/cfg/uglify.json \ + teleprint.js > teleprint.min.js + + CONTENT=$(cat teleprint.min.js) + rm -rf teleprint.js teleprint.min.js +else + CONTENT=$(cat teleprint.js) + rm -rf teleprint.js +fi + +# Prepend package information to the distribution +PACKAGE_JSON="require('./package.json')" +YEAR=$(date +"%Y") +AUTHOR="$(node -p -e ${PACKAGE_JSON}.author)" +COPYRIGHT="${YEAR} ${AUTHOR}" +NAME="$(node -p -e ${PACKAGE_JSON}.name)" +DESCRIPTION="$(node -p -e ${PACKAGE_JSON}.description)" +LICENSE="$(node -p -e ${PACKAGE_JSON}.license)" +VERSION="$(node -p -e ${PACKAGE_JSON}.version)" + +echo "// ${NAME} v${VERSION} | ${DESCRIPTION}" > teleprint.js +echo "// Copyright (c) ${COPYRIGHT}" >> teleprint.js +echo "// Distributed under the ${LICENSE} license" >> teleprint.js +echo "${CONTENT}" >> teleprint.js diff --git a/dev/tool/doc.sh b/dev/tool/doc.sh new file mode 100755 index 0000000..0352f8c --- /dev/null +++ b/dev/tool/doc.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env sh + +set -eu + +if [ "${1}" = "--commit" ]; then + tmp_docs=$(mktemp -d) + doc_timestamp=$(date +%Y-%m-%dT%H:%M:%S%z) + + ./dev/tool/doc.sh --create + + echo "Commiting the documentation..." + + mv docs ${tmp_docs}/ + + git checkout gh-pages + + rm -rf * + mv ${tmp_docs}/docs/* ./ + + git add * + git commit -am "doc: generated on '${doc_timestamp}'" + +elif [ "${1}" = "--create" ]; then + echo "Creating the documentation..." + + npm i + + # Custom styles and templates + mkdir -p docs/styles + + cat dev/cfg/jsdoc/container.tmpl > node_modules/docdash/tmpl/container.tmpl + cat dev/cfg/jsdoc/layout.tmpl > node_modules/docdash/tmpl/layout.tmpl + cat dev/cfg/jsdoc/method.tmpl > node_modules/docdash/tmpl/method.tmpl + + cp dev/cfg/jsdoc/jsdoc.teleprint.css docs/styles/ + + # Generate the documentation + node node_modules/jsdoc/jsdoc.js -r -c \ + dev/cfg/jsdoc/jsdoc.json src/module.js src/component/ +fi diff --git a/dev/tool/include.js b/dev/tool/include.js new file mode 100644 index 0000000..b6f45a0 --- /dev/null +++ b/dev/tool/include.js @@ -0,0 +1,33 @@ +#!/usr/bin/env node + +const fs = require('fs'); + +const include = (root, output) => { + let rootContent = fs.readFileSync(root, 'utf8'); + const matches = rootContent.match(/^(\s+)?(\/\/|\/\*|#| - - - - - - - - - - - -
-
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - -
-

Teleprint

Build Status

-

What does it do?

    -
  • It can print HTML from a URL, from the DOM, or from a string.
  • -
  • It can apply the current document's styles and scripts to the printed HTML.
  • -
  • It can apply custom styles and scripts to the printed HTML.
  • -
-

Package Information

NPM version -GitHub version -Bower version

-

Build Requirements

Install NPM packages

nvm use && npm i

Build the distribution

npm start

Documentation

-

Demonstration

-

License

MIT -Semver

-
- - - - - - - -
-
- -
- - -
- -
- - -
-
- - - - - -
- -   Teleprint - - - - 2016 - - - - Documentation generated by JSDoc 3.5.5 - - on September 22nd 2018, 12:18:18 pm - - using the DocStrap template. - -
- - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/namespaces.list.html b/docs/namespaces.list.html deleted file mode 100644 index 6166d51..0000000 --- a/docs/namespaces.list.html +++ /dev/null @@ -1,295 +0,0 @@ - - - - - - - Teleprint Namespaces - - - - - - - - - - - - - -
-
- - -
- -
- - -

Namespaces

-
- -
- -

- -

- - -
- - -
-
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - -

Namespaces

- -
-
teleprint
-
-
- - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - -
- -   Teleprint - - - - 2016 - - - - Documentation generated by JSDoc 3.5.5 - - on September 22nd 2018, 12:18:18 pm - - using the DocStrap template. - -
- - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/quicksearch.html b/docs/quicksearch.html deleted file mode 100644 index 4205e93..0000000 --- a/docs/quicksearch.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - diff --git a/docs/scripts/docstrap.lib.js b/docs/scripts/docstrap.lib.js deleted file mode 100644 index 09d9272..0000000 --- a/docs/scripts/docstrap.lib.js +++ /dev/null @@ -1,11 +0,0 @@ -if(!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b="length"in a&&a.length,c=_.type(a);return"function"!==c&&!_.isWindow(a)&&(!(1!==a.nodeType||!b)||("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a))}function d(a,b,c){if(_.isFunction(b))return _.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return _.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(ha.test(b))return _.filter(b,a,c);b=_.filter(b,a)}return _.grep(a,function(a){return U.call(b,a)>=0!==c})}function e(a,b){for(;(a=a[b])&&1!==a.nodeType;);return a}function f(a){var b=oa[a]={};return _.each(a.match(na)||[],function(a,c){b[c]=!0}),b}function g(){Z.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),_.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=_.expando+h.uid++}function i(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(ua,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c||"false"!==c&&("null"===c?null:+c+""===c?+c:ta.test(c)?_.parseJSON(c):c)}catch(a){}sa.set(a,b,c)}else c=void 0;return c}function j(){return!0}function k(){return!1}function l(){try{return Z.activeElement}catch(a){}}function m(a,b){return _.nodeName(a,"table")&&_.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function n(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function o(a){var b=Ka.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function p(a,b){for(var c=0,d=a.length;d>c;c++)ra.set(a[c],"globalEval",!b||ra.get(b[c],"globalEval"))}function q(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(ra.hasData(a)&&(f=ra.access(a),g=ra.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)_.event.add(b,e,j[e][c])}sa.hasData(a)&&(h=sa.access(a),i=_.extend({},h),sa.set(b,i))}}function r(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&_.nodeName(a,b)?_.merge([a],c):c}function s(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ya.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function t(b,c){var d,e=_(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:_.css(e[0],"display");return e.detach(),f}function u(a){var b=Z,c=Oa[a];return c||(c=t(a,b),"none"!==c&&c||(Na=(Na||_("