2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-20 20:00:33 +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:
Nikolay Kostyurin
2021-11-29 00:33:06 +02:00
committed by GitHub
parent 86d1dde106
commit da6709d437
66 changed files with 12410 additions and 20669 deletions
+24 -7
View File
@@ -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();