Skip to content

Commit

Permalink
Fix more nonsense
Browse files Browse the repository at this point in the history
  • Loading branch information
djfarrelly committed Jan 6, 2023
1 parent 379d38d commit 507e517
Show file tree
Hide file tree
Showing 30 changed files with 208 additions and 1,650 deletions.
2 changes: 0 additions & 2 deletions mdx/rehype.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export function rehypeShiki() {
node.properties.language
);

console.log(tokens);

textNode.value = shiki.renderToHtml(tokens, {
elements: {
pre: ({ children }) => children,
Expand Down
2 changes: 2 additions & 0 deletions pages/blog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export default function BlogLayout(props) {
<Image
className="rounded-t-lg lg:rounded-t-none lg:rounded-r-lg group-hover:rounded-lg"
src={focus.image}
alt={`Featured image for ${focus.heading} blog post`}
width={900}
height={900 / 2}
quality={95}
Expand All @@ -112,6 +113,7 @@ export default function BlogLayout(props) {
<Image
className="rounded-lg"
src={item.image}
alt={`Featured image for ${item.heading} blog post`}
width={720}
height={720 / 2}
/>
Expand Down
6 changes: 1 addition & 5 deletions pages/blog/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ import rehypeRaw from "rehype-raw";
import { serialize } from "next-mdx-remote/serialize";
import { MDXRemote } from "next-mdx-remote";
import Footer from "../../shared/Footer";
import Nav from "../../shared/legacy/nav";
import Callout from "../../shared/legacy/Callout";
import syntaxHighlightingCSS from "../../shared/legacy/syntaxHighlightingCSS";
import { Wrapper } from "../../shared/legacy/blog";
import { rehypePrependCode, rehypeShiki } from "../../utils/code";
import { rehypeParseCodeBlocks } from "../../mdx/rehype.mjs";
import ThemeToggleButton from "../../shared/legacy/ThemeToggleButton";
import Tags from "../../shared/Blog/Tags";

// MDX Components
Expand Down Expand Up @@ -125,6 +120,7 @@ export default function BlogLayout(props) {
<Image
className="rounded-lg shadow-lg"
src={scope.image}
alt={`Featured image for ${scope.heading} blog post`}
width={768}
height={768 / 2}
quality={95}
Expand Down
7 changes: 4 additions & 3 deletions pages/blog/_posts/no-workers-necessary-nodejs-express.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ curl -X PUT https://yourappsdomain.com/api/inngest
```

<aside className="flex flex-row gap-4 items-center">
<div>
🔜
</div><div>During the beta phase of our SDK development, this is the recommended flow, but we plan to automate this completely in the weeks ahead. <a href="https://eepurl.com/hI3dCr">Join our mailing list to get updates about SDK releases</a>.</div>
<div>🔜</div>
<div>During the beta phase of our SDK development, this is the recommended flow, but we plan to automate this completely in the weeks ahead. <a href="https://eepurl.com/hI3dCr">Join our mailing list to get updates about SDK releases</a>.</div>
</aside>


> _[You can read the full Express.js guide in our docs here →](/docs/frameworks/express?ref=blog-no-workers-necessary)_

We now can move unnecessarily blocking code out of the critical path of our app into background tasks without any new infrastructure to set up! The Inngest Cloud dashboard also gives you access to logs of all of your events as well as the results of every function that you run - Observability out-of-the-box.

<div className="blog-image-container:2">
Expand Down
10 changes: 5 additions & 5 deletions pages/blog/_posts/run-nextjs-functions-in-the-background.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ export default serve("My App", [ weeklyDigest ], {
signingKey: process.env.INNGEST_SIGNING_KEY
});
```
<!-- TODO - Replace w/ below when new inngest-js is out:
{/* TODO - Replace w/ below when new inngest-js is out:
export default serve("My App", [ sendWeeklyDigest ]);
-->
*/}

Let's break down what we're doing in the code above. We use [the Inngest SDK](https://github.com/inngest/inngest-js) (`npm install inngest`) to define our function and serve it. We start with defining a schedule function (aka Cron Job). This tells Inngest what to call the function, what schedule to run it on, and what code to run:

Expand Down Expand Up @@ -91,7 +91,7 @@ export default serve("My App", [
runDailyReport,
], { signingKey: process.env.INNGEST_SIGNING_KEY });
```
<!-- TODO - update this with new SDK -->
{/* TODO - update this with new SDK */}

Great! You've done all the hard work already. You can always add or remove functions as your app grows. The best part is your code stays in your existing repo right alongside everything else. Go ahead and merge your code and let your platform automatically deploy your code.

Expand Down Expand Up @@ -193,9 +193,9 @@ export default serve("My App", [ welcomeEmail ], {
signingKey: process.env.INNGEST_SIGNING_KEY
});
```
<!-- TODO - Replace w/ below when new inngest-js is out:
{/* TODO - Replace w/ below when new inngest-js is out:
export default serve("My App", [ sendWeeklyDigest ]);
-->
*/}
> Bonus: Inngest SDK's has [first-class TypeScript support - click to learn more](/docs/typescript?ref=blog-run-nextjs-functions-in-the-background)
Expand Down
1 change: 1 addition & 0 deletions pages/docs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export default function DocsHome(props) {
<div className="text-center">
<Image
src="/assets/docs/dev-server-example.png"
alt="Inngest Dev Server screenshot"
width={800}
height={(609 / 900) * 800}
quality="100"
Expand Down
16 changes: 5 additions & 11 deletions pages/docs/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import styled from "@emotion/styled";
import { serialize } from "next-mdx-remote/serialize";
import { MDXRemote } from "next-mdx-remote";
import rehypeSlug from "rehype-slug";
import rehypeRaw from "rehype-raw";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
// local
import {
Expand All @@ -18,7 +17,8 @@ import {
Docs,
} from "../../utils/docs";
import { DocsLayout, DocsContent } from "../docs";
import { rehypeShiki } from "../../utils/code";
import { rehypeParseCodeBlocks } from "../../mdx/rehype.mjs";
import { rehypePrependCode, rehypeShiki } from "../../utils/code";

export default function DocLayout(props: any) {
const scope: DocScope = JSON.parse(props.post.scope.json);
Expand Down Expand Up @@ -193,19 +193,13 @@ export async function getStaticProps({ params }) {

// Add categories to the scope such that we can show them in the UI.
const scope = { ...docs.scope };
const nodeTypes = [
"mdxFlowExpression",
"mdxJsxFlowElement",
"mdxJsxTextElement",
"mdxTextExpression",
"mdxjsEsm",
];
const post = await serialize(content, {
scope: { json: JSON.stringify(scope) },
mdxOptions: {
remarkPlugins: [rehypeShiki],
rehypePlugins: [
[rehypeRaw, { passThrough: nodeTypes }],
rehypeParseCodeBlocks,
rehypePrependCode,
rehypeShiki,
rehypeSlug,
rehypeAutolinkHeadings,
],
Expand Down
5 changes: 1 addition & 4 deletions pages/docs/_cloud/1-guides/1-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ Specifying the trigger before you begin developing your function allows you to m
<aside>
<p>
<b>Tip:</b>{" "}
<strong>
Inngest asks you for the event that triggers the function before you get
started.
</strong>{" "}
<strong>Inngest asks you for the event that triggers the function before you get started.</strong>{" "}
This allows the CLI to automatically generate types for your function, to
run local mock testing, and to ensure that invalid data doesn’t cause issues
for your function in production.
Expand Down
36 changes: 14 additions & 22 deletions pages/docs/_docs/100-quick-start-tutorial.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Before integrating Inngest we will start the [open-source development server](ht
npx inngest-cli@latest dev
```

<!-- TODO/DOCS: Add link to a dev server document which tells the user how to add the cli to npm run dev via concurrently -->
{/* TODO/DOCS: Add link to a dev server document which tells the user how to add the cli to npm run dev via concurrently */}

<details>
<summary><strong>You should see the following output:</strong></summary>
Expand All @@ -48,17 +48,14 @@ $ npx inngest-cli@latest dev

- http://127.0.0.1:8288 (http://localhost:8288)
```

</details>

This runs Inngest locally. We'll use this to test our functions as we write them. With this running you can visit ``http://localhost:8288` to see the development UI:
This runs Inngest locally. We'll use this to test our functions as we write them. With this running you can visit `http://localhost:8288` to see the development UI:

<div className="text-center">
<Image
src="/assets/docs/quick-start/dev-server-startup-screen.png"
width="600"
height="406"
quality="95"
/>
<img src="/assets/docs/quick-start/dev-server-startup-screen.png" style={{ maxWidth: "600px;" }}/>
{/* Replace this with Image tag we move this over to the new docs */}
</div>

Let's get started with adding Inngest to a project!
Expand Down Expand Up @@ -120,7 +117,7 @@ export default createStepFunction("My first function", "test/demo", ({ event, to

This creates a new function which will be called in the background any time Inngest receives an event with the name `test/demo`. This introduces some new concepts:

<!-- TODO/DOCS: Link these to relevant docs on each when completed (Concepts, guides, references etc.) -->
{/* TODO/DOCS: Link these to relevant docs on each when completed (Concepts, guides, references etc.) */}
- Functions are called by events (or on a schedule), in the background
- Functions can sleep
- Functions will retry automatically if they error.
Expand All @@ -140,15 +137,15 @@ export default serve("My app name", [demoFn]); // Serve your function

Here, we're adding your new function to the array of functions that are served by the API. This enables Inngest to discover and call your functions in your app.

<!-- TODO/DOCS: Add a future screenshot which shows this function listed in the dev server, e.g. at "localhost:8288/functions" -->
{/* TODO/DOCS: Add a future screenshot which shows this function listed in the dev server, e.g. at "localhost:8288/functions" */}

Now, let's run your function!

## 4. Triggering your function from the development UI

Ensure your Next.js app is up and running via `npm run dev` inside project root, then head to `http://localhost:8288`. You should see the following UI, which allows you to send events directly to Inngest:

<!-- TODO: ADD IMAGE -->
{/* TODO: ADD IMAGE */}

To send the event, click on “Send event” in the top right corner then add the following event data:

Expand All @@ -164,12 +161,8 @@ To send the event, click on “Send event” in the top right corner then add th
The event is sent to Inngest running locally via `npx inngest-cli@latest dev`, which automatically runs your function in the background reliably!

<div className="text-center">
<Image
src="/assets/docs/quick-start/dev-server-function-run.png"
width={720}
height={609/900*720}
quality="95"
/>
<img src="/assets/docs/quick-start/dev-server-function-run.png" style={{ maxWidth: "720px;" }}/>
{/* Replace this with Image tag we move this over to the new docs */}
</div>

This highlights the power of event-driven development. Using events, you can:
Expand All @@ -179,9 +172,9 @@ This highlights the power of event-driven development. Using events, you can:
- Store the event for some amount of time, to locally replay if there are errors in production
- Build complex sleeps and schedules without worrying about queues

<!-- TODO/DOCS:
{/* - TODO/DOCS:
Add and link "which we talk about here" (after using events...) to future "benefits of events" concept doc
-->
*/}
There are many other benefits to using events. For now, let's show you how to trigger functions in your code by sending events from your own app.

## 5. Triggering your function from code
Expand Down Expand Up @@ -235,6 +228,5 @@ If you'd like to learn more about functions or sending events check out these re
- [Writing functions](/docs/functions)
- [Writing scheduled functions](/docs/functions#writing-a-scheduled-function)
- [Sending events](/docs/events)
<!-- TODO/DOCS: Add the concepts category index page here when complete
- [Learn the concepts](/docs/concepts)
-->
{/* TODO/DOCS: Add the concepts category index page here when complete
- [Learn the concepts](/docs/concepts) */}
62 changes: 0 additions & 62 deletions pages/docs/_docs/120-cli/01-installation.mdx

This file was deleted.

28 changes: 0 additions & 28 deletions pages/docs/_docs/120-cli/02-init.mdx

This file was deleted.

Loading

0 comments on commit 507e517

Please sign in to comment.