Skip to content

Commit

Permalink
Merge pull request #217 from HelipengTony/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ttttonyhe authored Nov 6, 2021
2 parents 75a1f9a + 1427a7b commit 7c3e916
Show file tree
Hide file tree
Showing 78 changed files with 6,032 additions and 5,521 deletions.
98 changes: 47 additions & 51 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,48 @@
{
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
"plugin:cypress/recommended",
"plugin:@next/next/recommended"
],
"plugins": [
"react",
"@typescript-eslint",
"prettier",
"cypress"
],
"env": {
"node": true,
"browser": true,
"jasmine": true,
"jest": true,
"es6": true,
"cypress/globals": true
},
"rules": {
"camelcase": "error",
"prettier/prettier": [
"error",
{
"singleQuote": true
}
],
"react/prop-types": "off",
"react/display-name": "off",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"cypress/no-assigning-return-values": "error",
"cypress/no-unnecessary-waiting": "error",
"cypress/assertion-before-screenshot": "warn",
"cypress/no-force": "warn",
"cypress/no-async-tests": "error"
},
"parser": "@typescript-eslint/parser",
"settings": {
"react": {
"pragma": "React",
"version": "detect"
}
}
}
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
"plugin:cypress/recommended",
"plugin:@next/next/recommended"
],
"plugins": ["react", "@typescript-eslint", "prettier", "cypress"],
"env": {
"node": true,
"browser": true,
"jasmine": true,
"jest": true,
"es6": true,
"cypress/globals": true
},
"rules": {
"camelcase": "error",
"react/prop-types": "off",
"react/display-name": "off",
"react/react-in-jsx-scope": "off",
"react/self-closing-comp": [
"error",
{
"component": true,
"html": true
}
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"cypress/no-assigning-return-values": "error",
"cypress/no-unnecessary-waiting": "error",
"cypress/assertion-before-screenshot": "warn",
"cypress/no-force": "warn",
"cypress/no-async-tests": "error"
},
"parser": "@typescript-eslint/parser",
"settings": {
"react": {
"pragma": "React",
"version": "detect"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,24 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Environmental Variables
run: |
touch .env
echo NEXT_PUBLIC_SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env
echo SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} >> .env
echo SENTRY_PROJECT=${{ secrets.SENTRY_PROJECT }} >> .env
echo SENTRY_ORG=${{ secrets.SENTRY_ORG }} >> .env
echo NEXT_PUBLIC_BUTTONDOWN_TOKEN=${{ secrets.BUTTONDOWN_TOKEN }} >> .env
echo NEXT_PUBLIC_LC_KEY=${{ secrets.LC_KEY }} >> .env
echo NEXT_PUBLIC_LC_ID=${{ secrets.LC_ID }} >> .env
- name: Run Cypress
uses: cypress-io/github-action@v2
with:
install-command: yarn --immutable
build: yarn run build
start: yarn run start
browser: chrome
- name: Next.js Cache
- name: Cache Next.js Build
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.next/cache
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ yarn-error.log*
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
.pnp.*
# Sentry
.sentryclirc
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit ""
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.next
4 changes: 3 additions & 1 deletion .prettierrc → .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"singleQuote": true
"singleQuote": true,
"useTabs": true,
"endOfLine": "lf"
}
40 changes: 40 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-leading-blank': [1, 'always'],
'body-max-line-length': [2, 'always', 100],
'footer-leading-blank': [1, 'always'],
'footer-max-line-length': [2, 'always', 100],
'header-max-length': [2, 'always', 100],
'scope-case': [2, 'always', 'lower-case'],
'subject-case': [
2,
'never',
['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'type-case': [2, 'always', 'lower-case'],
'type-empty': [2, 'never'],
'type-enum': [
2,
'always',
[
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'style',
'test',
'translation',
'security',
'changeset',
],
],
},
}
12 changes: 11 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
const Dotenv = require('dotenv-webpack')
const { withSentryConfig } = require('@sentry/nextjs')

module.exports = {
const NextConfigs = {
webpack(config) {
config.plugins.push(new Dotenv())
return config
},
poweredByHeader: false,
productionBrowserSourceMaps: false,
compress: true,
swcMinify: true,
// FIXME: https://github.com/getsentry/sentry-javascript/issues/4103
outputFileTracing: false,
images: {
domains: ['static.ouorz.com', 'storage.snapaper.com'],
},
}

const SentryWebpackPluginOptions = {
silent: true,
}

module.exports = withSentryConfig(NextConfigs, SentryWebpackPluginOptions)
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
{
"name": "ouorz-next",
"version": "0.1.0",
"version": "0.2.0",
"private": true,
"license": "SEE LICENSE IN LICENSE",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint ./src -c .eslintrc.json --fix --ext ts,tsx",
"lint": "eslint ./src -c .eslintrc.json --fix --ext js,ts,tsx,json",
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"upgrade:dev": "ncu --upgrade && yarn install",
"upgrade:prod": "ncu --upgrade && yarn install --ignore-optional"
},
"dependencies": {
"crypto-js": "^4.1.1",
"@sentry/nextjs": "^6.14.1",
"dotenv-webpack": "^7.0.3",
"next": "^11.1.2",
"next": "^12.0.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"sharp": "^0.29.2"
},
"devDependencies": {
"@next/eslint-plugin-next": "^11.1.2",
"@commitlint/cli": "^14.1.0",
"@commitlint/config-conventional": "^14.1.0",
"@next/eslint-plugin-next": "^12.0.3",
"@tailwindcss/typography": "^0.4.1",
"@types/crypto-js": "^4.0.2",
"@types/node": "^16.11.6",
"@types/react": "^17.0.33",
"@types/react": "^17.0.34",
"@types/react-highlight": "^0.12.5",
"@types/react-timeago": "^4.1.3",
"@types/smoothscroll-polyfill": "^0.3.1",
"@typescript-eslint/eslint-plugin": "^5.2.0",
"@typescript-eslint/parser": "^5.2.0",
"@typescript-eslint/eslint-plugin": "^5.3.0",
"@typescript-eslint/parser": "^5.3.0",
"autoprefixer": "^10.4.0",
"comma-number": "^2.1.0",
"eslint": "^8.1.0",
"eslint-config-next": "^11.1.2",
"eslint": "<8.0.0",
"eslint-config-next": "^12.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.26.1",
Expand All @@ -50,7 +51,7 @@
"prettier": "^2.4.1",
"prettier-eslint": "^13.0.0",
"react-content-loader": "^6.0.3",
"react-h5-audio-player": "^3.7.2",
"react-h5-audio-player": "^3.7.4",
"react-highlight": "^0.14.0",
"react-infinite-scroll-component": "^6.1.0",
"react-timeago": "^6.2.1",
Expand All @@ -59,7 +60,7 @@
"tailwindcss": "^2.2.19",
"ts-loader": "^9.2.6",
"typescript": "^4.4.4",
"webpack": "^5.61.0"
"webpack": "^5.62.1"
},
"optionalDependencies": {
"@bahmutov/add-typescript-to-cypress": "^2.1.2",
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
Binary file modified public/tony.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions sentry.client.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as Sentry from '@sentry/nextjs'

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
tracesSampleRate: 1.0,
})
4 changes: 4 additions & 0 deletions sentry.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
defaults.url=https://sentry.io/
defaults.org=ouorz
defaults.project=personal-blog
cli.executable=../../../.npm/_npx/7072/lib/node_modules/@sentry/wizard/node_modules/@sentry/cli/bin/sentry-cli
6 changes: 6 additions & 0 deletions sentry.server.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as Sentry from '@sentry/nextjs'

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
tracesSampleRate: 1.0,
})
22 changes: 11 additions & 11 deletions src/assets/scripts/vendors/cloudflare/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ const request = require('request')
const schedule = require('node-schedule')

const scheduleCron = () => {
schedule.scheduleJob('0 56 2 * * *', () => {
let dirPath = path.join(__dirname, '../public')
let fileName = 'beacon.min.js'
let url = 'https://static.cloudflareinsights.com/beacon.min.js'
let stream = fs.createWriteStream(path.join(dirPath, fileName))
request(url)
.pipe(stream)
.on('close', function () {
console.log('File [' + fileName + '] Downloaded | ' + new Date())
})
})
schedule.scheduleJob('0 56 2 * * *', () => {
let dirPath = path.join(__dirname, '../public')
let fileName = 'beacon.min.js'
let url = 'https://static.cloudflareinsights.com/beacon.min.js'
let stream = fs.createWriteStream(path.join(dirPath, fileName))
request(url)
.pipe(stream)
.on('close', function () {
console.log('File [' + fileName + '] Downloaded | ' + new Date())
})
})
}

scheduleCron()
20 changes: 10 additions & 10 deletions src/assets/scripts/vendors/cloudflare/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "sync-cf-web-analytics",
"version": "1.0.0",
"description": "Donwload CloudFlare Web Analytics JS file to local machine once everyday",
"main": "index.js",
"author": "HelipengTony",
"license": "MIT",
"dependencies": {
"node-schedule": "^1.3.2",
"request": "^2.88.2"
}
"name": "sync-cf-web-analytics",
"version": "1.0.0",
"description": "Donwload CloudFlare Web Analytics JS file to local machine once everyday",
"main": "index.js",
"author": "HelipengTony",
"license": "MIT",
"dependencies": {
"node-schedule": "^1.3.2",
"request": "^2.88.2"
}
}
Loading

0 comments on commit 7c3e916

Please sign in to comment.