@lipemat/js-boilerplate 6.5.1 → 7.0.0-beta.2

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
@@ -1,4 +1,4 @@
1
- ## The Start Of A Beautiful JS App
1
+ # The Start Of A Beautiful JS App
2
2
 
3
3
  <p>
4
4
  <a href="https://www.npmjs.com/package/@lipemat/js-boilerplate">
@@ -10,12 +10,18 @@
10
10
 
11
11
  A zero configuration starting point for a React or non React app.
12
12
 
13
- ### Installation
13
+ ## Installation
14
14
  ```bash
15
15
  yarn add @lipemat/js-boilerplate
16
16
  ```
17
17
 
18
- ### Usage
18
+ ## Version 6
19
+
20
+ **Version 6 has many backward incompatibilities and should be updated with focus and thoroughness.**
21
+
22
+ [Migration instructions are here.](https://github.com/lipemat/js-boilerplate/wiki/Version-6-Migration)
23
+
24
+ ## Usage
19
25
  Add the following to your package.json. (this may also be found in the `templates` directory.
20
26
 
21
27
  ```json
@@ -39,25 +45,17 @@ Add the following to your package.json. (this may also be found in the `template
39
45
 
40
46
  **_You may adjust things as needed but be sure to leave the `scripts` as is._**
41
47
 
42
-
43
- ## Version 6
44
-
45
- **Version 6 has many backward incompatibilities and should be updated with focus and thoroughness.**
46
-
47
- [Migration instructions are here.](https://github.com/lipemat/js-boilerplate/wiki/Version-6-Migration)
48
-
49
-
50
- ### Code Completion In PHPStorm
48
+ ## Code Completion In PHPStorm
51
49
  Some `@types` have been specified in this library to assist with code completion and allow using the built-in TypeScript support. Unfortunately, some typescripts still send errors to PHPStorm like "Default export is not declared in an imported module". I've found that it's easier to just remove this warning by un-checking `Editor -> Inspections -> JavaScript -> General -> Validate Imports`. (this may not need to be un-checked if you enable the built-in TypeScript support).
52
50
 
53
51
 
54
- ### ESLint
52
+ ## ESLint
55
53
  To use the built-in eslint, copy the following items from `templates` into your project root:
56
54
  1. `.eslintrc`
57
55
 
58
56
  Now you may adjust the eslint configuration as desired and run the linter via `yarn run lint`.
59
57
 
60
- ### Browserslist
58
+ ## Browserslist
61
59
  To retrieve a list of all currently targeted browsers, add the following to your `package.json`
62
60
  and run `yarn browserslist`.
63
61
 
@@ -72,7 +70,7 @@ and run `yarn browserslist`.
72
70
  The console will display a list of browsers targeted by your [browserslist configruation](https://github.com/browserslist/browserslist#config-file), or the defaults if no configuration is specified.
73
71
 
74
72
 
75
- ### TypeScript
73
+ ## TypeScript
76
74
  To use the built-in TypeScript, copy the following items from `templates` into your project root:
77
75
  1. `tsconfig.json`
78
76
 
@@ -139,3 +137,14 @@ in your `package.json` to have it transformed.
139
137
  ]
140
138
  }
141
139
  ```
140
+
141
+ ## Certificates
142
+ If you are using https in your local environment, you may point to the certificates in your package.json like so:
143
+
144
+ ```json
145
+ "certificates": {
146
+ "cert": "<path to -crt.pem file>",
147
+ "key": "<path to -key.pem file>"
148
+ }
149
+ ```
150
+
@@ -32,7 +32,7 @@ const presetEnv = {
32
32
  * on every page.
33
33
  * @link https://github.com/WICG/focus-visible
34
34
  *
35
- * Most often will need it site wide on pages which do and don't us the JS app.
35
+ * Most often will need it site wide on pages which do and don't use the JS app.
36
36
  * @link https://unpkg.com/focus-visible@5.2.0/dist/focus-visible.min.js
37
37
  */
38
38
  'focus-visible-pseudo-class': {
@@ -15,7 +15,6 @@ const plugins = [
15
15
  jQuery: 'jquery',
16
16
  $: 'jquery',
17
17
  } ),
18
- new webpack.HotModuleReplacementPlugin(),
19
18
  ];
20
19
 
21
20
  // Loads a thread which verifies any TypeScripts on changes.
@@ -75,14 +74,14 @@ module.exports = {
75
74
  module: {
76
75
  rules: [
77
76
  {
78
- test: /\.(j|t)sx?$/,
77
+ test: /\.[jt]sx?$/,
79
78
  loader: 'babel-loader',
80
79
  include: path.resolve( config.workingDirectory, 'src' ),
81
80
  exclude: /node_modules/,
82
81
  options: babelOptions,
83
82
  },
84
83
  {
85
- test: /\.(j|t)sx?$/,
84
+ test: /\.[jt]sx?$/,
86
85
  include: /node_modules/,
87
86
  use: [ 'react-hot-loader/webpack' ],
88
87
  },
@@ -94,8 +93,10 @@ module.exports = {
94
93
  loader: 'css-loader',
95
94
  options: {
96
95
  importLoaders: 1,
97
- modules: true,
98
- localIdentName: 'Ⓜ[name]__[local]__[contenthash:base64:1]',
96
+ modules: {
97
+ exportLocalsConvention: 'camelCase',
98
+ localIdentName: 'Ⓜ[name]__[local]__[contenthash:base64:2]',
99
+ },
99
100
  sourceMap: true,
100
101
  url: false,
101
102
  },
@@ -87,7 +87,7 @@ module.exports = {
87
87
  module: {
88
88
  rules: [
89
89
  {
90
- test: /\.(j|t)sx?$/,
90
+ test: /\.[jt]sx?$/,
91
91
  loader: 'babel-loader',
92
92
  exclude: moduleHelpers.getBabelExcludeRegex(),
93
93
  options: babelOptions,
@@ -100,8 +100,10 @@ module.exports = {
100
100
  loader: 'css-loader',
101
101
  options: {
102
102
  importLoaders: 1,
103
- modules: true,
104
- localIdentName: '[contenthash:base64:5]',
103
+ modules: {
104
+ exportLocalsConvention: 'camelCase',
105
+ localIdentName: '[contenthash:base64:5]',
106
+ },
105
107
  url: false,
106
108
  },
107
109
  },
package/helpers/config.js CHANGED
@@ -1,6 +1,5 @@
1
1
  const packageConfig = require( './package-config' );
2
2
  const path = require( 'path' );
3
- const without = require( 'lodash/without' );
4
3
  const once = require( 'lodash/once' );
5
4
  const browserslist = require( 'browserslist' );
6
5
 
@@ -90,9 +89,7 @@ const getDefaultBrowsersList = once( () => {
90
89
  }
91
90
 
92
91
  if ( browserslist( browserslist.defaults ) === browserslist() ) {
93
- const browsers = require( '@wordpress/browserslist-config' );
94
- browsers.push( 'not IE 11' );
95
- return without( browsers, 'ie >= 11' );
92
+ return require( '@wordpress/browserslist-config' );
96
93
  }
97
94
  return false;
98
95
  } );
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@lipemat/js-boilerplate",
3
- "version": "6.5.1",
3
+ "version": "7.0.0-beta.2",
4
4
  "description": "Dependencies and scripts for a no config JavaScript app",
5
5
  "engines": {
6
- "node": ">=14.15.3"
6
+ "node": ">=14.17.6"
7
7
  },
8
8
  "repository": {
9
9
  "type": "git",
@@ -40,15 +40,14 @@
40
40
  "@lipemat/postcss-loader": "^3.1.2",
41
41
  "@lipemat/webpack-cleanup-plugin": "^1.0.0",
42
42
  "@types/lipemat__js-boilerplate": "lipemat/types-js-boilerplate#semver:^1.3.0",
43
- "@wordpress/browserslist-config": "^3.0.1",
43
+ "@wordpress/browserslist-config": "^4.1.0",
44
44
  "are-you-es5": "^2.1.1",
45
45
  "babel-jest": "^24.7.1",
46
- "babel-loader": "^8.0.5",
47
- "browserslist": "^4.16.3",
48
- "classnames": "^2.2.6",
46
+ "babel-loader": "^8.2.2",
47
+ "browserslist": "^4.17.0",
49
48
  "core-js": "^3.8.3",
50
49
  "cross-spawn": "^6.0.5",
51
- "css-loader": "2.1.1",
50
+ "css-loader": "6.2.0",
52
51
  "enzyme": "^3.9.0",
53
52
  "enzyme-adapter-react-16": "^1.12.1",
54
53
  "enzyme-to-json": "^3.5.0",
@@ -73,7 +72,7 @@
73
72
  "react-hot-loader": "^4.8.3",
74
73
  "react-test-renderer": "^16.5.2",
75
74
  "react-transition-group": "^4.4.1",
76
- "style-loader": "^2.0.0",
75
+ "style-loader": "^3.2.1",
77
76
  "typescript": "^4.2.4",
78
77
  "update-notifier": "^4.1.3",
79
78
  "webpack": "^5.11.0",
@@ -9,30 +9,37 @@
9
9
  * all loose module warnings unless the environmental variable
10
10
  * it set to display all warnings.
11
11
  *
12
- * @usage "scripts": {
12
+ * @example "scripts": {
13
13
  "postinstall": "lipemat-js-boilerplate fix-pnp"
14
14
  },
15
15
  *
16
16
  */
17
17
 
18
18
  const fs = require( 'fs' );
19
- const PNP_FILE = './.pnp.js';
20
19
 
21
- fs.readFile( PNP_FILE, 'utf8', ( err, data ) => {
22
- if ( err ) {
23
- return console.log( err );
24
- }
20
+ const PNP_FILES = [
21
+ './.pnp.js',
22
+ './.pnp.cjs',
23
+ ];
25
24
 
26
- const result = data.replace( /if \(reference != null\) {/, '// # Warnings suppressed via @lipemat/js-boilerplate/fix-pnp script. \n' +
27
- 'if (! alwaysWarnOnFallback && reference != null) { \n' +
28
- 'dependencyReference = reference; \n' +
29
- '} else if (alwaysWarnOnFallback && reference != null) {' );
25
+ PNP_FILES.forEach( PNP_FILE => {
26
+ if ( fs.existsSync( PNP_FILE ) ) {
27
+ fs.readFile( PNP_FILE, 'utf8', ( readError, data ) => {
28
+ if ( readError ) {
29
+ return console.log( readError );
30
+ }
30
31
 
31
- fs.writeFile( PNP_FILE, result, 'utf8', err => {
32
- if ( err ) {
33
- return console.log( err );
34
- }
35
- } );
36
- } );
32
+ const result = data.replace( /if \(reference != null\) {/, '// # Warnings suppressed via @lipemat/js-boilerplate/fix-pnp script. \n' +
33
+ 'if (! alwaysWarnOnFallback && reference != null) { \n' +
34
+ 'dependencyReference = reference; \n' +
35
+ '} else if (alwaysWarnOnFallback && reference != null) {' );
37
36
 
38
- console.log( 'The .pnp.js file has been adjusted to no longer display warnings for loose modules.' )
37
+ fs.writeFile( PNP_FILE, result, 'utf8', writeError => {
38
+ if ( writeError ) {
39
+ return console.log( writeError );
40
+ }
41
+ console.log( `The ${PNP_FILE} file has been adjusted to no longer display warnings for loose modules.` );
42
+ } );
43
+ } );
44
+ }
45
+ } );