Skip to content

Commit

Permalink
maint: Upgrade to Patternslib v4 final.
Browse files Browse the repository at this point in the history
  • Loading branch information
thet committed Apr 20, 2021
1 parent 6502df1 commit b7879f7
Show file tree
Hide file tree
Showing 12 changed files with 262 additions and 129 deletions.
11 changes: 11 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"parserPreset": "conventional-changelog-conventionalcommits",
"rules": {
"body-leading-blank": [1, "always"],
"footer-leading-blank": [1, "always"],
"subject-empty": [2, "never"],
"type-case": [2, "always", "lower-case"],
"type-empty": [2, "never"],
"type-enum": [2, "always", ["feat", "fix", "maint", "breaking"]]
}
}
11 changes: 7 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[*]
indent_style = space
charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.js]
[*{js,jsx,vue,ts}]
indent_size = 4

[{*.css,*.scss,*.xml,*.html}]
[*.{css,scss,xml,html,yml}]
indent_size = 2

[Makefile]
indent_style = tab
24 changes: 24 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
extends: ["eslint:recommended", "prettier"],
root: true,
env: {
es6: "true",
browser: true,
node: true,
jest: true,
},
parser: "@babel/eslint-parser",
ignorePatterns: [],
rules: {
"no-debugger": 1,
"no-duplicate-imports": 1,
// Do keep due avoid unintendet consequences.
"no-alert": 0,
"no-control-regex": 0,
"no-self-assign": 0,
"no-useless-escape": 0,
},
globals: {
spyOn: true, // eventually replace with jest.spyOn and then fix a ton of test failures.
},
};
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14'
- run: npm install yarn
- run: make check
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tabWidth": 4,
"quoteProps": "consistent",
"printWidth": 89
}
35 changes: 35 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"npm": {
"publish": true
},
"git": {
"requireBranch": "master",
"commitMessage": "maint(Release): Release new version."
},
"plugins": {
"@release-it/conventional-changelog": {
"infile": "CHANGES.md",
"preset": {
"name": "conventionalcommits",
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "maint",
"section": "Maintenance"
},
{
"type": "breaking",
"section": "Breaking Changes"
}
]
}
}
}
}
68 changes: 63 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,82 @@
YARN ?= node_modules/.bin/yarn
ESLINT ?= npx eslint
YARN ?= npx yarn


define get_package_var
$(shell node -p "require('./package.json').$(1)")
endef
PACKAGE_NAME := $(shell node -p "'$(call get_package_var,name)'.replace('@patternslib/', '')")
PACKAGE_VERSION := $(call get_package_var,version)


stamp-yarn:
npm install --no-package-lock --no-save yarn
$(YARN) install
# Install pre commit hook
$(YARN) husky install
touch stamp-yarn


clean-dist:
rm -Rf dist/


.PHONY: clean
clean::
rm -rf stamp-yarn node_modules
clean: clean-dist
rm -f stamp-yarn
rm -Rf node_modules/


eslint: stamp-yarn
$(ESLINT) ./src


.PHONY: check
check:: stamp-yarn eslint
$(YARN) run test


.PHONY: bundle
bundle: stamp-yarn
$(YARN) run build


release-web: clean-dist bundle
@echo name is $(PACKAGE_NAME)
@echo version is $(PACKAGE_VERSION)
tar -czf ./$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz dist --transform s/dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/
git clone -n git@github.com:Patternslib/Patterns-releases.git --depth 1 ./dist/Patterns-releases
mkdir ./dist/Patterns-releases/releases
mv ./$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz ./dist/Patterns-releases/releases/
cd ./dist/Patterns-releases && \
git reset HEAD && \
git add ./releases/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz && \
git commit -m"Add release $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz" && \
git push


.PHONY: release-major
release-major: check
npx release-it major --dry-run --ci && \
npx release-it major --ci && \
make release-web


.PHONY: release-minor
release-minor: check
npx release-it minor --dry-run --ci && \
npx release-it minor --ci && \
make release-web


.PHONY: release-patch
release-patch: check
npx release-it --dry-run --ci && \
npx release-it --ci && \
make release-web


.PHONY: serve
serve:: stamp-yarn
printf "\n\nGo to http://localhost:8000 to see the demo\n\n\n\n"
$(YARN) run start


Expand Down
7 changes: 2 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
module.exports = {
rootDir: "./src",
setupFilesAfterEnv: ["<rootDir>/setupTests.js"],
watchPlugins: [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname",
],
watchPlugins: ["jest-watch-typeahead/filename", "jest-watch-typeahead/testname"],
transform: {
"^.+\\.[t|j]sx?$": "babel-jest",
},
moduleNameMapper: {
"\\.(css|less|sass|scss)$": "identity-obj-proxy",
},
transformIgnorePatterns: ["/node_modules/(?!patternslib/*).+\\.[t|j]sx?$"],
transformIgnorePatterns: ["/node_modules/(?!.*patternslib/*).+\\.[t|j]sx?$"],
};
134 changes: 73 additions & 61 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,77 @@
{
"name": "pat-sortable-table",
"version": "1.0.0",
"description": "A pattern for interactive tables.",
"author": {
"name": "Syslab GesmbH",
"email": "dev@syslab.com"
},
"license": "MIT",
"homepage": "https://gitub.com/patternslib/pat-sortable-table",
"main": "./src/pat-sortable-table.js",
"dependencies": {
"datatables.net-dt": "^1.10.22",
"patternslib": "https://github.com/Patternslib/Patterns#master"
},
"devDependencies": {
"@babel/preset-env": "^7.9.6",
"@testing-library/jest-dom": "^5.5.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"core-js": "^3.7.0",
"duplicate-package-checker-webpack-plugin": "^3.0.0",
"eslint": "^7.0.0",
"jest": "^26.0.1",
"jest-watch-typeahead": "^0.6.0",
"regenerator-runtime": "^0.13.7",
"terser-webpack-plugin": "^2.3.6",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
},
"scripts": {
"start": "webpack-dev-server --config webpack.config.js --open --env.NODE_ENV=development",
"build": "webpack --config webpack.config.js --env.NODE_ENV=production",
"build:stats": "webpack --config webpack.config.js --env.NODE_ENV=production --json > stats.json",
"test": "jest --watch"
},
"eslintConfig": {
"root": true,
"env": {
"browser": true,
"node": true,
"jest": true
"name": "pat-PATTERN_TEMPLATE",
"version": "1.0.0",
"description": "A pattern for PATTERN_TEMPLATE",
"license": "MIT",
"main": "./src/PATTERN_TEMPLATE.js",
"dependencies": {
"@patternslib/patternslib": "4"
},
"parser": "babel-eslint",
"rules": {
"quote-props": [
1,
"consistent-as-needed"
]
"devDependencies": {
"@babel/core": "^7.13.15",
"@babel/eslint-parser": "^7.13.14",
"@babel/plugin-proposal-optional-chaining": "^7.11.0",
"@babel/preset-env": "^7.9.6",
"@commitlint/cli": "^12.1.1",
"@commitlint/config-conventional": "^12.1.1",
"@release-it/conventional-changelog": "^2.0.1",
"@testing-library/jest-dom": "^5.11.10",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^6.2.0",
"core-js": "3",
"css-loader": "^3.5.3",
"duplicate-package-checker-webpack-plugin": "^3.0.0",
"eslint": "^7.0.0",
"eslint-config-prettier": "^6.11.0",
"expose-loader": "^0.7.5",
"file-loader": "^6.2.0",
"husky": "^6.0.0",
"identity-obj-proxy": "^3.0.0",
"imports-loader": "^0.8.0",
"jest": "^26.6.3",
"jest-watch-typeahead": "^0.6.2",
"prettier": "^2.1.2",
"raw-loader": "^4.0.1",
"regenerator-runtime": "^0.13.5",
"release-it": "^14.6.1",
"sass": "^1.32.8",
"sass-loader": "^10.1.1",
"style-loader": "^1.2.1",
"svg-inline-loader": "^0.8.2",
"terser-webpack-plugin": "^2.3.6",
"webpack": "^4.43.0",
"webpack-bundle-analyzer": "^3.9.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.2",
"webpack-modernizr-loader": "^5.0.0",
"whybundled": "^2.0.0",
"yarn": "^1.22.10"
},
"scripts": {
"start": "webpack-dev-server --config webpack.config.js --mode=development",
"watch": "webpack --config webpack.config.js --watch --mode=development",
"build": "webpack --config webpack.config.js --mode=production",
"build:stats": "webpack --config webpack.config.js --mode=development --json > stats.json",
"test": "jest"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
]
},
"publishConfig": {
"access": "public"
},
"author": {
"name": "Syslab GesmbH",
"email": "dev@syslab.com"
},
"homepage": "https://gitub.com/patternslib/pat-PATTERN_TEMPLATE",
"repository": {
"type": "git",
"url": "https://gitub.com/patternslib/pat-PATTERN_TEMPLATE.git"
}
},
"prettier": {
"tabWidth": 4,
"quoteProps": "consistent"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
]
}
}
Loading

0 comments on commit b7879f7

Please sign in to comment.