Skip to content

Commit

Permalink
Revert commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadai2010 committed Oct 20, 2024
1 parent 7b0e55f commit 731903a
Show file tree
Hide file tree
Showing 164 changed files with 22,672 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Issue Overview

Provide a brief summary of the issue, including the motivation for addressing it, the problems it presents, and any features required to resolve it.

## Proposed Solutions or Ideas

Outline your proposed solution or share any ideas you have for discussing or resolving the issue.
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Task name here

Fixes #relevant-issue-here

## Types of change

- [ ] Feature
- [ ] Bug
- [ ] Enhancement

## Comments (optional)
62 changes: 62 additions & 0 deletions .github/workflows/demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: scaffold-stark-demo workflow

on:
pull_request:
types: [closed]
branches: [main]
paths:
- "packages/nextjs/**"

jobs:
version-bump-nextjs:
runs-on: ubuntu-22.04
steps:
- name: Checkout Source Repository
uses: actions/checkout@v4
with:
repository: Scaffold-Stark/scaffold-stark-2
token: ${{ secrets.ORG_GITHUB_TOKEN }}
path: source_repo

- name: Modify scaffoldConfig in Source Repository
run: |
cd source_repo
sed -i 's/targetNetworks: \[chains.devnet\]/targetNetworks: \[chains.sepolia\]/' packages/nextjs/scaffold.config.ts
cat packages/nextjs/scaffold.config.ts
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
registry-url: "https://registry.yarnpkg.com"

- name: Deploy to vercel
if: success()
id: deploy
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
run: |
cd source_repo
yarn install
vercel link --yes --project $VERCEL_PROJECT_ID --token $VERCEL_TOKEN --scope $VERCEL_ORG_ID
vercel --build-env NEXT_PUBLIC_IGNORE_BUILD_ERROR=true --prod --token $VERCEL_TOKEN --scope $VERCEL_ORG_ID
- name: Notify Slack on Success
if: success()
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: "GitHub deployed to vercel result: ${{ job.status }}\nRepository Name: ${{ github.repository }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

- name: Notify Slack on Failure
if: failure()
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: "GitHub deployed to vercel result: ${{ job.status }}\nRepository Name: ${{ github.repository }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
69 changes: 69 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Next.js CI

on:
push:
paths:
- "packages/snfoundry/contracts/**"
- "packages/nextjs/**"
pull_request:
branches:
- main
paths:
- "packages/nextjs/**"
- "packages/snfoundry/contracts/**"

jobs:
ci:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node: [lts/*]

steps:
- name: Checkout
uses: actions/checkout@master

- name: Install scarb
run: curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 2.8.2

- name: Install snfoundryup
run: curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh

- name: Install snforge
run: snfoundryup -v 0.30.0

- name: Run snforge tests
run: snforge test
working-directory: ./packages/snfoundry/contracts

- name: Setup node env
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: "yarn"
#cache-dependency-path: packages/nextjs/yarn.lock

- name: Install dependencies (Next.js)
run: yarn install --immutable
working-directory: ./packages/nextjs

- name: Check Code Format
run: yarn format:check

- name: Run Next.js lint
run: yarn next:lint --max-warnings=0
working-directory: ./packages/nextjs

- name: Check typings on Next.js
run: yarn next:check-types
working-directory: ./packages/nextjs

- name: Run Next.js tests
run: yarn test run
working-directory: ./packages/nextjs

- name: Build Next.js project
run: yarn build
working-directory: ./packages/nextjs
137 changes: 137 additions & 0 deletions .github/workflows/release-create-stark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Version Bump and Notify

on:
pull_request:
types: [merged]
branches: [main]

jobs:
check_commit:
runs-on: ubuntu-latest
outputs:
SHOULD_RUN: ${{ steps.check_commit.outputs.SHOULD_RUN }}
steps:
- name: Checkout Files
uses: actions/checkout@v4
with:
token: ${{ secrets.ORG_GITHUB_TOKEN }}

- name: check if skip ci
id: check_commit
run: |
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
if [[ "$COMMIT_MESSAGE" == *"[skip ci]"* ]]; then
echo "SHOULD_RUN=false" >> "$GITHUB_OUTPUT"
else
echo "Match is false"
fi
version-bump:
needs: check_commit
if: ${{ needs.check_commit.outputs.SHOULD_RUN != 'false' }}
runs-on: ubuntu-22.04

steps:
- name: Checkout Source Repository
uses: actions/checkout@v4
with:
repository: Scaffold-Stark/scaffold-stark-2
token: ${{ secrets.ORG_GITHUB_TOKEN }}
path: source_repo

- name: Checkout Destination Repository
uses: actions/checkout@v4
with:
repository: Scaffold-Stark/create-stark
token: ${{ secrets.ORG_GITHUB_TOKEN }}
path: destination_repo

- name: Determine version bump type
id: version
run: |
cd source_repo
commit_message=$(git log -1 --pretty=%B)
if [[ "$commit_message" == *"[major]"* ]]; then
echo "type=major" >> "$GITHUB_ENV"
elif [[ "$commit_message" == *"[minor]"* ]]; then
echo "type=minor" >> "$GITHUB_ENV"
else
echo "type=patch" >> "$GITHUB_ENV"
fi
- name: Bump version in Source Repository
id: bump-version-source
run: |
cd source_repo
git pull origin main --no-rebase --strategy=ort --no-edit
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
new_version=$(npm version ${{ env.type }} -m "chore(release): %s [skip ci]")
echo "NEW_VERSION=${new_version}" >> "$GITHUB_ENV"
git push origin main --follow-tags
- name: Copy Files to Destination Repository
run: |
rsync -av --delete --exclude='.git' source_repo/ destination_repo/templates/base
cd destination_repo
git add .
git commit -m "chore: sync files from scaffold-stark-2 [skip ci]"
- name: Format .gitignore files
run: |
find destination_repo/templates/base -type f -name ".gitignore" | while read -r gitignore_file; do
mjs_file="${gitignore_file%/*}/.gitignore.template.mjs"
gitignore_content=$(cat "$gitignore_file")
cat > "$mjs_file" <<-EOF
const contents = () =>
\`${gitignore_content}\`
export default contents;
EOF
rm "$gitignore_file"
done
cd destination_repo
git add .
git commit -m "Processed $gitignore_file into $mjs_file"
- name: Bump version in Destination Repository
id: bump-version-destination
run: |
cd destination_repo
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
new_version=$(npm version ${{ env.type }} -m "chore(release): %s [skip ci]")
git push origin main --follow-tags
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org/"

- name: Publish release
if: success()
id: publish-release
run: |
cd destination_repo
npm install && npm run build && npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Notify Slack on Success
if: success()
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: "GitHub Action succeeded for version bump to ${{ env.NEW_VERSION }}."
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

- name: Notify Slack on Failure
if: failure()
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: "GitHub Action failed for version bump."
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.vscode/**
node_modules
local-devnet
package-lock.json
.idea

# yarn / eslint
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.eslintcache
.DS_Store
Empty file added .gitmodules
Empty file.
17 changes: 17 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

DESIRED_COMMIT="46e0ec032956f0e7cbe0330f32b6b31eff824087"

cd packages/snfoundry/local-devnet

LAST_COMMIT=$(git log -1 --format="%H")

if [ "$LAST_COMMIT" != "$DESIRED_COMMIT" ]; then
echo "FAIL: Last local-devnet commit ($LAST_COMMIT) is not the desired ($DESIRED_COMMIT)."
exit 1
fi

cd -

npm run format:check
3 changes: 3 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
scarb 2.8.3
starknet-foundry 0.31.0
starknet-devnet 0.2.0
13 changes: 13 additions & 0 deletions .yarn/patches/usehooks-ts-npm-2.7.2-fceffe0e43.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/dist/esm/useLocalStorage/useLocalStorage.js b/dist/esm/useLocalStorage/useLocalStorage.js
index b0d584d4df29953551dfcf8febac002f89fa7acd..920ae5c52d28af73e3a892bdb935a7805a0f8224 100644
--- a/dist/esm/useLocalStorage/useLocalStorage.js
+++ b/dist/esm/useLocalStorage/useLocalStorage.js
@@ -14,7 +14,7 @@ function useLocalStorage(key, initialValue) {
return initialValue;
}
}, [initialValue, key]);
- const [storedValue, setStoredValue] = useState(readValue);
+ const [storedValue, setStoredValue] = useState(initialValue);
const setValue = useEventCallback(value => {
if (typeof window === 'undefined') {
console.warn(`Tried setting localStorage key “${key}” even though environment is not a client`);
9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

Large diffs are not rendered by default.

Loading

0 comments on commit 731903a

Please sign in to comment.