@unvt/charites 0.1.3 → 0.1.4
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/README.md
CHANGED
package/dist/cli/serve.js
CHANGED
|
@@ -15,10 +15,12 @@ program
|
|
|
15
15
|
.description('serve your map locally')
|
|
16
16
|
.option('--provider [provider]', 'your map service. e.g. `mapbox`, `geolonia`')
|
|
17
17
|
.option('--mapbox-access-token [mapboxAccessToken]', 'Access Token for the Mapbox')
|
|
18
|
+
.option('--port [port]', 'Specify custom port')
|
|
18
19
|
.action((source, serveOptions) => {
|
|
19
20
|
const options = program.opts();
|
|
20
21
|
options.provider = serveOptions.provider;
|
|
21
22
|
options.mapboxAccessToken = serveOptions.mapboxAccessToken;
|
|
23
|
+
options.port = serveOptions.port;
|
|
22
24
|
if (!fs_1.default.existsSync(defaultValues_1.defaultSettings.configFile)) {
|
|
23
25
|
fs_1.default.writeFileSync(defaultValues_1.defaultSettings.configFile, `provider: ${options.provider || 'default'}`);
|
|
24
26
|
}
|
package/dist/commands/serve.js
CHANGED
|
@@ -14,7 +14,10 @@ const yaml_parser_1 = require("../lib/yaml-parser");
|
|
|
14
14
|
const validate_style_1 = require("../lib/validate-style");
|
|
15
15
|
const defaultValues_1 = require("../lib/defaultValues");
|
|
16
16
|
function serve(source, options) {
|
|
17
|
-
|
|
17
|
+
let port = process.env.PORT || 8080;
|
|
18
|
+
if (options.port) {
|
|
19
|
+
port = Number(options.port);
|
|
20
|
+
}
|
|
18
21
|
let sourcePath = path_1.default.resolve(process.cwd(), source);
|
|
19
22
|
let provider = defaultValues_1.defaultValues.provider;
|
|
20
23
|
if (options.provider) {
|
|
@@ -87,9 +87,10 @@ Realtime editor on browser
|
|
|
87
87
|
Options:
|
|
88
88
|
--provider [provider] your map service. e.g. `mapbox`, `geolonia`
|
|
89
89
|
--mapbox-access-token [mapboxAccessToken] Access Token for the Mapbox
|
|
90
|
+
--port [port] Specify custom port
|
|
90
91
|
-h, --help display help for command
|
|
91
92
|
|
|
92
|
-
Charites has
|
|
93
|
+
Charites has three options for `serve` command.
|
|
93
94
|
|
|
94
95
|
- `--provider` - `mapbox`, `geolonia`, or `default`. When not specified, default or the value in the configuration file will be used.
|
|
95
96
|
|
|
@@ -97,3 +98,5 @@ Charites has two options for `serve` command.
|
|
|
97
98
|
- `geolonia` and `default` - the format linter runs against the MapLibre GL JS compatible specification.
|
|
98
99
|
|
|
99
100
|
- `--mapbox-access-token` - Set your access-token when styling for Mapbox.
|
|
101
|
+
|
|
102
|
+
- `--port` - Set http server's port number. When not specified, use 8080 port.
|
package/package.json
CHANGED
package/src/cli/serve.ts
CHANGED
|
@@ -17,10 +17,12 @@ program
|
|
|
17
17
|
'--mapbox-access-token [mapboxAccessToken]',
|
|
18
18
|
'Access Token for the Mapbox',
|
|
19
19
|
)
|
|
20
|
+
.option('--port [port]', 'Specify custom port')
|
|
20
21
|
.action((source: string, serveOptions: serveOptions) => {
|
|
21
22
|
const options: serveOptions = program.opts()
|
|
22
23
|
options.provider = serveOptions.provider
|
|
23
24
|
options.mapboxAccessToken = serveOptions.mapboxAccessToken
|
|
25
|
+
options.port = serveOptions.port
|
|
24
26
|
if (!fs.existsSync(defaultSettings.configFile)) {
|
|
25
27
|
fs.writeFileSync(
|
|
26
28
|
defaultSettings.configFile,
|
package/src/commands/serve.ts
CHANGED
|
@@ -12,10 +12,14 @@ import { defaultValues } from '../lib/defaultValues'
|
|
|
12
12
|
export interface serveOptions {
|
|
13
13
|
provider?: string
|
|
14
14
|
mapboxAccessToken?: string
|
|
15
|
+
port?: string
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export function serve(source: string, options: serveOptions) {
|
|
18
|
-
|
|
19
|
+
let port = process.env.PORT || 8080
|
|
20
|
+
if (options.port) {
|
|
21
|
+
port = Number(options.port)
|
|
22
|
+
}
|
|
19
23
|
let sourcePath = path.resolve(process.cwd(), source)
|
|
20
24
|
|
|
21
25
|
let provider = defaultValues.provider
|