Browse Source

General QOL changes

- Added 'test/package.json' for dependencies used by spec tests
- Changed package names of local tools to reflect actual usage
- Removed bins for local tools (using files via 'node [file]' command)
- Updated help text for the CLIs of local tools to reflect changes
- Updated READMEs for tools
- Moved babel dependencies to 'tools/bundle/package.json'
- 'tools/bundle' now only logs created and watching
- Updated scripts in root package.json
master
Futago-za Ryuu 3 years ago
parent
commit
93ceeff597
  1. 15
      package.json
  2. 10
      test/package.json
  3. 2
      tools/benchmark/README.md
  4. 13
      tools/benchmark/node.js
  5. 5
      tools/benchmark/package.json
  6. 2
      tools/bundle/create-pegjs-dist.js
  7. 10
      tools/bundle/index.js
  8. 5
      tools/bundle/package.json
  9. 4
      tools/impact/README.md
  10. 8
      tools/impact/index.js
  11. 3
      tools/impact/package.json
  12. 2
      website/package.json
  13. 2
      website/server.js

15
package.json

@ -4,30 +4,23 @@
"workspaces": [
"packages/*",
"tools/*",
"test",
"website"
],
"scripts": {
"lint": "eslint .",
"spec": "mocha --recursive",
"benchmark": "benchmark",
"benchmark": "node tools/benchmark/node",
"build-parser": "pegjs -c src/pegjs.config.js",
"generate-dist": "bundle",
"generate-dist": "node tools/bundle/create-pegjs-dist",
"clean": "rimraf packages/pegjs/dist website/js/*-bundle.js examples/*.js",
"impact": "impact master",
"impact": "node tools/impact master",
"start": "node website/server.js",
"test": "eslint . && nyc mocha --recursive",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"dependencies": {
"@babel/core": "~7.1.0",
"@babel/preset-env": "~7.1.0",
"chai": "4.2.0",
"chai-like": "1.1.1",
"sinon": "7.1.0"
},
"devDependencies": {
"coveralls": "3.0.2",
"dedent": "0.7.0",
"rimraf": "2.6.2",
"eslint": "5",
"eslint-config-futagozaryuu": "5",

10
test/package.json

@ -0,0 +1,10 @@
{
"name": "@pegjs/spec-suite",
"version": "0.11.0",
"private": true,
"dependencies": {
"chai": "4.2.0",
"chai-like": "1.1.1",
"sinon": "7.1.0"
}
}

2
tools/benchmark/README.md

@ -3,5 +3,5 @@ This directory contains the benchmark suite that measures the speed of parsers g
From the root of the repository:
```sh
npx benchmark
node tools/benchmark/node
```

13
tools/benchmark/node.js

@ -1,5 +1,3 @@
#!/usr/bin/env node
"use strict";
const Runner = require( "./runner.js" );
@ -91,15 +89,14 @@ function writeTableFooter() {
function printHelp() {
console.log( "Usage: run [options]" );
console.log( "Usage:" );
console.log( "" );
console.log( "Runs PEG.js benchmark suite." );
console.log( " node tools/benchmark [options]" );
console.log( "" );
console.log( "Options:" );
console.log( " -n, --run-count <n> number of runs (default: 10)" );
console.log( " --cache make tested parsers cache results" );
console.log( " -o, --optimize <goal> select optimization for speed or size (default:" );
console.log( " speed)" );
console.log( " -n, --run-count <n> number of runs (default: 10)" );
console.log( " --cache make tested parsers cache results" );
console.log( " -o, --optimize <goal> select optimization for speed or size (default: speed)" );
}

5
tools/benchmark/package.json

@ -1,6 +1,5 @@
{
"name": "benchmark",
"name": "@pegjs/benchmark-suite",
"version": "3.1.0",
"private": true,
"bin": "node.js"
"private": true
}

2
tools/bundle/create-pegjs-dist.js

@ -1,5 +1,3 @@
#!/usr/bin/env node
"use strict";
const bundle = require( "./index" );

10
tools/bundle/index.js

@ -92,13 +92,11 @@ module.exports = bundle => {
if ( bundle.watch !== true ) {
log( `@pegjs/bundle > bundling ${ pp( config.input ) }` );
return rollup.rollup( config )
.then( bundle => bundle.write( config.output ) )
.then( () => {
log( `@pegjs/bundle > created ${ pp( bundle.target ) }` );
log( `@pegjs/bundle-generator > created ${ pp( bundle.target ) }` );
} )
.catch( handleError );
@ -113,11 +111,11 @@ module.exports = bundle => {
switch ( event.code ) {
case "BUNDLE_START":
log( `@pegjs/bundle > watching ${ pp( event.input ) }` );
log( `@pegjs/bundle-generator > watching ${ pp( event.input ) }` );
break;
case "BUNDLE_END":
log( `@pegjs/bundle > created ${ pp( event.output ) } in ${ ms( event.duration ) }` );
log( `@pegjs/bundle-generator > created ${ pp( event.output ) } in ${ ms( event.duration ) }` );
break;
case "ERROR":
@ -125,7 +123,7 @@ module.exports = bundle => {
break;
case "FATAL":
console.error( "@pegjs/bundle > Fatel Error!" );
console.error( "@pegjs/bundle-generator > Fatel Error!" );
handleError( event.error );
break;

5
tools/bundle/package.json

@ -1,10 +1,11 @@
{
"name": "bundle",
"name": "@pegjs/bundle-generator",
"version": "2.1.0",
"private": true,
"main": "index.js",
"bin": "create-pegjs-dist.js",
"dependencies": {
"@babel/core": "~7.1.0",
"@babel/preset-env": "~7.1.0",
"dedent": "0.7.0",
"pretty-ms": "4.0.0",
"rollup": "0.66.6",

4
tools/impact/README.md

@ -3,6 +3,6 @@ This directory contains a tool used on the PEG.js repository that measures the i
From the root of the repository:
```sh
npx impact <commit>
npx impact <commit_before> <commit_after>
node tools/impact <commit>
node tools/impact <commit_before> <commit_after>
```

8
tools/impact/index.js

@ -1,5 +1,3 @@
#!/usr/bin/env node
//
// Measures impact of a Git commit (or multiple commits) on generated parsers
// speed and size. Makes sense to use only on PEG.js git repository checkout.
@ -132,8 +130,8 @@ if ( argv.length === 1 ) {
Usage:
test/impact <commit>
test/impact <commit_before> <commit_after>
node tools/impact <commit>
node tools/impact <commit_before> <commit_after>
Measures impact of a Git commit (or multiple commits) on generated parser's
speed and size. Makes sense to use only on PEG.js Git repository checkout.
@ -170,7 +168,7 @@ print_empty_line();
console.log( dedent`
test/impact ${ commit_before } ${ commit_after }
node tools/impact ${ commit_before } ${ commit_after }
Speed impact
------------

3
tools/impact/package.json

@ -1,8 +1,7 @@
{
"name": "impact",
"name": "@pegjs/commit-impact",
"version": "2.1.0",
"private": true,
"bin": "index.js",
"dependencies": {
"dedent": "0.7.0",
"glob": "7.1.3"

2
website/package.json

@ -1,5 +1,5 @@
{
"name": "pegjs-website",
"name": "@pegjs/website",
"version": "1.3.0",
"private": true,
"dependencies": {

2
website/server.js

@ -1,7 +1,7 @@
"use strict";
const bodyParser = require( "body-parser" );
const bundle = require( "bundle" );
const bundle = require( "@pegjs/bundle-generator" );
const express = require( "express" );
const layout = require( "express-layout" );
const logger = require( "morgan" );

Loading…
Cancel
Save