From 064f552c8875267b606c7fe05f300d95bb97967c Mon Sep 17 00:00:00 2001 From: Bill Date: Thu, 16 Sep 2021 00:48:43 -0400 Subject: [PATCH 1/2] Update build --- .browserslistrc | 11 +++++++++ craco.config.js | 5 ++++ package-lock.json | 57 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 20 ++++------------ tsconfig.json | 2 +- webpack-patcher.js | 22 ------------------ 6 files changed, 78 insertions(+), 39 deletions(-) create mode 100644 .browserslistrc create mode 100644 craco.config.js delete mode 100644 webpack-patcher.js diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 00000000..3e5809a3 --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,11 @@ +# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. +# For additional information regarding the format and rule options, please see: +# https://github.com/browserslist/browserslist#queries +# You can see what browsers were selected by your queries by running: +# npx browserslist + +last 1 Chrome version +last 1 Firefox version +last 1 Edge major versions +last 2 Safari major versions +last 2 iOS major versions diff --git a/craco.config.js b/craco.config.js new file mode 100644 index 00000000..48a9bf86 --- /dev/null +++ b/craco.config.js @@ -0,0 +1,5 @@ +module.exports = { + eslint: { + enabled: false + } +} diff --git a/package-lock.json b/package-lock.json index 9effa8d0..0f2a0fe4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1152,6 +1152,55 @@ "minimist": "^1.2.0" } }, + "@craco/craco": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@craco/craco/-/craco-6.3.0.tgz", + "integrity": "sha512-SCnfEQxT/6NAbU/3sIWw7gQXtzjjiTp/EZFdJTd8inPURILIy0YajrC2p8qBG2KhFo5cwgOrEDyaGyAFvvuyuA==", + "requires": { + "cross-spawn": "^7.0.0", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "webpack-merge": "^4.2.2" + }, + "dependencies": { + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "@csstools/convert-colors": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@csstools/convert-colors/-/convert-colors-1.4.0.tgz", @@ -18810,6 +18859,14 @@ } } }, + "webpack-merge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.2.tgz", + "integrity": "sha512-TUE1UGoTX2Cd42j3krGYqObZbOD+xF7u28WB7tfUordytSjbWTIjK/8V0amkBfTYN4/pB/GIDlJZZ657BGG19g==", + "requires": { + "lodash": "^4.17.15" + } + }, "webpack-sources": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz", diff --git a/package.json b/package.json index 05c2007b..bd043db6 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { + "@craco/craco": "^6.3.0", "@nitrots/nitro-renderer": "file:../nitro-renderer", "animate.css": "^4.1.1", "classnames": "^2.3.1", @@ -18,11 +19,10 @@ "web-vitals": "^1.1.2" }, "scripts": { - "postinstall": "node ./webpack-patcher.js", - "start": "react-scripts start", - "build": "react-scripts build", + "start": "craco start", + "build": "craco build", "build:prod": "npm i git+https://git@git.krews.org/nitro/nitro-renderer#dev && npm i && npm run build", - "test": "react-scripts test", + "test": "craco test", "eject": "react-scripts eject" }, "eslintConfig": { @@ -111,18 +111,6 @@ ] } }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - }, "devDependencies": { "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^11.2.7", diff --git a/tsconfig.json b/tsconfig.json index ac2a9fd7..df4dcf04 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,6 +24,6 @@ }, "include": [ "src", - "node_modules/@nitrots/nitro-renderer/src/**/*.ts", + "node_modules/@nitrots/nitro-renderer/**/*.ts", ] } diff --git a/webpack-patcher.js b/webpack-patcher.js deleted file mode 100644 index f4178ce0..00000000 --- a/webpack-patcher.js +++ /dev/null @@ -1,22 +0,0 @@ -const fs = require('fs'); - -function deleteLineFromFile(props) -{ - const data = fs.readFileSync(props.path, 'utf-8'); - const array = data.split('\n'); - const value = array[props.lineToRemove.index - 1].trim(); - - if (value === props.lineToRemove.value) - { - array.splice(props.lineToRemove.index - 1, 1); - - const newData = array.join('\n'); - - fs.writeFileSync(props.path, newData, 'utf-8'); - } -} - -deleteLineFromFile({ - path: 'node_modules/react-scripts/config/webpack.config.js', - lineToRemove: { index: 406, value: 'include: paths.appSrc,' }, -}); From 8f83c06cbee3aa43b26c1e9ead4809608c873e38 Mon Sep 17 00:00:00 2001 From: Bill Date: Thu, 16 Sep 2021 01:17:49 -0400 Subject: [PATCH 2/2] Test workflow --- .github/workflows/deploy.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..1a78a89b --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,25 @@ +name: Deploy Bundle@dev + +on: + push: + branches: [ dev ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Build Repository + uses: billsonnn/nitro-react@master + env: + HOST: ${{ secrets.HOST }} + USERNAME: ${{ secrets.USERNAME }} + PORT: ${{ secrets.PORT }} + KEY: ${{ secrets.SSHKEY }} + with: + node-version: '14.x' + registry-url: 'https://registry.npmjs.org' + source: "." + target: "/var/www/nitrots.co/domains/prod.nitrots.co/html" + run: npm run build:prod