From 1cd51ad6a29af1ff013ede051563928c36105827 Mon Sep 17 00:00:00 2001 From: Joey Cozza Date: Thu, 30 May 2019 15:49:15 -0600 Subject: [PATCH 1/2] precommit and prepush hooks for linting and running tests --- packages/react-scripts/scripts/utils/frontierInit.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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) From 4e933bb634d55f546da3a9fbb8c6956c545f44ba Mon Sep 17 00:00:00 2001 From: Joey Cozza Date: Thu, 30 May 2019 16:23:25 -0600 Subject: [PATCH 2/2] npm 6.9.0 has a weird error with the strong repo and a .git directory --- .travis.yml | 1 + 1 file changed, 1 insertion(+) 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"