Closed gthiabaud closed 4 years ago
As a workaround, you can pass the --no-verify
flag to the git commit
command, which skips the pre-commit git hook.
looks like we upgraded the lint-staged
dependency version on react
side and that caused the issue. Short term solution should be to change that back to 8.2.1
It looks like a lint-staged bug rather than a jhipster bug.@gthiabaud, can you try the latest version of lint-staged (10.0.2) to see if it fixes your issue. Or maybe try with git bash rather than CMD.exe.
Seems that lint-staged evolved as following:
version 8 is working quickly and without issues in all operating systems
version 9 has documented breaking change for Windows: lint-staged
dropped optimization done for Windows, excerpt from release notes: "Very long arguments strings are no longer chunked on Windows. Function linters should be used instead to customise this behaviour.". But in my testing function linters are extremely slow, at least in Windows (don't know are these slow also in Mac and Linux or not), see #10312
version 10 has another breaking change: initial commit is not allowed to process in lint-staged
any more, in JHipster we are formatting generated files internally, so this should not be a problem (as long as generator and generated projects are using the same version of Prettier
), just need to change https://github.com/jhipster/generator-jhipster/blob/master/generators/app/index.js#L593 (suppress pre-commit hooks for initial commit) from
this.gitExec(`commit -m "${commitMsg}" -- .`, { trace: false }, code => {
to
this.gitExec(`commit --no-verify -m "${commitMsg}" -- .`, { trace: false }, code => {
But if using lint-staged
10 then those who are generating initial version with --skip-git
and are committing to Git manually, need to know that they must add --no-verify
while doing initial commit to Git.
I tried to test lint-staged
version 10 with this modification and basically worked in Windows. But I encountered parallel Git access error after doing git reset
and then committing changes (lint-staged
is using git stash
now and this parallel Git access error is mentioned also in some lint-staged
documents).
For me ATM the most reliable solution is to downgrade lint-staged
to version 8 also in React (as this is done for Angular).
Alternative is to use version 10, but not sure we don't encounter problems in some situations.
@kaidohallik Thanks for the analysis. Personally I would not be against using lint-staged v10 even with the little problems in some specific cases but I guess its better to use the most "stable" version.
Overview of the issue
I generate an application by using jhipster. I try to commit in my github projet. I have the following error message from git client (I try with diffrent client including Jetbrain Java IDE) :
husky > pre-commit (node v10.16.3) ‼ lint-staged generated an argument string of 17387 characters, and commands might not run correctly on your platform. It is recommended to use functions as linters and split your command based on the number of staged files. For more info, please visit: https://github.com/okonet/lint-staged#using-js-functions-to-customize-linter-commands Stashing changes... [started]
Thank for your help and this beautifull tool that JHIPSTER is :)
Motivation for or Use Case
Impossible to continue to try to user JHIPSTER if it is not comatible with a Windows Dev environnement. :(
Reproduce the error
Launch JHIPSTER 6.6.0 Configure to build a :
Related issues
10312
Suggest a Fix
NA
JHipster Version(s)
6.6.0 It is a regression in the paste I didn't encounter this issue.
JHipster configuration
INFO! Using JHipster version installed locally in current project's node_modules INFO! Executing jhipster:info INFO! Options: from-cli: true Welcome to the JHipster Information Sub-Generator
JHipster Version(s)
JHipster configuration, a
.yo-rc.json
file generated in the root folder.yo-rc.json file
**JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
NA
Environment and Tools
java version "1.8.0_201" Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
git version 2.20.1.windows.1
node: v10.16.3
npm: 6.13.4
yeoman: 3.1.1
yarn: 1.21.1
Docker version 19.03.5, build 633a0ea
docker-compose version 1.24.1, build 4667896b
INFO! Congratulations, JHipster execution is complete!
----------------------- .yo-rc.json ------------------------------- { "generator-jhipster": { "promptValues": { "packageName": "com.gthiabaud.annonces", "nativeLanguage": "en" }, "jhipsterVersion": "6.6.0", "applicationType": "monolith", "baseName": "annonces", "packageName": "com.gthiabaud.annonces", "packageFolder": "com/gthiabaud/annonces", "serverPort": "8080", "authenticationType": "jwt", "cacheProvider": "ehcache", "enableHibernateCache": true, "websocket": false, "databaseType": "sql", "devDatabaseType": "h2Disk", "prodDatabaseType": "mariadb", "searchEngine": false, "messageBroker": false, "serviceDiscoveryType": "eureka", "buildTool": "maven", "enableSwaggerCodegen": false, "jwtSecretKey": "XXXXXXXXXXXXXX=", "embeddableLaunchScript": false, "useSass": true, "clientPackageManager": "npm", "clientFramework": "react", "clientTheme": "none", "clientThemeVariant": "", "creationTimestamp": 1579102768236, "testFrameworks": [], "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", "otherModules": [], "enableTranslation": true, "nativeLanguage": "en", "languages": ["en", "fr"], "blueprints": [] } }
NO JDL here
Browsers and Operating System
NA