Skip to content

Commit 2716b2c

Browse files
committed
fix readme
1 parent bfc796e commit 2716b2c

File tree

2 files changed

+12
-286
lines changed

2 files changed

+12
-286
lines changed

README.md

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ yarn add esbuild-dev-server -D
1515
```
1616
go get github.com/Falldot/esbuild-dev-server
1717
```
18+
## Configuration
19+
20+
- `options.Port`, `string`: local server start port.
21+
- `options.Index`, `string`: path to index html file.
22+
- `options.StaticDir`, `string`: path to static files (js, css, img ...).
23+
- `options.WatchDir`, `string`: path to working directory.
24+
- `options.OnLoad`, `() => void`: local server restart event.
25+
1826
## How to use?
1927
### Node.js
2028
```js
@@ -29,21 +37,14 @@ const {esBuildDevServer, startServer, sendError, sendReload} = require("esbuild-
2937
sourcemap: true,
3038
target: ['chrome58', 'firefox57', 'safari11', 'edge16'],
3139
outdir: "dist/js",
32-
// Important field!!!!!
3340
incremental: true,
3441
plugins: [
35-
// esbuild-dev-server plugin
3642
esBuildDevServer({
37-
Port: "8080", // Port start local server
38-
Index: "dist/index.html", // Root html file
39-
// Stacic files
40-
// dist/js, dist/css ...
43+
Port: "8080",
44+
Index: "dist/index.html",
4145
StaticDir: "dist",
42-
// Working directory
4346
WatchDir: "src",
44-
// Event reload local server
4547
OnLoad: async () => {
46-
// Error handler and rebuild esbuild
4748
try {
4849
await builder.rebuild();
4950
await sendReload();
@@ -55,7 +56,6 @@ const {esBuildDevServer, startServer, sendError, sendReload} = require("esbuild-
5556
})
5657
],
5758
});
58-
// Starting...
5959
await startServer();
6060
})();
6161
```
@@ -87,19 +87,13 @@ func main() {
8787
{api.EngineSafari, "11"},
8888
{api.EngineEdge, "16"},
8989
},
90-
// Important field!!!!!
9190
Incremental: true,
9291
Plugins: []api.Plugin{
93-
// esbuild-dev-server plugin
9492
devserver.Plugin(devserver.Options{
95-
Port: ":8080", // Port start local server
96-
Index: "dist/index.html", // Root html file
97-
// Stacic files
98-
// dist/js, dist/css ...
93+
Port: ":8080",
94+
Index: "dist/index.html",
9995
StaticDir: "dist",
100-
// Working directory
10196
WatchDir: "src",
102-
// Event reload local server
10397
OnReload: func() {
10498
result.Rebuild()
10599
},
@@ -110,7 +104,6 @@ func main() {
110104
log.Fatalln(result.Errors)
111105
}
112106

113-
// Starting...
114107
if err := devserver.Start(); err != nil {
115108
log.Fatalln(result.Errors)
116109
}

lib/.eslintrc.js

Lines changed: 0 additions & 267 deletions
Original file line numberDiff line numberDiff line change
@@ -10,271 +10,4 @@ module.exports = {
1010
"ecmaVersion": 12,
1111
"sourceType": "module"
1212
},
13-
"rules": {
14-
"accessor-pairs": "error",
15-
"array-bracket-newline": "error",
16-
"array-bracket-spacing": "error",
17-
"array-callback-return": "error",
18-
"array-element-newline": "off",
19-
"arrow-body-style": "error",
20-
"arrow-parens": [
21-
"error",
22-
"as-needed"
23-
],
24-
"arrow-spacing": [
25-
"error",
26-
{
27-
"after": true,
28-
"before": true
29-
}
30-
],
31-
"block-scoped-var": "error",
32-
"block-spacing": "error",
33-
"brace-style": [
34-
"error",
35-
"1tbs"
36-
],
37-
"camelcase": "error",
38-
"capitalized-comments": [
39-
"off",
40-
"never"
41-
],
42-
"class-methods-use-this": "off",
43-
"comma-dangle": "off",
44-
"comma-spacing": [
45-
"error",
46-
{
47-
"after": true,
48-
"before": false
49-
}
50-
],
51-
"comma-style": [
52-
"error",
53-
"last"
54-
],
55-
"complexity": "error",
56-
"computed-property-spacing": [
57-
"error",
58-
"never"
59-
],
60-
"consistent-return": "off",
61-
"consistent-this": "error",
62-
"curly": "off",
63-
"default-case": "error",
64-
"default-case-last": "error",
65-
"default-param-last": "error",
66-
"dot-location": "error",
67-
"dot-notation": "error",
68-
"eol-last": "off",
69-
"eqeqeq": "off",
70-
"func-call-spacing": "error",
71-
"func-name-matching": "error",
72-
"func-names": "error",
73-
"func-style": [
74-
"error",
75-
"expression"
76-
],
77-
"function-paren-newline": "error",
78-
"generator-star-spacing": "error",
79-
"grouped-accessor-pairs": "error",
80-
"guard-for-in": "off",
81-
"id-denylist": "error",
82-
"id-length": "off",
83-
"id-match": "error",
84-
"implicit-arrow-linebreak": "error",
85-
"indent": "off",
86-
"init-declarations": "off",
87-
"jsx-quotes": "error",
88-
"key-spacing": "error",
89-
"keyword-spacing": [
90-
"error",
91-
{
92-
"after": true,
93-
"before": true
94-
}
95-
],
96-
"line-comment-position": "off",
97-
"linebreak-style": "off",
98-
"lines-around-comment": "error",
99-
"lines-between-class-members": [
100-
"error",
101-
"always"
102-
],
103-
"max-classes-per-file": "off",
104-
"max-depth": "error",
105-
"max-len": "off",
106-
"max-lines": "error",
107-
"max-lines-per-function": "off",
108-
"max-nested-callbacks": "error",
109-
"max-params": "off",
110-
"max-statements": "off",
111-
"max-statements-per-line": "error",
112-
"multiline-comment-style": "off",
113-
"new-parens": "error",
114-
"newline-per-chained-call": "off",
115-
"no-alert": "error",
116-
"no-array-constructor": "off",
117-
"no-await-in-loop": "error",
118-
"no-bitwise": "error",
119-
"no-caller": "error",
120-
"no-confusing-arrow": "error",
121-
"no-console": "off",
122-
"no-constructor-return": "error",
123-
"no-continue": "error",
124-
"no-div-regex": "error",
125-
"no-duplicate-imports": "error",
126-
"no-else-return": "off",
127-
"no-empty-function": "off",
128-
"no-eq-null": "error",
129-
"no-eval": "error",
130-
"no-extend-native": "error",
131-
"no-extra-bind": "error",
132-
"no-extra-label": "error",
133-
"no-extra-parens": "error",
134-
"no-floating-decimal": "error",
135-
"no-implicit-coercion": "error",
136-
"no-implicit-globals": "error",
137-
"no-implied-eval": "error",
138-
"no-inline-comments": "off",
139-
"no-invalid-this": "error",
140-
"no-iterator": "error",
141-
"no-label-var": "error",
142-
"no-labels": "error",
143-
"no-lone-blocks": "error",
144-
"no-lonely-if": "error",
145-
"no-loop-func": "error",
146-
"no-loss-of-precision": "error",
147-
"no-magic-numbers": "off",
148-
"no-mixed-operators": "error",
149-
"no-multi-assign": "error",
150-
"no-multi-spaces": "off",
151-
"no-multi-str": "error",
152-
"no-multiple-empty-lines": "off",
153-
"no-negated-condition": "error",
154-
"no-nested-ternary": "error",
155-
"no-new": "error",
156-
"no-new-func": "error",
157-
"no-new-object": "error",
158-
"no-new-wrappers": "error",
159-
"no-nonoctal-decimal-escape": "error",
160-
"no-octal-escape": "error",
161-
"no-param-reassign": "error",
162-
"no-plusplus": "off",
163-
"no-promise-executor-return": "error",
164-
"no-proto": "error",
165-
"no-restricted-exports": "error",
166-
"no-restricted-globals": "error",
167-
"no-restricted-imports": "off",
168-
"no-restricted-properties": "error",
169-
"no-restricted-syntax": "error",
170-
"no-return-assign": "error",
171-
"no-return-await": "error",
172-
"no-script-url": "error",
173-
"no-self-compare": "error",
174-
"no-sequences": "error",
175-
"no-shadow": "error",
176-
"no-tabs": "error",
177-
"no-template-curly-in-string": "error",
178-
"no-ternary": "off",
179-
"no-throw-literal": "error",
180-
"no-trailing-spaces": "error",
181-
"no-undef-init": "error",
182-
"no-undefined": "off",
183-
"no-underscore-dangle": "off",
184-
"no-unmodified-loop-condition": "error",
185-
"no-unneeded-ternary": "error",
186-
"no-unreachable-loop": "error",
187-
"no-unused-vars": "warn",
188-
"no-unsafe-optional-chaining": "error",
189-
"no-unused-expressions": "off",
190-
"no-use-before-define": "error",
191-
"no-useless-backreference": "error",
192-
"no-useless-call": "error",
193-
"no-useless-computed-key": "error",
194-
"no-useless-concat": "error",
195-
"no-useless-constructor": "error",
196-
"no-useless-rename": "error",
197-
"no-useless-return": "error",
198-
"no-var": "warn",
199-
"no-void": "error",
200-
"no-warning-comments": "error",
201-
"no-whitespace-before-property": "error",
202-
"nonblock-statement-body-position": "error",
203-
"object-curly-newline": "error",
204-
"object-curly-spacing": "off",
205-
"object-property-newline": "off",
206-
"object-shorthand": "error",
207-
"one-var": "off",
208-
"one-var-declaration-per-line": "error",
209-
"operator-assignment": "error",
210-
"operator-linebreak": "error",
211-
"padded-blocks": "off",
212-
"padding-line-between-statements": "error",
213-
"prefer-arrow-callback": "error",
214-
"prefer-const": "error",
215-
"prefer-destructuring": "error",
216-
"prefer-exponentiation-operator": "error",
217-
"prefer-named-capture-group": "error",
218-
"prefer-numeric-literals": "error",
219-
"prefer-object-spread": "error",
220-
"prefer-promise-reject-errors": "error",
221-
"prefer-regex-literals": "error",
222-
"prefer-rest-params": "error",
223-
"prefer-spread": "error",
224-
"prefer-template": "off",
225-
"quote-props": "off",
226-
"quotes": "off",
227-
"radix": "error",
228-
"require-atomic-updates": "error",
229-
"require-await": "error",
230-
"require-unicode-regexp": "error",
231-
"rest-spread-spacing": [
232-
"error",
233-
"never"
234-
],
235-
"semi": [2, "always"],
236-
"semi-spacing": [
237-
"error",
238-
{
239-
"after": true,
240-
"before": false
241-
}
242-
],
243-
"semi-style": [
244-
"error",
245-
"last"
246-
],
247-
"sort-imports": "error",
248-
"sort-keys": "off",
249-
"sort-vars": "error",
250-
"space-before-blocks": "error",
251-
"space-before-function-paren": "off",
252-
"space-in-parens": [
253-
"error",
254-
"never"
255-
],
256-
"space-infix-ops": "error",
257-
"space-unary-ops": "error",
258-
"spaced-comment": [
259-
"off",
260-
"never"
261-
],
262-
"strict": "error",
263-
"switch-colon-spacing": "error",
264-
"symbol-description": "error",
265-
"template-curly-spacing": "error",
266-
"template-tag-spacing": "error",
267-
"unicode-bom": [
268-
"error",
269-
"never"
270-
],
271-
"vars-on-top": "error",
272-
"wrap-iife": "error",
273-
"wrap-regex": "error",
274-
"yield-star-spacing": "error",
275-
"yoda": [
276-
"error",
277-
"never"
278-
]
279-
}
28013
};

0 commit comments

Comments
 (0)