diff --git a/.travis.yml b/.travis.yml index 8d3cb9d3385..d77ebc86891 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ before_install: # because this is a weird monorepo and we cd into and out of directories, this is what worked for travis to publish - echo "//code.lds.org/artifactory/api/npm/npm-fhd/:_authToken=${NPM_PUBLISH_TOKEN}" >> packages/react-scripts/.npmrc - echo "@fs:registry=https://code.lds.org/artifactory/api/npm/npm-fhd/" >> packages/react-scripts/.npmrc + - npm i -g npm@6.8.0 install: - "npm i" - "cd packages/react-scripts" diff --git a/packages/react-scripts/scripts/utils/frontierInit.js b/packages/react-scripts/scripts/utils/frontierInit.js index 4cd9792a6f3..e81e6801779 100644 --- a/packages/react-scripts/scripts/utils/frontierInit.js +++ b/packages/react-scripts/scripts/utils/frontierInit.js @@ -13,7 +13,6 @@ const depsToInstall = [] const devDepsToInstall = [] function installFrontierDependencies(appPath, appName, ownPath) { - configureEF(appPath, ownPath, appName) configureHF(appPath, ownPath) @@ -56,6 +55,9 @@ function installFrontierDependencies(appPath, appName, ownPath) { 'dotenv@7', 'jest-dom@3', 'http-proxy-middleware@0.19', + 'husky@2', + 'lint-staged@8', + 'suppress-exit-code@0.1', ] ) @@ -67,13 +69,14 @@ function installFrontierDependencies(appPath, appName, ownPath) { 'storybook:build': 'NODE_ENV=development build-storybook -c .storybook -o build', lint: 'eslint src/', 'lint:fix': 'eslint src/ --fix', - test: `eslint src/ && ${packageJson.scripts.test}`, } packageJson.scripts = { ...packageJson.scripts, ...additionalScripts } delete packageJson.scripts.eject - packageJson.eslintConfig = { - extends: ['@fs/eslint-config-frontier-react'], + packageJson.eslintConfig = { extends: ['@fs/eslint-config-frontier-react'] } + packageJson.husky = { + hooks: { 'pre-commit': 'lint-staged', 'pre-push': 'npm run lint && CI=true npm test' }, } + packageJson['lint-staged'] = { '*.js': ['suppress-exit-code eslint --fix', 'git add'] } return packageJson }) installModulesSync(depsToInstall)