Skip to content

Commit

Permalink
Merge pull request #551 from hildjj/package-extract
Browse files Browse the repository at this point in the history
Move to package-extract.
  • Loading branch information
hildjj authored Sep 23, 2024
2 parents 12e969b + c7f4912 commit 85f1d79
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 57 deletions.
4 changes: 2 additions & 2 deletions lib/compiler/passes/generate-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const asts = require("../asts");
const op = require("../opcodes");
const Stack = require("../stack");
const VERSION = require("../../version");
const { version } = require("../../version");
const { stringEscape, regexpClassEscape } = require("../utils");
const { SourceNode } = require("source-map-generator");
const GrammarLocation = require("../../grammar-location");
Expand Down Expand Up @@ -1425,7 +1425,7 @@ function generateJS(ast, options) {
/** @return {(string|SourceNode)[]} */
function generateGeneratedByComment() {
return [
`// @generated by Peggy ${VERSION}.`,
`// @generated by Peggy ${version}.`,
"//",
"// https://peggyjs.org/",
];
Expand Down
2 changes: 1 addition & 1 deletion lib/peg.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const GrammarLocation = require("./grammar-location");
const asts = require("./compiler/asts.js");
const compiler = require("./compiler");
const parser = require("./parser");
const VERSION = require("./version");
const { version: VERSION } = require("./version");

const RESERVED_WORDS = [
// Reserved keywords as of ECMAScript 2015
Expand Down
9 changes: 3 additions & 6 deletions lib/version.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 21 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"clean": "rimraf -g build browser bin/*.map && mkdir browser",
"parser": "node bin/peggy.js -c src/opts.mjs",
"examples": "node bin/peggy.js -c docs/js/options.js docs/js/examples.peggy",
"set_version": "node ./tools/set_version",
"set_version": "package-extract -o lib/version.js -dcs && package-extract -o docs/index.html -r '(?<=https:\\/\\/unpkg.com\\/peggy@)(?<version>\\d+\\.\\d+\\.\\d+)(?=\\/browser\\/peggy\\.min\\.js)'",
"lint": "eslint .",
"ts": "tsc --build tsconfig.json",
"docs": "cd docs && npm run build",
Expand All @@ -45,16 +45,16 @@
"deploy:tests": "copyfiles -f build/test-bundle.min.js docs/js/",
"deploy:bench": "copyfiles -f build/benchmark-bundle.min.js docs/js/",
"build": "npm run build:notidy && npm run tidy",
"build:notidy": "npm run setup && npm run make && npm run lint && npm run audit",
"setup": "npm run clean && npm run set_version",
"build:notidy": "npm run clean && npm run make && npm run lint && npm run audit",
"make": "npm run parser && npm run ts && npm run rollup && npm run terser && npm run examples && npm run docs && npm run headers && npm run deploy",
"audit": "npm run test && npm run benchmark",
"tidy": "rimraf build",
"start": "cd docs && npm start"
"start": "cd docs && npm start",
"version": "npm run set_version && npm run parser && npm run parser && git add lib/version.js lib/parser.js docs/index.html"
},
"devDependencies": {
"@peggyjs/eslint-config": "^4.0.4",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-commonjs": "^26.0.2",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-multi-entry": "^6.0.1",
"@rollup/plugin-node-resolve": "^15.2.4",
Expand All @@ -71,6 +71,7 @@
"express": "4.21.0",
"glob": "^11.0.0",
"jest": "^29.7.0",
"package-extract": "2.2.0",
"rimraf": "^5.0.10",
"rollup": "^4.22.4",
"rollup-plugin-ignore": "1.0.10",
Expand Down
22 changes: 17 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Pass list of files on command line.

const fs = require("fs");
const version = require("../lib/version.js");
const { version } = require("../lib/version.js");

const header = `\
// peggy ${version}
Expand Down
33 changes: 0 additions & 33 deletions tools/set_version.js

This file was deleted.

0 comments on commit 85f1d79

Please sign in to comment.