Skip to content

Commit 9e381dd

Browse files
committed
Replace Gulp with CLI and webpack
1 parent 22a0587 commit 9e381dd

File tree

9 files changed

+255
-195
lines changed

9 files changed

+255
-195
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"settings": {
77
"import/resolver": {
88
"webpack": {
9-
"config": "webpack.test.config.js"
9+
"config": "webpack.config.test.js"
1010
}
1111
}
1212
}

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
run: yarn install
2020
-
2121
name: Run tests
22-
run: npm run build
22+
run: npm run release

.mocharc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"require": [
3+
"@babel/register",
4+
"global-jsdom/register"
5+
],
6+
"reporter": "spec"
7+
}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
import { cloneDeep } from 'lodash';
2+
import React from 'react';
3+
import CheckboxTree from 'react-checkbox-tree';
4+
5+
class BasicExample extends React.Component {
6+
state = {
7+
checked: [
8+
'/app/Http/Controllers/WelcomeController.js',
9+
'/app/Http/routes.js',
10+
'/public/assets/style.css',
11+
// '/public/index.html',
12+
'/.gitignore',
13+
],
14+
expanded: [
15+
'/app',
16+
],
17+
nodes: [
18+
{
19+
value: '/app',
20+
label: 'app',
21+
children: [
22+
{
23+
value: '/app/Http',
24+
label: 'Http',
25+
children: [
26+
{
27+
value: '/app/Http/Controllers',
28+
label: 'Controllers',
29+
children: [{
30+
value: '/app/Http/Controllers/WelcomeController.js',
31+
label: 'WelcomeController.js',
32+
}],
33+
},
34+
{
35+
value: '/app/Http/routes.js',
36+
label: 'routes.js',
37+
},
38+
],
39+
},
40+
{
41+
value: '/app/Providers',
42+
label: 'Providers',
43+
children: [{
44+
value: '/app/Providers/EventServiceProvider.js',
45+
label: 'EventServiceProvider.js',
46+
}],
47+
},
48+
],
49+
},
50+
{
51+
value: '/config',
52+
label: 'config',
53+
children: [
54+
{
55+
value: '/config/app.js',
56+
label: 'app.js',
57+
},
58+
{
59+
value: '/config/database.js',
60+
label: 'database.js',
61+
},
62+
],
63+
},
64+
{
65+
value: '/public',
66+
label: 'public',
67+
children: [
68+
{
69+
value: '/public/assets/',
70+
label: 'assets',
71+
children: [{
72+
value: '/public/assets/style.css',
73+
label: 'style.css',
74+
}],
75+
},
76+
{
77+
value: '/public/index.html',
78+
label: 'index.html',
79+
children: [],
80+
},
81+
],
82+
},
83+
{
84+
value: '/.env',
85+
label: '.env',
86+
},
87+
{
88+
value: '/.gitignore',
89+
label: '.gitignore',
90+
},
91+
{
92+
value: '/README.md',
93+
label: 'README.md',
94+
},
95+
],
96+
};
97+
98+
constructor(props) {
99+
super(props);
100+
101+
this.onCheck = this.onCheck.bind(this);
102+
this.onExpand = this.onExpand.bind(this);
103+
}
104+
105+
onCheck(checked) {
106+
this.setState({ checked });
107+
}
108+
109+
onExpand(expanded, newNode) {
110+
const { nodes } = this.state;
111+
const newNodes = cloneDeep(nodes);
112+
113+
if (newNode.value === '/public/index.html') {
114+
newNodes[2].children[1].children = [{
115+
label: 'Test',
116+
value: 'Best',
117+
}];
118+
}
119+
120+
this.setState({ expanded, nodes: newNodes });
121+
}
122+
123+
render() {
124+
const { checked, expanded, nodes } = this.state;
125+
126+
return (
127+
<CheckboxTree
128+
checked={checked}
129+
expanded={expanded}
130+
iconsClass="fa5"
131+
nodes={nodes}
132+
onCheck={this.onCheck}
133+
onExpand={this.onExpand}
134+
/>
135+
);
136+
}
137+
}
138+
139+
export default BasicExample;

gulpfile.js

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

package.json

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,25 @@
1919
"main": "lib/index.js",
2020
"browser": "lib/index.browser.js",
2121
"scripts": {
22-
"build": "gulp build",
23-
"examples": "gulp examples",
24-
"gh-deploy": "gulp build-gh-pages && bash ./gh-deploy.sh",
25-
"prepublishOnly": "gulp build",
26-
"test": "gulp test-script"
22+
"build-less": "lessc src/less/react-dual-listbox.less .css-compare/less.css",
23+
"build-script": "npm run build-script-node && npm run build-script-web",
24+
"build-script-node": "webpack --env=target=node",
25+
"build-script-web": "webpack --env=target=web",
26+
"build-sass": "sass src/scss/react-dual-listbox.scss lib/react-dual-listbox.css && cp lib/react-dual-listbox.css .css-compare/scss.css",
27+
"build-style": "npm run build-less && npm run build-sass && npm run build-style-autoprefix",
28+
"build-style-autoprefix": "postcss lib/react-dual-listbox.css --use autoprefixer --output lib/react-dual-listbox.css",
29+
"build": "npm run build-script && npm run build-style",
30+
"examples": "webpack serve --config=webpack.config.test.js",
31+
"gh-build": "webpack --config=webpack.config.test.js --mode=production",
32+
"gh-deploy": "npm run gh-build && bash ./gh-deploy.sh",
33+
"prepublishOnly": "npm run release",
34+
"release": "npm run test && npm run build && npm run test-style-equivalence",
35+
"test": "npm run test-script && npm run test-style",
36+
"test-script": "npm run test-script-format && npm run test-script-mocha",
37+
"test-script-format": "eslint src/**/*.{js,jsx} examples/src/**/*.{js,jsx} test/**/*.{js,jsx} *.{js,jsx}",
38+
"test-script-mocha": "cross-env NODE_PATH=./src mocha test/**/*.{js,jsx} --exit",
39+
"test-style": "stylelint src/scss/**/*.scss examples/src/scss/**/*.scss",
40+
"test-style-equivalence": "postcss .css-compare/less.css --output .css-compare/less.css && postcss .css-compare/scss.css --output .css-compare/scss.css && cmp .css-compare/less.css .css-compare/scss.css"
2741
},
2842
"peerDependencies": {
2943
"react": "^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
@@ -38,9 +52,13 @@
3852
"@testing-library/react": "^13.4.0",
3953
"@testing-library/user-event": "^14.4.3",
4054
"@types/react": "^18.0.18",
55+
"autoprefixer": "^10.4.13",
4156
"babel-loader": "^9.0.0",
4257
"browser-sync": "^2.18.6",
4358
"chai": "^4.0.0",
59+
"cross-env": "^7.0.3",
60+
"css-loader": "^6.7.3",
61+
"cssnano": "^5.1.15",
4462
"eslint": "^8.23.0",
4563
"eslint-config-takiyon-react": "^3.0.0",
4664
"eslint-import-resolver-webpack": "^0.13.0",
@@ -49,24 +67,23 @@
4967
"eslint-plugin-react": "^7.10.0",
5068
"eslint-plugin-react-hooks": "^4.2.0",
5169
"global-jsdom": "^8.6.0",
52-
"gulp": "^4.0.0",
53-
"gulp-autoprefixer": "^8.0.0",
54-
"gulp-clean-css": "^4.0.0",
55-
"gulp-dart-sass": "^1.0.2",
56-
"gulp-eslint-new": "^1.6.0",
57-
"gulp-exec": "^5.0.0",
58-
"gulp-header": "^2.0.5",
59-
"gulp-less": "^5.0.0",
60-
"gulp-mocha": "^8.0.0",
61-
"gulp-stylelint": "^13.0.0",
70+
"html-webpack-plugin": "^5.5.0",
6271
"jsdom": "^21.0.0",
72+
"less": "^4.1.3",
73+
"mini-css-extract-plugin": "^2.7.2",
6374
"mocha": "^10.0.0",
75+
"postcss": "^8.4.21",
76+
"postcss-cli": "^10.1.0",
6477
"react": "^18.2.0",
6578
"react-dom": "^18.2.0",
66-
"sass": "^1.28.0",
79+
"sass": "^1.58.2",
80+
"sass-loader": "^13.2.0",
6781
"stylelint": "^15.1.0",
6882
"stylelint-config-takiyon": "^2.0.4",
6983
"webpack": "^5.3.2",
84+
"webpack-cli": "^5.0.1",
85+
"webpack-dev-server": "^4.11.1",
86+
"webpack-remove-empty-scripts": "^1.0.1",
7087
"webpack-stream": "^7.0.0"
7188
},
7289
"dependencies": {

0 commit comments

Comments
 (0)