From 3374a601630697e41f3981bfe197cb14741521eb Mon Sep 17 00:00:00 2001 From: Oliver Stolz <73951934+OliverStolzBO@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:33:51 +0200 Subject: [PATCH] Add multi platform support (#28) * Ensure npm watch is executed before browserify - the browserify task depends on the code that is generated by npm watch * Enable code visualization for Windows * Don't remove the media directory - Shell commands for deleting / creating a directory are OS dependent - Therefore, remove the commands and consistently keep the media dir * Add install note for macOS users * Add media directory to repository * Add new release notes --- .gitignore | 1 - .ort.yml | 2 +- .vscode/tasks.json | 8 ++------ README.md | 10 +++++++++- client/package.json | 2 +- client/src/extension.ts | 12 +++++++++--- media/.gitignore | 6 ++++++ package.json | 2 +- server/package.json | 2 +- 9 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 media/.gitignore diff --git a/.gitignore b/.gitignore index b64fa45..54466e0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,5 @@ out node_modules .vscode-test coverage -media client/bundle.js package-lock.json diff --git a/.ort.yml b/.ort.yml index 4f7012e..f817173 100644 --- a/.ort.yml +++ b/.ort.yml @@ -16,7 +16,7 @@ excludes: curations: license_findings: - path: "README.md" - start_lines: 262 + start_lines: 270 line_count: 1 detected_license: "LGPL-2.0-or-later" reason: "DOCUMENTATION_OF" diff --git a/.vscode/tasks.json b/.vscode/tasks.json index e60ef4d..27aac2e 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -34,14 +34,10 @@ "type": "npm", "script": "browserify" }, - { - "type": "shell", - "label": "remove_dot_files", - "command": "rm -rf ./media && mkdir media" - }, { "label": "prepare_and_watch", - "dependsOn": ["browserify", "remove_dot_files", "npm_watch"] + "dependsOrder": "sequence", + "dependsOn": ["npm_watch", "browserify"] } ] } diff --git a/README.md b/README.md index 9ec9c90..43d6d1b 100644 --- a/README.md +++ b/README.md @@ -116,12 +116,16 @@ To install the extension, use the already built extension file in the build fold - [Python](https://www.python.org/) (>= v3.10) - [GraphViz](https://graphviz.org/) (>= v2.42.2) -- Pip packages from requirements.txt(install with `pip install -r requirements.txt`) +- Pip packages from requirements.txt (install with `pip install -r requirements.txt`) + - [ANTLR4](https://github.com/antlr/antlr4) (== v4.9.3) - [antlr-denter](https://github.com/yshavit/antlr-denter) (>=v1.3.1) - [SNAKES](https://github.com/fpom/snakes) (>=v0.9.30) + - (For development only) [NodeJS](https://nodejs.org/en/) (>=v18.17.1) +> **NOTE:** The pip packages must be accessible to the extension. Especially on macOS, consider installing them globally by adding the `--break-system-packages` flag. + ### Install from VSIX file Installing the extension from an already built VSIX file is the easiest and fastest way to test the extension. Find the current version as the artifact of the newest build pipeline in the repository. Then just open the Extensions tab in VS Code and find the dialogue shown in the image below. @@ -257,6 +261,10 @@ Note that the copyright information of this project found by ORT are not complet - Achieve REUSE compliance for the project - Add github workflows +### v0.1.2 + +- Enable multi-platform support + ## License VS Code Extension for the Production Flow Description Language (PFDL) is licensed under the MIT License. See [LICENSE](LICENSE) for details on the licensing terms. diff --git a/client/package.json b/client/package.json index 546dc52..952eee4 100644 --- a/client/package.json +++ b/client/package.json @@ -3,7 +3,7 @@ "description": "The VSCode client that listens for PFDL language server events", "author": "Oliver Stolz and Maximilian Hörstrup", "license": "MIT", - "version": "0.1.0", + "version": "0.1.2", "publisher": "fraunhofer", "repository": { "type": "git", diff --git a/client/src/extension.ts b/client/src/extension.ts index c23d0bb..dfe52de 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -25,7 +25,7 @@ export function activate(context: ExtensionContext) { const fs = require('fs'); // the filepath where the dotfile is saved. Create if not already exists - const mediaPath = __dirname + '/../../media/'; + const mediaPath = path.join(__dirname, '..', '..', 'media'); if (!fs.existsSync(mediaPath)) { fs.mkdir(mediaPath, (err) => { throw err; @@ -254,11 +254,17 @@ export function activate(context: ExtensionContext) { * @returns AN array containing the filename (without ending) and the complete filepath to the dotfile */ function getDotFilenameAndPathFromPfdlFilepath(filepath: string) { + // for Linux / macOS + let pathDivider = '/'; + if (!filepath.includes('/')) { + // for Windows operating systems + pathDivider = '\\'; + } const filename = filepath.substring( - filepath.lastIndexOf('/') + 1, // where the filename starts + filepath.lastIndexOf(pathDivider) + 1, // where the filename starts filepath.length - 5 // cut off the file ending (.pfdl) ); - return [filename, mediaPath + filename + '.dot']; + return [filename, path.join(mediaPath, filename + '.dot')]; } /** diff --git a/media/.gitignore b/media/.gitignore new file mode 100644 index 0000000..3bb12e4 --- /dev/null +++ b/media/.gitignore @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: The PFDL VS Code Extension Contributors +# SPDX-License-Identifier: CC0-1.0 + +# Ignore all files in the media directory except the .gitignore itself +* +!.gitignore diff --git a/package.json b/package.json index 37e9d70..f34e9bc 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "A VS Code extension to support syntax highlighting, formatting and code visualization for the Production Flow Description Language (PFDL) files", "author": "Oliver Stolz and Maximilian Hörstrup", "license": "MIT", - "version": "0.1.0", + "version": "0.1.2", "repository": { "type": "git", "url": "https://github.com/iml130/pfdl-vscode-extension" diff --git a/server/package.json b/server/package.json index 9ede10f..3fc501e 100644 --- a/server/package.json +++ b/server/package.json @@ -1,7 +1,7 @@ { "name": "pfdl-laguage-server", "description": "Implementation of a language server supporting the Production Flow Description Language (PFDL) in node.", - "version": "0.1.0", + "version": "0.1.2", "author": "Oliver Stolz and Maximilian Hörstrup", "license": "MIT", "engines": {