From 8817bd3db8c1d58b546f807d2873e958afcf5191 Mon Sep 17 00:00:00 2001 From: Gilles <43683714+corp-0@users.noreply.github.com> Date: Thu, 15 Sep 2022 01:19:12 -0300 Subject: [PATCH] chore: push new release (#4) * feat: download link will now get the user's OS automatically (#2) * chore: setup ci (#3) --- src/.eslintrc.json => .eslintrc.json | 0 .github/workflows/pull_request.yml | 41 + .github/workflows/push.yml | 56 + .gitignore | 62 +- .idea/.gitignore | 5 + .idea/codeStyles/codeStyleConfig.xml | 5 + .idea/discord.xml | 7 + .idea/modules.xml | 8 + .idea/unitystation-web.iml | 12 + .idea/vcs.xml | 6 + .idea/webResources.xml | 14 + .releaserc.json | 13 + README.md | 35 +- {src/components => components}/background.tsx | 0 {src/components => components}/button.tsx | 0 .../landing/landingButtons.tsx | 14 +- .../landing/landingText.tsx | 0 {src/components => components}/section.tsx | 0 cypress.config.ts | 17 + cypress/component/dummy.cy.ts | 7 + cypress/e2e/home.cy.ts | 7 + cypress/fixtures/example.json | 5 + cypress/support/commands.ts | 37 + cypress/support/component-index.html | 14 + cypress/support/component.ts | 39 + cypress/support/e2e.ts | 20 + jest.config.js | 19 + lib/platform.ts | 71 + src/next.config.js => next.config.js | 0 package-lock.json | 16053 ++++++++++++++++ package.json | 40 + {src/pages => pages}/_app.tsx | 0 {src/pages => pages}/index.tsx | 0 src/postcss.config.js => postcss.config.js | 0 {src/public => public}/background/layer1.png | Bin {src/public => public}/favicon.ico | Bin src/.gitignore | 36 - src/README.md | 34 - src/package-lock.json | 6375 ------ src/package.json | 27 - src/yarn.lock | 1974 -- {src/styles => styles}/globals.css | 0 src/tailwind.config.js => tailwind.config.js | 0 src/tsconfig.json => tsconfig.json | 22 +- types/githubReleaseResponse.ts | 73 + {src/types => types}/layoutChildren.ts | 0 46 files changed, 16663 insertions(+), 8485 deletions(-) rename src/.eslintrc.json => .eslintrc.json (100%) create mode 100644 .github/workflows/pull_request.yml create mode 100644 .github/workflows/push.yml create mode 100644 .idea/.gitignore create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/discord.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/unitystation-web.iml create mode 100644 .idea/vcs.xml create mode 100644 .idea/webResources.xml create mode 100644 .releaserc.json rename {src/components => components}/background.tsx (100%) rename {src/components => components}/button.tsx (100%) rename {src/components => components}/landing/landingButtons.tsx (60%) rename {src/components => components}/landing/landingText.tsx (100%) rename {src/components => components}/section.tsx (100%) create mode 100644 cypress.config.ts create mode 100644 cypress/component/dummy.cy.ts create mode 100644 cypress/e2e/home.cy.ts create mode 100644 cypress/fixtures/example.json create mode 100644 cypress/support/commands.ts create mode 100644 cypress/support/component-index.html create mode 100644 cypress/support/component.ts create mode 100644 cypress/support/e2e.ts create mode 100644 jest.config.js create mode 100644 lib/platform.ts rename src/next.config.js => next.config.js (100%) create mode 100644 package-lock.json create mode 100644 package.json rename {src/pages => pages}/_app.tsx (100%) rename {src/pages => pages}/index.tsx (100%) rename src/postcss.config.js => postcss.config.js (100%) rename {src/public => public}/background/layer1.png (100%) rename {src/public => public}/favicon.ico (100%) delete mode 100644 src/.gitignore delete mode 100644 src/README.md delete mode 100644 src/package-lock.json delete mode 100644 src/package.json delete mode 100644 src/yarn.lock rename {src/styles => styles}/globals.css (100%) rename src/tailwind.config.js => tailwind.config.js (100%) rename src/tsconfig.json => tsconfig.json (55%) create mode 100644 types/githubReleaseResponse.ts rename {src/types => types}/layoutChildren.ts (100%) diff --git a/src/.eslintrc.json b/.eslintrc.json similarity index 100% rename from src/.eslintrc.json rename to .eslintrc.json diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..2be1020 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,41 @@ +on: + pull_request: + branches: + - master + - develop +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18.x + - run: npm install + - run: npm run lint +# unit_test: +# runs-on: ubuntu-latest +# needs: [lint] +# steps: +# - uses: actions/checkout@v3 +# - uses: actions/setup-node@v3 +# with: +# node-version: 18.x +# - run: npm install +# - name: build +# run: npm run build +# - name: unit test +# run: npm run test:unit + e2e_test: + runs-on: ubuntu-latest + needs: [lint] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18.x + - run: npm install + - name: build + run: npm run build + - name: e2e testing + run: npm run test:e2e diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..25c9e16 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,56 @@ +on: + push: + branches: + - master + - develop +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18.x + - run: npm install + - run: npm run lint +# unit_test: +# runs-on: ubuntu-latest +# needs: [lint] +# steps: +# - uses: actions/checkout@v3 +# - uses: actions/setup-node@v3 +# with: +# node-version: 18.x +# - run: npm install +# - name: build +# run: npm run build +# - name: unit test +# run: npm run test:unit + e2e_test: + runs-on: ubuntu-latest + needs: [lint] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18.x + - run: npm install + - name: build + run: npm run build + - name: unit test + run: npm run test:e2e + release: + runs-on: ubuntu-latest + needs: [lint, e2e_test] + if: github.ref == 'refs/heads/master' + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v3 + with: + extra_plugins: | + @semantic-release/changelog@3.0.0 + @semantic-release/git + env: + GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE }} diff --git a/.gitignore b/.gitignore index 5210ddf..913a635 100644 --- a/.gitignore +++ b/.gitignore @@ -1,42 +1,40 @@ -# Logs -logs -*.log -npm-debug.log* - -# Runtime data -pids -*.pid -*.seed +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov +# dependencies +/node_modules +/.pnp +.pnp.js -# Coverage directory used by tools like istanbul -coverage +# testing +/coverage -# nyc test coverage -.nyc_output +# next.js +/.next/ +/out/ -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt +# production +/build -# node-waf configuration -.lock-wscript +# misc +.DS_Store +*.pem -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* -# Dependency directories -node_modules -jspm_packages +# local env files +.env*.local -# Optional npm cache directory -.npm +# vercel +.vercel -# Optional REPL history -.node_repl_history -.next +# typescript +*.tsbuildinfo +next-env.d.ts -# IDE -.idea/ -.vscode/ +# cypress +/cypress/videos +/cypress/screenshots diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000..d8e9561 --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..9a63f58 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/unitystation-web.iml b/.idea/unitystation-web.iml new file mode 100644 index 0000000..0c8867d --- /dev/null +++ b/.idea/unitystation-web.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/webResources.xml b/.idea/webResources.xml new file mode 100644 index 0000000..edf30b3 --- /dev/null +++ b/.idea/webResources.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..6259a36 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,13 @@ +{ + "branches": ["master"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + ["@semantic-release/git", { + "assets": ["CHANGELOG.md"], + "message": "docs(changelog): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + }], + "@semantic-release/github" + ] +} diff --git a/README.md b/README.md index 76bd83c..c87e042 100644 --- a/README.md +++ b/README.md @@ -1 +1,34 @@ -"# unitystation-web" +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). + +## Getting Started + +First, run the development server: + +```bash +npm run dev +# or +yarn dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. + +[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`. + +The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/src/components/background.tsx b/components/background.tsx similarity index 100% rename from src/components/background.tsx rename to components/background.tsx diff --git a/src/components/button.tsx b/components/button.tsx similarity index 100% rename from src/components/button.tsx rename to components/button.tsx diff --git a/src/components/landing/landingButtons.tsx b/components/landing/landingButtons.tsx similarity index 60% rename from src/components/landing/landingButtons.tsx rename to components/landing/landingButtons.tsx index 1c3f69c..9375dd5 100644 --- a/src/components/landing/landingButtons.tsx +++ b/components/landing/landingButtons.tsx @@ -1,10 +1,20 @@ import Button from '../button'; - -const downloadLink = 'https://github.com/unitystation/stationhub/releases'; +import getDownloadLink from '../../lib/platform'; const githubUrl = 'https://github.com/unitystation/unitystation'; const discordInviteUrl = 'https://discord.com/invite/tFcTpBp'; +const githubReleases = 'https://github.com/unitystation/stationhub/releases/latest'; + +import {useEffect, useState} from 'react'; + + const LandingButtons = () => { + const [downloadLink, setDownloadLink] = useState(githubReleases); + + useEffect(() => { + getDownloadLink().then((link) => setDownloadLink(link)); + }, []); + return (