newspack-scripts 3.0.0 → 3.1.0-alpha.4

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
@@ -35,6 +35,39 @@ Will run [`semantic-release`](semantic-release.gitbook.io/) based on a very opin
35
35
 
36
36
  ---
37
37
 
38
+ ## Semantic Release
39
+
40
+ This package contains a configuration of [`semantic-release`](semantic-release.gitbook.io/), which can be used for automated software releases, published on Github. It's configured to work with the following repository branch setup:
41
+
42
+ 1. `master` – ongoing development
43
+ 1. `alpha` – release candidate
44
+ 1. `release` – the production-ready, released code
45
+
46
+ The following assumes that CI will run:
47
+
48
+ 1. `npm run release` for `release`, `alpha`, and `hotfix/*` branches
49
+ 1. `post-release.sh` script on `release` branch, after the above command completes
50
+
51
+ ### Regular release flow
52
+
53
+ 1. Commit ongoing changes to `master` branch, using [structured commit messages](https://www.conventionalcommits.org/en/v1.0.0/)
54
+ 1. Merge `master` into `alpha` to create a release candidate (e.g. `1.2.0-alpha.1`)
55
+ 1. Merge `alpha` into `release` to create a release (e.g. `1.2.0`)
56
+ 1. `alpha` branch will be reset on top of `release`
57
+ 1. `master` branch will be updated with the changes from the `release` branch
58
+
59
+ ### Hotfix release flow
60
+
61
+ 1. Create a new `hotfix/*` branch off the `release` branch
62
+ 1. Push the branch to Github, so the CI can process it – _don't create a PR just yet!*_
63
+ 1. A new "hotfix" pre-release (e.g. `1.2.0-hotfix.1`) will be published
64
+ 1. Merge the hotfix branch into `release` to create a release
65
+ 1. `alpha` & `master` branches will be updated with the changes from the `release` branch
66
+
67
+ \* `semantic-release` [will not release if the CI job was triggered by a PR](https://github.com/semantic-release/semantic-release/blob/971a5e0d16f1a32e117e9ce382a1618c8256d0d9/index.js#L48-L51)
68
+
69
+ ---
70
+
38
71
  ## Available configs
39
72
 
40
73
  This package exposes a couple of configuration files.
@@ -5,9 +5,15 @@ const spawn = require("cross-spawn");
5
5
  const [scriptName, ...nodeArgs] = process.argv.slice(2);
6
6
 
7
7
  if (
8
- ["test", "build", "watch", "commit", "commitlint", "release"].includes(
9
- scriptName
10
- )
8
+ [
9
+ "test",
10
+ "build",
11
+ "watch",
12
+ "commit",
13
+ "commitlint",
14
+ "release",
15
+ "typescript-check",
16
+ ].includes(scriptName)
11
17
  ) {
12
18
  const result = spawn.sync(
13
19
  process.execPath,
@@ -15,11 +15,22 @@ module.exports = {
15
15
  "plugin:react/recommended",
16
16
  "plugin:import/errors",
17
17
  "plugin:import/warnings",
18
+ "plugin:@typescript-eslint/eslint-recommended",
19
+ "plugin:@typescript-eslint/recommended",
18
20
  ],
19
21
  env: {
20
22
  browser: true,
21
23
  jest: true,
22
24
  },
25
+ parser: "@typescript-eslint/parser",
26
+ plugins: ["@typescript-eslint"],
27
+ settings: {
28
+ "import/resolver": {
29
+ node: {
30
+ extensions: [".js", ".jsx", ".ts", ".tsx"],
31
+ },
32
+ },
33
+ },
23
34
  ignorePatterns: ["dist/", "node_modules/"],
24
35
  parser: "@babel/eslint-parser",
25
36
  rules: {
@@ -43,5 +54,8 @@ module.exports = {
43
54
  "jsdoc/require-param": "off",
44
55
  // Deprecated rules
45
56
  "jsx-a11y/no-onchange": "off",
57
+ // For TypeScript type declarations.
58
+ camelcase: "off",
59
+ "@typescript-eslint/no-empty-function": "off",
46
60
  },
47
61
  };
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "noEmit":true,
5
+ "rootDir": "scripts",
6
+ "composite": true,
7
+ "noEmitHelpers": true,
8
+ "skipLibCheck": true,
9
+ "lib": [
10
+ "ESNext",
11
+ "DOM",
12
+ "DOM.Iterable"
13
+ ],
14
+ "module": "ESNext",
15
+ "esModuleInterop": true,
16
+ "jsx": "react-jsx",
17
+ "strict": true,
18
+ "isolatedModules": true,
19
+ "moduleResolution": "node",
20
+ "resolveJsonModule": true,
21
+ "forceConsistentCasingInFileNames": true,
22
+ "allowJs": true,
23
+ "checkJs": false
24
+ },
25
+ "include": [
26
+ "scripts"
27
+ ]
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newspack-scripts",
3
- "version": "3.0.0",
3
+ "version": "3.1.0-alpha.4",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "newspack-scripts": "./bin/newspack-scripts.js"
@@ -17,6 +17,7 @@
17
17
  "@semantic-release/git": "^10.0.1",
18
18
  "@testing-library/jest-dom": "^5.15.1",
19
19
  "@testing-library/react": "^12.1.2",
20
+ "@types/wordpress__data": "^4.6.10",
20
21
  "@wordpress/a11y": "^3.2.4",
21
22
  "@wordpress/api-fetch": "^5.2.6",
22
23
  "@wordpress/base-styles": "^4.0.4",
@@ -30,7 +31,7 @@
30
31
  "@wordpress/edit-post": "^5.0.17",
31
32
  "@wordpress/element": "^4.0.4",
32
33
  "@wordpress/escape-html": "^2.2.3",
33
- "@wordpress/eslint-plugin": "^9.3.0",
34
+ "@wordpress/eslint-plugin": "^10.0.0",
34
35
  "@wordpress/hooks": "^3.2.2",
35
36
  "@wordpress/html-entities": "^3.2.3",
36
37
  "@wordpress/i18n": "^4.2.4",
@@ -44,11 +45,11 @@
44
45
  "commitizen": "^4.2.4",
45
46
  "cross-spawn": "^7.0.3",
46
47
  "cz-conventional-changelog": "^3.3.0",
47
- "eslint": "^7.32.0",
48
+ "eslint": "^8.8.0",
48
49
  "eslint-config-prettier": "^8.3.0",
49
- "eslint-plugin-import": "^2.25.3",
50
- "eslint-plugin-jest": "^25.3.0",
51
- "eslint-plugin-react": "^7.27.1",
50
+ "eslint-plugin-import": "^2.25.4",
51
+ "eslint-plugin-jest": "^26.0.0",
52
+ "eslint-plugin-react": "^7.28.0",
52
53
  "jest": "^27.4.3",
53
54
  "jest-environment-jsdom": "^27.4.3",
54
55
  "postcss": "^8.4.4",
@@ -59,6 +60,7 @@
59
60
  "stylelint": "^14.1.0",
60
61
  "stylelint-config-prettier": "^9.0.3",
61
62
  "stylelint-prettier": "^2.0.0",
63
+ "typescript": "^4.5.5",
62
64
  "webpack": "^5.65.0"
63
65
  },
64
66
  "scripts": {
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ const spawn = require("cross-spawn");
4
+ const path = require("path");
5
+ const modules = require("./utils/modules");
6
+
7
+ const result = spawn.sync(`${process.cwd()}/node_modules/.bin/tsc`, [], {
8
+ stdio: "inherit",
9
+ });
10
+
11
+ console.log(result);
12
+
13
+ process.exit(result.status);