2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-05-15 11:59:37 +03:00

feat: update all deps versions, move from babel to swc

- move all package commands to scripts/pkg-task
- jest now uses swc
- rollup now uses swc
- move all benchmark packages to benchmark/package.json
This commit is contained in:
Nikolay Kostyurin
2021-10-17 19:57:00 +02:00
parent 4237ca705c
commit 2ee5141d8e
38 changed files with 1614 additions and 3131 deletions
+12
View File
@@ -0,0 +1,12 @@
{
"module": {
"type": "es6"
},
"env": {
"loose": true,
"targets": "> 0.25%, not dead"
},
"jsc": {
"loose": true
}
}
+18
View File
@@ -0,0 +1,18 @@
{
"module": {
"type": "umd",
"strict": false,
"strictMode": true,
"lazy": false,
"noInterop": false,
"ignoreDynamic": false
},
"env": {
"loose": true,
"modules": false,
"targets": "> 0.25%, not dead"
},
"jsc": {
"loose": true
}
}
+37
View File
@@ -0,0 +1,37 @@
{
"name": "@bbob/benchmark",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"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=="
},
"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=="
}
}
}
+16
View File
@@ -0,0 +1,16 @@
{
"main": "index.js",
"private": true,
"directories": {
"test": "test"
},
"author": {
"name": "Nikolay Kostyurin <jilizart@gmail.com>",
"url": "https://artkost.ru/"
},
"dependencies": {
"benchmark": "2.1.4",
"xbbcode-parser": "0.1.2",
"ya-bbcode": "1.0.12"
}
}
+1181 -1165
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -9,13 +9,13 @@
"dependencies": {
"@bbob/preset-vue": "^2.7.0",
"@bbob/vue2": "^2.7.0",
"core-js": "^3.6.5",
"vue": "^2.6.11"
"core-js": "^3.18.2",
"vue": "^2.6.14"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"vue-template-compiler": "^2.6.11"
"@vue/cli-plugin-babel": "~4.5.13",
"@vue/cli-service": "~4.5.13",
"vue-template-compiler": "^2.6.14"
},
"browserslist": [
"> 1%",
+4
View File
@@ -2,6 +2,10 @@ module.exports = {
verbose: true,
coverageDirectory: './coverage/',
collectCoverage: true,
transform: {
// '^.+\\.(t|j)sx?$': '@swc/jest',
'\\.[jt]sx?$': '@swc/jest',
},
// transform: {
// '^.+\\.[t|j]sx?$': 'babel-jest',
// },
+170 -1842
View File
File diff suppressed because it is too large Load Diff
+6 -12
View File
@@ -18,20 +18,15 @@
},
"license": "MIT",
"devDependencies": {
"@babel/cli": "7.15.7",
"@babel/core": "7.15.8",
"@babel/plugin-external-helpers": "7.14.5",
"@babel/plugin-transform-modules-commonjs": "7.15.4",
"@babel/preset-env": "7.15.8",
"@babel/preset-react": "7.14.5",
"@commitlint/cli": "13.2.1",
"@commitlint/config-conventional": "13.2.0",
"@rollup/plugin-commonjs": "21.0.0",
"@rollup/plugin-node-resolve": "13.0.5",
"@rollup/plugin-replace": "3.0.0",
"@size-limit/preset-small-lib": "6.0.1",
"babel-jest": "27.2.5",
"benchmark": "2.1.4",
"@swc/cli": "0.1.51",
"@swc/core": "1.2.98",
"@swc/jest": "0.2.4",
"bundlesize": "0.18.1",
"cross-env": "7.0.3",
"eslint": "7.32.0",
@@ -42,7 +37,6 @@
"eslint-plugin-react": "7.26.1",
"husky": "7.0.2",
"jest": "27.2.5",
"jsdoc-to-markdown": "7.0.1",
"lerna": "4.0.0",
"lint-staged": "11.2.3",
"microtime": "3.0.0",
@@ -50,10 +44,10 @@
"rimraf": "^3.0.2",
"rollup": "2.58.0",
"rollup-plugin-babel": "4.3.3",
"rollup-plugin-gzip": "2.5.0",
"rollup-plugin-swc": "0.2.0",
"rollup-plugin-terser": "7.0.2",
"size-limit": "6.0.1",
"xbbcode-parser": "0.1.2",
"ya-bbcode": "1.0.12"
"size-limit": "6.0.1"
},
"publishConfig": {
"access": "public",
+1
View File
@@ -0,0 +1 @@
module.exports = require('../../jest.config');
+3 -3
View File
@@ -29,9 +29,9 @@
},
"homepage": "https://github.com/JiLiZART/bbob#readme",
"scripts": {
"test": "../../node_modules/.bin/jest --",
"cover": "../../node_modules/.bin/jest --coverage",
"lint": "../../node_modules/.bin/eslint ."
"test": "../../scripts/pkg-task test",
"cover": "../../scripts/pkg-task cover",
"lint": "../../scripts/pkg-task lint"
},
"author": "Nikolay Kostyurin <jilizart@gmail.com>",
"license": "MIT",
+1
View File
@@ -0,0 +1 @@
module.exports = require('../../jest.config');
+8 -8
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": [
{
+1
View File
@@ -0,0 +1 @@
module.exports = require('../../jest.config');
+8 -8
View File
@@ -28,15 +28,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 --debug",
"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": [
{
-1
View File
@@ -1 +0,0 @@
module.exports = require('../../babel.config');
+1
View File
@@ -0,0 +1 @@
module.exports = require('../../jest.config');
+8 -8
View File
@@ -31,15 +31,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",
"prepublishOnly": "npm run build"
},
"size-limit": [
+1 -1
View File
@@ -1,5 +1,5 @@
import {parse} from '../src'
import render from 'posthtml-render'
import { render } from 'posthtml-render'
describe('posthtml-render', () => {
@@ -0,0 +1 @@
module.exports = require('../../jest.config');
+8 -8
View File
@@ -23,15 +23,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",
"prepublishOnly": "npm run build"
},
"size-limit": [
@@ -0,0 +1 @@
module.exports = require('../../jest.config');
+8 -8
View File
@@ -30,15 +30,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": [
{
+10 -18
View File
@@ -2,14 +2,14 @@
import { getUniqAttr, isStringNode, isTagNode } from '@bbob/plugin-helper/lib/index';
import TagNode from '@bbob/plugin-helper/lib/TagNode';
const isStartsWith = (node, type) => (node[0] === type);
/* @__PURE__ */const isStartsWith = (node, type) => (node[0] === type);
const styleMap = {
color: (val) => `color:${val};`,
size: (val) => `font-size:${val};`,
};
const getStyleFromAttrs = (attrs) => Object
/* @__PURE__ */const getStyleFromAttrs = (attrs) => Object
.keys(attrs)
.reduce((acc, key) => (styleMap[key] ? acc.concat(styleMap[key](attrs[key])) : acc), [])
.join(' ');
@@ -59,25 +59,19 @@ const renderUrl = (node, render) => (getUniqAttr(node.attrs)
? getUniqAttr(node.attrs)
: render(node.content));
const toNode = (tag, attrs, content) => ({
/* @__PURE__ */const toNode = (tag, attrs, content) => ({
tag,
attrs,
content,
});
/* @__PURE__ */const toStyle = (style) => ({ style });
export default {
b: (node) => toNode('span', {
style: 'font-weight: bold;',
}, node.content),
i: (node) => toNode('span', {
style: 'font-style: italic;',
}, node.content),
u: (node) => toNode('span', {
style: 'text-decoration: underline;',
}, node.content),
s: (node) => toNode('span', {
style: 'text-decoration: line-through;',
}, node.content),
b: (node) => toNode('span', toStyle('font-weight: bold;'), node.content),
i: (node) => toNode('span', toStyle('font-style: italic;'), node.content),
u: (node) => toNode('span', toStyle('text-decoration: underline;'), node.content),
s: (node) => toNode('span', toStyle('text-decoration: line-through;'), node.content),
url: (node, { render }, options) => toNode('a', {
href: renderUrl(node, render, options),
}, node.content),
@@ -86,9 +80,7 @@ export default {
}, null),
quote: (node) => toNode('blockquote', {}, [toNode('p', {}, node.content)]),
code: (node) => toNode('pre', {}, node.content),
style: (node) => toNode('span', {
style: getStyleFromAttrs(node.attrs),
}, node.content),
style: (node) => toNode('span', toStyle(getStyleFromAttrs(node.attrs)), node.content),
list: (node) => {
const type = getUniqAttr(node.attrs);
@@ -0,0 +1 @@
module.exports = require('../../jest.config');
+8 -8
View File
@@ -29,15 +29,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": [
{
+1
View File
@@ -0,0 +1 @@
module.exports = require('../../jest.config');
+8 -8
View File
@@ -29,15 +29,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": [
{
+1
View File
@@ -0,0 +1 @@
module.exports = require('../../jest.config');
+8 -8
View File
@@ -23,15 +23,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": [
{
+1
View File
@@ -0,0 +1 @@
module.exports = require('../../jest.config');
+8 -8
View File
@@ -41,15 +41,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_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": [
{
+1
View File
@@ -0,0 +1 @@
module.exports = require('../../jest.config');
+8 -8
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_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": [
{
+3 -4
View File
@@ -1,8 +1,8 @@
import resolve from '@rollup/plugin-node-resolve';
import babel from 'rollup-plugin-babel';
import replace from '@rollup/plugin-replace';
import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
import swc from 'rollup-plugin-swc';
const pkg = require(`${process.cwd()}/package.json`);
const { NODE_ENV } = process.env;
@@ -22,14 +22,13 @@ const baseConfig = {
},
plugins: [
resolve(),
babel({
exclude: '**/node_modules/**',
}),
swc(),
replace({
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
}),
commonjs(),
// gzip(),
],
};
+11
View File
@@ -0,0 +1,11 @@
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"commander": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-8.2.0.tgz",
"integrity": "sha512-LLKxDvHeL91/8MIyTAD5BFMNtoIwztGPMiM/7Bl8rIPmHCZXRxmSWr91h57dpOpnQ6jIUqEWdXE/uBYMfiVZDA=="
}
}
}
+11
View File
@@ -0,0 +1,11 @@
{
"main": "index.js",
"private": true,
"author": {
"name": "Nikolay Kostyurin <jilizart@gmail.com>",
"url": "https://artkost.ru/"
},
"dependencies": {
"commander": "8.2.0"
}
}
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env node
'use strict';
const { resolve } = require('path')
const { spawn } = require('child_process')
const { Command } = require('commander');
const program = new Command();
const nmBinDir = resolve(`../../node_modules/.bin/`)
const shell = { cmd: 'sh', arg: '-c' }
const actionCommand = (command) => () => {
spawn(shell.cmd, [shell.arg, `${nmBinDir}/${command}`], {
env: process.env,
cwd: process.cwd(),
stdio: 'inherit',
})
}
const commandMap = {
'build-commonjs': `cross-env BABEL_ENV=commonjs NODE_ENV=production ${nmBinDir}/swc --config-file ../../.swcrc-commonjs --out-dir lib src`,
'build-es': `cross-env BABEL_ENV=es NODE_ENV=production ${nmBinDir}/swc --out-dir es src`,
'build-umd': `cross-env BABEL_ENV=rollup NODE_ENV=production ${nmBinDir}/rollup --config ../../rollup.config.js`,
test: `jest`,
cover: `jest --config ../../jest.config.js --coverage .`,
lint: `eslint .`,
bundlesize: `cross-env NODE_ENV=production ${nmBinDir}/bundlesize .`
}
program.version('1.0.0')
for (const [key, command] of Object.entries(commandMap)) {
program.command(key).action(actionCommand(command))
}
program.parse();