@modernpoacher/sprockets 0.0.11 → 0.0.13

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": "@modernpoacher/sprockets",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "Sprockets",
5
5
  "keywords": [
6
6
  "Sprockets",
@@ -24,17 +24,16 @@
24
24
  },
25
25
  "scripts": {
26
26
  "prepublishOnly": "cross-env NODE_ENV=production npm run build",
27
- "build": "cross-env DEBUG=@modernpoacher/sprockets npm run gulp -- build",
28
- "build:watch": "cross-env DEBUG=@modernpoacher/sprockets npm run gulp -- build:watch",
29
- "transform": "cross-env DEBUG=@modernpoacher/sprockets npm run gulp -- transform",
30
- "transform:watch": "cross-env DEBUG=@modernpoacher/sprockets npm run gulp -- transform:watch",
27
+ "build": "cross-env DEBUG=@modernpoacher/sprockets webpack",
28
+ "build:watch": "cross-env DEBUG=@modernpoacher/sprockets webpack --watch",
29
+ "transform": "cross-env DEBUG=@modernpoacher/sprockets ./transform.sh",
31
30
  "pregulp": "npm run nvm",
32
31
  "gulp": "gulp --color",
33
32
  "prelint": "npm run nvm",
34
33
  "lint": "cross-env NODE_ENV=production eslint . .storybook --ext .mjs,.cjs,.jsx,.mts,.cts",
35
34
  "lint:fix": "npm run lint -- --fix",
36
35
  "pretest": "npm run nvm",
37
- "test": "cross-env NODE_ENV=test jest --collect-coverage false --run-in-band",
36
+ "test": "cross-env NODE_ENV=test jest",
38
37
  "nvm": "bash nvm.sh",
39
38
  "prestorybook": "npm run build && npm run transform",
40
39
  "storybook": "storybook dev -p 6007",
@@ -52,57 +51,45 @@
52
51
  "@babel/preset-react": "^7.22.15",
53
52
  "@babel/register": "^7.22.15",
54
53
  "@modernpoacher/design-system": "1.0.72",
55
- "@modernpoacher/hooks": "^1.0.436",
56
- "@sequencemedia/gulp": "^1.1.84",
57
- "@sequencemedia/gulp-clean-css": "^1.0.38",
58
- "@sequencemedia/gulp-css-purge": "^1.1.31",
59
- "@sequencemedia/gulp-debug": "^1.0.42",
60
- "@sequencemedia/gulp-postcss": "^1.0.42",
61
- "@sequencemedia/gulp-sass": "^1.0.37",
62
- "@sequencemedia/gulp-sourcemaps": "^1.0.38",
63
- "@storybook/addon-actions": "^7.4.3",
64
- "@storybook/addon-essentials": "^7.4.3",
65
- "@storybook/addon-links": "^7.4.3",
66
- "@storybook/react": "^7.4.3",
67
- "@storybook/react-webpack5": "^7.4.3",
68
- "@types/react": "^18.2.22",
69
- "@typescript-eslint/eslint-plugin": "^6.7.2",
70
- "@typescript-eslint/parser": "^6.7.2",
71
- "autoprefixer": "^10.4.16",
54
+ "@modernpoacher/hooks": "^1.0.434",
55
+ "@storybook/addon-actions": "^7.4.0",
56
+ "@storybook/addon-essentials": "^7.4.0",
57
+ "@storybook/addon-links": "^7.4.0",
58
+ "@storybook/react": "^7.4.0",
59
+ "@storybook/react-webpack5": "^7.4.0",
60
+ "@types/react": "^18.2.21",
61
+ "@typescript-eslint/eslint-plugin": "^6.6.0",
62
+ "@typescript-eslint/parser": "^6.6.0",
72
63
  "babel-plugin-module-resolver": "^5.0.0",
64
+ "clean-webpack-plugin": "^4.0.0",
73
65
  "core-js": "^3.32.2",
74
66
  "cross-env": "^7.0.3",
75
- "cssnano": "^6.0.1",
76
- "del": "^7.1.0",
77
67
  "eslint": "^8.49.0",
78
68
  "eslint-config-standard": "^17.1.0",
79
69
  "eslint-config-standard-with-typescript": "^39.0.0",
80
70
  "eslint-import-resolver-babel-module": "^5.3.2",
81
71
  "eslint-plugin-react": "^7.33.2",
82
- "glob-all": "^3.3.1",
83
72
  "husky": "^8.0.3",
84
73
  "jest": "^29.7.0",
74
+ "mini-css-extract-plugin": "^2.7.6",
85
75
  "postcss": "^8.4.30",
86
- "postcss-easy-import": "^4.0.0",
76
+ "postcss-import": "^15.1.0",
77
+ "postcss-loader": "^7.3.3",
87
78
  "postcss-map": "^0.11.0",
88
- "postcss-normalize": "^10.0.1",
89
- "postcss-scss": "^4.0.8",
90
79
  "prop-types": "^15.8.1",
91
80
  "react": "^18.2.0",
92
81
  "react-dom": "^18.2.0",
93
82
  "react-router": "^6.16.0",
94
83
  "react-router-dom": "^6.16.0",
95
84
  "react-test-renderer": "^18.2.0",
96
- "regenerator-runtime": "^0.14.0",
97
- "sass": "^1.68.0",
98
- "storybook": "^7.4.3",
99
- "vinyl-paths": "^5.0.0"
85
+ "remove-files-webpack-plugin": "^1.5.0",
86
+ "sass": "^1.66.1",
87
+ "sass-loader": "^13.3.2",
88
+ "storybook": "^7.4.0",
89
+ "webpack": "^5.88.2",
90
+ "webpack-cli": "^5.1.4"
100
91
  },
101
92
  "imports": {
102
- "#build/gulp/build/*": "./build/gulp/build/*.mjs",
103
- "#build/gulp/build": "./build/gulp/build/index.mjs",
104
- "#build/gulp/*": "./build/gulp/*.mjs",
105
- "#build/gulp/transform": "./build/gulp/transform/index.mjs",
106
93
  "#build/paths": "./build/paths.mjs"
107
94
  },
108
95
  "exports": {
@@ -1,12 +1,7 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import debug from 'debug'
4
-
5
- const log = debug('@modernpoacher/sprockets/components/common/visually-hidden-text')
6
3
 
7
4
  export default function VisuallyHiddenText ({ visuallyHiddenText }) {
8
- log('VisuallyHiddenText')
9
-
10
5
  if (visuallyHiddenText) {
11
6
  return (
12
7
  <span className='visually-hidden-text'>
@@ -1,16 +1,11 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import debug from 'debug'
4
-
5
- const log = debug('@modernpoacher/sprockets/sprockets/check-answers/group')
6
3
 
7
4
  /**
8
5
  * @param {SprocketsTypes.AnswerDefinitionType}
9
6
  * @returns {React.JSX.Element}
10
7
  */
11
8
  export default function AnswerTitle ({ title }) {
12
- log('AnswerTitle')
13
-
14
9
  return (
15
10
  <dt className='answer-title'>
16
11
  {title}
@@ -1,8 +1,5 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import debug from 'debug'
4
-
5
- const log = debug('@modernpoacher/sprockets/sprockets/check-answers/group')
6
3
 
7
4
  /**
8
5
  * @param {string | string[]}
@@ -32,8 +29,6 @@ function getAnswerValue (value) {
32
29
  * @returns {React.JSX.Element}
33
30
  */
34
31
  export default function AnswerValue ({ value }) {
35
- log('AnswerValue')
36
-
37
32
  return (
38
33
  <dd className='answer-value'>
39
34
  {getAnswerValue(value)}
@@ -1,24 +1,18 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import debug from 'debug'
4
3
 
5
4
  import {
6
5
  Link
7
6
  } from 'react-router-dom'
8
7
 
9
8
  import TextContent from '@modernpoacher/sprockets/components/common/text-content'
10
-
11
- import VisuallyHiddenText from './visually-hidden-text.cjs'
12
-
13
- const log = debug('@modernpoacher/sprockets/sprockets/check-answers/group/change-answer')
9
+ import VisuallyHiddenText from '@modernpoacher/sprockets/components/common/visually-hidden-text'
14
10
 
15
11
  /**
16
12
  * @param {SprocketsTypes.AnswerDefinitionType}
17
13
  * @returns {React.JSX.Element}
18
14
  */
19
15
  export default function ChangeAnswer ({ href, text, visuallyHiddenText }) {
20
- log('ChangeAnswer')
21
-
22
16
  return (
23
17
  <dd className='change-answer'>
24
18
  <Link to={href}>
package/transform.sh ADDED
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ node -e 'import("./build/transform.mjs").then(({ default: transform }) => transform())'
@@ -0,0 +1,105 @@
1
+ import path from 'node:path'
2
+ import Webpack from 'webpack'
3
+ import {
4
+ CleanWebpackPlugin
5
+ } from 'clean-webpack-plugin'
6
+ import RemoveFilesPlugin from 'remove-files-webpack-plugin'
7
+ import MiniCssExtractPlugin from 'mini-css-extract-plugin'
8
+
9
+ import {
10
+ sourcePath as SOURCE_PATH,
11
+ targetPath as TARGET_PATH,
12
+ modulePath as MODULE_PATH
13
+ } from '#build/paths'
14
+
15
+ const {
16
+ SourceMapDevToolPlugin
17
+ } = Webpack
18
+
19
+ export default {
20
+ mode: 'production',
21
+ entry: {
22
+ 'preview-head': path.join(SOURCE_PATH, 'sass/preview-head.scss')
23
+ },
24
+ output: {
25
+ path: path.join(TARGET_PATH, 'css')
26
+ },
27
+ stats: {
28
+ colors: true
29
+ },
30
+ module: {
31
+ rules: [
32
+ {
33
+ test: /\.scss$/i,
34
+ use: [
35
+ MiniCssExtractPlugin.loader,
36
+ {
37
+ loader: 'css-loader',
38
+ options: {
39
+ importLoaders: 1,
40
+ sourceMap: false
41
+ }
42
+ },
43
+ {
44
+ loader: 'postcss-loader',
45
+ options: {
46
+ sourceMap: false,
47
+ postcssOptions: {
48
+ config: false,
49
+ plugins: [
50
+ 'postcss-import',
51
+ [
52
+ 'postcss-map', {
53
+ maps: [
54
+ path.join(MODULE_PATH, '@modernpoacher/design-system/src/tokens/palette.json')
55
+ ]
56
+ }
57
+ ]
58
+ ]
59
+ }
60
+ }
61
+ },
62
+ {
63
+ loader: 'sass-loader',
64
+ options: {
65
+ sourceMap: false,
66
+ sassOptions: {
67
+ includePaths: [
68
+ path.join(MODULE_PATH, '@modernpoacher/design-system/src/sass')
69
+ ]
70
+ }
71
+ }
72
+ }
73
+ ]
74
+ }
75
+ ]
76
+ },
77
+ plugins: [
78
+ new CleanWebpackPlugin({
79
+ verbose: false,
80
+ cleanOnceBeforeBuildPatterns: [
81
+ path.join(TARGET_PATH, 'css/*.css'),
82
+ path.join(TARGET_PATH, 'css/*.css.map')
83
+ ]
84
+ }),
85
+ new MiniCssExtractPlugin({
86
+ filename: '[name].css'
87
+ }),
88
+ new SourceMapDevToolPlugin({
89
+ test: /\.css$/i,
90
+ filename: '[name].css.map'
91
+ }),
92
+ new RemoveFilesPlugin({
93
+ after: {
94
+ test: [
95
+ {
96
+ folder: path.join(TARGET_PATH, 'css'),
97
+ method (filePath) {
98
+ return /\.js$/m.test(filePath)
99
+ }
100
+ }
101
+ ]
102
+ }
103
+ })
104
+ ]
105
+ }