@patternslib/dev 3.6.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGES.md CHANGED
@@ -2,6 +2,57 @@
2
2
 
3
3
 
4
4
 
5
+ ## 3.7.0 (2025-02-13)
6
+
7
+
8
+ * Fix Changelog. ([](https://github.com/patternslib/dev/commit/7202edf))
9
+
10
+
11
+ * Release new version. ([](https://github.com/patternslib/dev/commit/b837a68))
12
+
13
+
14
+ * yarn install. ([](https://github.com/patternslib/dev/commit/0225956))
15
+
16
+
17
+ * yarn install. ([](https://github.com/patternslib/dev/commit/dfe8b0a))
18
+
19
+
20
+ * Add postinstall script to upgrade dev. ([](https://github.com/patternslib/dev/commit/16b900d))
21
+
22
+ Note: the "make upgrade" target is run in the directory where npm
23
+ install is invoked. If you install "@patternslib/dev" as a dependency in
24
+ "@pattersnlib/patternslib", the Patternslib project is upgraded.
25
+
26
+
27
+ * Add upgrade to remove husky. ([](https://github.com/patternslib/dev/commit/6e3629c))
28
+
29
+
30
+ * Directly use git's commit hooks and remove dependency on husky. ([](https://github.com/patternslib/dev/commit/ae05dd3))
31
+
32
+
33
+ * Makefile: Define targets as phony, if they are. ([](https://github.com/patternslib/dev/commit/d4c63b7))
34
+
35
+
36
+ * Makefile: Let the install target depend on yarn.lock file to allow reinstalls when yarn.lock changes. ([](https://github.com/patternslib/dev/commit/9de2d28))
37
+
38
+
39
+ * Upgrade dependencies. ([](https://github.com/patternslib/dev/commit/74027e8))
40
+
41
+
42
+ * Upgrade to eslint v9. ([](https://github.com/patternslib/dev/commit/1279e70))
43
+
44
+ ## [3.6.1](https://github.com/patternslib/dev/compare/3.6.0...3.6.1) (2024-08-14)
45
+
46
+
47
+ ### Bug Fixes
48
+
49
+
50
+ * Webpack style loader. ([ecec3cf](https://github.com/patternslib/dev/commit/ecec3cf5654050c8ec96a924fcaa8bad618d526c))
51
+
52
+ Webpack style loader's insert option needs a different way to reference functions.
53
+ Also deprecate webpack-helpers module.
54
+
55
+
5
56
  ## [3.6.0](https://github.com/patternslib/dev/compare/3.5.3...3.6.0) (2024-08-14)
6
57
 
7
58
 
@@ -49,6 +100,7 @@ Note: As time of this commit, versions below 18 are unmaintained.
49
100
 
50
101
  * Upgrade GitHub Actions. ([f687bee](https://github.com/patternslib/dev/commit/f687bee3dcd94b50b14fd5df3370aa9ecf245943))
51
102
 
103
+
52
104
  ## [3.5.3](https://github.com/patternslib/dev/compare/3.5.2...3.5.3) (2023-11-22)
53
105
 
54
106
 
package/Makefile CHANGED
@@ -18,34 +18,37 @@ PACKAGE_DEV=@patternslib/dev
18
18
  PACKAGE_NAME := $(shell node -p "require('./package.json').name")
19
19
  BUNDLE_NAME := $(subst @patternslib/,,$(subst @plone/,,$(PACKAGE_NAME)))
20
20
 
21
- .PHONY: install
22
- stamp-yarn install:
21
+
22
+ yarn.lock install: .git/hooks/commit-msg
23
23
  $(YARN) install
24
- # Install pre commit hook
25
- $(YARN) husky install
26
- touch stamp-yarn
27
24
 
28
25
 
26
+ .git/hooks/commit-msg:
27
+ echo "npx commitlint --edit" > .git/hooks/commit-msg
28
+ chmod u+x .git/hooks/commit-msg
29
+
30
+
31
+ .PHONY: clean
29
32
  clean-dist:
30
33
  rm -Rf dist/
31
34
 
32
35
 
33
36
  .PHONY: clean
34
37
  clean: clean-dist
35
- rm -f stamp-yarn
36
38
  rm -Rf node_modules/
37
39
 
38
40
 
39
41
  .PHONY: eslint
40
- eslint: stamp-yarn
42
+ eslint: install
41
43
  $(ESLINT) ./src
42
44
 
43
45
 
44
46
  .PHONY: check
45
- check: stamp-yarn eslint
47
+ check: install eslint
46
48
  $(YARN) run test
47
49
 
48
50
 
51
+ .PHONY: bundle-pre
49
52
  bundle-pre:
50
53
  @# Override this in your project to add some tasks before the bundle is built.
51
54
  @# Example: Unlink any linked dependencies.
@@ -58,7 +61,7 @@ bundle-pre:
58
61
  # NOTE: When using the normal workflow - e.g. `make release-minor`, the
59
62
  # relase-it config runs `make bundle` after the version bump.
60
63
  .PHONY: bundle
61
- bundle: clean-dist bundle-pre stamp-yarn
64
+ bundle: clean-dist bundle-pre install
62
65
  ifneq "$(PACKAGE_NAME)" "$(PACKAGE_DEV)"
63
66
  @# Do not build a bundle for @patternslib/dev
64
67
  $(YARN) run build
@@ -66,6 +69,7 @@ endif
66
69
 
67
70
 
68
71
  # Create a ZIP file from the bundle which is uploaded to the GitHub release tag.
72
+ .PHONY: release-zip
69
73
  release-zip:
70
74
  ifneq "$(PACKAGE_NAME)" "$(PACKAGE_DEV)"
71
75
  @# Do not create a zip release for @patternslib/dev
@@ -79,6 +83,7 @@ endif
79
83
 
80
84
 
81
85
  # Prepare some necessary variables.
86
+ .PHONY: prepare-release
82
87
  prepare-release:
83
88
  ifeq ($(LEVEL),$(filter $(LEVEL), alpha beta))
84
89
  @# case alpha or beta pre-release
@@ -104,11 +109,13 @@ endif
104
109
 
105
110
 
106
111
  # Do the npm release.
112
+ .PHONY: release-npm
107
113
  release-npm: prepare-release
108
114
  npx release-it $(RELEASE_IT_LEVEL)
109
115
 
110
116
 
111
117
  # Do the GitHub release.
118
+ .PHONY: release-github
112
119
  release-github: prepare-release release-zip
113
120
  @# NOTE: PACKAGE_VERSION is defined in release-zip
114
121
 
@@ -130,6 +137,7 @@ release-github: prepare-release release-zip
130
137
  -rm $(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION).zip
131
138
 
132
139
 
140
+ .PHONY: release
133
141
  release: clean install check release-npm release-github
134
142
  @# Note: If you want to include the compiled bundle in your npm package you
135
143
  @# have to allow it in a .npmignore file.
@@ -159,8 +167,35 @@ prerelease-beta:
159
167
 
160
168
 
161
169
  .PHONY: serve
162
- serve: stamp-yarn
170
+ serve: install
163
171
  $(YARN) run start
164
172
 
165
173
 
166
- #
174
+ upgrade:\
175
+ .git/hooks/commit-msg\
176
+ upgrade-remove-husky\
177
+ upgrade-eslint
178
+ @# Upgrade target, depends on other upgrades
179
+
180
+
181
+ upgrade-remove-husky:
182
+ test -d .husky\
183
+ && rm -R .husky\
184
+ && git add .husky\
185
+ && git commit -m"maint: @patternslib/dev upgrade - remove .husky directory in favor of git hooks."\
186
+ || :
187
+ -git config --unset core.hooksPath
188
+
189
+
190
+ eslint.config.js upgrade-eslint:
191
+ test -f "eslint.config.js"\
192
+ || (\
193
+ echo 'module.exports = require("@patternslib/dev/eslint.config.js");' > eslint.config.js\
194
+ && git add eslint.config.js\
195
+ && git commit -m"maint: @patternslib/dev upgrade - create eslint.config.js."\
196
+ )
197
+ test -f ".eslintrc.js"\
198
+ && rm .eslintrc.js\
199
+ && git add .eslintrc.js\
200
+ && git commit -m"maint: @patternslib/dev upgrade - remove old .eslintrc.js."\
201
+ || :
package/README.md CHANGED
@@ -1,7 +1,17 @@
1
1
  # Development helpers and config for Patternslib and add-ons.
2
2
 
3
+ This repository includes base files which are extended in Patternslib, Mockup or other projects.
4
+
5
+ It includes a Makefile which helps in installing and releasing packages.
6
+
7
+ ## Upgrading
8
+
9
+ Run `make upgrade` in your project.
10
+
11
+ Alternatively, if there is a new `@patternslib/dev` version installed, the `postinstall` package.json script will automatically run `make upgrade` in the directory where package installer was invoked, that is your project directory which depends on `@patternslib/dev`.
12
+
13
+
3
14
  ## Code style
4
15
 
5
- The release process based on release-it includes automatic changelog generation via conventional-commit, commitlint and a pre-commit hook by husky.
16
+ The release process based on release-it includes automatic changelog generation via conventional-commit, commitlint and a git pre-commit hook.
6
17
  Please check the [code style guide](https://github.com/Patternslib/Patterns/blob/master/docs/developer/styleguide.md#commits-messages) for the commit specification!
7
-
@@ -0,0 +1,37 @@
1
+ const js = require("@eslint/js");
2
+ const config_prettier = require("eslint-config-prettier");
3
+ const globals = require("globals");
4
+ const babel_parser = require("@babel/eslint-parser");
5
+
6
+ module.exports = [
7
+ js.configs.recommended,
8
+ config_prettier,
9
+ {
10
+ languageOptions: {
11
+ ecmaVersion: 2022,
12
+ globals: {
13
+ ...globals.browser,
14
+ ...globals.node,
15
+ ...globals.jest,
16
+ },
17
+ parser: babel_parser,
18
+ },
19
+ ignores: [
20
+ "cache/",
21
+ "coverage/",
22
+ "dist/",
23
+ "node_modules/",
24
+ "stats.json",
25
+ "style/",
26
+ ],
27
+ rules: {
28
+ "no-debugger": 1,
29
+ "no-duplicate-imports": 1,
30
+ // Do keep due avoid unintendet consequences.
31
+ "no-alert": 0,
32
+ "no-control-regex": 0,
33
+ "no-self-assign": 0,
34
+ "no-useless-escape": 0,
35
+ },
36
+ }
37
+ ];
package/package.json CHANGED
@@ -1,36 +1,36 @@
1
1
  {
2
2
  "name": "@patternslib/dev",
3
- "version": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "description": "Development base files for working with Patternslib and add-ons.",
5
5
  "license": "MIT",
6
6
  "dependencies": {
7
- "@babel/core": "^7.25.2",
8
- "@babel/eslint-parser": "^7.25.1",
9
- "@babel/preset-env": "^7.25.3",
10
- "@commitlint/cli": "^19.4.0",
11
- "@commitlint/config-conventional": "^19.2.2",
12
- "@release-it/conventional-changelog": "^8.0.1",
13
- "babel-loader": "^9.1.3",
7
+ "@babel/core": "^7.26.8",
8
+ "@babel/eslint-parser": "^7.26.8",
9
+ "@babel/preset-env": "^7.26.8",
10
+ "@commitlint/cli": "^19.7.1",
11
+ "@commitlint/config-conventional": "^19.7.1",
12
+ "@release-it/conventional-changelog": "^10.0.0",
13
+ "babel-loader": "^9.2.1",
14
14
  "css-loader": "^7.1.2",
15
- "eslint": "^8.57.0",
16
- "eslint-config-prettier": "^9.1.0",
17
- "husky": "^8.0.3",
15
+ "eslint": "^9.20.1",
16
+ "eslint-config-prettier": "^10.0.1",
17
+ "globals": "^15.15.0",
18
18
  "identity-obj-proxy": "^3.0.0",
19
19
  "jest": "^29.7.0",
20
20
  "jest-environment-jsdom": "^29.7.0",
21
21
  "jest-watch-typeahead": "^2.2.2",
22
- "prettier": "^3.3.3",
22
+ "prettier": "^3.5.0",
23
23
  "regenerator-runtime": "^0.14.1",
24
- "release-it": "^17.6.0",
24
+ "release-it": "^18.1.2",
25
25
  "sass": "^1.77.8",
26
- "sass-loader": "^16.0.0",
26
+ "sass-loader": "^16.0.4",
27
27
  "style-loader": "^4.0.0",
28
- "terser-webpack-plugin": "^5.3.10",
28
+ "terser-webpack-plugin": "^5.3.11",
29
29
  "timezone-mock": "^1.3.6",
30
- "webpack": "^5.93.0",
30
+ "webpack": "^5.97.1",
31
31
  "webpack-bundle-analyzer": "^4.10.2",
32
- "webpack-cli": "^5.1.4",
33
- "webpack-dev-server": "^5.0.4",
32
+ "webpack-cli": "^6.0.1",
33
+ "webpack-dev-server": "^5.2.0",
34
34
  "whybundled": "^2.0.0",
35
35
  "yarn": "^1.22.22"
36
36
  },
@@ -38,6 +38,7 @@
38
38
  "node": ">=18.18"
39
39
  },
40
40
  "scripts": {
41
+ "postinstall": "cd $INIT_CWD && make upgrade",
41
42
  "test": "jest"
42
43
  },
43
44
  "author": {
@@ -0,0 +1,12 @@
1
+ function style_inserter(el) {
2
+ // Insert element at the top of <head>
3
+ // Used for injecting CSS via webpack before any other CSS
4
+ var first_child = document.head.querySelectorAll("*")[0];
5
+ if (first_child) {
6
+ document.head.insertBefore(el, first_child);
7
+ } else {
8
+ document.head.append(el);
9
+ }
10
+ }
11
+
12
+ module.exports = style_inserter;
@@ -1,16 +1,7 @@
1
- function top_head_insert(el) {
2
- // Insert element at the top of <head>
3
- // Used for injecting CSS via webpack before any other CSS
4
- // Note:
5
- // Keep code compatible with IE11 as long as we support it.
6
- var first_child = document.head.querySelectorAll("*")[0];
7
- if (first_child) {
8
- document.head.insertBefore(el, first_child);
9
- } else {
10
- document.head.append(el);
11
- }
12
- }
1
+ // BBB
2
+ // TODO: Remove in next major version.
3
+ const style_inserter = require("./style-inserter");
13
4
 
14
5
  module.exports = {
15
- top_head_insert: top_head_insert,
6
+ top_head_insert: style_inserter,
16
7
  };
@@ -1,6 +1,5 @@
1
1
  process.traceDeprecation = true;
2
2
  const webpack = require("webpack");
3
- const webpack_helpers = require("./webpack-helpers");
4
3
 
5
4
  // plugins
6
5
  const TerserPlugin = require("terser-webpack-plugin");
@@ -60,7 +59,7 @@ const config_factory = (env, argv, config, babel_include = [], package_json) =>
60
59
  {
61
60
  loader: "style-loader",
62
61
  options: {
63
- insert: webpack_helpers.top_head_insert,
62
+ insert: require.resolve("./style-inserter"),
64
63
  },
65
64
  },
66
65
  "css-loader",
package/.eslintrc.js DELETED
@@ -1,28 +0,0 @@
1
- module.exports = {
2
- extends: ["eslint:recommended", "prettier"],
3
- root: true,
4
- env: {
5
- es6: "true",
6
- browser: true,
7
- node: true,
8
- jest: true,
9
- },
10
- parser: "@babel/eslint-parser",
11
- ignorePatterns: [
12
- "cache/",
13
- "coverage/",
14
- "dist/",
15
- "node_modules/",
16
- "stats.json",
17
- "style/",
18
- ],
19
- rules: {
20
- "no-debugger": 1,
21
- "no-duplicate-imports": 1,
22
- // Do keep due avoid unintendet consequences.
23
- "no-alert": 0,
24
- "no-control-regex": 0,
25
- "no-self-assign": 0,
26
- "no-useless-escape": 0,
27
- },
28
- };
@@ -1,38 +0,0 @@
1
- // Depend on (snippet from package.json):
2
- // {
3
- // "dependencies": {
4
- // "vue": "^2.6.14",
5
- // "vue-async-computed": "^3.9.0"
6
- // },
7
- // "devDependencies": {
8
- // "vue-jest": "^4.0.1",
9
- // "vue-loader": "^15.9.8",
10
- // "vue-template-compiler": "^2.6.14"
11
- // }
12
- // }
13
- //
14
- // Add in jest.config.js:
15
- // transform: {
16
- // ...
17
- // "^.+\\.vue$": "vue-jest",
18
- // },
19
- //
20
- // Use in webpack like:
21
- // const vue_config = require("./webpack.vue");
22
- // module.exports = async (env, argv) => {
23
- // const config = vue_config(env, argv, patternslib_config(env, argv));
24
- // [...]
25
- // }
26
- const VueLoaderPlugin = require("vue-loader/lib/plugin");
27
-
28
- module.exports = (env, argv, config) => {
29
- // Vue Plugin config snippet
30
- config.resolve.alias.vue$ = "vue/dist/vue.esm.js";
31
- config.resolve.extensions = ["*", ".js", ".vue", ".json"];
32
- config.module.rules.push({
33
- test: /\.vue$/,
34
- loader: "vue-loader",
35
- });
36
- config.plugins.push(new VueLoaderPlugin());
37
- return config;
38
- };