@machtwatch/react-script 1.2.11-alpha.31 → 1.2.11-alpha.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@machtwatch/react-script",
3
- "version": "1.2.11-alpha.31",
3
+ "version": "1.2.11-alpha.33",
4
4
  "description": "Machtwatch React script",
5
5
  "author": "Danny Reza Miloen <danny@machtwatch.co.id>",
6
6
  "contributors": [],
@@ -15,7 +15,6 @@
15
15
  },
16
16
  "files": [
17
17
  "bin",
18
- "config",
19
18
  "scripts"
20
19
  ],
21
20
  "main": "./bin/react-script.js",
@@ -88,6 +87,7 @@
88
87
  "postcss-flexbugs-fixes": "^5.0.2",
89
88
  "postcss-import": "^14.1.0",
90
89
  "postcss-loader": "^8.1.1",
90
+ "postcss-nested": "^6.0.1",
91
91
  "postcss-preset-env": "^7.7.1",
92
92
  "process": "0.11.10",
93
93
  "promise": "^8.0.2",
@@ -313,6 +313,9 @@ const webpackConfig = ({ isClient }) => ({
313
313
  root: `${paths.appSrc}/styles/`
314
314
  }
315
315
  ],
316
+ require('tailwindcss/nesting')(require('postcss-nested')),
317
+ 'tailwindcss',
318
+ 'postcss-flexbugs-fixes',
316
319
  [
317
320
  'postcss-preset-env',
318
321
  {
@@ -320,12 +323,13 @@ const webpackConfig = ({ isClient }) => ({
320
323
  flexbox: 'no-2009',
321
324
  },
322
325
  stage: 3,
326
+ features: {
327
+ 'nesting-rules': false,
328
+ },
323
329
  browsers: pkg.browserslist
324
330
  }
325
331
  ],
326
- 'tailwindcss',
327
332
  'postcss-modules-values',
328
- 'postcss-flexbugs-fixes'
329
333
  ],
330
334
  },
331
335
  },
@@ -508,17 +512,21 @@ const clientConfig = {
508
512
  root: `${paths.appSrc}/styles/`
509
513
  }
510
514
  ],
515
+ require('tailwindcss/nesting')(require('postcss-nested')),
516
+ 'tailwindcss',
517
+ 'postcss-flexbugs-fixes',
511
518
  [
512
519
  'postcss-preset-env',
513
520
  {
514
521
  autoprefixer: { flexbox: 'no-2009' },
515
522
  stage: 3,
523
+ features: {
524
+ 'nesting-rules': false,
525
+ },
516
526
  browsers: pkg.browserslist,
517
527
  }
518
528
  ],
519
- 'tailwindcss',
520
529
  'postcss-modules-values',
521
- 'postcss-flexbugs-fixes',
522
530
  ],
523
531
  },
524
532
  },
@@ -1,70 +0,0 @@
1
- module.exports = () => ({
2
- customOptions({ transform_runtime, isClient, ...loader }) {
3
- return {
4
- loader,
5
- custom: { ...transform_runtime, isClient }
6
- };
7
- },
8
- config(cfg) {
9
- return {
10
- ...cfg.options,
11
- presets: [
12
- [
13
- require('@babel/preset-env'),
14
- {
15
- modules: false,
16
- useBuiltIns: 'usage',
17
- corejs: '3.22'
18
- }
19
- ],
20
- require('@babel/preset-react'),
21
-
22
- ],
23
- plugins: [
24
- require('@babel/plugin-transform-runtime'),
25
- require('@babel/plugin-proposal-function-bind'),
26
- require('@babel/plugin-proposal-export-default-from'),
27
- require('@babel/plugin-proposal-export-namespace-from'),
28
- require('@babel/plugin-proposal-throw-expressions'),
29
- require('@babel/plugin-syntax-dynamic-import'),
30
- require('@babel/plugin-proposal-json-strings'),
31
- require('@loadable/babel-plugin'),
32
- [require('babel-plugin-transform-imports'), {
33
- '@machtwatch/react-ui': {
34
- transform: '@machtwatch/react-ui/lib/${member}',
35
- preventFullImport: true
36
- }
37
- }],
38
- [require('@babel/plugin-proposal-decorators'), {
39
- legacy: true
40
- }],
41
- [require('@babel/plugin-proposal-optional-chaining'), {
42
- loose: true
43
- }],
44
- [require('@babel/plugin-proposal-class-properties'), {
45
- loose: true
46
- }],
47
- [require('@babel/plugin-proposal-private-methods'), { loose: true }],
48
- [require('@babel/plugin-proposal-private-property-in-object'), { loose: true }],
49
- [require('babel-plugin-add-module-exports'), {
50
- addDefaultProperty: true
51
- }],
52
- ...(cfg.options.isClient && !cfg.options.compact ? [
53
- require.resolve('react-refresh/babel')
54
- ] : [
55
- ...(cfg.options.compact ? [
56
- require('@babel/plugin-transform-react-inline-elements'),
57
- require('@babel/plugin-transform-react-constant-elements')
58
- ] : [])
59
- ]),
60
- ...(cfg.options.plugins || [])
61
- ],
62
- };
63
- },
64
- result(result) {
65
- return {
66
- ...result,
67
- code: `${result.code} \n// Generated by babel-custom-loader`
68
- };
69
- },
70
- });
package/config/env.js DELETED
@@ -1,67 +0,0 @@
1
- // @remove-on-eject-begin
2
- /**
3
- * Copyright (c) 2015-present, Facebook, Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
- // @remove-on-eject-end
9
- 'use strict';
10
-
11
- const fs = require('fs');
12
- const path = require('path');
13
-
14
- const paths = require('./paths');
15
-
16
- // Make sure that including paths.js after env.js will read .env variables.
17
- delete require.cache[require.resolve('./paths')];
18
-
19
- // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
20
- const dotenvFiles = [paths.dotenv].filter(Boolean);
21
- const appDirectory = fs.realpathSync(process.cwd());
22
-
23
- // Load environment variables from .env* files. Suppress warnings using silent
24
- // if this file is missing. dotenv will never modify any environment variables
25
- // that have already been set. Variable expansion is supported in .env files.
26
- // https://github.com/motdotla/dotenv
27
- // https://github.com/motdotla/dotenv-expand
28
- dotenvFiles.forEach(dotenvFile => {
29
- if (fs.existsSync(dotenvFile)) {
30
- require('dotenv-expand')(
31
- require('dotenv').config({ path: dotenvFile })
32
- );
33
- };
34
- });
35
-
36
- process.env.NODE_PATH = (process.env.NODE_PATH || '')
37
- .split(path.delimiter)
38
- .filter(folder => folder && !path.isAbsolute(folder))
39
- .map(folder => path.resolve(appDirectory, folder))
40
- .join(path.delimiter);
41
-
42
- function getClientEnvironment(publicUrl) {
43
- const raw = Object.keys(process.env)
44
- .reduce(
45
- (env, key) => {
46
- env[key] = process.env[key];
47
- return env;
48
- },
49
- {
50
- // Useful for determining whether we’re running in production mode.
51
- // Most importantly, it switches React into the correct mode.
52
- NODE_ENV: process.env.NODE_ENV || 'development',
53
- }
54
- );
55
-
56
- // Stringify all values so we can feed into Webpack DefinePlugin
57
- const stringified = {
58
- 'process.env': Object.keys(raw).reduce((env, key) => {
59
- env[key] = JSON.stringify(raw[key]);
60
- return env;
61
- }, {}),
62
- };
63
-
64
- return { raw, stringified };
65
- };
66
-
67
- module.exports = getClientEnvironment;
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- const babelJest = require('babel-jest');
4
-
5
- module.exports = babelJest.createTransformer({
6
- babelrc: false,
7
- presets: [
8
- ['@babel/preset-react'],
9
- ['@babel/preset-env', {
10
- modules: 'auto',
11
- useBuiltIns: 'entry',
12
- corejs: 3,
13
- }]
14
- ],
15
- plugins: [
16
- require('@babel/plugin-transform-runtime'),
17
- require('@babel/plugin-syntax-dynamic-import'),
18
- require('@babel/plugin-proposal-export-default-from'),
19
- require('babel-plugin-dynamic-import-node'),
20
- [require('babel-plugin-transform-imports'), {
21
- '@machtwatch/react-ui': {
22
- transform: '@machtwatch/react-ui/lib/${member}',
23
- preventFullImport: true
24
- }
25
- }]
26
- ]
27
- });
@@ -1,91 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('path');
4
- const fs = require('fs');
5
- const merge = require('deepmerge');
6
-
7
- module.exports = (resolve, rootDir, srcRoots, appConfig) => {
8
- const toRelRootDir = f => '<rootDir>/' + path.relative(rootDir || '', f);
9
- const extendedPath = path.join(process.cwd(), 'extended-jest.config.js');
10
-
11
- let isExtendedConfigExisted = false;
12
- let extendedConfig = {};
13
-
14
- try {
15
- isExtendedConfigExisted = fs.existsSync(extendedPath);
16
- } catch (err) {
17
- console.error(err.message);
18
- }
19
-
20
- if (isExtendedConfigExisted) {
21
- try {
22
- extendedConfig = require(extendedPath);
23
- } catch (err) {
24
- console.error(err.message);
25
- }
26
- }
27
-
28
- const config = {
29
- globals: {
30
- CONFIG: appConfig && (appConfig.globals || appConfig),
31
- },
32
- setupFiles: [resolve('scripts/utils/polyfills.js')],
33
- testMatch: [
34
- "<rootDir>/src/shared/**/*.(spec|test).{js,jsx,mjs}"
35
- ],
36
- collectCoverageFrom: [
37
- "src/shared/**/*.{js,jsx,mjs}"
38
- ],
39
- coverageThreshold: {
40
- global: {
41
- branches: 80,
42
- functions: 80,
43
- lines: 80,
44
- statements: 80
45
- }
46
- },
47
- coverageReporters: [
48
- "lcov",
49
- "html"
50
- ],
51
- roots: srcRoots.map(toRelRootDir),
52
- testEnvironment: 'node',
53
- testEnvironmentOptions: {
54
- url: 'http://localhost'
55
- },
56
- transform: {
57
- '^.+\\.(js|jsx|mjs|cjs)$': resolve('config/jest/babelTransform.js'),
58
- '^.+\\.css$': resolve('config/jest/cssTransform.js'),
59
- '^.+\\.(graphql)$': resolve('config/jest/graphqlTransform.js'),
60
- '^(?!.*\\.(js|jsx|mjs|css|json|graphql)$)': resolve('config/jest/fileTransform.js'),
61
- },
62
- transformIgnorePatterns: [
63
- '^.+\\.module\\.css$',
64
- ],
65
- moduleFileExtensions: [
66
- 'web.js',
67
- 'mjs',
68
- 'js',
69
- 'json',
70
- 'web.jsx',
71
- 'jsx',
72
- 'node',
73
- ],
74
- testPathIgnorePatterns: [
75
- "/node_modules/",
76
- "<rootDir>/tests/",
77
- "<rootDir>/src/*.js",
78
- "<rootDir>/graphql/"
79
- ],
80
- setupFilesAfterEnv: [resolve('config/jest/jest-setup.js'), '<rootDir>/jest-setup.js'],
81
- verbose: true,
82
- };
83
-
84
- const combinedConfig = merge(config, extendedConfig);
85
-
86
- if (rootDir) {
87
- config.rootDir = rootDir;
88
- }
89
-
90
- return combinedConfig;
91
- };
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- process() {
5
- return {
6
- code: 'module.exports = {};'
7
- };
8
- },
9
- getCacheKey() {
10
- // The output is always the same.
11
- return 'cssTransform';
12
- },
13
- };
@@ -1,23 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('path');
4
-
5
- module.exports = {
6
- process(src, filename) {
7
- const assetFilename = JSON.stringify(path.basename(filename));
8
-
9
- if (filename.match(/\.svg$/)) {
10
- return {
11
- code: `module.exports = {
12
- __esModule: true,
13
- default: ${assetFilename},
14
- ReactComponent: () => ${assetFilename},
15
- };`
16
- };
17
- }
18
-
19
- return {
20
- code: `module.exports = ${assetFilename};`
21
- };
22
- },
23
- };
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- const loader = require('graphql-tag/loader');
4
-
5
- module.exports = {
6
- process(src) {
7
- return {
8
- code: loader.call({ cacheable() {} }, src)
9
- };
10
- },
11
- };
@@ -1 +0,0 @@
1
- import "@testing-library/jest-dom";
package/config/paths.js DELETED
@@ -1,48 +0,0 @@
1
- // @remove-on-eject-begin
2
- /**
3
- * Copyright (c) 2015-present, Facebook, Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
- // @remove-on-eject-end
9
- 'use strict';
10
-
11
- const path = require('path');
12
- const fs = require('fs');
13
-
14
- // Make sure any symlinks in the project folder are resolved:
15
- const appDirectory = fs.realpathSync(process.cwd());
16
-
17
- const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
18
- const resolveOwn = relativePath => path.resolve(__dirname, '..', relativePath);
19
-
20
- const useTemplate = appDirectory === fs.realpathSync(path.join(__dirname, '..'));
21
-
22
- if (useTemplate) {
23
- module.exports = {
24
- dotenv: resolveOwn('template/.env'),
25
- appPath: resolveOwn('template/'),
26
- appBuild: resolveOwn('template/build'),
27
- appPublic: resolveOwn('template/public'),
28
- appIndexJs: resolveOwn('template/src/index.js'),
29
- appPackageJson: resolveOwn('template/package.json'),
30
- appSrc: resolveOwn('template/src'),
31
- appConfig: resolveOwn('template/config/default'),
32
- appNodeModules: resolveOwn('template/node_modules'),
33
- };
34
- } else {
35
- module.exports = {
36
- dotenv: resolveApp('.env'),
37
- appPath: resolveApp('.'),
38
- appBuild: resolveApp('build'),
39
- appPublic: resolveApp('public'),
40
- appPackageJson: resolveApp('package.json'),
41
- appSrc: resolveApp('src'),
42
- appConfig: resolveApp('config/default'),
43
- appNodeModules: resolveApp('node_modules'),
44
- };
45
- }
46
-
47
- module.exports.srcPaths = [module.exports.appSrc];
48
- module.exports.useYarn = fs.existsSync(path.join(module.exports.appPath, 'yarn.lock'));