This commit is contained in:
25
node_modules/@mapbox/mapbox-gl-style-spec/bin/gl-style-composite.js
generated
vendored
Executable file
25
node_modules/@mapbox/mapbox-gl-style-spec/bin/gl-style-composite.js
generated
vendored
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// @flow
|
||||
/* eslint-disable no-process-exit */
|
||||
|
||||
import fs from 'fs';
|
||||
import minimist from 'minimist';
|
||||
|
||||
/* eslint import/no-unresolved: [error, { ignore: ['^@mapbox/mapbox-gl-style-spec$'] }] */
|
||||
/* $FlowFixMe[cannot-resolve-module] */
|
||||
import {format, composite} from '@mapbox/mapbox-gl-style-spec';
|
||||
|
||||
const argv = minimist(process.argv.slice(2));
|
||||
|
||||
if (argv.help || argv.h || (!argv._.length && process.stdin.isTTY)) {
|
||||
help();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
console.log(format(composite(JSON.parse(fs.readFileSync(argv._[0]).toString()))));
|
||||
|
||||
function help() {
|
||||
console.log('usage:');
|
||||
console.log(' gl-style-composite style.json');
|
||||
}
|
||||
30
node_modules/@mapbox/mapbox-gl-style-spec/bin/gl-style-format.js
generated
vendored
Executable file
30
node_modules/@mapbox/mapbox-gl-style-spec/bin/gl-style-format.js
generated
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// @flow
|
||||
/* eslint-disable no-process-exit */
|
||||
|
||||
import fs from 'fs';
|
||||
import minimist from 'minimist';
|
||||
|
||||
/* eslint import/no-unresolved: [error, { ignore: ['^@mapbox/mapbox-gl-style-spec$'] }] */
|
||||
/* $FlowFixMe[cannot-resolve-module] */
|
||||
import {format} from '@mapbox/mapbox-gl-style-spec';
|
||||
|
||||
const argv = minimist(process.argv.slice(2));
|
||||
|
||||
if (argv.help || argv.h || (!argv._.length && process.stdin.isTTY)) {
|
||||
help();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
console.log(format(JSON.parse(fs.readFileSync(argv._[0]).toString()), argv.space));
|
||||
|
||||
function help() {
|
||||
console.log('usage:');
|
||||
console.log(' gl-style-format source.json > destination.json');
|
||||
console.log('');
|
||||
console.log('options:');
|
||||
console.log(' --space <num>');
|
||||
console.log(' Number of spaces in output (default "2")');
|
||||
console.log(' Pass "0" for minified output.');
|
||||
}
|
||||
25
node_modules/@mapbox/mapbox-gl-style-spec/bin/gl-style-migrate.js
generated
vendored
Executable file
25
node_modules/@mapbox/mapbox-gl-style-spec/bin/gl-style-migrate.js
generated
vendored
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// @flow
|
||||
/* eslint-disable no-process-exit */
|
||||
|
||||
import fs from 'fs';
|
||||
import minimist from 'minimist';
|
||||
|
||||
/* eslint import/no-unresolved: [error, { ignore: ['^@mapbox/mapbox-gl-style-spec$'] }] */
|
||||
/* $FlowFixMe[cannot-resolve-module] */
|
||||
import {format, migrate} from '@mapbox/mapbox-gl-style-spec';
|
||||
|
||||
const argv = minimist(process.argv.slice(2));
|
||||
|
||||
if (argv.help || argv.h || (!argv._.length && process.stdin.isTTY)) {
|
||||
help();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
console.log(format(migrate(JSON.parse(fs.readFileSync(argv._[0]).toString()))));
|
||||
|
||||
function help() {
|
||||
console.log('usage:');
|
||||
console.log(' gl-style-migrate source.json > destination.json');
|
||||
}
|
||||
57
node_modules/@mapbox/mapbox-gl-style-spec/bin/gl-style-validate.js
generated
vendored
Executable file
57
node_modules/@mapbox/mapbox-gl-style-spec/bin/gl-style-validate.js
generated
vendored
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// @flow
|
||||
/* eslint-disable no-process-exit */
|
||||
|
||||
import rw from 'rw';
|
||||
import minimist from 'minimist';
|
||||
|
||||
/* eslint import/no-unresolved: [error, { ignore: ['^@mapbox/mapbox-gl-style-spec$'] }] */
|
||||
/* $FlowFixMe[cannot-resolve-module] */
|
||||
import {validate, validateMapboxApiSupported} from '@mapbox/mapbox-gl-style-spec';
|
||||
|
||||
const argv = minimist(process.argv.slice(2), {
|
||||
boolean: ['json', 'mapbox-api-supported'],
|
||||
});
|
||||
|
||||
let status = 0;
|
||||
|
||||
if (argv.help || argv.h || (!argv._.length && process.stdin.isTTY)) {
|
||||
help();
|
||||
process.exit(status);
|
||||
}
|
||||
|
||||
if (!argv._.length) {
|
||||
argv._.push('/dev/stdin');
|
||||
}
|
||||
|
||||
argv._.forEach((file) => {
|
||||
let errors = [];
|
||||
if (argv['mapbox-api-supported']) {
|
||||
errors = validateMapboxApiSupported(rw.readFileSync(file, 'utf8'));
|
||||
} else {
|
||||
errors = validate(rw.readFileSync(file, 'utf8'));
|
||||
}
|
||||
if (errors.length) {
|
||||
if (argv.json) {
|
||||
process.stdout.write(JSON.stringify(errors, null, 2));
|
||||
} else {
|
||||
errors.forEach((e) => {
|
||||
console.log('%s:%d: %s', file, e.line, e.message);
|
||||
});
|
||||
}
|
||||
status = 1;
|
||||
}
|
||||
});
|
||||
|
||||
process.exit(status);
|
||||
|
||||
function help() {
|
||||
console.log('usage:');
|
||||
console.log(' gl-style-validate file.json');
|
||||
console.log(' gl-style-validate < file.json');
|
||||
console.log('');
|
||||
console.log('options:');
|
||||
console.log('--json output errors as json');
|
||||
console.log('--mapbox-api-supported validate compatibility with Mapbox Styles API');
|
||||
}
|
||||
Reference in New Issue
Block a user