Skip to content

Commit

Permalink
fix: allow multiple Plasmic projects (#1692)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryscheng committed Jun 22, 2024
1 parent 4951ca4 commit 6a934f3
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 21 deletions.
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@docusaurus/theme-common": "3.1.1",
"@laxels/docusaurus-plugin-segment": "^1.0.6",
"@mdx-js/react": "^3.0.0",
"@plasmicapp/react-web": "^0.2.340",
"@plasmicapp/react-web": "^0.2.341",
"clsx": "^2.1.0",
"prism-react-renderer": "^2.3.1",
"react": "^18.2.0",
Expand Down
22 changes: 16 additions & 6 deletions apps/frontend/plasmic-init.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import { initPlasmicLoader } from "@plasmicapp/loader-nextjs/react-server-conditional";
import _ from "lodash";
import { assert, ensure } from "@opensource-observer/utils";
import { PLASMIC_PROJECT_ID, PLASMIC_PROJECT_API_TOKEN } from "./lib/config";

const DELIMITER = ",";
const ids = _.compact(PLASMIC_PROJECT_ID.split(DELIMITER));
const tokens = _.compact(PLASMIC_PROJECT_API_TOKEN.split(DELIMITER));
assert(
ids.length === tokens.length,
`Plasmic Project ID count (${ids.length}) and API token count (${tokens.length}) mismatch`,
);

export const PLASMIC = initPlasmicLoader({
projects: [
{
id: PLASMIC_PROJECT_ID,
token: PLASMIC_PROJECT_API_TOKEN,
},
],
projects: _.zip(ids, tokens).map(([id, token]) => {
return {
id: ensure(id, "Plasmic Project ID is required"),
token: ensure(token, "Plasmic Project API token is required"),
};
}),
// Fetches the latest revisions, whether or not they were unpublished!
// Disable for production to ensure you render only published changes.
preview: false,
Expand Down
22 changes: 22 additions & 0 deletions apps/hasura/metadata/databases/cloudsql/tables/contracts_v0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
table:
name: contracts_v0
schema: public
select_permissions:
- role: anonymous
permission:
columns: "*"
filter: {}
allow_aggregations: false
comment: ""
- role: user
permission:
columns: "*"
filter: {}
allow_aggregations: false
comment: ""
- role: developer
permission:
columns: "*"
filter: {}
allow_aggregations: true
comment: ""
28 changes: 14 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6a934f3

Please sign in to comment.