Compare commits

...

17 commits

Author SHA1 Message Date
Lukasz Ostrowski
7b611b2e7a wip 2023-01-29 22:54:11 +01:00
Lukasz Ostrowski
669bf6827e wip 2023-01-29 22:53:52 +01:00
Lukasz Ostrowski
d955531027 rename 2023-01-29 22:20:26 +01:00
Lukasz Ostrowski
9a8e0525e2
Update deploy-prod.yml 2023-01-29 22:13:52 +01:00
Lukasz Ostrowski
75dba9008d
Update deploy-prod.yml 2023-01-29 22:11:00 +01:00
Lukasz Ostrowski
131cefa966
Update deploy-prod.yml 2023-01-29 22:09:43 +01:00
Lukasz Ostrowski
06050e71f4
Create deploy-prod.yml 2023-01-29 21:57:31 +01:00
Lukasz Ostrowski
3e540fdc16
Create pr.yml 2023-01-29 21:51:18 +01:00
Lukasz Ostrowski
bd1066e13c remove changeset 2023-01-29 21:12:59 +01:00
Lukasz Ostrowski
eed9a3ecec lint 2023-01-29 20:26:41 +01:00
Lukasz Ostrowski
de68dcca7b Update 2023-01-29 20:23:51 +01:00
Lukasz Ostrowski
20f439f3ce Add Slack App git, remove invoices 2023-01-29 19:59:50 +01:00
Lukasz Ostrowski
54e77d495e add shared lib 2023-01-20 17:48:53 +01:00
Lukasz Ostrowski
dae66beb59 setup linter 2023-01-20 17:38:13 +01:00
Lukasz Ostrowski
b9e3b5ca26 pnpm lock 2023-01-20 17:09:33 +01:00
Lukasz Ostrowski
1a6d39e2be add apps 2023-01-20 17:08:35 +01:00
Lukasz Ostrowski
8a7371c3d2 basic setup 2023-01-20 17:00:02 +01:00
17 changed files with 7305 additions and 0 deletions

9
.eslintrc.js Normal file
View file

@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ["saleor"],
settings: {
next: {
rootDir: ["apps/*/"],
},
},
};

42
.github/workflows/deploy-prod.yml vendored Normal file
View file

@ -0,0 +1,42 @@
name: Deployment
on:
workflow_dispatch:
inputs:
app_name:
type: choice
required: true
options:
- saleor-app-slack
description: What app to deploy
jobs:
prepare:
runs-on: ubuntu-latests
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.2.1
with:
version: 6.19.1
- uses: actions/setup-node@v3
with:
node-version: "18"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Install Vercel CLI
run: npm i -g vercel
deploy:
needs: [prepare]
environment: Prod
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Link
run: vercel link apps/${{inputs.app_name}}
- name: Pull env
run: vercel pull --environment=production
- name: Build
run: pnpm vercel build --prod --yes --token=${{ secrets.VERCEL_TOKEN }}
# - name: Deploy to Vecel
# run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}

18
.github/workflows/pr.yml vendored Normal file
View file

@ -0,0 +1,18 @@
name: QA
on: [pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.2.1
with:
version: 6.19.1
- uses: actions/setup-node@v3
with:
node-version: "18"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Check linters
run: pnpm lint

42
.gitignore vendored Normal file
View file

@ -0,0 +1,42 @@
node_modules
.pnp
.pnp.js
# testing
coverage
# next.js
.next/
out/
build
# 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
# turbo
.turbo
# vercel
.vercel
# Sentry
.sentryclirc
test-invoice.pdf
.env
# Sentry
.sentryclirc
sentry.properties
.idea

1
.npmrc Normal file
View file

@ -0,0 +1 @@
auto-install-peers = true

1
CODEOWNERS Normal file
View file

@ -0,0 +1 @@
* @saleor/appstore

1
apps/saleor-app-slack Submodule

@ -0,0 +1 @@
Subproject commit d16577696dbd0e95261ba3477bf738c8d3cf3f44

17
package.json Normal file
View file

@ -0,0 +1,17 @@
{
"private": true,
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev",
"lint": "turbo run lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
},
"devDependencies": {
"eslint": "^7.32.0",
"eslint-config-saleor": "workspace:*",
"prettier": "^2.5.1",
"turbo": "^1.7.0"
},
"packageManager": "pnpm@7.15.0",
"name": "@saleor/apps"
}

View file

@ -0,0 +1,8 @@
module.exports = {
plugins: ["simple-import-sort"],
extends: ["next", "turbo", "prettier"],
rules: {
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
},
};

View file

@ -0,0 +1,16 @@
{
"name": "eslint-config-saleor",
"version": "0.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"eslint-config-next": "^13.1.6",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-react": "7.32.1",
"eslint-config-turbo": "^0.0.7",
"eslint-plugin-simple-import-sort": "^10.0.0"
},
"publishConfig": {
"access": "public"
}
}

View file

@ -0,0 +1,3 @@
{
"extends": ["saleor"]
}

1
packages/shared/index.ts Normal file
View file

@ -0,0 +1 @@
export * from './lib/theme-synchronizer'

View file

@ -0,0 +1,38 @@
import { useAppBridge } from "@saleor/app-sdk/app-bridge";
import { useTheme } from "@saleor/macaw-ui";
import { memo, useEffect } from "react";
/**
* Macaw-ui stores its theme mode in memory and local storage. To synchronize App with Dashboard,
* Macaw must be informed about this change from AppBridge.
*
* If you are not using Macaw, you can remove this.
*/
function _ThemeSynchronizer() {
const { appBridgeState, appBridge } = useAppBridge();
const { setTheme, themeType } = useTheme();
// todo - replace this hook to appBridge.subscribe and react only only on initial theme event
// useEffect(() =>{
// appBridge?.subscribe('theme',console.log)
// },[appBridge])
useEffect(() => {
if (!setTheme || !appBridgeState?.theme) {
return;
}
if (themeType !== appBridgeState?.theme) {
setTheme(appBridgeState.theme);
/**
* Hack to fix macaw, which is going into infinite loop on light mode (probably de-sync local storage with react state)
* TODO Fix me when Macaw 2.0 is shipped
*/
window.localStorage.setItem("macaw-ui-theme", appBridgeState.theme);
}
}, [appBridgeState?.theme, setTheme, themeType]);
return null;
}
export const ThemeSynchronizer = memo(_ThemeSynchronizer);

View file

@ -0,0 +1,16 @@
{
"name": "@saleor/shared",
"version": "1.0.0",
"dependencies": {
"@saleor/macaw-ui": "^0.7.2",
"typescript": "^4.9.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@saleor/app-sdk": "^0.27.1"
},
"devDependencies": {
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"eslint-config-saleor": "workspace:*"
}
}

7073
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff

3
pnpm-workspace.yaml Normal file
View file

@ -0,0 +1,3 @@
packages:
- "apps/*"
- "packages/*"

16
turbo.json Normal file
View file

@ -0,0 +1,16 @@
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"outputs": [".next/**"]
},
"saleor-app-slack#build": {
"env": ["APL", "SENTRY_AUTH_TOKEN", "SENTRY_PROJECT", "SENTRY_ORG"]
},
"lint": {},
"dev": {
"cache": false,
"persistent": true
}
}
}