newspack-scripts 1.4.3 → 1.5.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.
package/README.md CHANGED
@@ -19,6 +19,14 @@ Will run `calypso-build`, creating optimised production builds.
19
19
 
20
20
  Will run `calypso-build` in watch mode.
21
21
 
22
+ ### commit
23
+
24
+ Uses [`commitizen`](https://www.npmjs.com/package/commitizen) to create a structured commit message.
25
+
26
+ ### commitlint
27
+
28
+ Lints to commit message, to be used in a git `commit-msg` hook.
29
+
22
30
  ## Available configs
23
31
 
24
32
  This package exposes a couple of configuration files.
@@ -76,4 +84,4 @@ Install `stylelint` via npm and reference this package's config file when runnin
76
84
  stylelint '**/*.scss' --syntax scss --config=./node_modules/newspack-scripts/config/stylelint.config.js
77
85
  ```
78
86
 
79
- _Note: for it to work properly, use `npm` at version `>=8.3.0`._
87
+ _Note: Due to issue with dependency resolving, you might end up a different version of `prettier` in project's `node_modules` and `node_modules/newspack-scripts/node_modules`. See https://github.com/Automattic/newspack-scripts/issues/1 for more information._
@@ -4,7 +4,7 @@ const spawn = require("cross-spawn");
4
4
 
5
5
  const [scriptName, ...nodeArgs] = process.argv.slice(2);
6
6
 
7
- if (["test", "build", "start"].includes(scriptName)) {
7
+ if (["test", "build", "start", "commit", "commitlint"].includes(scriptName)) {
8
8
  const result = spawn.sync(
9
9
  process.execPath,
10
10
  [require.resolve("../scripts/" + scriptName), ...nodeArgs],
@@ -0,0 +1 @@
1
+ module.exports = { extends: ["@commitlint/config-conventional"] };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newspack-scripts",
3
- "version": "1.4.3",
3
+ "version": "1.5.1",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "newspack-scripts": "./bin/newspack-scripts.js"
@@ -11,13 +11,17 @@
11
11
  "@automattic/calypso-build": "^10.0.0",
12
12
  "@babel/eslint-parser": "^7.16.3",
13
13
  "@babel/preset-env": "^7.16.4",
14
+ "@commitlint/cli": "^15.0.0",
15
+ "@commitlint/config-conventional": "^15.0.0",
14
16
  "@testing-library/jest-dom": "^5.15.1",
15
17
  "@testing-library/react": "^12.1.2",
16
18
  "@wordpress/eslint-plugin": "^9.3.0",
17
19
  "@wordpress/stylelint-config": "^19.1.0",
18
20
  "autoprefixer": "^10.4.0",
19
21
  "babel-jest": "^27.4.2",
22
+ "commitizen": "^4.2.4",
20
23
  "cross-spawn": "^7.0.3",
24
+ "cz-conventional-changelog": "^3.3.0",
21
25
  "eslint": "^7.32.0",
22
26
  "eslint-config-prettier": "^8.3.0",
23
27
  "eslint-plugin-import": "^2.25.3",
@@ -28,14 +32,11 @@
28
32
  "postcss": "^8.4.4",
29
33
  "postcss-focus-within": "^5.0.1",
30
34
  "prettier": "npm:wp-prettier@2.2.1-beta-1",
31
- "stylelint": "^13.3.1",
35
+ "stylelint": "^14.1.0",
32
36
  "stylelint-config-prettier": "^9.0.3",
33
- "stylelint-prettier": "^1.2.0",
37
+ "stylelint-prettier": "^2.0.0",
34
38
  "webpack": "^5.65.0"
35
39
  },
36
- "overrides": {
37
- "prettier": "npm:wp-prettier@2.2.1-beta-1"
38
- },
39
40
  "scripts": {
40
41
  "semantic-release": "semantic-release"
41
42
  },
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ const path = require("path");
4
+ const bootstrap = require("commitizen/dist/cli/git-cz").bootstrap;
5
+ const cliPath = path.resolve(require.resolve("commitizen"), "../..");
6
+
7
+ bootstrap({
8
+ cliPath,
9
+ config: {
10
+ path: "cz-conventional-changelog",
11
+ },
12
+ });
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ const spawn = require("cross-spawn");
4
+ const path = require("path");
5
+
6
+ const result = spawn.sync(
7
+ `${process.cwd()}/node_modules/.bin/commitlint`,
8
+ ["--config", path.resolve(__dirname, "../config/commitlint.config.js")],
9
+ {
10
+ stdio: "inherit",
11
+ }
12
+ );
13
+
14
+ process.exit(result.status);
@@ -1,7 +1,6 @@
1
1
  const fs = require("fs");
2
- const path = require("path");
3
2
 
4
3
  module.exports = {
5
4
  rootDirectory: fs.realpathSync(process.cwd()),
6
- calypsoBuild: require.resolve("@automattic/calypso-build/bin/calypso-build")
5
+ calypsoBuild: require.resolve("@automattic/calypso-build/bin/calypso-build"),
7
6
  };