Skip to content

Commit

Permalink
feat(#288): integrate eo2js with eoc
Browse files Browse the repository at this point in the history
  • Loading branch information
maxonfjvipon committed May 31, 2024
1 parent 026ef43 commit 84fd4d7
Show file tree
Hide file tree
Showing 24 changed files with 506 additions and 73 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/itest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
java: [11, 18]
node: [12, 16]
lang: [Java, JavaScript]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -50,9 +51,9 @@ jobs:
p=0.36.0
t=0.36.0
node ../src/eoc.js "--parser=$p" "--home-tag=$t" --batch \
dataize program
"-l=${{ matrix.lang }}" dataize program
node ../src/eoc.js "--parser=$p" "--home-tag=$t" --alone \
--batch dataize program
"-l=${{ matrix.lang }}" --batch dataize program
node ../src/eoc.js clean
node ../src/eoc.js "--parser=$p" "--home-tag=$t" --batch \
test
"-l=${{ matrix.lang }}" test
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.github/
.pdd
.rultor.yml
Gruntfile.js
Gruntfile.eo2jsw
test/
node_modules/
temp/
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ First, run `npm install`. Then, run `grunt`. All tests should pass.
If you want to run a single test:

```bash
npm test -- test/test_mvnw.js
npm test -- test/test_mvnw.eo2jsw
```

Make your changes and then
Expand All @@ -82,6 +82,6 @@ a pull request.

[npm]: https://www.npmjs.com/package/eolang
[java-se]: https://www.oracle.com/java/technologies/downloads/
[npm-install]: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
[npm-install]: https://docs.npmjs.com/downloading-and-installing-node-eo2jsw-and-npm
[dot]: https://en.wikipedia.org/wiki/DOT_%28graph_description_language%29
[blog]: https://www.yegor256.com/2021/10/21/objectionary.html
69 changes: 69 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
],
"dependencies": {
"colors": "1.4.0",
"eo2js": "0.0.5",
"commander": "12.0.0",
"fast-xml-parser": "4.3.6",
"node": "22.1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/compile.js → src/commands/java/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
*/

const rel = require('relative');
const {mvnw, flags} = require('../mvnw');
const {mvnw, flags} = require('../../mvnw');
const path = require('path');

/**
* Command to compile target language into binaries.
* @param {Hash} opts - All options
* @param {Object} opts - All options
* @return {Promise} of compile task
*/
module.exports = function(opts) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/dataize.js → src/commands/java/dataize.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const path = require('path');
* Runs the single executable binary.
* @param {String} obj - Name of object to dataize
* @param {Array} args - Arguments
* @param {Hash} opts - All options
* @param {Object} opts - All options
*/
module.exports = function(obj, args, opts) {
const params = [
Expand Down
4 changes: 2 additions & 2 deletions src/commands/link.js → src/commands/java/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
*/

const rel = require('relative');
const {mvnw, flags} = require('../mvnw');
const {mvnw, flags} = require('../../mvnw');
const path = require('path');

/**
* Command to link binaries into a single executable binary.
* @param {Hash} opts - All options
* @param {Object} opts - All options
* @return {Promise} of link task
*/
module.exports = function(opts) {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/test.js → src/commands/java/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
* SOFTWARE.
*/

const {mvnw, flags} = require('../mvnw');
const {mvnw, flags} = require('../../mvnw');

/**
* Command to run all available unit tests.
* @param {Hash} opts - All options
* @param {Object} opts - All options
* @return {Promise} of compile task
*/
module.exports = function(opts) {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/transpile.js → src/commands/java/transpile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
*/

const rel = require('relative');
const {mvnw, flags} = require('../mvnw');
const {mvnw, flags} = require('../../mvnw');
const path = require('path');

/**
* Command to transpile XMIR files into target language.
* @param {Hash} opts - All options
* @param {Object} opts - All options
* @return {Promise} of transpile task
*/
module.exports = function(opts) {
Expand Down
35 changes: 35 additions & 0 deletions src/commands/js/compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2022-2024 Objectionary.com
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

/**
* Command to compile target language into binaries.
* @param {Object} opts - All options
* @return {Promise} of compile task
*/
module.exports = function(opts) {
return new Promise((resolve, reject) => {
console.info('Compile step is skipped for JavaScript');
resolve(opts);
});
};
39 changes: 39 additions & 0 deletions src/commands/js/dataize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2022-2024 Objectionary.com
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

const eo2jsw = require('../../eo2jsw');

/**
* Runs the single executable binary.
* @param {String} obj - Name of object to dataize
* @param {Array} args - Arguments
* @param {Object} opts - All options
* @return {Promise} of executed command
*/
module.exports = function(obj, args, opts) {
return eo2jsw(
['dataize', obj, ...args.filter((arg) => !arg.startsWith('-'))].join(' '),
{...opts, alone: true, project: 'project'}
);
};
41 changes: 41 additions & 0 deletions src/commands/js/link.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2022-2024 Objectionary.com
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

const rel = require('relative');
const path = require('path');
const eo2jsw = require('../../eo2jsw');
const {program} = require('commander');

/**
* Command to create and build NPM project.
* @param {Object} opts - All options
* @return {Promise} of link task
*/
module.exports = function(opts) {
const tests = program.args[0] === 'test' || !!opts.tests;
return eo2jsw('link', {...opts, alone: true, project: 'project', tests}).then((r) => {
console.info(`NPM project generated in ${rel(path.resolve(opts.target, 'project'))}`);
return r;
});
};
34 changes: 34 additions & 0 deletions src/commands/js/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2022-2024 Objectionary.com
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

const eo2jsw = require('../../eo2jsw');

/**
* Command to run all available unit tests.
* @param {Object} opts - All options
* @return {Promise} of compile task
*/
module.exports = function(opts) {
return eo2jsw('test', {...opts, alone: true, project: 'project'});
};
Loading

0 comments on commit 84fd4d7

Please sign in to comment.