This is an automated email from the ASF dual-hosted git repository. erisu pushed a commit to branch chore/improve-ci-test-build in repository https://gitbox.apache.org/repos/asf/cordova-node-xcode.git
commit 322823463301e5c032c2999a7e3fa97e4bd8b978 Author: Erisu <[email protected]> AuthorDate: Fri Jun 12 15:55:53 2026 +0900 chore: create npm build run-script --- bin/generate-pbxproj-parser.js | 60 ++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/bin/generate-pbxproj-parser.js b/bin/generate-pbxproj-parser.js new file mode 100644 index 0000000..70581b3 --- /dev/null +++ b/bin/generate-pbxproj-parser.js @@ -0,0 +1,60 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +const fs = require('node:fs'); +const path = require('node:path'); +const peg = require('pegjs'); + +const ROOT_DIR = path.join(__dirname, '..'); +const parserDir = path.join(ROOT_DIR, 'lib/parser'); + +// Path to grammar file +const grammarFilePath = path.join(parserDir, 'pbxproj.pegjs'); +// Path to where the parser file is outputted +const outputFilePath = path.join(parserDir, 'pbxproj.js'); + +// Fetches the grammar file content and builds the output data. +const grammarData = fs.readFileSync(grammarFilePath, 'utf8'); +const outputData = peg.generate(grammarData, { + output: 'source', + format: 'commonjs' +}); + +const asfLicenseHeader = `/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ +`; + +// Append the Apache license header to the top of the built file. +fs.writeFileSync(outputFilePath, `${asfLicenseHeader}${outputData}`); diff --git a/package.json b/package.json index 1cabde2..a55f3a3 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "pegjs": "^0.10.0" }, "scripts": { - "pegjs": "node_modules/.bin/pegjs lib/parser/pbxproj.pegjs", + "build": "node bin/generate-pbxproj-parser.js", "lint": "eslint .", "lint:fix": "npm run lint -- --fix", "test": "node --test --experimental-test-coverage --test-reporter=spec --test-reporter=lcov --test-reporter-destination=stdout --test-reporter-destination=lcov.info" --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
