Skip to content

Commit

Permalink
Merge pull request #197 from deco-sites/update/to-app
Browse files Browse the repository at this point in the history
updating starting for apps
  • Loading branch information
devartes authored Oct 31, 2023
2 parents cfbae93 + 9770049 commit 50654b3
Show file tree
Hide file tree
Showing 35 changed files with 467 additions and 689 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DECO_SITE_NAME=starting
54 changes: 54 additions & 0 deletions .github/workflows/deco-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Deploy

concurrency:
group: environment-${{ github.head_ref || github.ref }}

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
set_vars:
runs-on: ubuntu-latest
outputs:
site_matrix: ${{ steps.set_vars.outputs.site_matrix }}
steps:
- name: Set site matrix
id: set_vars
shell: bash
run: |
if [ -z ${{ vars.SITES }} ]; then
echo "site_matrix={site: [\"${{ github.event.repository.name }}\"] }" >> $GITHUB_OUTPUT
else
echo "site_matrix={site: ${{ vars.SITES }} }" >> $GITHUB_OUTPUT
fi
deploy:
needs: set_vars
strategy:
matrix: ${{ fromJson(needs.set_vars.outputs.site_matrix) }}
name: Deploy
runs-on: ubuntu-latest

permissions:
id-token: write # Needed for auth with Deno Deploy
contents: read # Needed to clone the repository

steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Deco Deploy
id: decoDeployStep
continue-on-error: true
uses: deco-cx/deploy@v0
with:
site: ${{ matrix.site }}

- name: Retry Deco Deploy
id: decoDeployRetryStep
if: steps.decoDeployStep.outcome == 'failure'
uses: deco-cx/deploy@v0
with:
site: ${{ matrix.site }}
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ typings/
# Output of 'npm pack'
*.tgz

# dotenv environment variable files
.env*

.cache/

# Mac files
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"deno.enable": true,
"deno.importMap": "./import_map.json",
"deno.importMap": "./deno.json",
"deno.codeLens.test": true,
"editor.quickSuggestions": {
"strings": true
Expand Down
23 changes: 23 additions & 0 deletions apps/site.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { App, AppContext as AC } from "$live/mod.ts";
import std, { Props } from "apps/compat/std/mod.ts";

import manifest, { Manifest } from "../manifest.gen.ts";

type StdApp = ReturnType<typeof std>;
export default function Site(
state: Props,
): App<Manifest, Props, [
StdApp,
]> {
return {
state,
manifest,
dependencies: [
std(state),
],
};
}

export type SiteApp = ReturnType<typeof Site>;
export type AppContext = AC<SiteApp>;
export { onBeforeResolveProps } from "apps/compat/$live/mod.ts";
2 changes: 1 addition & 1 deletion components/decohelp/pages/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { HTML } from "deco-sites/std/components/HTMLRenderer.tsx";
import { Image as LiveImage } from "deco-sites/std/components/types.ts";
import Image from "deco-sites/std/components/Image.tsx";
import { Section } from "$live/blocks/section.ts";
import { Section } from "deco/blocks/section.ts";

export interface Props {
Title?: string;
Expand Down
2 changes: 1 addition & 1 deletion components/decohelp/pages/ui/Content/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ContentType,
Props,
} from "deco-sites/starting/components/decohelp/pages/interfaces.ts";
import { useLivePageContext } from "$live/pages/LivePage.tsx";
import { useLivePageContext } from "deco/pages/LivePage.tsx";

function renderContentItem(item: ContentType, idx: number) {
const { renderSection } = useLivePageContext();
Expand Down
2 changes: 1 addition & 1 deletion components/ranking/RankingList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LoaderReturnType } from "$live/types.ts";
import { LoaderReturnType } from "deco/types.ts";
import type { Site } from "deco-sites/starting/routes/api/ranking.ts";
import { SiteList } from "./list/SiteList.tsx";

Expand Down
2 changes: 1 addition & 1 deletion components/ui/Markdown.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { marky } from "https://deno.land/x/[email protected]/mod.ts";
import defaultParsers from "https://deno.land/x/[email protected]/parsers.ts";
import { LoaderReturnType } from "$live/types.ts";
import { LoaderReturnType } from "deco/types.ts";
import { PostBody } from "../utils/Blog.ts";

export type Props = {
Expand Down
51 changes: 45 additions & 6 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,59 @@
{
"imports": {
"deco-sites/starting/": "./",
"deco-sites/std/": "https://denopkg.com/deco-sites/[email protected]/",
"$live/": "https://denopkg.com/deco-cx/[email protected]/",
"$store/": "./",
"deco/": "https://denopkg.com/deco-cx/[email protected]/",
"apps/": "https://denopkg.com/deco-cx/[email protected]/",
"$fresh/": "https://denopkg.com/denoland/fresh@7ad4610e3a42aba42638cbc1041b96ee58a9b29e/",
"preact": "https://esm.sh/[email protected]",
"preact/": "https://esm.sh/[email protected]/",
"preact-render-to-string": "https://esm.sh/*[email protected]",
"@preact/signals": "https://esm.sh/*@preact/[email protected]",
"@preact/signals-core": "https://esm.sh/*@preact/[email protected]",
"std/": "https://deno.land/[email protected]/",
"partytown/": "https://denopkg.com/deco-cx/[email protected]/",
"daisyui": "npm:[email protected]",
"deno-dom": "https://deno.land/x/[email protected]/deno-dom-wasm.ts",
"typography": "npm:@tailwindcss/[email protected]",
"https://deno.land/x/[email protected]/mod.ts": "./overrides/gfm.mod.ts"
},
"tasks": {
"start": "deno run -A --watch=sections/,functions/,docs/ dev.ts",
"start": "deno task bundle && deno run -A --unstable --watch=tailwind.css,sections/,functions/,loaders/,actions/,workflows/,accounts/,.env dev.ts",
"gen": "deno run -A dev.ts --gen-only",
"component": "deno eval 'import \"$live/scripts/component.ts\"'",
"check": "deno fmt && deno lint && deno check dev.ts main.ts"
"play": "USE_LOCAL_STORAGE_ONLY=true deno task start",
"component": "deno eval 'import \"deco/scripts/component.ts\"'",
"release": "deno eval 'import \"deco/scripts/release.ts\"'",
"update": "deno run -Ar https://deco.cx/update",
"check": "deno fmt && deno lint && deno check dev.ts main.ts",
"install": "deno eval 'import \"deco/scripts/apps/install.ts\"'",
"uninstall": "deno eval 'import \"deco/scripts/apps/uninstall.ts\"'",
"bundle": "deno eval 'import \"deco/scripts/apps/bundle.ts\"' deco-sites/starting",
"cache_clean": "rm deno.lock; deno cache -r main.ts",
"build": "deno run -A dev.ts build",
"preview": "deno run -A main.ts"
},
"githooks": {
"pre-commit": "check"
},
"exclude": [
"node_modules",
"static/",
"docs/**/*.md"
"README.md",
"_fresh"
],
"importMap": "./import_map.json",
"lint": {
"rules": {
"tags": [
"fresh",
"recommended"
]
}
},
"nodeModulesDir": true,
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
}
}
}
22 changes: 11 additions & 11 deletions dev.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env -S deno run -A --watch=static/
import dev from "$live/dev.ts";
import liveManifest from "$live/live.gen.ts";
import liveStdManifest from "deco-sites/std/live.gen.ts";
#!/usr/bin/env -S deno run -A --watch
import "https://deno.land/x/[email protected]/load.ts";

await dev(import.meta.url, "./main.ts", {
injectRoutes: false,
imports: {
"$live": liveManifest,
"deco-sites/std": liveStdManifest,
},
});
import dev from "$fresh/dev.ts";
import config from "./fresh.config.ts";

// Generate manifest and boot server
await dev(import.meta.url, "./main.ts", config);

if (Deno.args.includes("build")) {
Deno.exit(0);
}
13 changes: 13 additions & 0 deletions fresh.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from "$fresh/server.ts";
import plugins from "https://denopkg.com/deco-sites/[email protected]/plugins/mod.ts";
import partytownPlugin from "partytown/mod.ts";
import decoManifest from "./manifest.gen.ts";

export default defineConfig({
plugins: [
...plugins({
manifest: decoManifest,
}),
partytownPlugin(),
],
});
74 changes: 74 additions & 0 deletions fresh.gen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// DO NOT EDIT. This file is generated by Fresh.
// This file SHOULD be checked into source version control.
// This file is automatically updated during development when running `dev.ts`.

import * as $0 from "./routes/_app.tsx";
import * as $1 from "./routes/admin/[...catchall].tsx";
import * as $2 from "./routes/api/calc.tsx";
import * as $3 from "./routes/api/case.tsx";
import * as $4 from "./routes/api/leads.tsx";
import * as $5 from "./routes/api/ranking.ts";
import * as $6 from "./routes/api/webinar.tsx";
import * as $7 from "./routes/gfm.css.ts";
import * as $8 from "./routes/hackathon4.ts";
import * as $9 from "./routes/index.tsx";
import * as $10 from "./routes/proxy/image/index.tsx";
import * as $$0 from "./islands/CampHeader.tsx";
import * as $$1 from "./islands/CampMentor.tsx";
import * as $$2 from "./islands/Case.tsx";
import * as $$3 from "./islands/ChangeDevice.tsx";
import * as $$4 from "./islands/ChangeTheme.tsx";
import * as $$5 from "./islands/Cms.tsx";
import * as $$6 from "./islands/ContactUs.tsx";
import * as $$7 from "./islands/FaviconImage.tsx";
import * as $$8 from "./islands/ForwardBackButtons/ForwardBackButtons.tsx";
import * as $$9 from "./islands/Header.tsx";
import * as $$10 from "./islands/HelpFaq.tsx";
import * as $$11 from "./islands/ImpactCalculator.tsx";
import * as $$12 from "./islands/LiveProjects.tsx";
import * as $$13 from "./islands/OnThisPage.tsx";
import * as $$14 from "./islands/PopularDocuments.tsx";
import * as $$15 from "./islands/RankingAnalyze.tsx";
import * as $$16 from "./islands/RankingHeader.tsx";
import * as $$17 from "./islands/Sidebar.tsx";
import * as $$18 from "./islands/SliderJS.tsx";

const manifest = {
routes: {
"./routes/_app.tsx": $0,
"./routes/admin/[...catchall].tsx": $1,
"./routes/api/calc.tsx": $2,
"./routes/api/case.tsx": $3,
"./routes/api/leads.tsx": $4,
"./routes/api/ranking.ts": $5,
"./routes/api/webinar.tsx": $6,
"./routes/gfm.css.ts": $7,
"./routes/hackathon4.ts": $8,
"./routes/index.tsx": $9,
"./routes/proxy/image/index.tsx": $10,
},
islands: {
"./islands/CampHeader.tsx": $$0,
"./islands/CampMentor.tsx": $$1,
"./islands/Case.tsx": $$2,
"./islands/ChangeDevice.tsx": $$3,
"./islands/ChangeTheme.tsx": $$4,
"./islands/Cms.tsx": $$5,
"./islands/ContactUs.tsx": $$6,
"./islands/FaviconImage.tsx": $$7,
"./islands/ForwardBackButtons/ForwardBackButtons.tsx": $$8,
"./islands/Header.tsx": $$9,
"./islands/HelpFaq.tsx": $$10,
"./islands/ImpactCalculator.tsx": $$11,
"./islands/LiveProjects.tsx": $$12,
"./islands/OnThisPage.tsx": $$13,
"./islands/PopularDocuments.tsx": $$14,
"./islands/RankingAnalyze.tsx": $$15,
"./islands/RankingHeader.tsx": $$16,
"./islands/Sidebar.tsx": $$17,
"./islands/SliderJS.tsx": $$18,
},
baseUrl: import.meta.url,
};

export default manifest;
2 changes: 1 addition & 1 deletion functions/LoadGitHubRaw.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LoaderFunction } from "$live/types.ts";
import type { LoaderFunction } from "deco/types.ts";

export interface Props {
/** @description Complete user/repo format */
Expand Down
2 changes: 1 addition & 1 deletion functions/LoadGitHubRawPost.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LoaderFunction } from "$live/types.ts";
import type { LoaderFunction } from "deco/types.ts";
import { PostBody } from "../components/utils/Blog.ts";

export interface Props {
Expand Down
2 changes: 1 addition & 1 deletion functions/LoadGitHubRawPostList.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LoaderFunction } from "$live/types.ts";
import type { LoaderFunction } from "deco/types.ts";
import { PostList } from "../components/utils/Blog.ts";

export interface Props {
Expand Down
2 changes: 1 addition & 1 deletion functions/LoadPageProps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LoaderFunction } from "$live/types.ts";
import type { LoaderFunction } from "deco/types.ts";
import { PathObj, PropNull } from "../sections/BlogPostHeader.tsx";

/**
Expand Down
2 changes: 1 addition & 1 deletion functions/psiRankingList.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LoaderFunction } from "$live/types.ts";
import type { LoaderFunction } from "deco/types.ts";
import type { Site } from "deco-sites/starting/routes/api/ranking.ts";
import { ranking } from "../routes/api/ranking.ts";

Expand Down
19 changes: 0 additions & 19 deletions import_map.json

This file was deleted.

Loading

0 comments on commit 50654b3

Please sign in to comment.