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 6 years ago
parent 4866d6ddb6
commit 93ceeff597

@ -4,30 +4,23 @@
"workspaces": [ "workspaces": [
"packages/*", "packages/*",
"tools/*", "tools/*",
"test",
"website" "website"
], ],
"scripts": { "scripts": {
"lint": "eslint .", "lint": "eslint .",
"spec": "mocha --recursive", "spec": "mocha --recursive",
"benchmark": "benchmark", "benchmark": "node tools/benchmark/node",
"build-parser": "pegjs -c src/pegjs.config.js", "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", "clean": "rimraf packages/pegjs/dist website/js/*-bundle.js examples/*.js",
"impact": "impact master", "impact": "node tools/impact master",
"start": "node website/server.js", "start": "node website/server.js",
"test": "eslint . && nyc mocha --recursive", "test": "eslint . && nyc mocha --recursive",
"coverage": "nyc report --reporter=text-lcov | coveralls" "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": { "devDependencies": {
"coveralls": "3.0.2", "coveralls": "3.0.2",
"dedent": "0.7.0",
"rimraf": "2.6.2", "rimraf": "2.6.2",
"eslint": "5", "eslint": "5",
"eslint-config-futagozaryuu": "5", "eslint-config-futagozaryuu": "5",

@ -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"
}
}

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

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

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

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

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

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

@ -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: From the root of the repository:
```sh ```sh
npx impact <commit> node tools/impact <commit>
npx impact <commit_before> <commit_after> node tools/impact <commit_before> <commit_after>
``` ```

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

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

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

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

Loading…
Cancel
Save