@massimo-cassandro/minimo 1.11.0 → 1.12.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.
- package/dev-tools/README.md +1 -1
- package/dev-tools/update-version/index.mjs +1 -1
- package/dev-tools/update-version/src/chooser-inquirer.mjs +1 -1
- package/dev-tools/webpack-setup/starter-install.sh +149 -0
- package/dev-tools/webpack-setup/templates/__project__.code-workspace +93 -0
- package/dev-tools/webpack-setup/templates/_browserslistrc +27 -0
- package/dev-tools/webpack-setup/templates/_editorconfig +17 -0
- package/dev-tools/webpack-setup/templates/_gitignore +21 -0
- package/dev-tools/webpack-setup/templates/_prettierrc +9 -0
- package/dev-tools/webpack-setup/templates/eslint.config.mjs +31 -0
- package/dev-tools/webpack-setup/templates/jsconfig.json +22 -0
- package/dev-tools/webpack-setup/templates/package-tpl.json +37 -0
- package/dev-tools/webpack-setup/templates/stylelint.config.mjs +32 -0
- package/dev-tools/webpack-setup/webpack-modules/css-rules.mjs +177 -0
- package/dev-tools/webpack-setup/webpack-modules/get-jsConfig-aliases.mjs +33 -0
- package/dev-tools/webpack-setup/webpack-modules/postcss.config.mjs +77 -0
- package/dev-tools/webpack-setup/webpack-modules/svg-rules.mjs +154 -0
- package/dev-tools/webpack-setup/webpack-modules/svgo.config.mjs +26 -0
- package/dev-tools/webpack-setup/webpack-template.ejs +20 -0
- package/dev-tools/webpack-setup/webpack.config.mjs +585 -0
- package/package.json +6 -3
- package/snippets/ImgViewerController.php +403 -0
- package/snippets/UnsplashController.php +74 -0
- package/snippets/controllo-codice-fiscale-IT.js +48 -0
- package/snippets/controllo-partita-iva-IT.js +32 -0
- package/snippets/email-antispam.js +108 -0
- package/snippets/error-pages/bundles/TwigBundle/Exception/error.html.twig +33 -0
- package/snippets/error-pages/error-pages.js +37 -0
- package/snippets/festivita.js +101 -0
- package/snippets/minimo-form-layout.html.twig +446 -0
- package/src/components/form-reset-submit.js +1 -1
- package/src/utilities/better-text.js +39 -30
package/dev-tools/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A collection of standalone Node.js CLI utilities to help manage a web project's
|
|
|
6
6
|
* [Svg Icons Tools](./svg-icons-tools/README.md) — optimizes SVG icons and combines/converts them into symbols, JSX, or SCSS variables
|
|
7
7
|
* [Create favicons](./create-favicons/README.md) — generates the full favicon set (SVG, PNG, ICO, webmanifest, HTML snippet) from a source image
|
|
8
8
|
* [upd@m](./upd@m/README.md) — updates all `@massimo-cassandro/*` packages installed in `node_modules`
|
|
9
|
-
|
|
9
|
+
* **webpack-setup** — script for installing minimo environment
|
|
10
10
|
|
|
11
11
|
## Usage of SVG adn favicons tools
|
|
12
12
|
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#!/bin/zsh
|
|
2
|
+
|
|
3
|
+
# Configurazione variabili
|
|
4
|
+
# BASE_URL="https://raw.githubusercontent.com/massimo-cassandro/minimo/refs/heads/main"
|
|
5
|
+
|
|
6
|
+
# in locale: cat ....
|
|
7
|
+
# da remoto curl -s
|
|
8
|
+
|
|
9
|
+
# %:A risolve il percorso assoluto (anche con link simbolici)
|
|
10
|
+
# %:h estrae l'header (ovvero la directory, come 'dirname')
|
|
11
|
+
BASE_URL=${0:A:h}
|
|
12
|
+
|
|
13
|
+
echo "BASE_URL: ${BASE_URL}"
|
|
14
|
+
|
|
15
|
+
TEMPLATES_DIR="${BASE_URL}/templates"
|
|
16
|
+
# WEBPACK_SOURCE_DIR="$BASE_URL/webpack-setup"
|
|
17
|
+
WEBPACK_SOURCE_DIR="$BASE_URL"
|
|
18
|
+
|
|
19
|
+
RED='\033[0;31m'
|
|
20
|
+
YELLOW='\033[0;33m'
|
|
21
|
+
GREEN='\033[0;32m'
|
|
22
|
+
NC='\033[0m' # No Color
|
|
23
|
+
|
|
24
|
+
# protezione contro la sovrascrittura
|
|
25
|
+
set -C
|
|
26
|
+
|
|
27
|
+
# Array per tracciare le copie bloccati
|
|
28
|
+
BLOCKED_FILES=()
|
|
29
|
+
|
|
30
|
+
# Wrapper: copia solo se il file non esiste, altrimenti registra il blocco
|
|
31
|
+
safe_cat() {
|
|
32
|
+
local src="$1"
|
|
33
|
+
local dest="$2"
|
|
34
|
+
if [ -e "$dest" ]; then
|
|
35
|
+
BLOCKED_FILES+=("$dest")
|
|
36
|
+
else
|
|
37
|
+
cat "$src" > "$dest"
|
|
38
|
+
fi
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
echo -e "${GREEN}...package.json${NC}"
|
|
42
|
+
if [ ! -f package.json ]; then
|
|
43
|
+
safe_cat "${TEMPLATES_DIR}/package-tpl.json" package.json
|
|
44
|
+
else
|
|
45
|
+
echo -e "${GREEN}package.json already exists${NC}"
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
echo -e "${GREEN}...gitignore${NC}"
|
|
49
|
+
if [ ! -f .gitignore ]; then
|
|
50
|
+
safe_cat "${TEMPLATES_DIR}/_gitignore" .gitignore
|
|
51
|
+
else
|
|
52
|
+
echo -e "${GREEN}.gitignore already exists${NC}"
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
echo -e "\n${GREEN}Where do you want to install the frontend configuration?${NC}"
|
|
56
|
+
echo "1) Root directory"
|
|
57
|
+
echo "2) 'frontend' Directory"
|
|
58
|
+
read "?Choose (1 or 2) [default: 1]: " choice < /dev/tty
|
|
59
|
+
choice=${choice:-1}
|
|
60
|
+
|
|
61
|
+
if [ "$choice" = "2" ]; then
|
|
62
|
+
FRONTEND_INSTALL_PATH="./frontend"
|
|
63
|
+
echo -e "${GREEN}Files will be installed in: ./frontend${NC}"
|
|
64
|
+
else
|
|
65
|
+
FRONTEND_INSTALL_PATH="."
|
|
66
|
+
echo -e "${GREEN}Files will be installed in: root directory${NC}"
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
if [ "$FRONTEND_INSTALL_PATH" = "./frontend" ]; then
|
|
70
|
+
mkdir -p frontend
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
echo -e "\n${GREEN}...config files & utilities${NC}"
|
|
75
|
+
|
|
76
|
+
safe_cat "${TEMPLATES_DIR}/_browserslistrc" .browserslistrc
|
|
77
|
+
safe_cat "${TEMPLATES_DIR}/_editorconfig" .editorconfig
|
|
78
|
+
safe_cat "${TEMPLATES_DIR}/_prettierrc" .prettierrc
|
|
79
|
+
safe_cat "${TEMPLATES_DIR}/jsconfig.json" jsconfig.json
|
|
80
|
+
safe_cat "${TEMPLATES_DIR}/__project__.code-workspace" __project__.code-workspace
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
echo -e "\n${GREEN}...eslint${NC}"
|
|
84
|
+
npm i -D @massimo-cassandro/eslint-config
|
|
85
|
+
safe_cat "${TEMPLATES_DIR}/eslint.config.mjs" eslint.config.mjs
|
|
86
|
+
|
|
87
|
+
echo -e "\n${GREEN}...stylelint${NC}"
|
|
88
|
+
npm i -D @massimo-cassandro/stylelint-config
|
|
89
|
+
safe_cat "${TEMPLATES_DIR}/stylelint.config.mjs" stylelint.config.mjs
|
|
90
|
+
|
|
91
|
+
echo -e "\n${GREEN}...webpack${NC}"
|
|
92
|
+
npm i -D webpack-cli webpack-dev-server webpack-manifest-plugin webpack
|
|
93
|
+
npm i -D @babel/core @babel/preset-env babel-loader terser-webpack-plugin
|
|
94
|
+
npm i -D webpack-remove-empty-scripts copy-webpack-plugin html-loader html-webpack-plugin
|
|
95
|
+
npm i -D postcss autoprefixer postcss-custom-media @csstools/postcss-global-data postcss-loader postcss-preset-env
|
|
96
|
+
npm i -D cssnano mini-css-extract-plugin style-loader css-loader css-minimizer-webpack-plugin
|
|
97
|
+
npm i -D responsive-loader
|
|
98
|
+
npm i -D process dotenv-webpack
|
|
99
|
+
npm i -D svgo svg-url-loader svgo-loader svgo-add-viewbox mini-svg-data-uri
|
|
100
|
+
npm i -D ejs-loader
|
|
101
|
+
npm i -D purgecss-webpack-plugin glob
|
|
102
|
+
|
|
103
|
+
npm i -D style-dictionary
|
|
104
|
+
|
|
105
|
+
safe_cat "${WEBPACK_SOURCE_DIR}/webpack.config.mjs" "${FRONTEND_INSTALL_PATH}/webpack.config.mjs"
|
|
106
|
+
safe_cat "${WEBPACK_SOURCE_DIR}/webpack-template.ejs" "${FRONTEND_INSTALL_PATH}/webpack-template.ejs"
|
|
107
|
+
|
|
108
|
+
# cartella webpack
|
|
109
|
+
WEBPACK_LOCAL_DIR="${FRONTEND_INSTALL_PATH}/webpack-modules"
|
|
110
|
+
WEBPACK_MODULES_REMOTE_URL="${WEBPACK_SOURCE_DIR}/webpack-modules"
|
|
111
|
+
FILES=(
|
|
112
|
+
'css-rules.mjs'
|
|
113
|
+
'get-jsConfig-aliases.mjs'
|
|
114
|
+
'mini-svg-data-uri-loader.cjs'
|
|
115
|
+
'svg-rules.mjs'
|
|
116
|
+
'svgo.config.mjs'
|
|
117
|
+
'postcss.config.mjs'
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
if [ ! -d "$WEBPACK_LOCAL_DIR" ]; then
|
|
121
|
+
mkdir -p "$WEBPACK_LOCAL_DIR"
|
|
122
|
+
|
|
123
|
+
for FILE in "${FILES[@]}"; do
|
|
124
|
+
# echo "Scaricamento di $FILE..."
|
|
125
|
+
safe_cat "${WEBPACK_MODULES_REMOTE_URL}/${FILE}" "${WEBPACK_LOCAL_DIR}/${FILE}"
|
|
126
|
+
done
|
|
127
|
+
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
echo -e "\n${GREEN}Creating a template of your frontend application's folder structured${NC}"
|
|
131
|
+
|
|
132
|
+
TEMPLATE_DIR_NAME="__frontend_app_dir_template__"
|
|
133
|
+
mkdir -p "$TEMPLATE_DIR_NAME"
|
|
134
|
+
cd "$TEMPLATE_DIR_NAME"
|
|
135
|
+
mkdir -p error-pages imgs icons src src/css favicons design-tokens
|
|
136
|
+
cd ..
|
|
137
|
+
set +C
|
|
138
|
+
|
|
139
|
+
# Riepilogo finale dei file bloccati
|
|
140
|
+
if [ ${#BLOCKED_FILES[@]} -gt 0 ]; then
|
|
141
|
+
echo -e "\n${YELLOW}*** File non copiati (già esistenti): ***${NC}"
|
|
142
|
+
for F in "${BLOCKED_FILES[@]}"; do
|
|
143
|
+
echo -e "${YELLOW} ✗ $F${NC}"
|
|
144
|
+
done
|
|
145
|
+
else
|
|
146
|
+
echo -e "\n${GREEN}Nessun file bloccato.${NC}"
|
|
147
|
+
fi
|
|
148
|
+
|
|
149
|
+
echo -e "\n\n${GREEN}*** END ***${NC}"
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
"folders": [
|
|
3
|
+
{
|
|
4
|
+
"path": "."
|
|
5
|
+
}
|
|
6
|
+
],
|
|
7
|
+
"settings": {
|
|
8
|
+
|
|
9
|
+
"cssvar.files": [
|
|
10
|
+
"frontend/css/custom-properties-list.css", // project props
|
|
11
|
+
|
|
12
|
+
// OPEN PROPS
|
|
13
|
+
// "./node_modules/open-props/open-props.min.css", // all open-props
|
|
14
|
+
|
|
15
|
+
// "./node_modules/open-props/animations.min.css",
|
|
16
|
+
// "./node_modules/open-props/aspects.min.css",
|
|
17
|
+
// "./node_modules/open-props/borders.min.css",
|
|
18
|
+
// "./node_modules/open-props/buttons.dark.min.css",
|
|
19
|
+
// "./node_modules/open-props/buttons.light.min.css",
|
|
20
|
+
// "./node_modules/open-props/buttons.min.css",
|
|
21
|
+
// "./node_modules/open-props/durations.min.css",
|
|
22
|
+
// "./node_modules/open-props/easings.min.css",
|
|
23
|
+
// "./node_modules/open-props/fonts.min.css",
|
|
24
|
+
// "./node_modules/open-props/gradients.min.css",
|
|
25
|
+
// "./node_modules/open-props/masks.corner-cuts.min.css",
|
|
26
|
+
// "./node_modules/open-props/masks.edges.min.css",
|
|
27
|
+
// "./node_modules/open-props/media.min.css",
|
|
28
|
+
// "./node_modules/open-props/normalize.dark.min.css",
|
|
29
|
+
// "./node_modules/open-props/normalize.light.min.css",
|
|
30
|
+
// "./node_modules/open-props/normalize.min.css",
|
|
31
|
+
// "./node_modules/open-props/sizes.min.css",
|
|
32
|
+
// "./node_modules/open-props/supports.min.css",
|
|
33
|
+
// "./node_modules/open-props/theme.dark.switch.min.css",
|
|
34
|
+
// "./node_modules/open-props/theme.light.switch.min.css",
|
|
35
|
+
// "./node_modules/open-props/zindex.min.css",
|
|
36
|
+
|
|
37
|
+
// "./node_modules/open-props/colors.min.css",
|
|
38
|
+
// "./node_modules/open-props/colors-hsl.min.css",
|
|
39
|
+
// "./node_modules/open-props/colors-hsl.shadow.min.css",
|
|
40
|
+
// "./node_modules/open-props/colors-oklch.min.css",
|
|
41
|
+
// "./node_modules/open-props/colors-oklch.shadow.min.css",
|
|
42
|
+
// "./node_modules/open-props/oklch-hues.min.css",
|
|
43
|
+
// "./node_modules/open-props/oklch-hues.shadow.min.css",
|
|
44
|
+
|
|
45
|
+
// "./node_modules/open-props/shadows.min.css",
|
|
46
|
+
// "./node_modules/open-props/animations.shadow.min.css",
|
|
47
|
+
// "./node_modules/open-props/aspects.shadow.min.css",
|
|
48
|
+
// "./node_modules/open-props/borders.shadow.min.css",
|
|
49
|
+
// "./node_modules/open-props/colors.shadow.min.css",
|
|
50
|
+
// "./node_modules/open-props/easings.shadow.min.css",
|
|
51
|
+
// "./node_modules/open-props/fonts.shadow.min.css",
|
|
52
|
+
// "./node_modules/open-props/gradients.shadow.min.css",
|
|
53
|
+
// "./node_modules/open-props/normalize.shadow.min.css",
|
|
54
|
+
// "./node_modules/open-props/shadows.shadow.min.css",
|
|
55
|
+
// "./node_modules/open-props/sizes.shadow.min.css",
|
|
56
|
+
// "./node_modules/open-props/zindex.shadow.min.css",
|
|
57
|
+
|
|
58
|
+
],
|
|
59
|
+
// Do not ignore node_modules css files, which is ignored by default
|
|
60
|
+
"cssvar.ignore": [],
|
|
61
|
+
|
|
62
|
+
// add support for autocomplete in JS or JS like files
|
|
63
|
+
"cssvar.extensions": [
|
|
64
|
+
"css", "postcss", "jsx", "tsx", "scss"
|
|
65
|
+
],
|
|
66
|
+
|
|
67
|
+
"favorites.resources": [
|
|
68
|
+
{
|
|
69
|
+
"filePath": "node_modules/@fontsource-variable",
|
|
70
|
+
"group": "Default"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"filePath": "node_modules/@fontsource",
|
|
74
|
+
"group": "Default"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"filePath": "node_modules/@massimo-cassandro",
|
|
78
|
+
"group": "Default"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"filePath": "node_modules/open-props",
|
|
82
|
+
"group": "Default"
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
|
|
86
|
+
"bootstrapIntelliSense": {
|
|
87
|
+
"enable": false,
|
|
88
|
+
"bsVersion": "5.3.7",
|
|
89
|
+
"showSuggestions": false,
|
|
90
|
+
"autoComplete": false
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# https://github.com/browserslist/browserslist
|
|
2
|
+
# https://browsersl.ist/
|
|
3
|
+
|
|
4
|
+
last 2 major versions
|
|
5
|
+
since 2023
|
|
6
|
+
not dead
|
|
7
|
+
|
|
8
|
+
not op_mini all
|
|
9
|
+
not op_mob > 0
|
|
10
|
+
not and_uc > 0
|
|
11
|
+
not and_qq > 0
|
|
12
|
+
not baidu > 0
|
|
13
|
+
not kaios > 0
|
|
14
|
+
not android > 0
|
|
15
|
+
not ie > 0
|
|
16
|
+
not ie_mob > 0
|
|
17
|
+
not bb > 0
|
|
18
|
+
|
|
19
|
+
safari >= 16
|
|
20
|
+
ios_saf >= 16
|
|
21
|
+
edge >= 109
|
|
22
|
+
chrome >= 109
|
|
23
|
+
firefox esr
|
|
24
|
+
opera >= 95
|
|
25
|
+
samsung >= 20
|
|
26
|
+
|
|
27
|
+
> 3% in IT
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# https://editorconfig.org
|
|
2
|
+
|
|
3
|
+
# top-most EditorConfig file
|
|
4
|
+
root = true
|
|
5
|
+
|
|
6
|
+
[*]
|
|
7
|
+
charset = utf-8
|
|
8
|
+
end_of_line = lf
|
|
9
|
+
indent_size = 2
|
|
10
|
+
indent_style = space
|
|
11
|
+
insert_final_newline = true
|
|
12
|
+
trim_trailing_whitespace = true
|
|
13
|
+
|
|
14
|
+
[*.md]
|
|
15
|
+
max_line_length = off
|
|
16
|
+
trim_trailing_whitespace = false
|
|
17
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
*~
|
|
2
|
+
.DS_Store
|
|
3
|
+
**/*.mwb.bak
|
|
4
|
+
**/*.mwb.beforefix
|
|
5
|
+
|
|
6
|
+
vendor
|
|
7
|
+
|
|
8
|
+
# local env
|
|
9
|
+
# .env
|
|
10
|
+
.env.dev
|
|
11
|
+
.env.local
|
|
12
|
+
.env.development
|
|
13
|
+
.env.test
|
|
14
|
+
.env.development.local
|
|
15
|
+
.env.test.local
|
|
16
|
+
.env.production.local
|
|
17
|
+
|
|
18
|
+
# frontend
|
|
19
|
+
node_modules
|
|
20
|
+
_private
|
|
21
|
+
public/_dev
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import eslint_config from '@massimo-cassandro/eslint-config';
|
|
2
|
+
|
|
3
|
+
// https://github.com/cybozu/eslint-config
|
|
4
|
+
// import cybozuEslintConfigBaseline from '@cybozu/eslint-config/flat/presets/css-baseline.js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
|
|
9
|
+
// ...cybozuEslintConfigBaseline.map((config) => ({
|
|
10
|
+
// ...config,
|
|
11
|
+
// files: ['**/*.css']
|
|
12
|
+
// })),
|
|
13
|
+
|
|
14
|
+
...eslint_config,
|
|
15
|
+
// {
|
|
16
|
+
// files: ['src/**/*.js'],
|
|
17
|
+
// ignores: [
|
|
18
|
+
// 'dist/',
|
|
19
|
+
// 'build/',
|
|
20
|
+
// '**/vendor/'
|
|
21
|
+
// ],
|
|
22
|
+
// }
|
|
23
|
+
// {
|
|
24
|
+
// languageOptions: {
|
|
25
|
+
// globals: {
|
|
26
|
+
// jQuery: 'readonly',
|
|
27
|
+
// $: 'readonly',
|
|
28
|
+
// },
|
|
29
|
+
// },
|
|
30
|
+
// },
|
|
31
|
+
];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"__help": "https://code.visualstudio.com/docs/languages/jsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"checkJs": true,
|
|
5
|
+
"target": "ES2023",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"baseUrl": ".",
|
|
8
|
+
"allowSyntheticDefaultImports": false,
|
|
9
|
+
"paths": {
|
|
10
|
+
"@frontend/*": ["./frontend/*"],
|
|
11
|
+
"@src/*": ["frontend/src/*"],
|
|
12
|
+
"@imgs/*": ["./frontend/imgs/*"],
|
|
13
|
+
"@icone/*": ["./frontend/icone/*"],
|
|
14
|
+
"@backoffice/*": ["./frontend/backoffice/*"],
|
|
15
|
+
"@minimo/*": ["./node_modules/@massimo-cassandro/minimo/src/*"]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
},
|
|
21
|
+
"exclude": ["node_modules", "dist", "docs", "build", "public"]
|
|
22
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "xxxxx",
|
|
3
|
+
"description": "",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Massimo Cassandro",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"type":"module",
|
|
9
|
+
"sideEffects": [
|
|
10
|
+
"*.css",
|
|
11
|
+
"*.js",
|
|
12
|
+
"*.svg",
|
|
13
|
+
"*.jpg",
|
|
14
|
+
"*.jpeg",
|
|
15
|
+
"*.png",
|
|
16
|
+
"*.webp",
|
|
17
|
+
"*.avif"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"progetto JS webpack DEV": "npm 'launchChrome' && NODE_ENV=development webpack serve --config ./webpack.config.mjs #--open-app-name 'Google Chrome'",
|
|
21
|
+
"progettop sf webpack DEV": "rm -rf ./public/_dev && NODE_ENV=development webpack --config ./frontend/webpack.config.mjs",
|
|
22
|
+
"webpack PROD": "NODE_ENV=production webpack --config ./webpack.config.mjs --stats minimal",
|
|
23
|
+
"create-favicons INIT": "npx create-favicons init",
|
|
24
|
+
"create-favicons": "npx create-favicons --dir=./src/favicons",
|
|
25
|
+
"UPD-version": "npx update-version # --log-file=./frontend/changelog.md --log-patch --pkg=alt/path/to/package.json",
|
|
26
|
+
"upd@m": "npx upd@m",
|
|
27
|
+
"launchChrome": "open -n -a 'Google Chrome' --args --profile-directory='Profile 3'",
|
|
28
|
+
"python server": "python3 -m http.server 8000 # --directory __dirname__ # 8000 = default port",
|
|
29
|
+
"php server": "php -S localhost:8000 # -t root_dir/",
|
|
30
|
+
"symfony local server": "symfony serve -d",
|
|
31
|
+
"node server": "node serve # richiede ‘npm i serve’",
|
|
32
|
+
"build tokens": "npx buildTokens --config ./path/to/tokens-config.mjs",
|
|
33
|
+
"check unresolved props": "npx checkUnresolvedProps --config ./path/to/tokens-config.mjs"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {},
|
|
36
|
+
"devDependencies": {}
|
|
37
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
extends: [
|
|
3
|
+
'@massimo-cassandro/stylelint-config',
|
|
4
|
+
],
|
|
5
|
+
|
|
6
|
+
// File da ignorare durante l'analisi
|
|
7
|
+
ignoreFiles: [
|
|
8
|
+
'node_modules/**/*.{css,scss}',
|
|
9
|
+
'vendor/**/*.{css,scss}',
|
|
10
|
+
'templates/**/*.{css,scss}',
|
|
11
|
+
'dist/**/*.css',
|
|
12
|
+
'build/**/*.css',
|
|
13
|
+
'public/**/*.css',
|
|
14
|
+
'test/**/*.css',
|
|
15
|
+
'docs/**/*.css',
|
|
16
|
+
'demo/**/*.css',
|
|
17
|
+
],
|
|
18
|
+
|
|
19
|
+
// Overrides
|
|
20
|
+
rules: {
|
|
21
|
+
|
|
22
|
+
// 'color-function-notation': null,
|
|
23
|
+
|
|
24
|
+
//********************** optionally for tailwind:
|
|
25
|
+
// 'at-rule-no-unknown': [
|
|
26
|
+
// true,
|
|
27
|
+
// 'value-keyword-case': null,
|
|
28
|
+
// '@stylistic/number-no-trailing-zeros': null
|
|
29
|
+
// ],
|
|
30
|
+
//********************** /tailwind
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// import path from 'path';
|
|
2
|
+
// import { fileURLToPath } from 'url';
|
|
3
|
+
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
4
|
+
|
|
5
|
+
// const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
// const __dirname = path.dirname(__filename);
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const postcssLoader = (isDevelopment, postcssConfig_path) => ({
|
|
11
|
+
loader: 'postcss-loader',
|
|
12
|
+
options: {
|
|
13
|
+
sourceMap: isDevelopment,
|
|
14
|
+
postcssOptions: {
|
|
15
|
+
// 'config' accetta un percorso assoluto (stringa) o un booleano
|
|
16
|
+
config: postcssConfig_path,
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export function cssRules({
|
|
22
|
+
isDevelopment = false,
|
|
23
|
+
useSass = false,
|
|
24
|
+
inlineCssInDevMode = true,
|
|
25
|
+
postcssConfig_path
|
|
26
|
+
}) {
|
|
27
|
+
const configOptions = { isDevelopment, useSass, inlineCssInDevMode, postcssConfig_path };
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
return [
|
|
31
|
+
// CSS modules
|
|
32
|
+
{
|
|
33
|
+
test: /\.module\.(sass|scss|css)$/i,
|
|
34
|
+
oneOf: [
|
|
35
|
+
|
|
36
|
+
// inserimento critical css con tag style al momento della build
|
|
37
|
+
{
|
|
38
|
+
test: /\.critical\.module\./i,
|
|
39
|
+
use: css_loaders({ ...configOptions, critical: true, css_modules: true }),
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// inserimento css con tag style nel runtime
|
|
43
|
+
{
|
|
44
|
+
resourceQuery: /inline/,
|
|
45
|
+
use: css_loaders({ ...configOptions, inline: true, css_modules: true }),
|
|
46
|
+
},
|
|
47
|
+
// comportamento standard
|
|
48
|
+
{
|
|
49
|
+
use: css_loaders({ ...configOptions, css_modules: true }),
|
|
50
|
+
},
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
// CSS standard
|
|
54
|
+
{
|
|
55
|
+
test: /\.(sass|scss|css)$/i,
|
|
56
|
+
exclude: /\.module\.(sass|scss|css)$/i,
|
|
57
|
+
sideEffects: true,
|
|
58
|
+
oneOf: [
|
|
59
|
+
|
|
60
|
+
// raw content per web-components
|
|
61
|
+
{
|
|
62
|
+
resourceQuery: /raw/,
|
|
63
|
+
use: [
|
|
64
|
+
// exportType: 'string' sostituisce raw-loader deprecato
|
|
65
|
+
{
|
|
66
|
+
loader: 'css-loader',
|
|
67
|
+
options: {
|
|
68
|
+
exportType: 'string',
|
|
69
|
+
sourceMap: isDevelopment,
|
|
70
|
+
importLoaders: useSass? 2 : 1
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
postcssLoader(isDevelopment, postcssConfig_path),
|
|
75
|
+
|
|
76
|
+
...(useSass ? [{
|
|
77
|
+
loader: 'sass-loader',
|
|
78
|
+
options: { sourceMap: isDevelopment }
|
|
79
|
+
}] : [])
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
{
|
|
84
|
+
test: /\.critical\.(sass|scss|css)$/i,
|
|
85
|
+
use: css_loaders({ ...configOptions, critical: true }),
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
resourceQuery: /inline/,
|
|
89
|
+
use: css_loaders({ ...configOptions, inline: true }),
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
|
|
93
|
+
use: css_loaders({ ...configOptions }),
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function css_loaders({
|
|
101
|
+
isDevelopment = false,
|
|
102
|
+
useSass = false,
|
|
103
|
+
inlineCssInDevMode = true,
|
|
104
|
+
postcssConfig_path = postcssConfig_path,
|
|
105
|
+
css_modules = false,
|
|
106
|
+
critical = false, // Iniezione statica nell'HTML
|
|
107
|
+
inline = false // Iniezione dinamica via JS
|
|
108
|
+
}) {
|
|
109
|
+
|
|
110
|
+
let mainLoader;
|
|
111
|
+
|
|
112
|
+
if (inline) {
|
|
113
|
+
// usa style-loader per la query string ?inline
|
|
114
|
+
mainLoader = {
|
|
115
|
+
loader: 'style-loader',
|
|
116
|
+
options: {
|
|
117
|
+
injectType: 'singletonStyleTag',
|
|
118
|
+
esModule: css_modules
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
} else if (critical) {
|
|
123
|
+
// usa MiniCssExtractPlugin per permettere al plugin HTML di leggerlo
|
|
124
|
+
mainLoader = MiniCssExtractPlugin.loader;
|
|
125
|
+
|
|
126
|
+
} else {
|
|
127
|
+
// compartamento standard
|
|
128
|
+
mainLoader = (isDevelopment && inlineCssInDevMode)
|
|
129
|
+
? {
|
|
130
|
+
loader: 'style-loader',
|
|
131
|
+
options: {
|
|
132
|
+
injectType: 'singletonStyleTag',
|
|
133
|
+
// esModule: css_modules
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
: MiniCssExtractPlugin.loader;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
return [
|
|
141
|
+
mainLoader,
|
|
142
|
+
|
|
143
|
+
{
|
|
144
|
+
loader: 'css-loader',
|
|
145
|
+
options: {
|
|
146
|
+
modules: css_modules
|
|
147
|
+
? {
|
|
148
|
+
auto: true,
|
|
149
|
+
localIdentName: isDevelopment ? '[local]_[hash:base64:6]' : '[hash:base64:10]',
|
|
150
|
+
exportLocalsConvention: 'as-is',
|
|
151
|
+
|
|
152
|
+
// namedExport: false,
|
|
153
|
+
// exportOnlyLocals: false
|
|
154
|
+
}
|
|
155
|
+
: false,
|
|
156
|
+
sourceMap: isDevelopment,
|
|
157
|
+
importLoaders: useSass ? 2 : 1,
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
postcssLoader(isDevelopment, postcssConfig_path),
|
|
162
|
+
|
|
163
|
+
...(useSass
|
|
164
|
+
? [ {
|
|
165
|
+
loader: 'sass-loader',
|
|
166
|
+
options: {
|
|
167
|
+
sourceMap: isDevelopment,
|
|
168
|
+
sassOptions: {
|
|
169
|
+
quietDeps: true,
|
|
170
|
+
silenceDeprecations: [ 'legacy-js-api', 'mixed-decls', 'color-functions', 'global-builtin', 'import' ],
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
} ]
|
|
174
|
+
: []
|
|
175
|
+
)
|
|
176
|
+
];
|
|
177
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Funzione per ottenere gli alias direttamente leggendo il file jsconfig.json
|
|
6
|
+
* @param {string} jsconfigAbsPath - Il percorso assoluto del file jsconfig.json
|
|
7
|
+
* @returns {Record<string, string>}
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export function getJsConfigAliases(jsconfigAbsPath) {
|
|
11
|
+
|
|
12
|
+
const baseDir = path.dirname(jsconfigAbsPath);
|
|
13
|
+
|
|
14
|
+
const fileContent = fs.readFileSync(jsconfigAbsPath, 'utf-8');
|
|
15
|
+
const jsconfig = JSON.parse(fileContent);
|
|
16
|
+
|
|
17
|
+
const aliases = {};
|
|
18
|
+
const paths = jsconfig.compilerOptions?.paths || {};
|
|
19
|
+
|
|
20
|
+
for (const item in paths) {
|
|
21
|
+
// Rimuove la wildcard /* alla fine della chiave (alias)
|
|
22
|
+
const key = item.replace(/(\/\*)$/, '');
|
|
23
|
+
|
|
24
|
+
// Prende il primo valore (path) e rimuove la wildcard /*
|
|
25
|
+
const targetPath = paths[item][0].replace(/(\/\*)$/, '');
|
|
26
|
+
|
|
27
|
+
const absolutePath = path.resolve(baseDir, targetPath);
|
|
28
|
+
|
|
29
|
+
aliases[key] = absolutePath;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return aliases;
|
|
33
|
+
}
|