Skip to content

Commit 8271517

Browse files
committed
maint: Upgrade to Patternslib v4 final.
1 parent 1c9abbb commit 8271517

14 files changed

+261
-98
lines changed

.commitlintrc.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"parserPreset": "conventional-changelog-conventionalcommits",
3+
"rules": {
4+
"body-leading-blank": [1, "always"],
5+
"footer-leading-blank": [1, "always"],
6+
"subject-empty": [2, "never"],
7+
"type-case": [2, "always", "lower-case"],
8+
"type-empty": [2, "never"],
9+
"type-enum": [2, "always", ["feat", "fix", "maint", "breaking"]]
10+
}
11+
}

.editorconfig

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
[*]
2-
indent_style = space
2+
charset = utf-8
33
end_of_line = lf
4+
indent_style = space
45
insert_final_newline = true
56
trim_trailing_whitespace = true
6-
charset = utf-8
77

8-
[*.js]
8+
[*{js,jsx,vue,ts}]
99
indent_size = 4
1010

11-
[{*.css,*.scss,*.xml,*.html}]
11+
[*.{css,scss,xml,html,yml}]
1212
indent_size = 2
13+
14+
[Makefile]
15+
indent_style = tab

.eslintrc.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ module.exports = {
77
node: true,
88
jest: true,
99
},
10-
parser: "babel-eslint",
11-
ignorePatterns: [
12-
"src/lib/depends_parse.js",
13-
"src/pat/calendar/moment-timezone-with-data-2010-2020.js",
14-
],
10+
parser: "@babel/eslint-parser",
11+
ignorePatterns: [],
1512
rules: {
1613
"no-debugger": 1,
1714
"no-duplicate-imports": 1,

.github/workflows/test.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: test
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
jobs:
10+
build:
11+
name: test
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-node@v1
16+
with:
17+
node-version: '14'
18+
- run: npm install yarn
19+
- run: make check

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.DS_Store
22
node_modules
3-
stamp-npm
4-
package-lock.json
3+
stamp-yarn
54
yarn.lock

.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn commitlint --edit

.prettierrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"tabWidth": 4,
3-
"quoteProps": "consistent"
3+
"quoteProps": "consistent",
4+
"printWidth": 89
45
}

.release-it.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"npm": {
3+
"publish": true
4+
},
5+
"git": {
6+
"requireBranch": "master",
7+
"commitMessage": "maint(Release): Release new version."
8+
},
9+
"plugins": {
10+
"@release-it/conventional-changelog": {
11+
"infile": "CHANGES.md",
12+
"preset": {
13+
"name": "conventionalcommits",
14+
"types": [
15+
{
16+
"type": "feat",
17+
"section": "Features"
18+
},
19+
{
20+
"type": "fix",
21+
"section": "Bug Fixes"
22+
},
23+
{
24+
"type": "maint",
25+
"section": "Maintenance"
26+
},
27+
{
28+
"type": "breaking",
29+
"section": "Breaking Changes"
30+
}
31+
]
32+
}
33+
}
34+
}
35+
}

Makefile

+77-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,83 @@
1-
all:: designerhappy
1+
ESLINT ?= npx eslint
2+
YARN ?= npx yarn
23

34

4-
stamp-npm: package.json
5-
npm install
6-
touch stamp-npm
5+
define get_package_var
6+
$(shell node -p "require('./package.json').$(1)")
7+
endef
8+
PACKAGE_NAME := $(shell node -p "'$(call get_package_var,name)'.replace('@patternslib/', '')")
9+
PACKAGE_VERSION := $(call get_package_var,version)
710

811

9-
clean::
10-
rm -rf stamp-npm node_modules
12+
stamp-yarn:
13+
$(YARN) install
14+
# Install pre commit hook
15+
$(YARN) husky install
16+
touch stamp-yarn
1117

1218

13-
designerhappy:: stamp-npm
14-
printf "\n\n Designer, you can be happy now.\n Go to http://localhost:8000 to see the demo \n\n\n\n"
15-
npm run start
19+
clean-dist:
20+
rm -Rf dist/
21+
22+
23+
.PHONY: clean
24+
clean: clean-dist
25+
rm -f stamp-yarn
26+
rm -Rf node_modules/
27+
28+
29+
eslint: stamp-yarn
30+
$(ESLINT) ./src
31+
32+
33+
.PHONY: check
34+
check:: stamp-yarn eslint
35+
$(YARN) run test
36+
37+
38+
.PHONY: bundle
39+
bundle: stamp-yarn
40+
$(YARN) run build
41+
42+
43+
release-web: clean-dist bundle
44+
@echo name is $(PACKAGE_NAME)
45+
@echo version is $(PACKAGE_VERSION)
46+
tar -czf ./$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz dist --transform s/dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/
47+
git clone -n [email protected]:Patternslib/Patterns-releases.git --depth 1 ./dist/Patterns-releases
48+
mkdir ./dist/Patterns-releases/releases
49+
mv ./$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz ./dist/Patterns-releases/releases/
50+
cd ./dist/Patterns-releases && \
51+
git reset HEAD && \
52+
git add ./releases/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz && \
53+
git commit -m"Add release $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz" && \
54+
git push
55+
56+
57+
.PHONY: release-major
58+
release-major: check
59+
npx release-it major --dry-run --ci && \
60+
npx release-it major --ci && \
61+
make release-web
62+
63+
64+
.PHONY: release-minor
65+
release-minor: check
66+
npx release-it minor --dry-run --ci && \
67+
npx release-it minor --ci && \
68+
make release-web
69+
70+
71+
.PHONY: release-patch
72+
release-patch: check
73+
npx release-it --dry-run --ci && \
74+
npx release-it --ci && \
75+
make release-web
76+
77+
78+
.PHONY: serve
79+
serve:: stamp-yarn
80+
$(YARN) run start
81+
82+
83+
#

bundle-config.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import registry from "patternslib/src/core/registry.js";
1+
import registry from "@patternslib/patternslib/src/core/registry.js";
22
import "./src/pat-content-mirror.js";
33

4-
54
registry.init();

jest.config.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
rootDir: "./src",
3+
setupFilesAfterEnv: ["<rootDir>/setupTests.js"],
4+
watchPlugins: ["jest-watch-typeahead/filename", "jest-watch-typeahead/testname"],
5+
transform: {
6+
"^.+\\.[t|j]sx?$": "babel-jest",
7+
},
8+
moduleNameMapper: {
9+
"\\.(css|less|sass|scss)$": "identity-obj-proxy",
10+
},
11+
transformIgnorePatterns: ["/node_modules/(?!.*patternslib/*).+\\.[t|j]sx?$"],
12+
};

package.json

+70-47
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,73 @@
11
{
2-
"name": "pat-content-mirror",
3-
"version": "1.0.0",
4-
"description": "A pattern for rich comments in the social stream.",
5-
"author": {
6-
"name": "Fulvio Casali",
7-
"email": "[email protected]"
8-
},
9-
"homepage": "https://gitub.com/ploneintranet/pat-content-mirror",
10-
"docs": "https://gitub.com/ploneintranet/pat-content-mirror",
11-
"license": "MIT",
12-
"repository": {
13-
"type": "git",
14-
"url": "[email protected]:ploneintranet/pat-content-mirror.git"
15-
},
16-
"main": "./src/pat-content-mirror.js",
17-
"dependencies": {
18-
"patternslib": "https://github.com/Patternslib/Patterns#master"
19-
},
20-
"devDependencies": {
21-
"@babel/plugin-proposal-optional-chaining": "^7.11.0",
22-
"@babel/preset-env": "^7.9.6",
23-
"babel-eslint": "^10.1.0",
24-
"babel-loader": "^8.1.0",
25-
"core-js": "3",
26-
"eslint": "^7.0.0",
27-
"eslint-config-prettier": "^6.11.0",
28-
"prettier": "^2.1.2",
29-
"regenerator-runtime": "^0.13.5",
30-
"webpack": "^4.43.0",
31-
"webpack-cli": "^3.3.11",
32-
"webpack-dev-server": "^3.10.3"
33-
},
34-
"scripts": {
35-
"start": "webpack-dev-server --config webpack.config.js --open --env.NODE_ENV=development",
36-
"build": "webpack --config webpack.config.js --env.NODE_ENV=production"
37-
},
38-
"browserslist": [
39-
">0.2%",
40-
"ie >= 11",
41-
"not dead"
42-
],
43-
"maintainers": [
44-
{
45-
"name": "Syslab.com GmbH",
46-
"email": "[email protected]",
47-
"url": "http://www.syslab.com"
2+
"name": "pat-content-mirror",
3+
"version": "1.0.0",
4+
"description": "A pattern for content-mirror",
5+
"author": {
6+
"name": "Syslab GesmbH",
7+
"email": "[email protected]"
8+
},
9+
"license": "MIT",
10+
"homepage": "https://gitub.com/ploneintranet/pat-content-mirror",
11+
"main": "./src/content-mirror.js",
12+
"dependencies": {
13+
"@patternslib/patternslib": "4"
14+
},
15+
"devDependencies": {
16+
"@babel/core": "^7.13.15",
17+
"@babel/eslint-parser": "^7.13.14",
18+
"@babel/plugin-proposal-optional-chaining": "^7.11.0",
19+
"@babel/preset-env": "^7.9.6",
20+
"@commitlint/cli": "^12.1.1",
21+
"@commitlint/config-conventional": "^12.1.1",
22+
"@release-it/conventional-changelog": "^2.0.1",
23+
"@testing-library/jest-dom": "^5.11.10",
24+
"babel-loader": "^8.1.0",
25+
"clean-webpack-plugin": "^3.0.0",
26+
"copy-webpack-plugin": "^6.2.0",
27+
"core-js": "3",
28+
"css-loader": "^3.5.3",
29+
"duplicate-package-checker-webpack-plugin": "^3.0.0",
30+
"eslint": "^7.0.0",
31+
"eslint-config-prettier": "^6.11.0",
32+
"expose-loader": "^0.7.5",
33+
"file-loader": "^6.2.0",
34+
"husky": "^6.0.0",
35+
"identity-obj-proxy": "^3.0.0",
36+
"imports-loader": "^0.8.0",
37+
"jest": "^26.6.3",
38+
"jest-watch-typeahead": "^0.6.2",
39+
"prettier": "^2.1.2",
40+
"raw-loader": "^4.0.1",
41+
"regenerator-runtime": "^0.13.5",
42+
"release-it": "^14.6.1",
43+
"sass": "^1.32.8",
44+
"sass-loader": "^10.1.1",
45+
"style-loader": "^1.2.1",
46+
"svg-inline-loader": "^0.8.2",
47+
"terser-webpack-plugin": "^2.3.6",
48+
"webpack": "^4.43.0",
49+
"webpack-bundle-analyzer": "^3.9.0",
50+
"webpack-cli": "^3.3.12",
51+
"webpack-dev-server": "^3.11.2",
52+
"webpack-modernizr-loader": "^5.0.0",
53+
"whybundled": "^2.0.0",
54+
"yarn": "^1.22.10"
55+
},
56+
"scripts": {
57+
"start": "webpack-dev-server --config webpack.config.js --mode=development",
58+
"watch": "webpack --config webpack.config.js --watch --mode=development",
59+
"build": "webpack --config webpack.config.js --mode=production",
60+
"build:stats": "webpack --config webpack.config.js --mode=development --json > stats.json",
61+
"test": "jest"
62+
},
63+
"browserslist": {
64+
"production": [
65+
">0.2%",
66+
"not dead",
67+
"not op_mini all"
68+
]
69+
},
70+
"publishConfig": {
71+
"access": "public"
4872
}
49-
]
5073
}

0 commit comments

Comments
 (0)