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
-1
View File
@@ -1 +0,0 @@
module.exports = require('../../babel.config');
+1
View File
@@ -0,0 +1 @@
module.exports = require('../../jest.config');
+9 -9
View File
@@ -38,15 +38,15 @@
"url": "git://github.com/JiLiZART/bbob.git"
},
"scripts": {
"build:commonjs": "../../node_modules/.bin/cross-env BABEL_ENV=commonjs NODE_ENV=production ../../node_modules/.bin/babel src --out-dir lib",
"build:es": "../../node_modules/.bin/cross-env BABEL_ENV=es NODE_ENV=production ../../node_modules/.bin/babel src --out-dir es",
"build:umd": "../../node_modules/.bin/cross-env BABEL_ENV=rollup NODE_ENV=production ../../node_modules/.bin/rollup --config ../../rollup.config.js",
"build:commonjs": "../../scripts/pkg-task build-commonjs",
"build:es": "../../scripts/pkg-task build-es",
"build:umd": "../../scripts/pkg-task build-umd",
"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/cross-env NODE_ENV=production ../../node_modules/.bin/size-limit",
"bundlesize": "../../node_modules/.bin/cross-env NODE_ENV=production ../../node_modules/.bin/bundlesize"
"test": "../../scripts/pkg-task test",
"cover": "../../scripts/pkg-task cover",
"lint": "../../scripts/pkg-task lint",
"size": "../../scripts/pkg-task size",
"bundlesize": "../../scripts/pkg-task bundlesize"
},
"size-limit": [
{
@@ -56,7 +56,7 @@
"bundlesize": [
{
"path": "./dist/index.min.js",
"maxSize": "3.8 KB"
"maxSize": "4.5 KB"
}
],
"publishConfig": {
+3 -8
View File
@@ -2,7 +2,7 @@
const isObj = (value) => (typeof value === 'object');
const isBool = (value) => (typeof value === 'boolean');
function iterate(t, cb) {
export function iterate(t, cb) {
const tree = t;
if (Array.isArray(tree)) {
@@ -16,7 +16,7 @@ function iterate(t, cb) {
return tree;
}
function same(expected, actual) {
export function same(expected, actual) {
if (typeof expected !== typeof actual) {
return false;
}
@@ -45,7 +45,7 @@ function same(expected, actual) {
});
}
function match(expression, cb) {
export function match(expression, cb) {
return Array.isArray(expression)
? iterate(this, (node) => {
for (let idx = 0; idx < expression.length; idx++) {
@@ -58,8 +58,3 @@ function match(expression, cb) {
})
: iterate(this, (node) => (same(expression, node) ? cb(node) : node));
}
export {
iterate,
match,
};
+19 -1
View File
@@ -1,4 +1,4 @@
import { iterate, match } from '../src/utils';
import { iterate, match, same } from '../src/utils';
const stringify = val => JSON.stringify(val);
@@ -62,4 +62,22 @@ describe('@bbob/core utils', () => {
expect(stringify(resultArr)).toEqual(stringify(expected))
})
describe('same', () => {
test('same not same typeof', () => {
expect(same(1, {})).toBe(false)
})
test('same boolean', () => {
expect(same(true, true)).toBe(true)
})
test('same null', () => {
expect(same(null, null)).toBe(true)
})
test('same array', () => {
expect(same([1, 2, 3], [1, 2, 3, 4])).toBe(true)
})
test('same object', () => {
expect(same({ foo: true, bar: 'test' }, { foo: true, bar: 'test', ext: true })).toBe(true)
})
})
});