I am currently trying to adapt the paths used in one of my project to be used in any OS. Those paths are inside a JSON file (package.json), the parts I want to modify are the keys build and start inside the scripts key :
{"name": "cesiumtest","version": "1.0.0","main": "index.js","scripts": {"build": "node_modules\\.bin\\webpack --config webpack.config.js","start": "node_modules\\.bin\\webpack-dev-server --config webpack.config.js --open" },"author": "JulienL","license": "ISC","description": "","devDependencies": {"cesium": "^1.118.2","copy-webpack-plugin": "^12.0.2","css-loader": "^7.1.2","html-webpack-plugin": "^5.6.0","style-loader": "^4.0.0","url-loader": "^4.1.1","vite": "^5.4.2","webpack": "^5.91.0","webpack-cli": "^5.1.4","webpack-dev-server": "^5.0.4" },"dependencies": {"from": "^0.1.7","mathjs": "^13.1.1","scene": "^1.3.0","three": "^0.168.0" }}This json was made to work with windows, so the escape caracters from the paths are '\\'. But for example in linux, I need the '/' caracters. So I need to modify them.
I then decided to create a .bat to convert such paths and try to modify them. I installed jq to modify the json file, but it seems like it does not work :
echo '{ "scripts": "node_modules\.bin\webpack-dev-server --config webpack.config.js --open" }'>package.jsonjaq -i '.scripts = $v' --arg v 'node_modules/.bin/webpack-dev-server -- --config webpack.config.js -- --open' package.jsonpauseC:\Users\jleblond\Documents\git\OreCzmlJSInterface>jaq -i '.scripts = $v' --arg v 'node_modules/.bin/webpack-dev-server -- --config webpack.config.js -- --open' package.jsonError: expected token╭─│1 │←[31m'←[0m.scripts┆←[31m┬←[0m┆←[31m│←[0m┆←[31m╰─────────←[0m unexpected character ←[31m'←[0m──╯I would have expected the '\\' to be modifed to '/' but at the end I only have this in the package.json file :
'{ "scripts": "node_modules\.bin\webpack-dev-server --config webpack.config.js --open" }'Any help would be appreciated, I am kind of lost about what to do.
Have a good day !