-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Pkcarreno/develop
feat: first commit
- Loading branch information
Showing
123 changed files
with
15,134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Taken from obytes' react native template: https://github.com/obytes/react-native-template-obytes | ||
|
||
name: 'Setup Node + PNPM + Install Dependencies' | ||
description: 'Setup Node + PNPM + Install Dependencies' | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- uses: pnpm/action-setup@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
cache: 'pnpm' | ||
|
||
- name: 📦 Install Project Dependencies | ||
run: pnpm install --frozen-lockfile | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: 'npm' | ||
directory: '/' | ||
schedule: | ||
interval: 'monthly' | ||
time: '01:00' | ||
commit-message: | ||
prefix: 'pnpm' | ||
groups: | ||
all: | ||
patterns: | ||
- '*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Taken from obytes' react native template: https://github.com/obytes/react-native-template-obytes | ||
|
||
name: Precheck | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
workflow_call: | ||
|
||
jobs: | ||
install: | ||
name: Prepare enviroment + Cache | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 📦 Checkout project repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 📦 Setup Node + PNPM + install deps | ||
uses: ./.github/actions/setup-node-pnpm-install | ||
|
||
lint: | ||
name: Lint TS (eslint, prettier) | ||
needs: [install] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 📦 Checkout project repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 📦 Setup Node + PNPM + install deps | ||
uses: ./.github/actions/setup-node-pnpm-install | ||
|
||
- name: 🏃♂️ Run ESLint PR | ||
if: github.event_name == 'pull_request' | ||
uses: reviewdog/action-eslint@v1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
reporter: github-pr-review | ||
eslint_flags: 'src --max-warnings=0' | ||
|
||
- name: 🏃♂️ Run ESLint PR | ||
if: github.event_name != 'pull_request' | ||
run: pnpm run lint | ||
|
||
type-check: | ||
name: Type Check (tsc) | ||
needs: [install] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 📦 Checkout project repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 📦 Setup Node + PNPM + install deps | ||
uses: ./.github/actions/setup-node-pnpm-install | ||
|
||
- name: 📦 Install Reviewdog | ||
if: github.event_name == 'pull_request' | ||
uses: reviewdog/action-setup@v1 | ||
|
||
- name: 🏃♂️ Run TypeScript PR # Reviewdog tsc errorformat: %f:%l:%c - error TS%n: %m | ||
# We only need to add the reviewdog step if it's a pull request | ||
if: github.event_name == 'pull_request' | ||
run: | | ||
pnpm type-check | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-on-error -tee | ||
env: | ||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: | ||
🏃♂️ Run TypeScript Commit | ||
# If it's not a Pull Request then we just need to run the type-check | ||
if: github.event_name != 'pull_request' | ||
run: pnpm type-check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
||
name: 'release and deploy' | ||
|
||
jobs: | ||
prepare: | ||
uses: ./.github/workflows/precheck.yml | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: [prepare] | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- uses: googleapis/release-please-action@v4 | ||
id: release | ||
with: | ||
release-type: node | ||
outputs: | ||
release-created: ${{ steps.release.outputs.release_created }} | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: [release] | ||
if: ${{ needs.release.outputs.release-created }} | ||
env: | ||
VITE_BASE_URL: '/jsod' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 📦 Setup Node + PNPM + install deps | ||
uses: ./.github/actions/setup-node-pnpm-install | ||
|
||
- name: Build | ||
run: pnpm build | ||
shell: bash | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
env: | ||
VITE_BASE_URL: '/release-please-test/' | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: dist | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
/dev-dist | ||
|
||
# local env files | ||
.env | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pnpm commitlint --edit $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
command_exists() { | ||
command -v "$1" >/dev/null 2>&1 | ||
} | ||
|
||
# Workaround for Windows 10, Git Bash and Yarn | ||
if command_exists winpty && test -t 1; then | ||
exec </dev/tty | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function changed { | ||
git diff --name-only HEAD@{1} HEAD | grep "^$1" >/dev/null 2>&1 | ||
} | ||
|
||
echo 'Checking for changes in pnpm-lock.yml...' | ||
|
||
if changed 'pnpm-lock.yml'; then | ||
echo "📦 pnpm-lock.yml changed. Run pnpm install to bring your dependencies up to date." | ||
pnpm install | ||
fi | ||
|
||
echo 'You are up to date :)' | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/common.sh" | ||
|
||
echo "===\n>> Checking branch name..." | ||
|
||
# Check branch protection | ||
BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
PROTECTED_BRANCHES="^(master|main)" | ||
|
||
if [[ $BRANCH =~ $PROTECTED_BRANCHES ]]; then | ||
echo ">> Direct commits to the $BRANCH branch are not allowed. Please choose a new branch name." | ||
exit 1 | ||
fi | ||
|
||
echo ">> Finish checking branch name" | ||
echo ">> Linting your files and fixing them if needed..." | ||
|
||
pnpm type-check | ||
pnpm lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/common.sh" | ||
|
||
echo "===\n>> Checking branch name..." | ||
|
||
# Check branch protection | ||
BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
PROTECTED_BRANCHES="^(master|main)" | ||
|
||
if [[ $BRANCH =~ $PROTECTED_BRANCHES ]]; then | ||
echo ">> Direct push to the $BRANCH branch are not allowed. Please choose a new branch name." | ||
exit 1 | ||
fi | ||
|
||
echo ">> Finish checking branch name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"$schema": "https://unpkg.com/knip@5/schema.json", | ||
"entry": ["src/index.{js,ts,tsx}"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"endOfLine": "lf" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { expect, afterEach } from 'vitest'; | ||
import { cleanup } from '@testing-library/react'; | ||
import * as matchers from '@testing-library/jest-dom/matchers'; | ||
|
||
expect.extend(matchers); | ||
afterEach(cleanup); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# JSOD | ||
|
||
> [!IMPORTANT] | ||
> | ||
> The project is under development, so bugs or missing important features are expected. | ||
Write, run, and share JavaScript code instantly. | ||
|
||
It's: | ||
|
||
- Open Source | ||
- Run 100% on your device | ||
- Powered by QuickJS (via [quickjs-emscripten](https://github.com/justjake/quickjs-emscripten)) | ||
- Shareable | ||
- Installable | ||
- Offline first | ||
|
||
> [!CAUTION] | ||
> | ||
> Although JSOD aims to provide a safe environment, there may be inappropriate or malicious behavior when executing third-party code. | ||
## Folder Structure | ||
|
||
Follow [Bulletproof-react project structure](https://github.com/alan2207/bulletproof-react/blob/master/docs/project-structure.md). | ||
|
||
## Development | ||
|
||
To get a local copy of the code, clone it using git: | ||
|
||
```bash | ||
git clone https://github.com/Pkcarreno/jsod | ||
cd jsod | ||
``` | ||
|
||
Install dependencies: | ||
|
||
```bash | ||
pnpm i | ||
``` | ||
|
||
Now, you can start a local web server by running: | ||
|
||
```bash | ||
pnpm dev | ||
``` | ||
|
||
And then open [http://localhost:4000](http://localhost:4000) to view it in the browser. | ||
|
||
## Thanks to | ||
|
||
[Vite Template React](https://github.com/SafdarJamal/vite-template-react): Template used in this project. | ||
[quickjs-emscripten](https://github.com/justjake/quickjs-emscripten) and [quickjs-emscripten-sync](https://github.com/reearth/quickjs-emscripten-sync): Quickjs wrapper, the engine of this app. | ||
[codi.link](http://codi.link): Web editor, made in community. Great inspiration. | ||
[borrowed.nvim](https://github.com/MyyPo/borrowed.nvim): Neovim color scheme, take the naming convention to create a color scheme under the JSOD color palette. | ||
|
||
## License | ||
|
||
This project is licensed under the terms of the [MIT license](https://github.com/Pkcarreno/jsod/blob/main/LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default { extends: ['@commitlint/config-conventional'] }; |
Oops, something went wrong.