mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-17 19:21:20 +03:00
feat: update core deps (#120)
* feat: use swc.rs instead of babel * BREAKING CHANGE: now we use swc.rs as main bundler and transpiler instead of babel - jest now uses swc - rollup now uses swc * feat: benchmark now separate package with `npm start` and colored output - benchmark as separate package with error throw if package drops performance * feat: all lerna packages now using scripts/pkg-task * feat(github): publish to npm and github registry - when release was created this action automaticly publish packages to npm and github * feat(github): move all from Travis CI to Github Actions - code analysis and tests now using github actions * test: increase tests coverage - add more tests for @bbob/react, @bbob/vue2 and @bbob/parser
This commit is contained in:
committed by
GitHub
parent
86d1dde106
commit
da6709d437
Vendored
+24
-7
@@ -1,7 +1,15 @@
|
||||
/* eslint-disable global-require */
|
||||
const Benchmark = require('benchmark');
|
||||
const pico = require('picocolors');
|
||||
|
||||
const stub = require('./test/stub');
|
||||
|
||||
function formatNumber(number) {
|
||||
return String(number)
|
||||
// .replace(/\d{3}$/, ',$&')
|
||||
.replace(/^(\d|\d\d)(\d{3},)/, '$1,$2');
|
||||
}
|
||||
|
||||
const suite = new Benchmark.Suite();
|
||||
|
||||
suite
|
||||
@@ -40,27 +48,36 @@ suite
|
||||
});
|
||||
})
|
||||
.add('@bbob/parser lexer old', () => {
|
||||
const lexer1 = require('../packages/bbob-parser/lib/lexer_old');
|
||||
const lexer1 = require('@bbob/parser/lib/lexer_old');
|
||||
|
||||
return require('../packages/bbob-parser/lib/index').parse(stub, {
|
||||
return require('@bbob/parser/lib/index').parse(stub, {
|
||||
onlyAllowTags: ['ch'],
|
||||
createTokenizer: lexer1.createLexer,
|
||||
});
|
||||
})
|
||||
.add('@bbob/parser lexer', () => {
|
||||
const lexer2 = require('../packages/bbob-parser/lib/lexer');
|
||||
const lexer2 = require('@bbob/parser/lib/lexer');
|
||||
|
||||
return require('../packages/bbob-parser/lib/index').parse(stub, {
|
||||
return require('@bbob/parser/lib/index').parse(stub, {
|
||||
onlyAllowTags: ['ch'],
|
||||
createTokenizer: lexer2.createLexer,
|
||||
});
|
||||
})
|
||||
// add listeners
|
||||
.on('cycle', (event) => {
|
||||
console.log(String(event.target));
|
||||
const name = event.target.name.padEnd('@bbob/parser lexer old'.length);
|
||||
const hz = formatNumber(event.target.hz.toFixed(0)).padStart(10);
|
||||
|
||||
process.stdout.write(`${name}${pico.bold(hz)}${pico.dim(' ops/sec')}\n`);
|
||||
})
|
||||
.on('complete', function onComplete() {
|
||||
console.log(`Fastest is ${this.filter('fastest').map('name')}`);
|
||||
const name = this.filter('fastest').map('name').toString();
|
||||
|
||||
process.stdout.write(`Fastest is ${pico.bold(name)}`);
|
||||
|
||||
if (name.indexOf('@bbob') === -1) {
|
||||
process.exit(1);
|
||||
}
|
||||
})
|
||||
// run async
|
||||
.run({ async: false });
|
||||
.run();
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"requires": true,
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"@bbob/parser": {
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@bbob/parser/-/parser-2.7.1.tgz",
|
||||
"integrity": "sha512-tpfkbxXU4klszMjXGWrq9N8v2FdsakPMjj9nPEDVg15j0GRnhRSkWetwFSa31t6uXQ7cSTA6N/IdgMN9EDB5tw==",
|
||||
"requires": {
|
||||
"@bbob/plugin-helper": "^2.7.1"
|
||||
}
|
||||
},
|
||||
"@bbob/plugin-helper": {
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@bbob/plugin-helper/-/plugin-helper-2.7.1.tgz",
|
||||
"integrity": "sha512-84DfXx7yQ0OJZN6bf/54q6RPhLFImLnMtCpCAlJO8ExNpWQuOJv0aTJJ4vRRRiyuPJ2uCECSalgOZv2t8j/M0g=="
|
||||
},
|
||||
"benchmark": {
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz",
|
||||
"integrity": "sha1-CfPeMckWQl1JjMLuVloOvzwqVik=",
|
||||
"requires": {
|
||||
"lodash": "^4.17.4",
|
||||
"platform": "^1.3.3"
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"picocolors": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
||||
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ=="
|
||||
},
|
||||
"platform": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz",
|
||||
"integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg=="
|
||||
},
|
||||
"xbbcode-parser": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/xbbcode-parser/-/xbbcode-parser-0.1.2.tgz",
|
||||
"integrity": "sha1-Bs5gpA9WagZz6rIR024jgpJgdGc="
|
||||
},
|
||||
"ya-bbcode": {
|
||||
"version": "1.0.12",
|
||||
"resolved": "https://registry.npmjs.org/ya-bbcode/-/ya-bbcode-1.0.12.tgz",
|
||||
"integrity": "sha512-CI/2AmfmRDv/qxIpaTFymrzpnEn4VUa8Jsnoad6eidkhjQ8UTyim+XwPhDu/r9IZh9uzJugXZV0iyJQgX1FSCA=="
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "benchmark",
|
||||
"main": "index.js",
|
||||
"private": true,
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node index.js"
|
||||
},
|
||||
"author": {
|
||||
"name": "Nikolay Kostyurin <jilizart@gmail.com>",
|
||||
"url": "https://artkost.ru/"
|
||||
},
|
||||
"dependencies": {
|
||||
"@bbob/parser": "^2.7.1",
|
||||
"benchmark": "2.1.4",
|
||||
"picocolors": "1.0.0",
|
||||
"xbbcode-parser": "0.1.2",
|
||||
"ya-bbcode": "1.0.12"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user