Skip to content

Commit

Permalink
Merge branch 'vscode-extension' of github.com:snipsnapdev/snipsnap-cl…
Browse files Browse the repository at this point in the history
…oud into vscode-extension
  • Loading branch information
lnikell committed May 16, 2021
2 parents f5b296d + 47b9a62 commit da56d58
Show file tree
Hide file tree
Showing 368 changed files with 39,123 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
**Describe what changes this pull request brings**

<!--
Some examples:
1. This pull request brings component Hero for the page Home.
2. This pull request adds fixes for the responsive version of the page Blog.
3. This pull request fixes user assignment via phone number in the existing stay.
-->

**Describe any additional changes**

<!--
An example:
- fixes Header's height
- introduces a new SASS variables $header-height
- renames global CSS class "block" into "section"
- fixes a typo in Hero for Home
If this pull request does not contain any additional changes, set N/A as a value for it.
-->

**Steps to test**
N/A

<!--
Some examples:
If the project **has** auto-deployment:
1. Open [the page](https://BRANCH_NAME--PROJECT_NAME.netlify.app/PAGE_URL)
2. Confirm that everything looks and works as expected
If the project **does not have** auto-deployment:
1. Pull the changes
2. Run `npm i`
3. Start the project in development mode, `npm run start`
4. Follow `/any-page`
5. Confirm that everything looks and works as expected
-->

**Screenshots**
N/A

<!--
Attach any relevant screenshots.
If this pull request does not represent any visual changes, set N/A as a value for it.
-->

**Checklist**

<!--
Check all applicable items.
-->

- [ ] I've checked for typos
- [ ] I've made sure overall structure consistency is preserved
- [ ] I've made sure overall headings hierarchy is preserved
- [ ] I've reread proposed changes twice

**TODO**

<!--
Add any tasks that have to be done in the future.
An example:
- [ ] Add animations for items while they are being changed in **Products**
- [ ] Add stripes on background for **Awards**
If this pull request does not have any tasks left, set N/A as a value for it.
-->

**References**

<!--
Tag any related issues or tasks in Notion.
Some examples:
1. Resolves #1.
2. Closes #1.
3. Fixes #1.
4. Closes the task [Update README](https://www.notion.so/) in Notion.
You can read more about linking a pull request to an issue here — https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue
If this pull request does not contain any references, set N/A as a value for it.
-->
92 changes: 92 additions & 0 deletions .github/workflows/snipsnap-templates-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: snipsnap-templates-frontend

on:
push:
branches: [master]
paths:
- templates/frontend/**

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
env:
WORKING_DIRECTORY: ./templates/frontend/
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14"
- name: Restore cache
uses: actions/cache@v2
with:
path: "./templates/frontend/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('./templates/frontend/package-lock.json') }}
- name: NPM Install
run: npm install
working-directory: ${{env.WORKING_DIRECTORY}}
- name: ESLint and stylelint
run: npm run lint
working-directory: ${{env.WORKING_DIRECTORY}}

build:
runs-on: ubuntu-latest
needs: lint
env:
WORKING_DIRECTORY: ./templates/frontend/
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14"
- name: NPM Install
run: npm ci
working-directory: ${{env.WORKING_DIRECTORY}}
- name: Build frontend
env:
SENTRY_ENABLED: true
SENTRY_ENVIRONMENT: production
SENTRY_URL: https://sentry.io/
SENTRY_ORG: ${{ secrets.SENTRY_ORG}}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT}}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN}}
NEXT_PUBLIC_SENTRY_DSN: ${{ secrets.NEXT_PUBLIC_SENTRY_DSN}}
NEXT_PUBLIC_SITE_URL: https://templates.snipsnap.dev/
NEXT_PUBLIC_GRAPHQL_URL: https://hasura-t.snipsnap.dev/v1/graphql
run: npm run build
working-directory: ${{env.WORKING_DIRECTORY}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Pixel Point Container Registry
uses: docker/login-action@v1
with:
registry: https://registry.pixelpoint.io
username: ${{ secrets.DOCKER_USERNAME}}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./templates/frontend
file: ./templates/frontend/Dockerfile.prod
push: true
tags: registry.pixelpoint.io/snipsnap-templates-frontend:latest

deploy:
runs-on: ubuntu-latest
needs: build
env:
KUBERNETES_URL: ${{ secrets.KUBERNETES_URL }}
KUBERNETES_TOKEN: ${{ secrets.KUBERNETES_TOKEN }}
steps:
- name: Pull deployment plugin
run: docker pull peloton/drone-k8s-deployment
# TODO: wrap Drone plugin as a Github action, have not found any available solutions
# in the marketplace that could just redeploy
- name: Deploy
run: |
docker run --rm -e PLUGIN_URL=$KUBERNETES_URL -e PLUGIN_TOKEN=$KUBERNETES_TOKEN -e PLUGIN_DEPLOYMENT_NAMES=snipsnap-templates-frontend -e PLUGIN_CONTAINER_NAMES=snipsnap-templates-frontend -e PLUGIN_NAMESPACES=snipsnap-templates -e PLUGIN_DOCKER_IMAGE=registry.pixelpoint.io/snipsnap-templates-frontend:latest -e PLUGIN_DATE_LABEL=deployment.github/date-deployed peloton/drone-k8s-deployment
68 changes: 68 additions & 0 deletions .github/workflows/snipsnap-templates-graphql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: snipsnap-templates-graphql

on:
push:
branches: [master]
paths:
- templates/hasura/**
- templates/graphql/**

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Pixel Point Container Registry
uses: docker/login-action@v1
with:
registry: https://registry.pixelpoint.io
username: ${{ secrets.DOCKER_USERNAME}}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./templates/graphql
file: ./templates/graphql/Dockerfile.prod
push: true
tags: registry.pixelpoint.io/snipsnap-templates-graphql:latest

deploy:
runs-on: ubuntu-latest
needs: build
env:
KUBERNETES_URL: ${{ secrets.KUBERNETES_URL }}
KUBERNETES_TOKEN: ${{ secrets.KUBERNETES_TOKEN }}
steps:
- name: Pull deployment plugin
run: docker pull peloton/drone-k8s-deployment
# TODO: wrap Drone plugin as a Github action, have not found any available solutions
# in the marketplace that could just redeploy
- name: Deploy
run: |
docker run --rm -e PLUGIN_URL=$KUBERNETES_URL -e PLUGIN_TOKEN=$KUBERNETES_TOKEN -e PLUGIN_DEPLOYMENT_NAMES=snipsnap-templates-graphql -e PLUGIN_CONTAINER_NAMES=snipsnap-templates-graphql -e PLUGIN_NAMESPACES=snipsnap-templates -e PLUGIN_DOCKER_IMAGE=registry.pixelpoint.io/snipsnap-templates-graphql:latest -e PLUGIN_DATE_LABEL=deployment.github/date-deployed peloton/drone-k8s-deployment
update-database:
runs-on: ubuntu-latest
needs: deploy
env:
WORKING_DIRECTORY: ./templates/hasura/
HASURA_GRAPHQL_ADMIN_SECRET: ${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}
HASURA_GRAPHQL_ENDPOINT: ${{ secrets.HASURA_GRAPHQL_ENDPOINT }}
steps:
- uses: actions/checkout@v2
- name: Install Hasura CLI
run: sudo npm install -g hasura-cli@v2.0.0-alpha.10 --unsafe-perm=true
- name: Apply migrations
run: hasura migrate apply
working-directory: ${{env.WORKING_DIRECTORY}}
- name: Apply metadata
run: hasura metadata apply
working-directory: ${{env.WORKING_DIRECTORY}}
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel
.vscode/snipsnap.code-snippets

#linters
.stylelintcache
.eslintcache

tmp

prisma/.env

sentry.properties
27 changes: 27 additions & 0 deletions templates/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: '3.6'
services:
postgres:
image: timescale/timescaledb:2.2.1-pg12
restart: always
ports:
- 8433:5432
volumes:
- ./tmp/db:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: postgrespassword
graphql-engine:
image: hasura/graphql-engine:v2.0.0-alpha.9
ports:
- '3010:8080'
depends_on:
- 'postgres'
restart: always
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
HASURA_GRAPHQL_ENABLE_CONSOLE: 'false'
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: guest
HASURA_GRAPHQL_JWT_SECRET: '{"type":"HS512","key":"eyJrdHkiOiJvY3QiLCJraWQiOiJ1WG5Ub21VaDcwVm15V0U4RmVoR0tpX2JWaTk2UEtSejExWUVTUEV2cWdNdVhuVG9tVWg3MFZteVdFOEZlaEdLaV9iVmk5NlBLUnoxMVlFU1BFdnFnTSIsImFsZyI6IkhTNTEyIiwiayI6IjMwOXFTY3JfSE1FYk"}'
HASURA_GRAPHQL_ENABLE_REMOTE_SCHEMA_PERMISSIONS: 'true'
REMOTE_SCHEMA_URL: http://host.docker.internal:4000/
21 changes: 21 additions & 0 deletions templates/frontend/.commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"scope-enum": [
2,
"always",
[
"components",
"constants",
"hooks",
"icons",
"images",
"layouts",
"pages",
"styles",
"templates",
"utils"
]
]
}
}
10 changes: 10 additions & 0 deletions templates/frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
npm-debug.log
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
19 changes: 19 additions & 0 deletions templates/frontend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
DATABASE_URL="postgres://postgres:postgrespassword@localhost:8433/postgres?schema=public"
GITHUB_CLIENT_ID=f72f5e6090032cb78916
GITHUB_CLIENT_SECRET=4337253b93ae24a3337ff245264167a9472c18b8
NEXTAUTH_URL=http://localhost:3000
JWT_SECRET=eyJrdHkiOiJvY3QiLCJraWQiOiJ1WG5Ub21VaDcwVm15V0U4RmVoR0tpX2JWaTk2UEtSejExWUVTUEV2cWdNdVhuVG9tVWg3MFZteVdFOEZlaEdLaV9iVmk5NlBLUnoxMVlFU1BFdnFnTSIsImFsZyI6IkhTNTEyIiwiayI6IjMwOXFTY3JfSE1FYk
NEXT_PUBLIC_SITE_URL=http://localhost:3000
NEXT_PUBLIC_GRAPHQL_URL=http://localhost:3010/v1/graphql
HASURA_ADMIN_SECRET=myadminsecretkey
# Number in seconds 60 * 60 = 1 hour
JWT_API_MAX_AGE=3600

# Sentry - production only
SENTRY_ENABLED=true
SENTRY_ENVIRONMENT=production
NEXT_PUBLIC_SENTRY_DSN=
SENTRY_URL=https://sentry.io/
SENTRY_ORG=pixel-point-ip
SENTRY_PROJECT=snipsnap-templates-frontend
SENTRY_AUTH_TOKEN=
Loading

0 comments on commit da56d58

Please sign in to comment.