Compare commits
17 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7b611b2e7a | ||
![]() |
669bf6827e | ||
![]() |
d955531027 | ||
![]() |
9a8e0525e2 | ||
![]() |
75dba9008d | ||
![]() |
131cefa966 | ||
![]() |
06050e71f4 | ||
![]() |
3e540fdc16 | ||
![]() |
bd1066e13c | ||
![]() |
eed9a3ecec | ||
![]() |
de68dcca7b | ||
![]() |
20f439f3ce | ||
![]() |
54e77d495e | ||
![]() |
dae66beb59 | ||
![]() |
b9e3b5ca26 | ||
![]() |
1a6d39e2be | ||
![]() |
8a7371c3d2 |
17 changed files with 7305 additions and 0 deletions
9
.eslintrc.js
Normal file
9
.eslintrc.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
extends: ["saleor"],
|
||||||
|
settings: {
|
||||||
|
next: {
|
||||||
|
rootDir: ["apps/*/"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
42
.github/workflows/deploy-prod.yml
vendored
Normal file
42
.github/workflows/deploy-prod.yml
vendored
Normal 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
18
.github/workflows/pr.yml
vendored
Normal 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
42
.gitignore
vendored
Normal 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
1
.npmrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
auto-install-peers = true
|
1
CODEOWNERS
Normal file
1
CODEOWNERS
Normal file
|
@ -0,0 +1 @@
|
||||||
|
* @saleor/appstore
|
1
apps/saleor-app-slack
Submodule
1
apps/saleor-app-slack
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit d16577696dbd0e95261ba3477bf738c8d3cf3f44
|
17
package.json
Normal file
17
package.json
Normal 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"
|
||||||
|
}
|
8
packages/eslint-config-saleor/index.js
Normal file
8
packages/eslint-config-saleor/index.js
Normal 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",
|
||||||
|
},
|
||||||
|
};
|
16
packages/eslint-config-saleor/package.json
Normal file
16
packages/eslint-config-saleor/package.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
3
packages/shared/.eslintrc
Normal file
3
packages/shared/.eslintrc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"extends": ["saleor"]
|
||||||
|
}
|
1
packages/shared/index.ts
Normal file
1
packages/shared/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export * from './lib/theme-synchronizer'
|
38
packages/shared/lib/theme-synchronizer.tsx
Normal file
38
packages/shared/lib/theme-synchronizer.tsx
Normal 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);
|
16
packages/shared/package.json
Normal file
16
packages/shared/package.json
Normal 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
7073
pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load diff
3
pnpm-workspace.yaml
Normal file
3
pnpm-workspace.yaml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
packages:
|
||||||
|
- "apps/*"
|
||||||
|
- "packages/*"
|
16
turbo.json
Normal file
16
turbo.json
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue