Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: rework build system to use esbuild. #1043

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
10 changes: 0 additions & 10 deletions .babelrc

This file was deleted.

76 changes: 30 additions & 46 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,39 @@
module.exports = {
"env": {
"es6": true,
"browser": true
"es2015": true,
"browser": true,
"node": true
},

"parser": "babel-eslint",

"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:@typescript-eslint/recommended"
],
"overrides": [
{
"env": {
"node": true
},
"files": [
".eslintrc.{js,cjs}"
],
"parserOptions": {
"sourceType": "script"
}
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 7,
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},

"settings": {
"react": {
"createClass": "createReactClass",
"pragma": "React",
"version": "15.0"
},
"propWrapperFunctions": [ "forbidExtraProps" ],
"import/resolver": "webpack"
},

"extends": ["eslint:recommended", "plugin:react/recommended", "plugin:import/recommended", "prettier"],

"plugins": ["prettier"],

"globals": {
"process": true
},

"plugins": [
"@typescript-eslint",
"react"
],
"rules": {
"quotes": [0],
"comma-dangle": [2, "only-multiline"],
"max-len": [1, {"code": 80}],
"no-unused-expressions": [0],
"no-continue": [0],
"no-plusplus": [0],
"func-names": [0],
"arrow-parens": [0],
"space-before-function-paren": [0],
"jsx-a11y/no-static-element-interactions": [0],
"prettier/prettier": "error",
"react/no-find-dom-node": [0],
"react/jsx-closing-bracket-location": [0],
"react/require-default-props": 0,
"import/no-extraneous-dependencies": [2, {
"devDependencies": ["specs/**"]
}]
"@typescript-eslint/no-unused-vars": "off",
"react/no-deprecated": "warn"
}

}
26 changes: 14 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@ NODE=$(shell which node 2> /dev/null)
NPM=$(shell which npm 2> /dev/null)
YARN=$(shell which yarn 2> /dev/null)
JQ=$(shell which jq 2> /dev/null)
ESBUILD=npx esbuild

PKM?=$(if $(YARN),$(YARN),$(shell which npm))

BABEL=./node_modules/.bin/babel
COVERALLS=./node_modules/coveralls/bin/coveralls.js
REMOTE="[email protected]:reactjs/react-modal"
CURRENT_VERSION:=$(shell jq ".version" package.json)

COVERALLS=./node_modules/coveralls/bin/coveralls.js
COVERAGE?=true

BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
CURRENT_VERSION:=$(shell jq ".version" package.json)

VERSION:=$(if $(RELEASE),$(shell read -p "Release $(CURRENT_VERSION) -> " V && echo $$V),"HEAD")

ESBUILDFLAGS?=

help: info
@echo
@echo "Current version: $(CURRENT_VERSION)"
Expand Down Expand Up @@ -50,9 +53,6 @@ deps-docs:

# Rules for development

serve:
@npm start

tests:
@npm run test

Expand All @@ -76,15 +76,17 @@ docs: build-docs

check-working-tree:
@[ -z "`git status -s`" ] && \
echo "Stopping publish. There are change to commit or discard." || echo "Worktree is clean."
echo "Stopping publish. There are change to commit or discard." || \
echo "Worktree is clean."

compile:
@echo "[Compiling source]"
$(BABEL) src --out-dir lib
build:
@$(NODE) build.mjs

build: compile
@echo "[Building dists]"
@npx webpack --config ./scripts/webpack.dist.config.js
build-minified:
@$(NODE) build.mjs --minify

serve:
@ESBUILDFLAGS="--watch" make -C . -k build

pre-release-commit:
git commit --allow-empty -m "Release v$(VERSION)."
Expand Down
17 changes: 17 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as esbuild from 'esbuild'
import { nodeExternalsPlugin } from 'esbuild-node-externals';

const minify = Boolean(process.argv.find(option => option == "--minify"));

await esbuild.build({
entryPoints: ["src/index.js"],
bundle: true,
format: "cjs",
outfile: `lib/index${minify ? '.min' : ''}.js`,
loader: {
'.js': 'jsx',
'.ts': 'tsx'
},
minify: minify,
plugins: [nodeExternalsPlugin()],
});
50 changes: 0 additions & 50 deletions karma.conf.js

This file was deleted.

Loading
Loading