@patternslib/dev 3.0.0 → 3.1.1

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.
Files changed (3) hide show
  1. package/CHANGES.md +38 -0
  2. package/Makefile +93 -35
  3. package/package.json +17 -16
package/CHANGES.md CHANGED
@@ -2,6 +2,44 @@
2
2
 
3
3
 
4
4
 
5
+ ## [3.1.1](https://github.com/patternslib/dev/compare/3.1.0...3.1.1) (2022-11-15)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+
11
+ * Fix Makefile error with GitHub release. ([7df20db](https://github.com/patternslib/dev/commit/7df20db4ef54c820b07e49db9123823b23ee1161))
12
+
13
+ ## [3.1.0](https://github.com/patternslib/dev/compare/3.0.0...3.1.0) (2022-11-15)
14
+
15
+
16
+ ### Features
17
+
18
+
19
+ * Allow to add the compiled bundles to npm packages. ([84bdefd](https://github.com/patternslib/dev/commit/84bdefd339b9aa553ef78e9448e4cdd998178d40))Creating a npm release with the Makefile prepares now a bundle build
20
+ with the correct package version added as a comment to the bundle files.
21
+ The compiled bundle can then be uploaded to npm if it is part of the git
22
+ repository (included by .gitignore) or part of the npm release
23
+ (preferred, included by .npmignore).
24
+
25
+ Adding the compiled bundle to npm allows to directly include it via a
26
+ CDN like so:
27
+
28
+ https://cdn.jsdelivr.net/npm/@patternslib/patternslib@9.7.0-alpha.2/dist/bundle.min.js
29
+ or
30
+ https://unpkg.com/@patternslib/patternslib@9.7.0-alpha.2/dist/bundle.min.js
31
+
32
+ We have to compile the bundle with the correct version BEFORE the npm
33
+ package is created with release-it. The next version is queried using
34
+ the LEVEL parameter (set by the different release targets) and the
35
+ "semver" tool.
36
+
37
+
38
+ ### Maintenance
39
+
40
+
41
+ * Upgrade dependencies. ([e687405](https://github.com/patternslib/dev/commit/e6874052cf9ae2cd359996659c091de532b6f5cb))
42
+
5
43
  ## [3.0.0](https://github.com/patternslib/dev/compare/2.7.2...3.0.0) (2022-10-15)
6
44
 
7
45
 
package/Makefile CHANGED
@@ -1,11 +1,22 @@
1
+ # This Makefile is meant to be exported by Patternslib or Mockup packages.
2
+
3
+ # .evn include, mainly for a GITHUB_TOKEN.
1
4
  -include .env
2
5
  export
3
6
 
7
+
8
+ # If you want to release on GitHub, make sure to have a .env file with a GITHUB_TOKEN.
9
+ # Also see:
10
+ # https://github.com/settings/tokens
11
+ # and https://github.com/release-it/release-it/blob/master/docs/github-releases.md#automated
12
+
13
+
4
14
  ESLINT ?= npx eslint
5
15
  YARN ?= npx yarn
6
16
 
7
17
  PACKAGE_DEV=@patternslib/dev
8
18
  PACKAGE_NAME := $(shell node -p "require('./package.json').name")
19
+ BUNDLE_NAME := $(subst @patternslib/,,$(subst @plone/,,$(PACKAGE_NAME)))
9
20
 
10
21
  .PHONY: install
11
22
  stamp-yarn install:
@@ -43,6 +54,7 @@ bundle-pre:
43
54
  @# yarn install --force
44
55
 
45
56
 
57
+ # Compile the bundle.
46
58
  .PHONY: bundle
47
59
  bundle: bundle-pre stamp-yarn
48
60
  ifneq "$(PACKAGE_NAME)" "$(PACKAGE_DEV)"
@@ -51,58 +63,104 @@ ifneq "$(PACKAGE_NAME)" "$(PACKAGE_DEV)"
51
63
  endif
52
64
 
53
65
 
54
- # If you want to release on GitHub, make sure to have a .env file with a GITHUB_TOKEN.
55
- # Also see:
56
- # https://github.com/settings/tokens
57
- # and https://github.com/release-it/release-it/blob/master/docs/github-releases.md#automated
58
-
59
-
66
+ # Create a ZIP file from the bundle which is uploaded to the GitHub release tag.
60
67
  release-zip: clean-dist bundle
61
68
  ifneq "$(PACKAGE_NAME)" "$(PACKAGE_DEV)"
62
69
  @# Do not create a zip release for @patternslib/dev
63
- $(eval BUNDLE_NAME := $(subst @patternslib/,,$(subst @plone/,,$(PACKAGE_NAME))))
64
70
  $(eval PACKAGE_VERSION := $(shell node -p "require('./package.json').version"))
65
71
  @echo Creating $(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION).zip
66
- mkdir -p dist/$(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION)
67
- -mv dist/* dist/$(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION)
68
- cd dist/ && zip -r $(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION).zip $(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION)/
72
+ mkdir -p $(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION)
73
+ -cp -R dist/* $(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION)
74
+ zip -r $(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION).zip $(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION)/
75
+ rm -Rf $(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION)
69
76
  endif
70
77
 
71
78
 
79
+ # Update the package.json version with NEXT_VERSION
80
+ define write_package_json
81
+ const fs = require("fs"); \
82
+ const package_json = require("./package.json"); \
83
+ package_json.version = "$(NEXT_VERSION)"; \
84
+ const data = JSON.stringify(package_json, null, 4); \
85
+ fs.writeFileSync("package.json", data);
86
+ endef
87
+
88
+ prepare-release:
89
+ @# Get the current package version.
90
+ $(eval CURRENT_VERSION := $(shell node -p "require('./package.json').version"))
91
+ ifeq ($(LEVEL),$(filter $(LEVEL), alpha beta))
92
+ @# case alpha or beta pre-release
93
+
94
+ @# Set level argument for release-it.
95
+ $(eval RELEASE_IT_LEVEL := "--preRelease=$(LEVEL)")
96
+ @# Get the next version via semver.
97
+ $(eval NEXT_VERSION := $(shell npx semver --increment premajor --preid $(LEVEL) $(CURRENT_VERSION)))
98
+ else
99
+ @# case normal major/minor/patch release
100
+
101
+ @# Set level argument for release-it.
102
+ $(eval RELEASE_IT_LEVEL := $(LEVEL))
103
+ @# Get the next version via semver.
104
+ $(eval NEXT_VERSION := $(shell npx semver --increment $(LEVEL) $(CURRENT_VERSION)))
105
+ endif
106
+ @echo Next version is: $(NEXT_VERSION)
107
+
108
+ @# Temporarily write the NEXT_VERSION to package.json, so that the bundle
109
+ @# and release-zip generate correct version strings.
110
+ node -p '$(write_package_json)'
111
+
112
+
113
+ release: clean install check prepare-release release-zip
114
+ @# RELEASE_IT_LEVEL and NEXT_VERSION set by prepare-release
115
+
116
+ @# Note: If you want to include the compiled bundle in your npm package you
117
+ @# have to allow it in a .npmignore file.
118
+
119
+ @# Checkout package.json which was modified by prepare-release and read by
120
+ @# release-zip.
121
+ git checkout .
122
+
123
+ @# 1) Release on npm.
124
+ @# 2) When successful, update release on GitHub
125
+ @# 3) Checkout CHANGES.md, which was modified by step 2)
126
+ npx release-it $(RELEASE_IT_LEVEL) \
127
+ && npx release-it \
128
+ --github.release \
129
+ --github.update \
130
+ --github.assets=$(BUNDLE_NAME)-bundle-$(NEXT_VERSION).zip \
131
+ --no-github.draft \
132
+ --no-increment \
133
+ --no-git \
134
+ --no-npm \
135
+ && git checkout CHANGES.md
136
+
137
+ @# Remove the bundle from release-zip again.
138
+ rm $(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION).zip
139
+
140
+
72
141
  .PHONY: release-major
73
- release-major: check
74
- npx release-it major && \
75
- make release-zip && \
76
- npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
77
- git checkout CHANGES.md
142
+ release-major:
143
+ make LEVEL=major release
144
+
78
145
 
79
146
  .PHONY: release-minor
80
- release-minor: check
81
- npx release-it minor && \
82
- make release-zip && \
83
- npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
84
- git checkout CHANGES.md
147
+ release-minor:
148
+ make LEVEL=minor release
149
+
85
150
 
86
151
  .PHONY: release-patch
87
- release-patch: check
88
- npx release-it patch && \
89
- make release-zip && \
90
- npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
91
- git checkout CHANGES.md
152
+ release-patch:
153
+ make LEVEL=patch release
154
+
92
155
 
93
156
  .PHONY: prerelease-alpha
94
- prerelease-alpha: clean install
95
- npx release-it --preRelease=alpha && \
96
- make release-zip && \
97
- npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
98
- git checkout CHANGES.md
157
+ prerelease-alpha:
158
+ make LEVEL=alpha release
159
+
99
160
 
100
161
  .PHONY: prerelease-beta
101
- prerelease-beta: clean install
102
- npx release-it --preRelease=beta && \
103
- make release-zip && \
104
- npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
105
- git checkout CHANGES.md
162
+ prerelease-beta:
163
+ make LEVEL=beta release
106
164
 
107
165
 
108
166
  .PHONY: serve
package/package.json CHANGED
@@ -1,35 +1,36 @@
1
1
  {
2
2
  "name": "@patternslib/dev",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "description": "Development base files for working with Patternslib and add-ons.",
5
5
  "license": "MIT",
6
6
  "dependencies": {
7
- "@babel/core": "^7.19.3",
7
+ "@babel/core": "^7.20.2",
8
8
  "@babel/eslint-parser": "^7.19.1",
9
- "@babel/preset-env": "^7.19.4",
10
- "@commitlint/cli": "^17.1.2",
11
- "@commitlint/config-conventional": "^17.1.0",
9
+ "@babel/preset-env": "^7.20.2",
10
+ "@commitlint/cli": "^17.2.0",
11
+ "@commitlint/config-conventional": "^17.2.0",
12
12
  "@release-it/conventional-changelog": "^5.1.1",
13
- "babel-loader": "^8.2.5",
14
- "core-js": "3.25.5",
15
- "css-loader": "^6.7.1",
16
- "eslint": "^8.25.0",
13
+ "babel-loader": "^9.1.0",
14
+ "core-js": "3.26.1",
15
+ "css-loader": "^6.7.2",
16
+ "eslint": "^8.27.0",
17
17
  "eslint-config-prettier": "^8.5.0",
18
- "husky": "^8.0.1",
18
+ "husky": "^8.0.2",
19
19
  "identity-obj-proxy": "^3.0.0",
20
- "jest": "^29.2.0",
21
- "jest-environment-jsdom": "^29.2.0",
20
+ "jest": "^29.3.1",
21
+ "jest-environment-jsdom": "^29.3.1",
22
22
  "jest-watch-typeahead": "^2.2.0",
23
23
  "prettier": "^2.7.1",
24
24
  "regenerator-runtime": "^0.13.10",
25
25
  "release-it": "^15.5.0",
26
- "sass": "^1.55.0",
27
- "sass-loader": "^13.1.0",
26
+ "sass": "^1.56.1",
27
+ "sass-loader": "^13.2.0",
28
+ "semver": "^7.3.8",
28
29
  "style-loader": "^3.3.0",
29
30
  "terser-webpack-plugin": "^5.3.6",
30
31
  "timezone-mock": "^1.3.4",
31
- "webpack": "^5.74.0",
32
- "webpack-bundle-analyzer": "^4.6.1",
32
+ "webpack": "^5.75.0",
33
+ "webpack-bundle-analyzer": "^4.7.0",
33
34
  "webpack-cli": "^4.10.0",
34
35
  "webpack-dev-server": "^4.11.1",
35
36
  "whybundled": "^2.0.0",