@lipemat/js-boilerplate 6.6.0 → 7.0.0-beta.3

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
@@ -15,11 +15,11 @@ A zero configuration starting point for a React or non React app.
15
15
  yarn add @lipemat/js-boilerplate
16
16
  ```
17
17
 
18
- ## Version 6
18
+ ## Version 7
19
19
 
20
- **Version 6 has many backward incompatibilities and should be updated with focus and thoroughness.**
20
+ **Version 7 has some backward incompatibilities and should be updated with focus and thoroughness.**
21
21
 
22
- [Migration instructions are here.](https://github.com/lipemat/js-boilerplate/wiki/Version-6-Migration)
22
+ [Migration instructions are here.](https://github.com/lipemat/js-boilerplate/wiki/Version-7-Migration)
23
23
 
24
24
  ## Usage
25
25
  Add the following to your package.json. (this may also be found in the `templates` directory.
@@ -142,9 +142,11 @@ in your `package.json` to have it transformed.
142
142
  If you are using https in your local environment, you may point to the certificates in your package.json like so:
143
143
 
144
144
  ```json
145
+ {
145
146
  "certificates": {
146
- "cert": "<path to -crt.pem file>",
147
- "key": "<path to -key.pem file>"
147
+ "cert": "<path to -crt.pem file>",
148
+ "key": "<path to -key.pem file>"
148
149
  }
150
+ }
149
151
  ```
150
152
 
@@ -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.
@@ -26,6 +25,9 @@ if ( configHelper.hasLocalOverride( 'tsconfig.json', true ) ) {
26
25
  logger: {
27
26
  devServer: false,
28
27
  },
28
+ typescript: {
29
+ configFile: config.workingDirectory + '/tsconfig.json',
30
+ },
29
31
  } ) );
30
32
  }
31
33
 
@@ -33,14 +35,14 @@ const entry = {
33
35
  master: [
34
36
  'webpack-dev-server/client?' + config.url + ':3000',
35
37
  'webpack/hot/only-dev-server',
36
- './src/index.js',
38
+ config.workingDirectory + '/src/index.js',
37
39
  ],
38
40
  };
39
41
 
40
- // Loads an admin.js file if it exists @since 5.0.0
41
- if ( fs.existsSync( path.resolve( config.workingDirectory, './src/admin.js' ) ) ) {
42
+ // Loads an admin.js file if it exists.
43
+ if ( fs.existsSync( path.resolve( config.workingDirectory, '/src/admin.js' ) ) ) {
42
44
  entry.admin = [ ...entry.master ];
43
- entry.admin.splice( -1, 1, './src/admin.js' );
45
+ entry.admin.splice( -1, 1, config.workingDirectory + '/src/admin.js' );
44
46
  }
45
47
 
46
48
  module.exports = {
@@ -75,14 +77,14 @@ module.exports = {
75
77
  module: {
76
78
  rules: [
77
79
  {
78
- test: /\.(j|t)sx?$/,
80
+ test: /\.[jt]sx?$/,
79
81
  loader: 'babel-loader',
80
82
  include: path.resolve( config.workingDirectory, 'src' ),
81
83
  exclude: /node_modules/,
82
84
  options: babelOptions,
83
85
  },
84
86
  {
85
- test: /\.(j|t)sx?$/,
87
+ test: /\.[jt]sx?$/,
86
88
  include: /node_modules/,
87
89
  use: [ 'react-hot-loader/webpack' ],
88
90
  },
@@ -94,8 +96,10 @@ module.exports = {
94
96
  loader: 'css-loader',
95
97
  options: {
96
98
  importLoaders: 1,
97
- modules: true,
98
- localIdentName: 'Ⓜ[name]__[local]__[contenthash:base64:1]',
99
+ modules: {
100
+ exportLocalsConvention: 'camelCase',
101
+ localIdentName: 'Ⓜ[name]__[local]__[contenthash:base64:2]',
102
+ },
99
103
  sourceMap: true,
100
104
  url: false,
101
105
  },
@@ -12,14 +12,14 @@ const SriPlugin = require( 'webpack-subresource-integrity' );
12
12
 
13
13
  const entry = {
14
14
  master: [
15
- './src/index.js',
15
+ config.workingDirectory + '/src/index.js',
16
16
  ],
17
17
  };
18
18
 
19
- // Loads an admin.js file if it exists @since 4.3.0
20
- if ( fs.existsSync( path.resolve( config.workingDirectory, './src/admin.js' ) ) ) {
19
+ // Loads an admin.js file if it exists.
20
+ if ( fs.existsSync( path.resolve( config.workingDirectory, '/src/admin.js' ) ) ) {
21
21
  entry.admin = [ ...entry.master ];
22
- entry.admin.splice( -1, 1, './src/admin.js' );
22
+ entry.admin.splice( -1, 1, config.workingDirectory + '/src/admin.js' );
23
23
  }
24
24
 
25
25
  module.exports = {
@@ -55,7 +55,7 @@ module.exports = {
55
55
  output: {
56
56
  path: path.resolve( config.workingDirectory, 'dist' ),
57
57
  filename: '[name].js',
58
- publicPath: config.theme_path + 'js/dist/',
58
+ publicPath: config.themeUrlPath + 'js/dist/',
59
59
  chunkFilename: '[name].[chunkhash].js',
60
60
  crossOriginLoading: 'anonymous',
61
61
  },
@@ -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
  } );
@@ -6,8 +6,8 @@ const fs = require( 'fs' );
6
6
  const workingDirectory = fs.realpathSync( process.cwd() );
7
7
 
8
8
  let packageConfig = require( path.resolve( workingDirectory, 'package.json' ) );
9
- packageConfig.workingDirectory = workingDirectory;
10
- packageConfig.theme_path = packageConfig.theme_path || '/';
9
+ packageConfig.workingDirectory = packageConfig.jsPath ? path.resolve( packageConfig.jsPath ) : workingDirectory;
10
+ packageConfig.themeUrlPath = packageConfig.themeUrlPath || '/';
11
11
  packageConfig.url = packageConfig.url || 'http://localhost';
12
12
  packageConfig.root = packageConfig.root || './';
13
13
  packageConfig.regenerate_revision = packageConfig.regenerate_revision || false;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@lipemat/js-boilerplate",
3
- "version": "6.6.0",
3
+ "version": "7.0.0-beta.3",
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",
package/scripts/lint.js CHANGED
@@ -1,3 +1,4 @@
1
1
  const eslint = require( 'eslint/lib/cli' );
2
+ const packageConfig = require( '../helpers/package-config' );
2
3
 
3
- eslint.execute( [ '', '', 'src', '--fix', '--ext', '.tsx,.ts,.js,.jsx' ] );
4
+ eslint.execute( [ '', '', packageConfig.workingDirectory + '/src', '--fix', '--ext', '.tsx,.ts,.js,.jsx' ] );