Skip to content

Commit fe329f7

Browse files
committed
add build prod
1 parent f3d1afb commit fe329f7

File tree

11 files changed

+3472
-3104
lines changed

11 files changed

+3472
-3104
lines changed

.stylelintignore

Whitespace-only changes.

.stylelintrc renamed to .stylelintrc.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"stylelint-config-recess-order"
55
],
66
"customSyntax": "postcss-scss",
7+
"allowEmptyInput": true,
8+
"extensions" : [
9+
"css",
10+
"scss"
11+
],
712
"overrides": [
813
{
914
"files": ["**/*.scss"],
@@ -43,4 +48,4 @@
4348
}
4449
}
4550
]
46-
}
51+
}

.yarn/releases/yarn-3.2.3.cjs

Lines changed: 0 additions & 783 deletions
This file was deleted.

.yarn/releases/yarn-3.6.1.cjs

Lines changed: 874 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
nodeLinker: node-modules
1+
nodeLinker: pnp
2+
pnpMode: "loose"
23

3-
yarnPath: .yarn/releases/yarn-3.2.3.cjs
4+
yarnPath: .yarn/releases/yarn-3.6.1.cjs

config/esbuild.dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('esbuild.dev.js');

config/esbuild.entries.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
app: ['./src/js/index.js', './src/scss/style.scss'],
3+
editor: ['./src/js/editor.js', './src/scss/editor.scss'],
4+
'post-build': './src/js/post-build.js',
5+
login: './src/scss/login.scss',
6+
}

config/esbuild.prod.js

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import * as esbuild from 'esbuild'
2+
import eslintPlugin from 'esbuild-plugin-eslint'
3+
import stylePlugin from 'esbuild-style-plugin'
4+
import manifestPlugin from 'esbuild-plugin-manifest'
5+
//import stylelintPlugin from 'esbuild-plugin-stylelint'
6+
import postCssPlugin from '@deanc/esbuild-plugin-postcss'
7+
8+
async function bundle() {
9+
try {
10+
// build
11+
await esbuild.build({
12+
entryPoints: [
13+
'src/js/index.js',
14+
'src/js/editor.js',
15+
'src/js/post-build.js',
16+
'src/scss/style.scss',
17+
'src/scss/editor.scss',
18+
'src/scss/login.scss',
19+
],
20+
assetNames: 'assets/[name]-[hash]',
21+
chunkNames: 'assets/[name]-[hash]',
22+
loader: {
23+
'.png': 'file',
24+
'.jpg': 'file',
25+
'.gif': 'file',
26+
'.woff': 'file',
27+
'.woff2': 'file',
28+
'.svg': 'file',
29+
},
30+
bundle: true,
31+
minify: true,
32+
outdir: 'dist',
33+
target: ['chrome114', 'firefox114', 'safari15', 'edge114'],
34+
sourcemap: false,
35+
plugins: [
36+
stylePlugin(),
37+
postCssPlugin({
38+
plugins: [
39+
{
40+
'postcss-import': {},
41+
'postcss-preset-env': {
42+
browsers: 'last 2 versions',
43+
stage: 0,
44+
},
45+
'postcss-pxtorem': { propWhiteList: [] },
46+
'postcss-sort-media-queries': {},
47+
},
48+
],
49+
}),
50+
// stylelintPlugin({ fix: true}),
51+
eslintPlugin(),
52+
manifestPlugin({ shortNames: 'input' }),
53+
],
54+
})
55+
56+
console.log('Build successful!')
57+
} catch (error) {
58+
console.error('Build failed:', error)
59+
process.exit(1)
60+
}
61+
}
62+
63+
bundle()

package.json

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,26 @@
66
"type": "git",
77
"url": "https://github.com/BeAPI/beapi-frontend-framework"
88
},
9+
"type": "module",
910
"scripts": {
1011
"start": "yarn webpack --watch --config config/webpack.dev.js",
1112
"build": "yarn webpack --config config/webpack.prod.js",
1213
"bundle-report": "yarn webpack --config config/webpack.prod.js --json=dist/stats.json && yarn webpack-bundle-analyzer dist/stats.json",
13-
"image": "yarn node config/image-sizes.js"
14+
"image": "yarn node config/image-sizes.js",
15+
"esbuild": "yarn node config/esbuild.prod.js",
16+
"eswatch": "yarn node config/esbuild.dev.js"
1417
},
1518
"license": "GPL-2.0",
1619
"dependencies": {
20+
"@deanc/esbuild-plugin-postcss": "^1.0.2",
21+
"crypto": "^1.0.1",
22+
"esbuild": "^0.18.14",
23+
"esbuild-plugin-eslint": "^0.3.6",
24+
"esbuild-plugin-manifest": "^0.6.0",
25+
"esbuild-plugin-postcss": "^0.2.1",
26+
"esbuild-plugin-sass": "^1.0.1",
27+
"esbuild-plugin-stylelint": "^0.0.2",
28+
"eslint-plugin-import": "^2.27.5",
1729
"lazysizes": "^5.3.2",
1830
"oneloop.js": "^5.0.0",
1931
"what-input": "^5.2.10"
@@ -30,7 +42,8 @@
3042
"css-loader": "^5.2.4",
3143
"cssnano": "^5.0.1",
3244
"esbuild-loader": "^2.19.0",
33-
"eslint": "^8.23.1",
45+
"esbuild-style-plugin": "^1.6.2",
46+
"eslint": "^8.45.0",
3447
"eslint-config-prettier": "^8.5.0",
3548
"eslint-plugin-prettier": "^4.2.1",
3649
"eslint-webpack-plugin": "^3.2.0",
@@ -59,8 +72,10 @@
5972
"style-loader": "^2.0.0",
6073
"stylelint": "^14.13.0",
6174
"stylelint-config-recess-order": "^3.0.0",
75+
"stylelint-formatter-pretty": "^3.2.0",
6276
"stylelint-scss": "^4.3.0",
6377
"stylelint-webpack-plugin": "^3.3.0",
78+
"supports-color": "^9.4.0",
6479
"svg-sprite-loader": "^6.0.10",
6580
"svgo": "^3.0.2",
6681
"svgo-loader": "^3.0.0",
@@ -74,7 +89,7 @@
7489
},
7590
"volta": {
7691
"node": "18.12.1",
77-
"yarn": "1.22.19"
92+
"yarn": "3.6.1"
7893
},
79-
"packageManager": "yarn@3.2.3"
94+
"packageManager": "yarn@3.6.1"
8095
}

src/js/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import lazySizes from 'lazysizes'
1+
import lazysizes from 'lazysizes'
22
import 'lazysizes/plugins/native-loading/ls.native-loading'
33
import 'lazysizes/plugins/object-fit/ls.object-fit'
44
import 'what-input'
55
import './classes/ScrollDirection'
66
import './classes/ButtonSeoClick'
77
import './classes/Header'
88
import './classes/Animation'
9-
109
/**
1110
* LazySizes configuration
1211
* https://github.com/aFarkas/lazysizes/#js-api---options
1312
*/
14-
lazySizes.cfg.nativeLoading = {
15-
setLoadingAttribute: false,
13+
lazysizes.cfg.nativeLoading = {
14+
setloadingattribute: false,
1615
}

0 commit comments

Comments
 (0)