Skip to content

Commit

Permalink
[Nammatham] Marked version 1 and write doc v2 (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
mildronize authored May 8, 2024
2 parents 417a87c + 6e1ec6a commit 466b44b
Show file tree
Hide file tree
Showing 17 changed files with 1,017 additions and 229 deletions.
23 changes: 12 additions & 11 deletions apps/nammatham/docs/community/local-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ sidebar_position: 1

# Local Development

```sh
npx nx build nammatham
# or
npx nx run nammatham:build
npx nx run nammatham:dev
## Local Dev Setup

npx nx run nammatham:test:watch


# Publish npm with nx
pnpm --filter nammatham publish
```bash
# Install dependencies
pnpm install
# Before dev (Update workspace to local dependencies)
pnpm pre-local && pnpm install
# While dev
pnpm dev
# After dev before submitting PRs (Update workspace to actual dependencies), `pnpm install` for making sure lockfile is correct.
pnpm post-local && pnpm install
# Release package
pnpm release
```

287 changes: 76 additions & 211 deletions apps/nammatham/docs/intro.md

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions apps/nammatham/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ const config: Config = {
navbar: {
title: 'Nammatham',
logo: {
alt: 'My Site Logo',
src: 'img/logo.svg',
alt: 'Nammatham Logo',
src: 'https://i.ibb.co/QmTh7x4/Nammatham-Logo-v2.png',
},
items: [
{
Expand All @@ -71,6 +71,12 @@ const config: Config = {
label: 'Docs',
},
{ to: '/blog', label: 'Blog', position: 'left' },
{
type: 'docsVersionDropdown',
// dropdownItemsAfter: [{to: '/versions', label: 'All versions'}],
// dropdownActiveClassDisabled: true,
position: 'right',
},
{
href: 'https://github.com/thaitype/nammatham',
label: 'GitHub',
Expand Down
22 changes: 18 additions & 4 deletions apps/nammatham/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,39 @@

/* You can override the default Infima variables here. */
:root {
--ifm-color-primary: #2e8555;
/* --ifm-color-primary: #2e8555;
--ifm-color-primary-dark: #29784c;
--ifm-color-primary-darker: #277148;
--ifm-color-primary-darkest: #205d3b;
--ifm-color-primary-light: #33925d;
--ifm-color-primary-lighter: #359962;
--ifm-color-primary-lightest: #3cad6e;
--ifm-color-primary-lightest: #3cad6e; */
--ifm-color-primary: #671b0e;
--ifm-color-primary-dark: #5d180d;
--ifm-color-primary-darker: #58170c;
--ifm-color-primary-darkest: #48130a;
--ifm-color-primary-light: #711e0f;
--ifm-color-primary-lighter: #761f10;
--ifm-color-primary-lightest: #862312;
--ifm-code-font-size: 95%;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
}

/* For readability concerns, you should choose a lighter palette in dark mode. */
[data-theme='dark'] {
--ifm-color-primary: #25c2a0;
/* --ifm-color-primary: #25c2a0;
--ifm-color-primary-dark: #21af90;
--ifm-color-primary-darker: #1fa588;
--ifm-color-primary-darkest: #1a8870;
--ifm-color-primary-light: #29d5b0;
--ifm-color-primary-lighter: #32d8b4;
--ifm-color-primary-lightest: #4fddbf;
--ifm-color-primary-lightest: #4fddbf; */
--ifm-color-primary: #efd0cc;
--ifm-color-primary-dark: #e4b1aa;
--ifm-color-primary-darker: #dfa199;
--ifm-color-primary-darkest: #cf7367;
--ifm-color-primary-light: #faefee;
--ifm-color-primary-lighter: #ffffff;
--ifm-color-primary-lightest: #ffffff;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
}
4 changes: 3 additions & 1 deletion apps/nammatham/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ function HomepageHeader() {
return (
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container">
<img src="https://i.ibb.co/QmTh7x4/Nammatham-Logo-v2.png" width="120" alt="Nammatham Logo" />
<Heading as="h1" className="hero__title">
{siteConfig.title}
</Heading>

<p className="hero__subtitle">{siteConfig.tagline}</p>
<div className={styles.buttons}>
<Link
className="button button--secondary button--lg"
to="/docs/intro"
>
Docusaurus Tutorial - 5min ⏱️
Nammatham Tutorial - 5min ⏱️
</Link>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "Community",
"position": 3,
"link": {
"type": "generated-index"
}
}
19 changes: 19 additions & 0 deletions apps/nammatham/versioned_docs/version-1.x/community/local-dev.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
sidebar_position: 1
---

# Local Development

```sh
npx nx build nammatham
# or
npx nx run nammatham:build
npx nx run nammatham:dev

npx nx run nammatham:test:watch


# Publish npm with nx
pnpm --filter nammatham publish
```

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Concepts",
"position": 2,
"link": {
"type": "generated-index",
"description": "Nammatham Concepts."
}
}
130 changes: 130 additions & 0 deletions apps/nammatham/versioned_docs/version-1.x/concept/binding-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
sidebar_position: 3
---
# All Built-in Binding Type

You can see all built-in binding type in [test case](https://github.com/thaitype/nammatham/blob/v1.x/packages/core/src/test-usecases/all-bindings/fixtures/functions/all-bindings.function.ts) as shown below:

```ts
import { BaseFunction, binding, functionName } from '../../../../main';
import { responseHelper } from '../../../response-helper';
import { HttpRequest, HttpResponse, Timer } from '@azure/functions';

const bindings = [
binding.httpTrigger({ name: 'req' as const }), // make string to literal type
binding.http({ name: 'res' as const }), // make string to literal type
binding.http_withReturn(),
binding.timerTrigger({ name: 'timer' as const, schedule: '*' }), // make string to literal type
binding.cosmosDBTrigger_v2({
name: 'document_trigger_v2' as const,
collectionName: '',
connectionStringSetting: '',
databaseName: '',
}),
binding.cosmosDBTrigger_v4({
name: 'document_trigger_v4' as const,
connection: '',
containerName: '',
databaseName: '',
}),
binding.cosmosDBTrigger({
name: 'document_trigger_default' as const,
connection: '',
containerName: '',
databaseName: '',
}),
binding.cosmosDB_output_v2({
name: 'document_output_v2' as const,
collectionName: '',
connectionStringSetting: '',
createIfNotExists: true,
databaseName: '',
}),
binding.cosmosDB_output_v4({
name: 'document_output_v4' as const,
createIfNotExists: true,
databaseName: '',
connection: '',
containerName: '',
}),
binding.cosmosDB_output({
name: 'document_output_default' as const,
createIfNotExists: true,
databaseName: '',
connection: '',
containerName: '',
}),
binding.cosmosDB_input_v2({
name: 'document_input_v2' as const,
collectionName: '',
connectionStringSetting: '',
databaseName: '',
id: '',
partitionKey: '',
sqlQuery: '',
}),
binding.cosmosDB_input_v4({
name: 'document_input_v4' as const,
databaseName: '',
id: '',
partitionKey: '',
sqlQuery: '',
connection: '',
containerName: '',
}),
binding.cosmosDB_input({
name: 'document_input_default' as const,
databaseName: '',
id: '',
partitionKey: '',
sqlQuery: '',
connection: '',
containerName: '',
}),
binding.blobTrigger({
connection: '',
name: 'blob_trigger' as const,
path: '',
}),
binding.blob_input({
connection: '',
name: 'blob_input' as const,
path: '',
}),
binding.blob_output({
connection: '',
name: 'blob_output' as const,
path: '',
}),
] as const;

const customBindings = binding.custom({ name: 'req' as const, type: 'custom', direction: 'in' });

@functionName('AllBindingsFunction', ...bindings, customBindings)
export class AllBindingsFunction extends BaseFunction<typeof bindings> {
public override execute() {
const req: HttpRequest = this.bindings.req;
const res: HttpResponse = this.bindings.res;
const timer: Timer = this.bindings.timer;

const document_output_v2: any = this.bindings.document_output_v2;
const document_output_v4: any = this.bindings.document_output_v4;
const document_output_default: any = this.bindings.document_output_default;

const document_input_v2: any = this.bindings.document_input_v2;
const document_input_v4: any = this.bindings.document_input_v4;
const document_input_default: any = this.bindings.document_input_default;

const document_trigger_v2: any = this.bindings.document_trigger_v2;
const document_trigger_v4: any = this.bindings.document_trigger_v4;
const document_trigger_default: any = this.bindings.document_trigger_default;

const blob_trigger: any = this.bindings.blob_trigger;
const blob_input: any = this.bindings.blob_input;
const blob_output: any = this.bindings.blob_output;

const { name } = this.req.query;
this.res.send(responseHelper(name));
}
}
```
Loading

0 comments on commit 466b44b

Please sign in to comment.