Skip to content

Commit ea1bcd8

Browse files
committed
头部下拉列表增加微件 增加dev命令
1 parent 008ed3c commit ea1bcd8

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

build/server.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
const path = require('path');
2+
const express = require('express');
3+
const open = require("open");
4+
const serveIndex = require('serve-index')
5+
6+
7+
const webpack = require('webpack');
8+
const webpackDevMiddleware = require('webpack-dev-middleware');
9+
const product = process.argv[2] || 'leaflet';
10+
const config = require(`./webpack.config.${product}.js`);
11+
const entry = [`./src/${product}/index.js`];
12+
if (['leaflet', 'openlayers'].includes(product)) {
13+
entry.push(`./src/${product}/css/index.js`);
14+
}
15+
config.mode = 'development';
16+
config.entry = entry;
17+
config.output.filename = `iclient9-${product}-es6.js`
18+
config.devtool = 'cheap-module-eval-source-map';
19+
20+
21+
const compiler = webpack(config);
22+
const app = module.exports = express();
23+
const instance = webpackDevMiddleware(compiler, {
24+
publicPath: `/dist/${product}`,
25+
stats: {
26+
colors: true
27+
}
28+
});
29+
app.use(instance);
30+
31+
const server = app.listen(9999, () => {
32+
const host = server.address().address;
33+
const port = server.address().port;
34+
console.log('Example app listening at http://%s:%s', host, port);
35+
});
36+
37+
app.use(express.static('web'));
38+
app.use("/examples/template/header.html", express.static('web/template/header.html'));
39+
app.use("/examples", express.static('examples'), serveIndex('examples'));
40+
app.use("/dist", express.static('dist'), serveIndex('dist'));
41+
app.use("/build", express.static('build'), serveIndex('build'));
42+
app.use("/docs", express.static('docs'), serveIndex('docs'));
43+
app.use("/web", express.static('web'), serveIndex('web'));
44+
45+
app.use("/en/examples/template/header.html", express.static('web/en/web/template/header.html'));
46+
app.use("/en/examples", express.static('examples'), serveIndex('examples'));
47+
app.use("/en/docs", express.static('docs'), serveIndex('docs'));
48+
app.use("/en/dist", express.static('dist'), serveIndex('dist'));
49+
app.use("/en/build", express.static('build'), serveIndex('build'));
50+
app.use("/en", express.static('web/en'), serveIndex('web/en'));
51+
instance.waitUntilValid(() => {
52+
open(`http://localhost:9999/examples/${product}`);
53+
});

examples/locales/en-US/resources.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ window.examplesResources = {
7373
"analysis": "Analysis",
7474
"clientSpatialAnalyst": "Client Spatial Analysis",
7575
"control": "Control",
76+
"widgets": "Widgets",
7677
"OGC": "OGC",
7778
"mapping": "Third Party Map",
7879
"others": "Others",

examples/locales/zh-CN/resources.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ window.examplesResources = {
4545
"analysis": "分析",
4646
"clientSpatialAnalyst": "客户端分析",
4747
"control": "控件",
48+
"widgets": "微件",
4849
"OGC": "OGC",
4950
"mapping": "互联网地图",
5051
"others": "其他",

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"exampletest": "examples-test"
1010
},
1111
"scripts": {
12+
"dev": "node ./build/server.js",
1213
"lint": "eslint src",
1314
"release": "npm run release-leaflet && npm run release-openlayers && npm run release-mapboxgl && npm run release-classic",
1415
"release-leaflet": "npm run release-leaflet-es5 && npm run release-leaflet-es6",
@@ -73,6 +74,7 @@
7374
"eslint": "^4.6.1",
7475
"eslint-loader": "^2.0.0",
7576
"eslint-plugin-import": "^2.8.0",
77+
"express": "^4.16.3",
7678
"extract-text-webpack-plugin": "^4.0.0-beta.0",
7779
"file-loader": "^1.1.11",
7880
"get-pixels": "^3.3.0",
@@ -89,16 +91,19 @@
8991
"karma-jasmine": "^1.1.0",
9092
"karma-teamcity-reporter": "^1.0.0",
9193
"nightwatch": "^0.9.5",
94+
"open": "0.0.5",
9295
"pngjs": "^3.3.0",
9396
"request": "^2.83.0",
9497
"selenium-server": "^2.53.1",
98+
"serve-index": "^1.9.1",
9599
"shelljs": "^0.7.6",
96100
"style-loader": "^0.13.1",
97101
"uglify-es": "^3.3.9",
98102
"url-loader": "^1.0.1",
99103
"watchify": "^3.9.0",
100104
"webpack": "^4.1.1",
101105
"webpack-cli": "^2.0.12",
106+
"webpack-dev-middleware": "^3.2.0",
102107
"webpack-node-externals": "^1.6.0"
103108
},
104109
"dependencies": {

0 commit comments

Comments
 (0)