Prepare app for production

This commit is contained in:
Lukasz Ostrowski 2023-02-13 09:26:21 +01:00
parent 846ad44d89
commit 4bd75271aa
6 changed files with 56 additions and 27 deletions

View file

@ -0,0 +1,9 @@
---
"saleor-app-data-importer": minor
---
Enable origins check for installation via env variables
Update app-sdk
Set Nuvo development mode based on env variables

1
.gitignore vendored
View file

@ -39,3 +39,4 @@ yarn-error.log*
test-invoice.pdf
coverage/
apps/**/generated
.eslintcache

View file

@ -19,7 +19,7 @@
"@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.3",
"@material-ui/lab": "4.0.0-alpha.61",
"@saleor/app-sdk": "0.26.1",
"@saleor/app-sdk": "0.28.0",
"@saleor/macaw-ui": "^0.7.2",
"@urql/exchange-auth": "^1.0.0",
"@vitejs/plugin-react": "^3.1.0",

View file

@ -36,7 +36,7 @@ const columns = getCustomersModelColumns();
const nuvoSettings: SettingsAPI = {
columns,
developerMode: true, //todo
developerMode: process.env.NODE_ENV !== "production",
identifier: "customers",
modal: false,
style: {

View file

@ -2,8 +2,27 @@ import { createAppRegisterHandler } from "@saleor/app-sdk/handlers/next";
import { saleorApp } from "../../../saleor-app";
const allowedUrlsPattern = process.env.ALLOWED_DOMAIN_PATTERN;
/**
* Required endpoint, called by Saleor to install app.
* It will exchange tokens with app, so saleorApp.apl will contain token
*/
export default createAppRegisterHandler(saleorApp);
export default createAppRegisterHandler({
apl: saleorApp.apl,
/**
* Prohibit installation from Saleors other than specified by the regex.
* Regex source is ENV so if ENV is not set, all installations will be allowed.
*/
allowedSaleorUrls: [
(url) => {
if (allowedUrlsPattern) {
const regex = new RegExp(allowedUrlsPattern);
return regex.test(url);
}
return true;
},
],
});

View file

@ -31,7 +31,7 @@ importers:
'@material-ui/core': ^4.12.4
'@material-ui/icons': ^4.11.3
'@material-ui/lab': 4.0.0-alpha.61
'@saleor/app-sdk': 0.26.1
'@saleor/app-sdk': 0.28.0
'@saleor/apps-shared': workspace:*
'@saleor/macaw-ui': ^0.7.2
'@testing-library/react': ^13.4.0
@ -65,7 +65,7 @@ importers:
'@material-ui/core': 4.12.4_5ndqzdd6t4rivxsukjv3i3ak2q
'@material-ui/icons': 4.11.3_x54wk6dsnsxe7g7vvfmytp77te
'@material-ui/lab': 4.0.0-alpha.61_x54wk6dsnsxe7g7vvfmytp77te
'@saleor/app-sdk': 0.26.1_3vryta7zmbcsw4rrqf4axjqggm
'@saleor/app-sdk': 0.28.0_3vryta7zmbcsw4rrqf4axjqggm
'@saleor/apps-shared': link:../../packages/shared
'@saleor/macaw-ui': 0.7.2_pmlnlm755hlzzzocw2qhf3a34e
'@urql/exchange-auth': 1.0.0_graphql@16.6.0
@ -3784,27 +3784,6 @@ packages:
/@rushstack/eslint-patch/1.2.0:
resolution: {integrity: sha512-sXo/qW2/pAcmT43VoRKOJbDOfV3cYpq3szSVfIThQXNt+E4DfKj361vaAt3c88U5tPUxzEswam7GW48PJqtKAg==}
/@saleor/app-sdk/0.26.1_3vryta7zmbcsw4rrqf4axjqggm:
resolution: {integrity: sha512-gkNQusr8XrfLR7EcB5OKt2MV7og7g1TmdeGBTsdJwkRK18lhYz4fpTGqzoQ+3UrNq98TNuoM3dznr7oPi1QFUA==}
peerDependencies:
next: '>=12'
react: '>=17'
react-dom: '>=17'
dependencies:
debug: 4.3.4
fast-glob: 3.2.12
graphql: 16.6.0
jose: 4.11.4
next: 13.1.6_biqbaboplfbrettd7655fr4n2y
raw-body: 2.5.1
react: 18.2.0
react-dom: 18.2.0_react@18.2.0
retes: 0.33.0
uuid: 8.3.2
transitivePeerDependencies:
- supports-color
dev: false
/@saleor/app-sdk/0.26.1_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-gkNQusr8XrfLR7EcB5OKt2MV7og7g1TmdeGBTsdJwkRK18lhYz4fpTGqzoQ+3UrNq98TNuoM3dznr7oPi1QFUA==}
peerDependencies:
@ -3888,6 +3867,27 @@ packages:
- supports-color
dev: false
/@saleor/app-sdk/0.28.0_3vryta7zmbcsw4rrqf4axjqggm:
resolution: {integrity: sha512-miH54G0/q+VPeWEnnyOdHac7/4DUB789O+eV0VmuYqsp9C3S7KWQXqmJ4Wb4V7M2NBHnLIVy8vnMQwCa5PTESw==}
peerDependencies:
next: '>=12'
react: '>=17'
react-dom: '>=17'
dependencies:
debug: 4.3.4
fast-glob: 3.2.12
graphql: 16.6.0
jose: 4.11.4
next: 13.1.6_biqbaboplfbrettd7655fr4n2y
raw-body: 2.5.1
react: 18.2.0
react-dom: 18.2.0_react@18.2.0
retes: 0.33.0
uuid: 8.3.2
transitivePeerDependencies:
- supports-color
dev: false
/@saleor/macaw-ui/0.7.2_2dwar4pp5qoelfawvjffoi6dne:
resolution: {integrity: sha512-Fli7fhTWuHu7q2CzxwTUpB4x9HYaxHSAzCLZLA23VY1ieIWbCxbsXadMiMGWp/nuYitswMr6JXMm+1SDe9K8LQ==}
engines: {node: '>=16 <19'}