Skip to content

Commit

Permalink
deploy and made it as static website
Browse files Browse the repository at this point in the history
🗂️
  • Loading branch information
rinturaj committed Dec 15, 2024
1 parent ea50b9e commit 0153ae6
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 36 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/jekyll-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Deploy to GitHub Pages

on:
push:
branches: 'main'

jobs:
build_site:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

# If you're using pnpm, add this step then change the commands and cache key below to use `pnpm`
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8



- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: build
env:
BASE_PATH: '/${{ github.event.repository.name }}'
run: |
pnpm run build
- name: Upload Artifacts
uses: actions/upload-pages-artifact@v3
with:
# this should match the `pages` option in your adapter-static options
path: 'build/'

deploy:
needs: build_site
runs-on: ubuntu-latest

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-static": "^3.0.6",
"@sveltejs/kit": "^2.9.0",
"@sveltejs/vite-plugin-svelte": "^5.0.0",
"autoprefixer": "^10.4.20",
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

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

37 changes: 25 additions & 12 deletions src/lib/custom/Monaco.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { onDestroy, onMount } from 'svelte';
import { onDestroy, onMount, createEventDispatcher } from 'svelte';
import * as monaco from 'monaco-editor';
import editorWorker from './../../../node_modules/monaco-editor/esm/vs/editor/editor.worker?worker';
import jsonWorker from './../../../node_modules/monaco-editor/esm/vs/language/json/json.worker?worker';
Expand Down Expand Up @@ -167,7 +167,9 @@
}
}
onMount(async () => {
const dispatch = createEventDispatcher();
onMount(() => {
// Register custom themes
monaco.editor.defineTheme('customLight', lightTheme);
monaco.editor.defineTheme('customDark', darkTheme);
Expand Down Expand Up @@ -216,23 +218,34 @@
// Add change listeners
if (originalModel) {
originalModel.onDidChangeContent(() => {
dispatchEvent(
new CustomEvent('originalChange', {
detail: getOriginalValue()
})
);
dispatch('originalChange', getOriginalValue());
});
}
if (modifiedModel) {
modifiedModel.onDidChangeContent(() => {
dispatchEvent(
new CustomEvent('modifiedChange', {
detail: getModifiedValue()
})
);
dispatch('modifiedChange', getModifiedValue());
});
}
// Dispatch load event when Monaco is ready
dispatch('load', 'Monaco is ready');
return () => {
if (diffEditor) {
diffEditor.setModel(null);
}
if (originalModel) {
originalModel.dispose();
}
if (modifiedModel) {
modifiedModel.dispose();
}
if (diffEditor) {
diffEditor.dispose();
}
};
});
onDestroy(() => {
Expand Down
12 changes: 6 additions & 6 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
import { ModeWatcher } from 'mode-watcher';
import '../app.css';
import Header from '../lib/custom/header.svelte';
import * as Card from '../lib/components/ui/card/index';
import Input from '../lib/components/ui/input/input.svelte';
import Button from '../lib/components/ui/button/button.svelte';
import Checkbox from '../lib/components/ui/checkbox/checkbox.svelte';
let { children } = $props();
</script>

Expand All @@ -21,10 +17,14 @@
data-x-chunk-container="chunk-container after:right-0"
>
<div class="mx-auto grid w-full gap-2">
<h1 class="text-xl font-semibold">Tabs</h1>
<h1 class="text-xl font-semibold">
Welcome to

<span class="font-extrabold text-black">TextCompare </span>
</h1>
</div>

<a href="##" class="font-semibold text-primary"> New </a>
<a href="##" class="font-semibold text-primary"> Exciting new features are coming soon! 🚀</a>
<!-- <a href="##">Security</a>
<a href="##">Integrations</a>
<a href="##">Support</a>
Expand Down
24 changes: 9 additions & 15 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
let monacoComponent: Monaco;
let originalCode = `Please Enter your text here`;
let modifiedCode = `Please Enter your text here`;
let isLoading = true;
function handleOriginalChange(event: CustomEvent) {
originalCode = event.detail;
Expand All @@ -16,20 +17,9 @@
modifiedCode = event.detail;
}
function handleAcceptLeft(lineNumber: number) {
monacoComponent.acceptLeftChange(lineNumber);
}
function handleAcceptRight(lineNumber: number) {
monacoComponent.acceptRightChange(lineNumber);
}
function handleAcceptAllLeft() {
monacoComponent.acceptAllLeft();
}
function handleAcceptAllRight() {
monacoComponent.acceptAllRight();
function handleMonacoLoad(event: CustomEvent) {
console.log('Monaco loaded:', event.detail);
isLoading = false;
}
</script>

Expand All @@ -52,7 +42,10 @@
line or all at once.</Card.Description
>
</Card.Header>
<Card.CardContent class="h-[80vh] ">
<Card.CardContent class="relative h-[80vh]">
{#if isLoading}
<div>loading...</div>
{/if}
<Monaco
bind:this={monacoComponent}
originalText={originalCode}
Expand All @@ -61,6 +54,7 @@
isDark={$mode == 'dark'}
on:originalChange={handleOriginalChange}
on:modifiedChange={handleModifiedChange}
on:load={handleMonacoLoad}
/>
</Card.CardContent>
</Card.Root>
Expand Down
1 change: 1 addition & 0 deletions src/routes/+page.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const ssr = false;
export const prerender = true;
4 changes: 4 additions & 0 deletions static/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
User-agent: *
Disallow: /private/
Disallow: /temp/
Allow: /
14 changes: 11 additions & 3 deletions svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import adapter from '@sveltejs/adapter-auto';
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
Expand All @@ -11,9 +11,17 @@ const config = {
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
adapter: adapter(),
adapter: adapter({
// default options are shown. On some platforms
// these options are set automatically — see below
pages: 'build',
assets: 'build',
fallback: null,
precompress: false
}),
alias: {
'@/*': './path/to/lib/*'
'@/*': './path/to/lib/*',
'@/*': './src/*'
}
}
};
Expand Down

0 comments on commit 0153ae6

Please sign in to comment.