Skip to content

Commit

Permalink
feat: simplify config, no need to import individual config files (sis…
Browse files Browse the repository at this point in the history
  • Loading branch information
leosayous21 authored Jul 8, 2023
1 parent 8388ec2 commit 543e105
Show file tree
Hide file tree
Showing 35 changed files with 1,200 additions and 119 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/create-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Create Sismo Connect App

on:
issue_comment:
types: [created]

jobs:
create-app:
runs-on: ubuntu-latest
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/create-app') && github.event.comment.author_association == 'COLLABORATOR'
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Create Sismo Connect App on the factory
run: yarn sync-all-apps-factory
env:
SISMO_FACTORY_URL: https://factory-api.sismo.io
SISMO_FACTORY_TOKEN: ${{ secrets.SISMO_FACTORY_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Commit and push filled appId
run: |
git config --global user.email "[email protected]"
git config --global user.name "Sismo Bot"
git add -A
git commit -m "feat: create Sismo Connect App and auto-fill appId" || exit 0
git push origin HEAD:${{ github.event.issue.pull_request.head.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ next-env.d.ts

.yarn
.yarn.lock

.space-configs/
.space-configs/*
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ space-configs/
│   ├── aave_chan_initiative_apps_swag_1014x720.png
│   ├── aave_chan_initiative_apps_swag_400x400.png
│   └── ...
├── index.ts
└── types.ts
```

Expand Down
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"dev": "yarn build-config && (next dev & nodemon --watch ./space-configs --ext ts --exec 'yarn build-config')",
"build": "yarn build-config && next build",
"start": "next start",
"lint": "next lint",
"test": "yarn jest --coverage",
"test": "yarn build-config && yarn jest --coverage",
"prebuild": "yarn run build-config",
"build-config": "tsx ./src/scripts/configs-to-json/configs-to-json.script.ts",
"sync-all-apps-factory": "NEXT_PUBLIC_NODE_ENV=main yarn sync-apps-factory && NEXT_PUBLIC_NODE_ENV=demo yarn sync-apps-factory",
"sync-apps-factory": "yarn run build-config && tsx -r ./svgMock.js ./src/scripts/sync-apps-factory/sync-apps-factory.script.ts",
"prettier": "prettier --write 'src/**/*.ts' '.github' 'README.md'"
},
"dependencies": {
Expand Down Expand Up @@ -52,8 +56,10 @@
"jest": "^29.5.0",
"jest-date-mock": "^1.0.8",
"jest-environment-jsdom": "29.5.0",
"nodemon": "^2.0.22",
"sass": "^1.62.1",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1"
"ts-node": "^10.9.1",
"tsx": "^3.12.7"
}
}
11 changes: 4 additions & 7 deletions space-configs/demo/aave-chan-initiative.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// add an images folder in your space folder if you would like Sismo to host your images
import { AuthType, ClaimType } from "@sismo-core/sismo-connect-server";
import { AuthType } from "@sismo-core/sismo-connect-server";
import { SpaceConfig } from "../types";

export const aaveChanInitiativeConfigDemo: SpaceConfig = {
export default {
metadata: {
slug: "aave-chan-initiative",
name: "Aave-Chan Initiative",
description:
"This Space is dedicated to the Aave-Chan Initiative (ACI - Aavechan.eth), a delegate platform. Aave users that delegated their governance power to ACI will get access to gifts and premium features.",
Expand Down Expand Up @@ -47,9 +46,7 @@ export const aaveChanInitiativeConfigDemo: SpaceConfig = {
value: 1000,
},
],
impersonateAddresses: [
"0x5af25164a0f1207db70727a2c447d6a7b44b89d0"
],
impersonateAddresses: ["0x5af25164a0f1207db70727a2c447d6a7b44b89d0"],
},
templateConfig: {
step2CtaText: "Claim your Swag",
Expand Down Expand Up @@ -118,4 +115,4 @@ export const aaveChanInitiativeConfigDemo: SpaceConfig = {
},
},
],
};
} as SpaceConfig;
19 changes: 8 additions & 11 deletions space-configs/demo/cow-swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import { AuthType } from "@sismo-core/sismo-connect-server";
import { SpaceConfig } from "../types";

export const cowSwapConfigDemo: SpaceConfig = {
export default {
metadata: {
slug: "cow-swap",
name: "Cow Swap",
description:
"This Space is dedicated to Cow Swap, a DEX aggregator. Cow Traders and Holders will get access to gifts and premium features.",
Expand Down Expand Up @@ -54,9 +53,7 @@ export const cowSwapConfigDemo: SpaceConfig = {
value: 3,
},
],
impersonateAddresses: [
"0xb18e3bf33365fd2466c2e99b181e527a165c210c"
],
impersonateAddresses: ["0xb18e3bf33365fd2466c2e99b181e527a165c210c"],
},
templateConfig: {
step2CtaText: "Claim your Swag",
Expand All @@ -74,7 +71,8 @@ export const cowSwapConfigDemo: SpaceConfig = {
],
congratulationsMessage: {
title: "Congratulations!",
description: "Swags are given on a first come first serve basis. Come to our booth and tell us your name/pseudonym to claim your Swag 🎒",
description:
"Swags are given on a first come first serve basis. Come to our booth and tell us your name/pseudonym to claim your Swag 🎒",
},
output: {
destination: {
Expand Down Expand Up @@ -109,9 +107,7 @@ export const cowSwapConfigDemo: SpaceConfig = {
value: 1,
},
],
impersonateAddresses: [
"0xb18e3bf33365fd2466c2e99b181e527a165c210c"
],
impersonateAddresses: ["0xb18e3bf33365fd2466c2e99b181e527a165c210c"],
},
templateConfig: {
step2CtaText: "Register to get your Ticket",
Expand All @@ -129,7 +125,8 @@ export const cowSwapConfigDemo: SpaceConfig = {
],
congratulationsMessage: {
title: "Congratulations!",
description: "Tickets are processed on a first come first serve basis. You will receive an email update in a few days! See you there 💜",
description:
"Tickets are processed on a first come first serve basis. You will receive an email update in a few days! See you there 💜",
},
output: {
destination: {
Expand All @@ -145,4 +142,4 @@ export const cowSwapConfigDemo: SpaceConfig = {
},
},
],
};
} as SpaceConfig;
5 changes: 2 additions & 3 deletions space-configs/demo/privacy-is-normal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import { AuthType, ClaimType } from "@sismo-core/sismo-connect-server";
import { SpaceConfig } from "../types";

export const privacyIsNormalConfigDemo: SpaceConfig = {
export default {
metadata: {
slug: "privacy-is-normal",
name: "Privacy Is Normal 🌼",
description:
"This Space celebrates privacy as a fundamental human right. By proving you are a Tornado Cash user in a privacy-preserving manner and with a Gitcoin Passport, you were able to participate in our Sybil-resistant lottery. 10 winners have been selected to receive a printed ‘Privacy Is Normal’ artwork.",
Expand Down Expand Up @@ -157,4 +156,4 @@ export const privacyIsNormalConfigDemo: SpaceConfig = {
},
},
],
};
} as SpaceConfig;
5 changes: 2 additions & 3 deletions space-configs/demo/sismo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import { AuthType } from "@sismo-core/sismo-connect-server";
import { SpaceConfig } from "../types";

export const sismoConfigDemo: SpaceConfig = {
export default {
metadata: {
slug: "sismo",
name: "Sismo",
description:
"This Space presents Sismo Apps, offering exclusive benefits for our contributors and community members. Prove your level and unlock access to the apps. Learn more about the Sismo Community and check your level: https://community.sismo.io.",
Expand Down Expand Up @@ -470,4 +469,4 @@ export const sismoConfigDemo: SpaceConfig = {
},
},
],
};
} as SpaceConfig;
9 changes: 4 additions & 5 deletions space-configs/demo/the-merge-contributors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import { AuthType } from "@sismo-core/sismo-connect-client";
import { SpaceConfig } from "../types";

export const theMergeContributorsConfigDemo: SpaceConfig = {
export default {
metadata: {
name: "The Merge Contributors",
slug: "the-merge-contributors",
description: "Tribute to contributors to the Ethereum Merge.",
image: "pfp_Space_TheMergeContributors_400x400.png",
},
Expand All @@ -19,7 +18,7 @@ export const theMergeContributorsConfigDemo: SpaceConfig = {
description:
"Register your email address to receive exclusive tickets for web3 events - open to contributors to The Merge.",
tags: ["Event"],
image: "EthCCtickets_1014x720px.png",
image: "EthCCtickets_1014x720px.png",
createdAt: new Date("2022-07-01T00:00:00.000Z"),
},
sismoConnectRequest: {
Expand Down Expand Up @@ -60,7 +59,7 @@ export const theMergeContributorsConfigDemo: SpaceConfig = {
},
options: {
isFeatured: true,
}
},
},
],
};
} as SpaceConfig;
27 changes: 0 additions & 27 deletions space-configs/index.ts

This file was deleted.

7 changes: 3 additions & 4 deletions space-configs/main/aave-chan-initiative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import { AuthType, ClaimType } from "@sismo-core/sismo-connect-server";
import { SpaceConfig } from "../types";

export const aaveChanInitiativeConfigMain: SpaceConfig = {
export default {
metadata: {
slug: "aave-chan-initiative",
name: "Aave-Chan Initiative",
description:
"This Space is dedicated to the Aave-Chan Initiative (ACI - Aavechan.eth), a delegate platform. Aave users that delegated their governance power to ACI will get access to gifts and premium features.",
Expand Down Expand Up @@ -112,7 +111,7 @@ export const aaveChanInitiativeConfigMain: SpaceConfig = {
},
options: {
isFeatured: true,
}
},
},
],
};
} as SpaceConfig;
8 changes: 3 additions & 5 deletions space-configs/main/cow-swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import { AuthType } from "@sismo-core/sismo-connect-server";
import { SpaceConfig } from "../types";

export const cowSwapConfigMain: SpaceConfig = {
export default {
metadata: {
slug: "cow-swap",
name: "CoW Swap",
description:
"Welcome to the CoW Swap Sismo Space. CoW Swap is a decentralized exchange aggregator that protects users from MEV. CoW community, traders and holders can find here exclusive events, swags and premium features.",
Expand Down Expand Up @@ -109,8 +108,7 @@ export const cowSwapConfigMain: SpaceConfig = {
],
},
templateConfig: {
step2CtaText
: "Register to get your ticket",
step2CtaText: "Register to get your ticket",
fields: [
{
type: "short-text",
Expand Down Expand Up @@ -142,4 +140,4 @@ export const cowSwapConfigMain: SpaceConfig = {
},
},
],
};
} as SpaceConfig;
5 changes: 2 additions & 3 deletions space-configs/main/privacy-is-normal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import { AuthType, ClaimType } from "@sismo-core/sismo-connect-server";
import { SpaceConfig } from "../types";

export const privacyIsNormalConfigMain: SpaceConfig = {
export default {
metadata: {
slug: "privacy-is-normal",
name: "Privacy Is Normal 🌼",
description:
"This Space celebrates privacy as a fundamental human right. By proving you are a Tornado Cash user in a privacy-preserving manner and with a Gitcoin Passport, you were able to participate in our Sybil-resistant lottery. 10 winners have been selected to receive a printed ‘Privacy Is Normal’ artwork.",
Expand Down Expand Up @@ -155,4 +154,4 @@ export const privacyIsNormalConfigMain: SpaceConfig = {
},
},
],
};
} as SpaceConfig;
5 changes: 2 additions & 3 deletions space-configs/main/sismo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import { AuthType } from "@sismo-core/sismo-connect-server";
import { SpaceConfig } from "../types";

export const sismoConfigMain: SpaceConfig = {
export default {
metadata: {
slug: "sismo",
name: "Sismo",
description:
"This Space presents Sismo Apps, offering exclusive benefits for our contributors and community members. Prove your level and unlock access to the apps. Learn more about the Sismo Community and check your level: https://community.sismo.io.",
Expand Down Expand Up @@ -188,4 +187,4 @@ export const sismoConfigMain: SpaceConfig = {
},
},
],
};
} as SpaceConfig;
7 changes: 3 additions & 4 deletions space-configs/main/the-merge-contributors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import { AuthType } from "@sismo-core/sismo-connect-client";
import { SpaceConfig } from "../types";

export const theMergeContributorsConfigMain: SpaceConfig = {
export default {
metadata: {
name: "The Merge Contributors",
slug: "the-merge-contributors",
description: "Tribute to contributors to the Ethereum Merge.",
image: "pfp_Space_TheMergeContributors_400x400.png",
},
Expand Down Expand Up @@ -82,7 +81,7 @@ export const theMergeContributorsConfigMain: SpaceConfig = {
},
options: {
isFeatured: true,
}
},
},
],
};
} as SpaceConfig;
5 changes: 2 additions & 3 deletions space-configs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { AuthRequest, ClaimRequest } from "@sismo-core/sismo-connect-react";
export type SpaceConfig = {
metadata: {
name: string; // 80 characters max
slug: string; // spaces.sismo.io/[slug]
description: string; // 300 characters max
image?: string; // 160x160px can be an url or local file
socialLinks?: {
type: SocialType;
link: string;
}[];
tags?: string[];
slug?: string; // spaces.sismo.io/[slug] - auto-generated with the filename
};
apps?: AppConfig[];
options?: {
Expand Down Expand Up @@ -53,7 +53,6 @@ type AppCommonConfig = {
};
};


export type ExternalAppTemplateConfig = {
link: string;
};
Expand Down Expand Up @@ -167,4 +166,4 @@ type InputCommon = {
helperText?: string; // 80 characters max
maxCharacter?: number;
isRequired?: boolean;
};
};
Loading

0 comments on commit 543e105

Please sign in to comment.