2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-14 18:42:24 +03:00

refactor(*): convert to babel and generation to lib, es, dist folders (#2)

* refactor(*): convert to babel and generation to lib, es, dist

* chore(*): remove generated files

* fix(*): lint run command
This commit is contained in:
Nikolay Kostyurin
2018-09-09 23:55:28 +02:00
committed by GitHub
parent d22a2895a4
commit 32a7fb51da
76 changed files with 930 additions and 10174 deletions
+2
View File
@@ -1,2 +1,4 @@
dist
es
lib
test
+3 -1
View File
@@ -1,3 +1,5 @@
package-lock.json
coverage
dist
dist
lib
es
+2 -1
View File
@@ -1,6 +1,7 @@
package-lock.json
coverage
src
dist
!dist
!lib
!es
*.test.js
+37 -7
View File
@@ -2,21 +2,51 @@
"name": "@bbob/html",
"version": "1.1.0",
"description": "HTML renderer for BBCode pareser BBob",
"main": "lib/index.js",
"keywords": [],
"dependencies": {
"@bbob/plugin-helper": "^1.1.0"
},
"devDependencies": {
"@bbob/parser": "^1.2.0"
},
"scripts": {
"test": "../../node_modules/.bin/jest --",
"cover": "../../node_modules/.bin/jest --coverage",
"lint": "../../node_modules/.bin/eslint ."
},
"main": "lib/index.js",
"module": "es/index.js",
"jsnext:main": "es/index.js",
"browser": "dist/index.js",
"browserName": "BbobHtml",
"homepage": "https://github.com/JiLiZART/bbob",
"author": "Nikolay Kostyurin <jilizart@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/JiLiZART/bbob/issues"
},
"repository": {
"type": "git",
"url": "git://github.com/JiLiZART/bbob.git"
},
"scripts": {
"build:commonjs": "../../node_modules/.bin/cross-env BABEL_ENV=commonjs ../../node_modules/.bin/babel src --out-dir lib",
"build:es": "../../node_modules/.bin/cross-env BABEL_ENV=es ../../node_modules/.bin/babel src --out-dir es",
"build:umd": "../../node_modules/.bin/cross-env BABEL_ENV=rollup NODE_ENV=development ../../node_modules/.bin/rollup --config ../../rollup.config.js",
"build": "npm run build:commonjs && npm run build:es && npm run build:umd",
"test": "../../node_modules/.bin/jest --",
"cover": "../../node_modules/.bin/jest --coverage",
"lint": "../../node_modules/.bin/eslint .",
"size": "../../node_modules/.bin/size-limit"
},
"size-limit": [
{
"path": "lib/index.js"
}
],
"publishConfig": {
"registry": "https://registry.npmjs.org/"
}
},
"files": [
"dist",
"lib",
"src",
"es"
]
}
@@ -43,4 +43,5 @@ const renderNodes = (nodes, { stripTags = false } = {}) => []
.concat(nodes)
.reduce((r, node) => r + renderNode(node, { stripTags }), '');
module.exports = renderNodes;
export const render = renderNodes;
export default renderNodes;
+11 -5
View File
@@ -1,14 +1,20 @@
const render = require('../lib/index');
const parse = require('@bbob/parser');
import {parse} from '@bbob/parser'
import {render} from '../src';
const process = (input, params) => render(parse(input), params);
const process = (input, params) => {
const ast = parse(input);
const html = render(ast, params);
return html
};
describe('@bbob/html', () => {
test('render bbcode tag with single param as html tag', () => {
const input = '[url=https://ru.wikipedia.org]Text[/url]';
const result = '<url url="https://ru.wikipedia.org">Text</url>';
const expected = '<url url="https://ru.wikipedia.org">Text</url>';
const result = process(input)
expect(process(input)).toBe(result);
expect(result).toBe(expected);
});
test('render bbcode tag with multiple params as html tag', () => {