Say I put one client folder and one backend folder in a single repo and pushed to git. Each client and backend has its own package.json. But the root folder has its own package JSON. The reason I do this is that I have some pre-commit hooks that are common to both the client and backend repo. And it makes sense for developers to push the repo at the root, then the pre-commit hooks will take place. So I am thinking of putting the pre-commit hooks in the common root in a package.json file. Is it possible for me to do as below for project structure?
RootFolder
- client
- package.json
- backend
- package.json
package.json
In backend package.JSON:
{
"name": "backend",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"start": "set NODE_ENV=development && src/app.js",
},
"author": "",
"license": "ISC",
"dependencies": {},
"devDependencies": {},
}
In client package.JSON:
{
"name": "client",
"version": "1.0.0",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"dependencies": {},
}
And in the root folder, the package.JSON is something like this:
{
"name": "root",
"version": "1.0.0",
"description": "",
"scripts": {}, //should be empty
"author": "",
"license": "ISC",
"dependencies": {},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*/src/**/*.{js,ts}": [
"prettier --write",
"eslint --cache --fix"
]
}
}