@lipemat/js-boilerplate 10.3.0-beta.7 → 10.3.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.
@@ -1,5 +1,4 @@
1
- const config = require( '../helpers/package-config' );
2
- const {getLocalIdent} = require( '../helpers/css-classnames' );
1
+ const {getLocalIdent, usingShortCssClasses} = require( '../helpers/css-classnames' );
3
2
 
4
3
  /**
5
4
  * Options for the Webpack `css-loader`.
@@ -40,7 +39,7 @@ if ( 'production' === process.env.NODE_ENV ) {
40
39
  modules: {
41
40
  exportLocalsConvention: 'camelCase',
42
41
  // Use short CSS Classes if enabled.
43
- ...config.shortCssClasses ? {getLocalIdent} : {},
42
+ ...usingShortCssClasses() ? {getLocalIdent} : {},
44
43
  // Hash used when short CSS classes are not enabled.
45
44
  localIdentName: '[contenthash:base64:5]',
46
45
  mode,
@@ -1,6 +1,8 @@
1
1
  {
2
- "//": "@see ./templates/tsconfig.json to use/extend this configuration in your project",
3
- "//": "PHPStorm will only see changes to the file, if you re-save the project root's tsconfig.json file",
2
+ "//~": "@see ./templates/tsconfig.json to use/extend this configuration in your project",
3
+ "//~~": "PHPStorm will only see changes to the file, if you re-save the project root's tsconfig.json file",
4
+ "$schema": "https://json.schemastore.org/tsconfig",
5
+ "display": "JS Boilerplate",
4
6
  "compilerOptions": {
5
7
  "allowSyntheticDefaultImports": true,
6
8
  "jsx": "preserve",
@@ -8,14 +10,16 @@
8
10
  "dom",
9
11
  "es2018"
10
12
  ],
11
- "module": "commonjs",
13
+ "module": "ESNext",
14
+ "moduleResolution": "Node",
12
15
  "noFallthroughCasesInSwitch": true,
13
16
  "noImplicitReturns": true,
14
17
  "noImplicitThis": true,
15
18
  "sourceMap": true,
16
19
  "strictBindCallApply": true,
17
20
  "strictNullChecks": true,
18
- "target": "es6"
21
+ "target": "es6",
22
+ "verbatimModuleSyntax": false
19
23
  },
20
24
  "exclude": [
21
25
  "node_modules"
@@ -1,9 +1,22 @@
1
+ const {getPackageConfig} = require( './package-config' );
2
+
1
3
  const SHORT_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
2
4
  const ALPHABET = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
3
5
 
4
6
  const classes = {};
5
7
  let counters = [ -1 ];
6
8
 
9
+ /**
10
+ * Check if short CSS classes are enabled.
11
+ *
12
+ * Using a helper function to allow for future enhancements.
13
+ *
14
+ * @since 10.3.0
15
+ */
16
+ function usingShortCssClasses() {
17
+ return getPackageConfig().shortCssClasses;
18
+ }
19
+
7
20
  /**
8
21
  * Reset all counters.
9
22
  *
@@ -102,5 +115,6 @@ module.exports = {
102
115
  SHORT_ALPHABET,
103
116
  getLocalIdent,
104
117
  getNextClass,
118
+ usingShortCssClasses,
105
119
  resetCounters,
106
120
  };
@@ -19,4 +19,17 @@ try {
19
19
  } catch ( e ) {
20
20
  }
21
21
 
22
+ /**
23
+ * Helper function to get the results of `packageConfig`.
24
+ *
25
+ * - Allows mocking the results of `packageConfig` for testing.
26
+ * - Allows getting the config through a callback instead of an import.
27
+ *
28
+ * @since 10.3.0
29
+ */
30
+ function getPackageConfig() {
31
+ return packageConfig;
32
+ }
33
+ packageConfig.getPackageConfig = getPackageConfig;
34
+
22
35
  module.exports = packageConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lipemat/js-boilerplate",
3
- "version": "10.3.0-beta.7",
3
+ "version": "10.3.0",
4
4
  "description": "Dependencies and scripts for a no config JavaScript app",
5
5
  "author": "Mat Lipe",
6
6
  "license": "MIT",
@@ -42,7 +42,7 @@
42
42
  "@babel/preset-env": "^7.22.9",
43
43
  "@babel/preset-react": "^7.12.10",
44
44
  "@babel/preset-typescript": "^7.12.7",
45
- "@csstools/postcss-global-data": "^2.0.0",
45
+ "@csstools/postcss-global-data": "2.0.0",
46
46
  "@lipemat/css-mqpacker": "^9.0.0",
47
47
  "@lipemat/eslint-config": "^3.0.1",
48
48
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",