Rewrite the build script (#852)

* npm install

* Drop remove-modules

* Drop updates

* Refactor: rewrite build script

* Add: BUILD.md

* Add: start-chrome command

* Rebuild vendor

* Update contributing.md

* Update BUILD.md

* Update BUILD.md

Co-authored-by: narcolepticinsomniac <therealdoctorgonzo@gmail.com>
This commit is contained in:
eight 2020-02-15 01:02:57 +08:00 committed by GitHub
parent 9f2261ae95
commit 4831183207
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 896 additions and 918 deletions

View File

@ -211,3 +211,12 @@ rules:
wrap-iife: [2, inside]
yield-star-spacing: [2, {before: true, after: false}]
yoda: [2, never]
overrides:
- files: [tools/*]
env:
node: true
browser: false
webextensions: false
parserOptions:
ecmaVersion: 2017

View File

@ -34,25 +34,9 @@ You can help us translate the extension on [Transifex](https://www.transifex.com
* Make any changes within a branch of this repository (not the `master` branch).
* Submit a pull request and include a reference to the initial issue with the discussion.
## Scripts
## Build scripts
* `npm run lint` - Run ESLint on all JavaScript files.
* `npm run update` - Runs update-node & update-main scripts.
* `npm run update-quick` - Updates development dependencies (uses `npm update`; does not include new dependencies).
* `npm run update-locales` (admin only)- Updates locale files from Transifex. See the [updating locale files section](#updating-locale-files-admin-only) for more details.
* `npm run update-main` - Runs update-versions & update-codemirror.
* `npm run update-node` - Update development dependencies, removes & reinstalls `node_modules` folder (slow).
* `npm run update-transifex` (admin only) - Upload `en/messages.json` source to Transifex.
* `npm run update-vendor` - Update codemirror, codemirror themes & other vendor libraries.
* `npm run update-versions` - Update version of `manifest.json` to match `package.json`.
* `npm run zip` - Run update-versions, then compress required files into a zip file.
## Updating locale files (admin only)
* Make sure you have the Transifex client installed. Follow the instructions on [this page](https://docs.transifex.com/client/installing-the-client).
* Contact another admin if you need the `.transifexrc` file in the root folder. It includes the API key to use Transifex's API.
* Use `npm run update-locales` in the command line to [update the language files](https://docs.transifex.com/client/pull) in the repo.
* Use `npm run update-transifex` in the command line to [upload the source](https://docs.transifex.com/client/push) `en/messages.json` file to Transifex.
See [Build.md](../Build.md) for more information.
## Contact us

68
BUILD.md Normal file
View File

@ -0,0 +1,68 @@
# Build this project
## Preparation
1. Install [Node.js](https://nodejs.org/en/).
2. Go to the project root, run `npm install`. This will install all required dependencies.
Extra preparations are needed if you want to pull locale files from Transifex:
1. Install Transifex client. Follow the instructions on [this page](https://docs.transifex.com/client/installing-the-client).
2. You need a `.transifexrc` file in the root folder. Contact another admin if you need one. It includes the API key to use Transifex's API.
## Generate the ZIP release
Use the following command to generate a ZIP file that can be submitted to AMO or CWS:
```
npm run zip
```
The zip file includes all the files from the repository **except**:
* All dot files (e.g. `.eslintrc` & `.gitignore`).
* `node_modules` folder.
* `tools` folder.
* `package.json` file.
* `package-lock.json` and/or `yarn.lock` file(s).
<!-- FIXME: is this statement still true?
* `vendor/codemirror/lib` files. This path is excluded because it contains a file modified for development purposes only. Instead, the CodeMirror files are copied directly from `node_modules/codemirror/lib`.
-->
## Tag a release/Bump the version
Use the `npm version (major | minor | patch)` command to tag a release.
There are some scripts that will run automatically before/after tagging a version. Includes:
1. Test.
2. Update version number in `manifest.json`.
3. Generate the ZIP file.
4. Push the tag to github.
## Translation
We host locale files (`message.json`) on Transifex. To pull files from Transifex, run
```
npm run update-locales
```
To push files to Transifex:
```
npm run update-transifex
```
## 3rd-party libraries
3rd-party libraries are managed by `npm`. Since Stylus is built with vanilla JS, we only use libraries that can run in the browser.
We keep a copy of these libraries inside the `vendor` directory so users can side-load this repository without executing the build script. These files are downloaded from CDN or pulled from npm (`node_modules`).
To add/update a library to the latest version, run `npm install PACKAGE_NAME@latest`.
To remove a library, run `npm uninstall PACKAGE_NAME`.
After the (un)installation, specify files which should be copied in `tools/build-vendor.js` and run `npm run build-vendor` to rebuild the vendor folder.

934
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -15,26 +15,32 @@
"jsonlint": "^1.6.3",
"less-bundle": "github:openstyles/less-bundle#v0.1.0",
"lz-string-unsafe": "^1.4.4-fork-1",
"rimraf": "^3.0.1",
"make-fetch-happen": "^7.1.1",
"semver-bundle": "^0.1.1",
"shx": "^0.3.2",
"stylelint-bundle": "^8.0.0",
"stylus-lang-bundle": "^0.54.5",
"updates": "^9.3.3",
"sync-version": "^1.0.1",
"tiny-glob": "^0.2.6",
"usercss-meta": "^0.9.0",
"web-ext": "^4.0.0",
"uuid": "^3.4.0",
"web-ext": "^4.1.0",
"webext-tx-fix": "^0.3.3"
},
"scripts": {
"lint": "eslint **/*.js --cache || exit 0",
"update": "npm run update-node && npm run update-main",
"update-quick": "updates -u && npm update && npm run update-main",
"lint": "eslint \"**/*.js\" --cache",
"test": "npm run lint && web-ext lint",
"update-locales": "tx pull --all && webext-tx-fix",
"update-main": "npm run update-versions && npm run update-vendor",
"update-node": "updates -u && node tools/remove-modules.js && npm install",
"update-transifex": "tx push -s",
"update-vendor": "node tools/update-libraries.js && node tools/update-codemirror-themes.js",
"update-versions": "node tools/update-versions",
"zip": "npm run update-versions && node tools/zip.js",
"start": "web-ext run"
"build-vendor": "shx rm -rf vendor/* && node tools/build-vendor",
"zip": "node tools/zip.js",
"start": "web-ext run --bc",
"start-chrome": "web-ext run -t chromium --bc",
"preversion": "npm test",
"version": "sync-version manifest.json && git add .",
"postversion": "npm run zip && git push --follow-tags"
},
"engines": {
"node": ">=10.0.0"
}
}

View File

@ -1,9 +0,0 @@
# https://github.com/eslint/eslint/blob/master/docs/rules/README.md
parserOptions:
ecmaVersion: 2017
env:
browser: true
es6: true
node: true

162
tools/build-vendor.js Normal file
View File

@ -0,0 +1,162 @@
/* eslint-env node */
'use strict';
const path = require('path');
const endent = require('endent');
const fetch = require('make-fetch-happen');
const fse = require('fs-extra');
const glob = require('tiny-glob');
const files = {
'codemirror': [
'addon/comment/comment.js',
'addon/dialog',
'addon/edit/closebrackets.js',
'addon/edit/matchbrackets.js',
'addon/fold/brace-fold.js',
'addon/fold/comment-fold.js',
'addon/fold/foldcode.js',
'addon/fold/foldgutter.*',
'addon/fold/indent-fold.js',
'addon/hint/css-hint.js',
'addon/hint/show-hint.*',
'addon/lint/css-lint.js',
'addon/lint/json-lint.js',
'addon/lint/lint.*',
'addon/scroll/annotatescrollbar.js',
'addon/search/matchesonscrollbar.*',
'addon/search/searchcursor.js',
'addon/selection/active-line.js',
'keymap/*',
'lib/*',
'mode/css',
'mode/javascript',
'mode/stylus',
'theme/*'
],
'jsonlint': [
'lib/jsonlint.js → jsonlint.js',
'README.md → LICENSE'
],
'less-bundle': [
'dist/less.min.js → less.min.js'
],
'lz-string-unsafe': [
'lz-string-unsafe.min.js'
],
'semver-bundle': [
'dist/semver.js → semver.js'
],
'stylelint-bundle': [
'stylelint-bundle.min.js',
'https://github.com/stylelint/stylelint/raw/{VERSION}/LICENSE → LICENSE'
],
'stylus-lang-bundle': [
'stylus.min.js'
],
'usercss-meta': [
'dist/usercss-meta.min.js → usercss-meta.min.js'
],
'db-to-cloud': [
'dist/db-to-cloud.min.js → db-to-cloud.min.js'
],
'uuid': [
'https://bundle.run/uuid@{VERSION}/v4.js → uuid.min.js'
]
};
main().catch(console.error);
async function main() {
for (const pkg in files) {
console.log('\x1b[32m%s\x1b[0m', `Building ${pkg}...`);
// other files
const [fetched, copied] = await buildFiles(pkg, files[pkg]);
// README
await fse.outputFile(`vendor/${pkg}/README.md`, generateReadme(pkg, fetched, copied));
// LICENSE
await copyLicense(pkg);
}
console.log('\x1b[32m%s\x1b[0m', 'updating codemirror themes list...');
await fse.outputFile('edit/codemirror-themes.js', await generateThemeList());
}
async function generateThemeList() {
const themes = (await fse.readdir('vendor/codemirror/theme'))
.filter(name => name.endsWith('.css'))
.map(name => name.replace('.css', ''))
.sort();
return endent`
/* exported CODEMIRROR_THEMES */
// this file is generated by update-codemirror-themes.js
'use strict';
const CODEMIRROR_THEMES = ${JSON.stringify(themes, null, 2)};
`.replace(/"/g, "'") + '\n';
}
async function copyLicense(pkg) {
try {
await fse.access(`vendor/${pkg}/LICENSE`);
return;
} catch (err) {
// pass
}
for (const file of await glob(`node_modules/${pkg}/LICEN[SC]E*`)) {
await fse.copy(file, `vendor/${pkg}/LICENSE`);
return;
}
throw new Error(`cannot find license file for ${pkg}`);
}
async function buildFiles(pkg, patterns) {
const fetchedFiles = [];
const copiedFiles = [];
for (let pattern of patterns) {
pattern = pattern.replace('{VERSION}', require(`${pkg}/package.json`).version);
const [src, dest] = pattern.split(/\s*→\s*/);
if (src.startsWith('http')) {
const content = await (await fetch(src)).text();
await fse.outputFile(`vendor/${pkg}/${dest}`, content);
fetchedFiles.push([src, dest]);
} else {
for (const file of await glob(`node_modules/${pkg}/${src}`)) {
if (dest) {
await fse.copy(file, `vendor/${pkg}/${dest}`);
} else {
await fse.copy(file, path.join('vendor', path.relative('node_modules', file)));
}
copiedFiles.push([path.relative(`node_modules/${pkg}`, file), dest]);
}
}
}
return [fetchedFiles, copiedFiles];
}
function generateReadme(lib, fetched, copied) {
const pkg = require(`${lib}/package.json`);
let txt = `## ${pkg.name} v${pkg.version}\n\n`;
if (fetched.length) {
txt += `Following files are downloaded from HTTP:\n\n${generateList(fetched)}\n\n`;
}
if (copied.length) {
txt += `Following files are copied from npm (node_modules):\n\n${generateList(copied)}\n`;
}
return txt;
}
function generateList(list) {
return list.map(([src, dest]) => {
if (dest) {
return `* ${dest}: ${src}`;
}
return `* ${src}`;
}).join('\n');
}
// Rename CodeMirror$1 -> CodeMirror for development purposes
// FIXME: is this a workaround for old version of codemirror?
// function renameCodeMirrorVariable(filePath) {
// const file = fs.readFileSync(filePath, 'utf8');
// fs.writeFileSync(filePath, file.replace(/CodeMirror\$1/g, 'CodeMirror'));
// }

View File

@ -1,8 +0,0 @@
#!/usr/bin/env node
'use strict';
const fs = require('fs');
const rimraf = require('rimraf');
// See https://github.com/isaacs/rimraf/issues/102#issuecomment-412310309
rimraf('node_modules/!(rimraf|.bin)', fs, () => {});

View File

@ -1,39 +0,0 @@
#!/usr/bin/env node
'use strict';
const fs = require('fs-extra');
const path = require('path');
const endent = require('endent');
// Update theme names list in codemirror-editing-hook.js
async function getThemes() {
const p = path.join(__dirname, '..', 'vendor/codemirror/theme/');
const files = await fs.readdir(p);
return files
.filter(name => name.endsWith('.css'))
.map(name => name.replace('.css', ''))
.sort();
}
async function updateHook(themes) {
const fileName = path.join(__dirname, '..', 'edit/codemirror-themes.js');
fs.writeFile(fileName, endent`
/* exported CODEMIRROR_THEMES */
// this file is generated by update-codemirror-themes.js
'use strict';
const CODEMIRROR_THEMES = ${JSON.stringify(themes, null, 2)};
`.replace(/"/g, "'") + '\n');
}
function exit(err) {
if (err) {
console.error(err);
}
process.exit(err ? 1 : 0);
}
getThemes()
.then(themes => updateHook(themes))
.then(() => console.log('\x1b[32m%s\x1b[0m', 'codemirror themes list updated'))
.catch(exit);

View File

@ -1,129 +0,0 @@
#!/usr/bin/env node
'use strict';
const fs = require('fs-extra');
const path = require('path');
const root = path.join(__dirname, '..');
const files = {
'codemirror': [
'*', // only update existing vendor files
'theme' // update all theme files
],
'jsonlint': [
'lib/jsonlint.js → jsonlint.js'
],
'less-bundle': [
'dist/less.min.js → less.min.js'
],
'lz-string-unsafe': [
'lz-string-unsafe.min.js'
],
'semver-bundle': [
'dist/semver.js → semver.js'
],
'stylelint-bundle': [
'stylelint-bundle.min.js'
],
'stylus-lang-bundle': [
'stylus.min.js'
],
'usercss-meta': [
'dist/usercss-meta.min.js → usercss-meta.min.js'
],
'db-to-cloud': [
'dist/db-to-cloud.min.js → db-to-cloud.min.js'
]
};
async function updateReadme(lib) {
const pkg = await fs.readJson(`${root}/node_modules/${lib}/package.json`);
const file = `${root}/vendor/${lib}/README.md`;
const txt = await fs.readFile(file, 'utf8');
return fs.writeFile(file, txt.replace(/\b([v@])[\d.]+[-\w]*\b/g, `$1${pkg.version}`));
}
function isFolder(fileOrFolder) {
const stat = fs.statSync(fileOrFolder);
return stat.isDirectory();
}
// Rename CodeMirror$1 -> CodeMirror for development purposes
function renameCodeMirrorVariable(filePath) {
const file = fs.readFileSync(filePath, 'utf8');
fs.writeFileSync(filePath, file.replace(/CodeMirror\$1/g, 'CodeMirror'));
}
function updateExisting(lib) {
const libRoot = `${root}/node_modules/`;
const vendorRoot = `${root}/vendor/`;
const folders = [lib];
const process = function () {
if (folders.length) {
const folder = folders.shift();
const folderRoot = `${vendorRoot}${folder}`;
const entries = fs.readdirSync(folderRoot);
entries.forEach(entry => {
if (entry !== 'README.md' && entry !== 'LICENSE') {
// Ignore README.md & LICENSE files
const entryPath = `${folderRoot}/${entry}`;
try {
if (fs.existsSync(entryPath)) {
if (isFolder(entryPath)) {
folders.push(`${folder}/${entry}`);
} else {
fs.copySync(`${libRoot}${folder}/${entry}`, entryPath);
// Remove $1 from "CodeMirror$1" in codemirror.js
if (entry === 'codemirror.js') {
renameCodeMirrorVariable(entryPath);
}
}
}
} catch (err) {
// Show error in case file exists in vendor, but not in node_modules
console.log('\x1b[36m%s\x1b[0m', `"${entryPath}" doesn't exist!`);
}
}
});
}
if (folders.length) {
process();
}
};
process();
}
async function copy(lib, folder) {
const [src, dest] = folder.split(/\s*→\s*/);
try {
if (folder === '*') {
updateExisting(lib);
} else {
await fs.copy(`${root}/node_modules/${lib}/${src}`, `${root}/vendor/${lib}/${dest || src}`);
}
} catch (err) {
exit(err);
}
}
function exit(err) {
if (err) {
console.error(err);
}
process.exit(err ? 1 : 0);
}
Object.keys(files).forEach(lib => {
updateReadme(lib);
files[lib].forEach(folder => {
if (folder === '*') {
updateExisting(lib);
} else {
copy(lib, folder);
}
});
console.log('\x1b[32m%s\x1b[0m', `${lib} files updated`);
});

View File

@ -1,70 +0,0 @@
#!/usr/bin/env node
'use strict';
const fs = require('fs-extra');
const path = require('path');
const root = path.join(__dirname, '..');
const good = '\x1b[32m%s\x1b[0m';
const warn = '\x1b[36m%s\x1b[0m';
function exit(err) {
if (err) {
console.error(err);
}
process.exit(err ? 1 : 0);
}
function verToArray(v) {
return v.replace('v', '').split('.').map(Number);
}
// Simple compare function since we can't require semverCompare here
function compare(v1, v2) {
if (v1 === v2) {
return 0;
}
const [maj1, min1, pat1] = verToArray(v1);
const [maj2, min2, pat2] = verToArray(v2);
const majMatch = maj1 === maj2;
const minMatch = min1 === min2;
if (
maj1 > maj2 ||
majMatch && min1 > min2 ||
majMatch && minMatch && pat1 > pat2
) {
return 1;
}
return -1;
}
async function updateVersions() {
const regexp = /"([v\d.]+)"/;
const manifest = await fs.readFile(`${root}/manifest.json`, 'utf8');
const pkg = await fs.readFile(`${root}/package.json`, 'utf8');
const manifestVersion = manifest.match(regexp);
const pkgVersion = pkg.match(regexp);
if (manifestVersion && pkgVersion) {
const result = compare(manifestVersion[1], pkgVersion[1]);
let match, version, file, str;
if (result === 0) {
return console.log(good, 'Manifest & package versions match');
} else if (result > 0) {
match = pkgVersion;
version = manifestVersion[1];
file = 'package.json';
str = pkg;
} else {
match = manifestVersion;
version = pkgVersion[1];
file = 'manifest.json';
str = manifest;
}
console.log(warn, `Updating ${file} to ${version}`);
str = str.slice(0, match.index + 1) + version + str.slice(match.index + match[1].length + 1);
return fs.writeFile(`${root}/${file}`, str);
}
throw Error(`Error reading ${manifestVersion ? '' : 'manifest.json'} ${pkgVersion ? '' : 'package.json'}`);
}
updateVersions().catch(err => exit(err));

41
vendor/README.md vendored
View File

@ -1,41 +0,0 @@
# Vendor files are populated by the build script:
## What the build script does
Using this repo, run `npm install`... the latest versions of:
* `CodeMirror` (https://github.com/codemirror/CodeMirror) is installed.
* `jsonlint` (https://github.com/zaach/jsonlint) is installed.
* `less` (https://github.com/less/less.js) is installed.
* `lz-string-unsafe` (https://github.com/openstyles/lz-string-unsafe) is installed.
* `semver-bundle` (https://github.com/openstyles/semver-bundle) is installed.
* `stylus-lang` (https://github.com/openstyles/stylus-lang-bundle) is installed.
* `usercss-meta` (https://github.com/StylishThemes/parse-usercss) is installed.
* The necessary build tools are installed; see `devDependencies` in the `package.json`.
## Running the build script
Use `npm run update` to first update the packages in the `node_modules` folder & then update the vendor folder.
The following changes are made:
* `CodeMirror`: Only existing files are updated directly from the `node_modules` folder; see the [CodeMirror readme](codemirror/README.md) for specifics.
* `jsonlint`: The uncompressed `lib/jsonlint.js` is copied directly to `vendor/jsonlint`.
* `less`: The compressed `dist/less.min.js` file is copied directly into `vendor/less`.
* `lz-string-unsafe`: The compressed `lz-string-unsafe.min.js` file is copied directly into `vendor/lz-string-unsafe`.
* `semver-bundle`: The `dist/semver.js` file is copied directly into `vendor/semver`.
* `stylus-lang-bundle`: The `stylus.min.js` file is copied directly into `vendor/stylus-lang-bundle`.
* `usercss-meta`: The `dist/usercss-meta.min.js` file is copied directly into `vendor/usercss-meta`.
## Creating the ZIP
Use `npm run zip`.
This command creates a zip file that includes all the files from the repository **except**:
* All dot files (e.g. `.eslintrc` & `.gitignore`).
* `node_modules` folder.
* `tools` folder.
* `package.json` file.
* `package-lock.json` and/or `yarn.lock` file(s).
* `vendor/codemirror/lib` files. This path is excluded because it contains a file modified for development purposes only. Instead, the CodeMirror files are copied directly from `node_modules/codemirror/lib`.

View File

@ -1,8 +1,3 @@
https://codemirror.net/
https://github.com/codemirror/CodeMirror/blob/master/LICENSE
MIT License
Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others

View File

@ -1,3 +1,97 @@
## CodeMirror v5.51.0
## codemirror v5.51.0
Only files & folders that exist in the `vendor/codemirror` folder are copied from the `node_modules/codemirror` folder. Except all theme files are copied, in case new themes have been added.
Following files are copied from npm (node_modules):
* addon\comment\comment.js
* addon\dialog
* addon\edit\closebrackets.js
* addon\edit\matchbrackets.js
* addon\fold\brace-fold.js
* addon\fold\comment-fold.js
* addon\fold\foldcode.js
* addon\fold\foldgutter.css
* addon\fold\foldgutter.js
* addon\fold\indent-fold.js
* addon\hint\css-hint.js
* addon\hint\show-hint.css
* addon\hint\show-hint.js
* addon\lint\css-lint.js
* addon\lint\json-lint.js
* addon\lint\lint.css
* addon\lint\lint.js
* addon\scroll\annotatescrollbar.js
* addon\search\matchesonscrollbar.css
* addon\search\matchesonscrollbar.js
* addon\search\searchcursor.js
* addon\selection\active-line.js
* keymap\emacs.js
* keymap\sublime.js
* keymap\vim.js
* lib\codemirror.css
* lib\codemirror.js
* mode\css
* mode\javascript
* mode\stylus
* theme\3024-day.css
* theme\3024-night.css
* theme\abcdef.css
* theme\ambiance-mobile.css
* theme\ambiance.css
* theme\ayu-dark.css
* theme\ayu-mirage.css
* theme\base16-dark.css
* theme\base16-light.css
* theme\bespin.css
* theme\blackboard.css
* theme\cobalt.css
* theme\colorforth.css
* theme\darcula.css
* theme\dracula.css
* theme\duotone-dark.css
* theme\duotone-light.css
* theme\eclipse.css
* theme\elegant.css
* theme\erlang-dark.css
* theme\gruvbox-dark.css
* theme\hopscotch.css
* theme\icecoder.css
* theme\idea.css
* theme\isotope.css
* theme\lesser-dark.css
* theme\liquibyte.css
* theme\lucario.css
* theme\material-darker.css
* theme\material-ocean.css
* theme\material-palenight.css
* theme\material.css
* theme\mbo.css
* theme\mdn-like.css
* theme\midnight.css
* theme\monokai.css
* theme\moxer.css
* theme\neat.css
* theme\neo.css
* theme\night.css
* theme\nord.css
* theme\oceanic-next.css
* theme\panda-syntax.css
* theme\paraiso-dark.css
* theme\paraiso-light.css
* theme\pastel-on-dark.css
* theme\railscasts.css
* theme\rubyblue.css
* theme\seti.css
* theme\shadowfox.css
* theme\solarized.css
* theme\ssms.css
* theme\the-matrix.css
* theme\tomorrow-night-bright.css
* theme\tomorrow-night-eighties.css
* theme\ttcn.css
* theme\twilight.css
* theme\vibrant-ink.css
* theme\xq-dark.css
* theme\xq-light.css
* theme\yeti.css
* theme\yonce.css
* theme\zenburn.css

View File

@ -1,9 +1,5 @@
## db-to-cloud v0.4.5
Installed via npm - source code:
Following files are copied from npm (node_modules):
https://github.com/eight04/db-to-cloud/tree/v0.4.5
Bundled code:
https://unpkg.com/db-to-cloud@0.4.5/dist/db-to-cloud.min.js
* db-to-cloud.min.js: dist\db-to-cloud.min.js

View File

@ -1,10 +1,61 @@
https://github.com/zaach/jison
https://github.com/zaach/jsonlint
JSON Lint
=========
A pure [JavaScript version](http://zaach.github.com/jsonlint/) of the service provided at [jsonlint.com](http://jsonlint.com).
## Command line interface
Install jsonlint with npm to use the command line interface:
npm install jsonlint -g
Validate a file like so:
jsonlint myfile.json
or pipe input into stdin:
cat myfile.json | jsonlint
jsonlint will either report a syntax error with details or pretty print the source if it is valid.
### Options
$ jsonlint -h
Usage: jsonlint [file] [options]
file file to parse; otherwise uses stdin
Options:
-v, --version print version and exit
-s, --sort-keys sort object keys
-i, --in-place overwrite the file
-t CHAR, --indent CHAR character(s) to use for indentation [ ]
-c, --compact compact error display
-V, --validate a JSON schema to use for validation
-e, --environment which specification of JSON Schema the validation file uses [json-schema-draft-03]
-q, --quiet do not print the parsed json to STDOUT [false]
-p, --pretty-print force pretty printing even if invalid
Copyright (c) 2009-2014 Zachary Carter
## Module interface
MIT LICENSE
I'm not sure why you wouldn't use the built in `JSON.parse` but you can use jsonlint from a CommonJS module:
var jsonlint = require("jsonlint");
jsonlint.parse('{"creative?": false}');
It returns the parsed object or throws an `Error`.
## Vim Plugins
* [Syntastic](http://www.vim.org/scripts/script.php?script_id=2736)
* [sourcebeautify](http://www.vim.org/scripts/script.php?script_id=4079)
## MIT License
Copyright (C) 2012 Zachary Carter
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View File

@ -1,10 +1,6 @@
## Jsonlint v1.6.3
## jsonlint v1.6.3
Jsonlint installed via npm - source repo:
Following files are copied from npm (node_modules):
https://github.com/zaach/jsonlint/blob/v1.6.3/lib/jsonlint.js
If the link doesn't work, it is likely that the npm version and the release versions don't match:
- https://www.npmjs.com/package/jsonlint
- https://github.com/zaach/jsonlint/releases
* jsonlint.js: lib\jsonlint.js
* LICENSE: README.md

View File

@ -1,5 +1,5 @@
## less-bundle v0.1.0
less-bundle installed via npm - source repo:
Following files are copied from npm (node_modules):
https://github.com/openstyles/less-bundle/raw/v0.1.0/dist/less.min.js
* less.min.js: dist\less.min.js

View File

@ -1,23 +1,13 @@
http://pieroxy.net/blog/pages/lz-string/index.html
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
https://github.com/pieroxy/lz-string/blob/master/LICENSE.txt
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
Copyright (c) 2013 Pieroxy <pieroxy@pieroxy.net>
This work is free. You can redistribute it and/or modify it
under the terms of the WTFPL, Version 2
For more information see LICENSE.txt or http://www.wtfpl.net/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
For more information, the home page:
http://pieroxy.net/blog/pages/lz-string/testing.html
LZ-based compression algorithm, version 1.4.4
Copyright (c) 2013 Pieroxy <pieroxy@pieroxy.net>
This work is free. You can redistribute it and/or modify it
under the terms of the WTFPL, Version 2
For more information see LICENSE.txt or http://www.wtfpl.net/
For more information, the home page:
http://pieroxy.net/blog/pages/lz-string/testing.html
LZ-based compression algorithm, version 1.4.4
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -1,5 +1,5 @@
## Lz-string-unsafe v1.4.4-fork-1
## lz-string-unsafe v1.4.4-fork-1
lz-string-unsafe installed via npm - source repo:
Following files are copied from npm (node_modules):
https://github.com/openstyles/lz-string-unsafe/blob/v1.4.4-fork-1/lz-string-unsafe.min.js
* lz-string-unsafe.min.js

View File

@ -1,8 +1,3 @@
https://github.com/openstyles/semver-bundle
https://github.com/openstyles/semver-bundle/blob/master/LICENSE
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors

View File

@ -1,5 +1,5 @@
## Semver-bundle v0.1.1
## semver-bundle v0.1.1
semver-bundle installed via npm - source repo:
Following files are copied from npm (node_modules):
https://github.com/openstyles/semver-bundle/blob/v0.1.1/dist/semver.js
* semver.js: dist\semver.js

View File

@ -1,12 +1,6 @@
https://github.com/stylelint/stylelint
https://github.com/openstyles/stylelint-bundle/tree/v8.0.0
https://github.com/stylelint/stylelint/blob/master/LICENSE
The MIT License (MIT)
Copyright (c) 2015 - present Maxime Thirouin, David Clark & Richard Hallows
Copyright (c) 2015 - 2017 Maxime Thirouin, David Clark & Richard Hallows
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

View File

@ -1,5 +1,9 @@
## Stylelint-bundle v8.0.0
## stylelint-bundle v8.0.0
stylelint-bundle installed via npm - source repo:
Following files are downloaded from HTTP:
https://github.com/openstyles/stylelint-bundle/blob/v8.0.0/stylelint-bundle.min.js
* LICENSE: https://github.com/stylelint/stylelint/raw/8.0.0/LICENSE
Following files are copied from npm (node_modules):
* stylelint-bundle.min.js

View File

@ -1,11 +1,4 @@
http://stylus-lang.com/
https://github.com/stylus/stylus/
https://github.com/openstyles/stylus-lang-bundle
https://github.com/openstyles/stylus-lang-bundle/blob/master/LICENSE
The MIT License
(The MIT License)
Copyright (c) Automattic <developer.wordpress.com>

View File

@ -1,5 +1,5 @@
## Stylus-lang-bundle v0.54.5
## stylus-lang-bundle v0.54.5
stylus-lang-bundle installed via npm - source repo:
Following files are copied from npm (node_modules):
https://github.com/openstyles/stylus-lang-bundle/blob/v0.54.5/stylus.min.js
* stylus.min.js

View File

@ -1,5 +1,5 @@
## usercss-meta v0.9.0
usercss-meta installed via npm - source repo:
Following files are copied from npm (node_modules):
https://unpkg.com/usercss-meta@0.9.0/dist/usercss-meta.min.js
* usercss-meta.min.js: dist\usercss-meta.min.js

View File

@ -1,9 +1,6 @@
## uuid v3.3.3
## uuid v3.4.0
Installed via npm - source code:
Following files are downloaded from HTTP:
https://github.com/kelektiv/node-uuid/tree/v3.3.3
* uuid.min.js: https://bundle.run/uuid@3.4.0/v4.js
Bundled code:
https://bundle.run/uuid@3.3.3/v4.js