Skip to content

Commit

Permalink
docs: get started on documentation page
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinanielsen committed Dec 13, 2023
1 parent dd5a04e commit 25e99a6
Show file tree
Hide file tree
Showing 23 changed files with 9,882 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
9 changes: 9 additions & 0 deletions docs/docs/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
sidebar_position: 1
---

# Introduction

Learn about tfjs-image-node

## Why?
50 changes: 50 additions & 0 deletions docs/docs/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
sidebar_position: 2
---

# Usage

Let's discover how to use the tfjs-image-node module.

## Getting Started

Get started by opening your node project where you want to use tfjs to identify images.

### What you'll need

- [Node.js](https://nodejs.org/en/download/) version 18.0 or above:
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.

## Installation

You can install the tfjs-image-node module using your favorite node package manager.

```bash
npm install tfjs-image-node
# or
pnpm add tfjs-image-node
# or
bun add tfjs-image-node
# or
yarn add tfjs-image-node
```

You can type this command into Command Prompt, Powershell, Terminal, or any other integrated terminal of your code editor.

The command installs all necessary dependencies you need to use tfjs-image-node, that includes the `@tensorflow/tfjs` and the `@tensorflow/tfjs-node` packages. You can choose which of these you want to utilize. Both are included since sometimes one of them can cause problems.

## Import the module

You can import the tfjs-image-node module either with the ES import or with the commonjs require.

**CJS**

```javascript
const classifyImage = require("tfjs-image-node");
```

**ES**

```javascript
import { classifyImage } from "tfjs-image-node";
```
111 changes: 111 additions & 0 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// @ts-check
// `@type` JSDoc annotations allow editor autocompletion and type checking
// (when paired with `@ts-check`).
// There are various equivalent ways to declare your Docusaurus config.
// See: https://docusaurus.io/docs/api/docusaurus-config

import { themes as prismThemes } from "prism-react-renderer";

/** @type {import('@docusaurus/types').Config} */
const config = {
title: "TFJS-image-node",
tagline: "The easiest way to classify images in node using tfjs.",
favicon: "img/favicon.ico",

// Set the production url of your site here
url: "https://your-docusaurus-site.example.com",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/",

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "kevinanielsen", // Usually your GitHub org/user name.
projectName: "tfjs-image-node", // Usually your repo name.

onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",

// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en"],
},

presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: "./sidebars.js",
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: "https://github.com/kevinanielsen/tfjs-image-node/",
},
theme: {
customCss: "./src/css/custom.css",
},
}),
],
],

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// Replace with your project's social card
image: "img/docusaurus-social-card.jpg",
navbar: {
title: "TFJS-image-node",
logo: {
alt: "My Site Logo",
src: "img/logo.svg",
},
items: [
{
type: "docSidebar",
sidebarId: "tutorialSidebar",
position: "left",
label: "Documentation",
},
{
href: "https://github.com/kevinanielsen/tfjs-image-node",
label: "GitHub",
position: "right",
},
],
},
footer: {
style: "dark",
links: [
{
title: "Docs",
items: [
{
label: "Tutorial",
to: "/docs/intro",
},
],
},
{
title: "More",
items: [
{
label: "GitHub",
href: "https://github.com/kevinanielsen/tfjs-image-node",
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} tfjs-image-node, Kevin Alex Nielsen. Built with Docusaurus.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
}),
};

export default config;
44 changes: 44 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "docs",
"version": "0.0.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "3.0.1",
"@docusaurus/preset-classic": "3.0.1",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.0.0",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.0.1",
"@docusaurus/types": "3.0.1"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 3 chrome version",
"last 3 firefox version",
"last 5 safari version"
]
},
"engines": {
"node": ">=18.0"
}
}
Loading

0 comments on commit 25e99a6

Please sign in to comment.