newspack-scripts 1.3.0 → 1.4.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/README.md CHANGED
@@ -17,4 +17,61 @@ Will run `calypso-build`, creating optimised production builds.
17
17
 
18
18
  ### start
19
19
 
20
- Will run `calypso-build` in watch mode.
20
+ Will run `calypso-build` in watch mode.
21
+
22
+ ## Available configs
23
+
24
+ This package exposes a couple of configuration files.
25
+
26
+ ### webpack
27
+
28
+ The `webpack.config.js` file should use this package's config-extending function:
29
+
30
+ ```js
31
+ const getBaseWebpackConfig = require( 'newspack-scripts/config/getWebpackConfig' );
32
+
33
+ const webpackConfig = getBaseWebpackConfig(
34
+ { WP: true },
35
+ {
36
+ entry: {
37
+ 'some-script': './src/some-script.js'
38
+ },
39
+ }
40
+ );
41
+
42
+ module.exports = webpackConfig;
43
+ ```
44
+
45
+ ### babel
46
+
47
+ A basic `babel.config.js`:
48
+
49
+ ```js
50
+ module.exports = api => {
51
+ api.cache( true );
52
+ return {
53
+ extends: 'newspack-scripts/config/babel.config.js',
54
+ };
55
+ };
56
+ ```
57
+
58
+ ### eslint
59
+
60
+ Because of eslint's [issue](https://github.com/eslint/eslint/issues/3458) with resolving dependencies of extended configurations, a patch has to be used to use this config in a stand-alone fashion: install `@rushstack/eslint-patch` and set up the `.eslintrc.js` like so:
61
+
62
+ ```js
63
+ require( '@rushstack/eslint-patch/modern-module-resolution' );
64
+
65
+ module.exports = {
66
+ extends: [ './node_modules/newspack-scripts/config/eslintrc.js' ],
67
+ // Additional options…
68
+ };
69
+ ```
70
+
71
+ ### stylelint
72
+
73
+ Install `stylelint` via npm and reference this package's config file when running it, e.g.:
74
+
75
+ ```shell
76
+ stylelint '**/*.scss' --syntax scss --config=./node_modules/newspack-scripts/config/stylelint.config.js
77
+ ```
@@ -0,0 +1,21 @@
1
+ module.exports = {
2
+ extends: [
3
+ "@wordpress/stylelint-config/scss",
4
+ "stylelint-prettier/recommended",
5
+ ],
6
+ rules: {
7
+ "rule-empty-line-before": null,
8
+ "at-rule-empty-line-before": null,
9
+ "comment-empty-line-before": null,
10
+ "string-quotes": "single",
11
+ "no-descending-specificity": null,
12
+ "function-url-quotes": null,
13
+ "declaration-property-unit-whitelist": null,
14
+ "font-weight-notation": null,
15
+ "color-named": null,
16
+ "function-parentheses-space-inside": "always-single-line",
17
+ "media-feature-parentheses-space-inside": "always",
18
+ "selector-pseudo-class-parentheses-space-inside": "always",
19
+ "selector-class-pattern": null,
20
+ },
21
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newspack-scripts",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "newspack-scripts": "./bin/newspack-scripts.js"
@@ -14,6 +14,7 @@
14
14
  "@testing-library/jest-dom": "^5.15.1",
15
15
  "@testing-library/react": "^12.1.2",
16
16
  "@wordpress/eslint-plugin": "^9.3.0",
17
+ "@wordpress/stylelint-config": "^19.1.0",
17
18
  "autoprefixer": "^10.4.0",
18
19
  "babel-jest": "^27.4.2",
19
20
  "cross-spawn": "^7.0.3",
@@ -26,6 +27,10 @@
26
27
  "jest-environment-jsdom": "^27.4.3",
27
28
  "postcss": "^8.4.4",
28
29
  "postcss-focus-within": "^5.0.1",
30
+ "prettier": "npm:wp-prettier@^2.2.1-beta-1",
31
+ "stylelint": "^14.1.0",
32
+ "stylelint-config-prettier": "^9.0.3",
33
+ "stylelint-prettier": "^2.0.0",
29
34
  "webpack": "^5.65.0"
30
35
  },
31
36
  "scripts": {