phovea / generator-phovea

Yeoman Generator for Phovea
https://www.npmjs.com/package/generator-phovea
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Use `rimraf` package instead of `rm -rf` in `preinstall` script #443

Closed oltionchampari closed 3 years ago

oltionchampari commented 3 years ago

Closes phovea/generator-phovea#404

Developer Checklist (Definition of Done)

Summary of changes

Notes

Another windows incompatible script is: "build:python": "rm -rf build/source && find . -name '*.pyc' -delete && node buildPython.js && cp -r ./<%-name.toLowerCase()%> build/source/", Both the rm -rf and cp do not exist in windows. I do not know though if this needs to be windows compatible though.

ghost commented 3 years ago

@oltionchampari Thanks for the fix. I tried that new preinstall command with my PowerShell on Windows 10 (with 20H2) and got the following error (in German):

In Zeile:1 Zeichen:39
+ rimraf node_modules package-lock.json || exit 0
+                                       ~~
Das Token "||" ist in dieser Version kein gültiges Anweisungstrennzeichen.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine

Researching the error, I've found that the pipeline operators || and && have been introduced with PowerShell v7.0.0 (see PowerShell/PowerShell#9849). Hence, they will only work with the most recent PowerShell version.

@anita-steiner We need to decide if Windows users require the newest PowerShell or we change the preinstall command.

I will check the version: the version is 5.1.17763.1490

thinkh commented 3 years ago

Btw there are a lot of still other scripts that use the pipeline operators (&& and ||; see https://github.com/phovea/generator-phovea/pull/447). We might need to change it as well (depending on the PowerShell version).

ghost commented 3 years ago

so we need a solution for ps version >= 5.1