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 1c9abbb commit 8271517
Show file tree
Hide file tree
Showing 14 changed files with 261 additions and 98 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
7 changes: 2 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ module.exports = {
node: true,
jest: true,
},
parser: "babel-eslint",
ignorePatterns: [
"src/lib/depends_parse.js",
"src/pat/calendar/moment-timezone-with-data-2010-2020.js",
],
parser: "@babel/eslint-parser",
ignorePatterns: [],
rules: {
"no-debugger": 1,
"no-duplicate-imports": 1,
Expand Down
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
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.DS_Store
node_modules
stamp-npm
package-lock.json
stamp-yarn
yarn.lock
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
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"tabWidth": 4,
"quoteProps": "consistent"
"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"
}
]
}
}
}
}
86 changes: 77 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,83 @@
all:: designerhappy
ESLINT ?= npx eslint
YARN ?= npx yarn


stamp-npm: package.json
npm install
touch stamp-npm
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)


clean::
rm -rf stamp-npm node_modules
stamp-yarn:
$(YARN) install
# Install pre commit hook
$(YARN) husky install
touch stamp-yarn


designerhappy:: stamp-npm
printf "\n\n Designer, you can be happy now.\n Go to http://localhost:8000 to see the demo \n\n\n\n"
npm run start
clean-dist:
rm -Rf dist/


.PHONY: clean
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
$(YARN) run start


#
3 changes: 1 addition & 2 deletions bundle-config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import registry from "patternslib/src/core/registry.js";
import registry from "@patternslib/patternslib/src/core/registry.js";
import "./src/pat-content-mirror.js";


registry.init();
12 changes: 12 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
rootDir: "./src",
setupFilesAfterEnv: ["<rootDir>/setupTests.js"],
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?$"],
};
117 changes: 70 additions & 47 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,73 @@
{
"name": "pat-content-mirror",
"version": "1.0.0",
"description": "A pattern for rich comments in the social stream.",
"author": {
"name": "Fulvio Casali",
"email": "fulviocasali@gmail.com"
},
"homepage": "https://gitub.com/ploneintranet/pat-content-mirror",
"docs": "https://gitub.com/ploneintranet/pat-content-mirror",
"license": "MIT",
"repository": {
"type": "git",
"url": "git@github.com:ploneintranet/pat-content-mirror.git"
},
"main": "./src/pat-content-mirror.js",
"dependencies": {
"patternslib": "https://github.com/Patternslib/Patterns#master"
},
"devDependencies": {
"@babel/plugin-proposal-optional-chaining": "^7.11.0",
"@babel/preset-env": "^7.9.6",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"core-js": "3",
"eslint": "^7.0.0",
"eslint-config-prettier": "^6.11.0",
"prettier": "^2.1.2",
"regenerator-runtime": "^0.13.5",
"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"
},
"browserslist": [
">0.2%",
"ie >= 11",
"not dead"
],
"maintainers": [
{
"name": "Syslab.com GmbH",
"email": "info@syslab.com",
"url": "http://www.syslab.com"
"name": "pat-content-mirror",
"version": "1.0.0",
"description": "A pattern for content-mirror",
"author": {
"name": "Syslab GesmbH",
"email": "dev@syslab.com"
},
"license": "MIT",
"homepage": "https://gitub.com/ploneintranet/pat-content-mirror",
"main": "./src/content-mirror.js",
"dependencies": {
"@patternslib/patternslib": "4"
},
"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"
}
]
}
Loading

0 comments on commit 8271517

Please sign in to comment.