From 875651ef386a8357da6839d5592ee00a6ce0dd63 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 21 Aug 2025 19:22:55 +0000 Subject: [PATCH] Add API documentation pages for CLI and packages Co-authored-by: mernjscommunity --- docs/api/auth-service.html | 51 +++++++++++++++ docs/api/create-mernjs-app.html | 77 +++++++++++++++++++++++ docs/api/index.html | 40 ++++++++++++ docs/api/node-google-sheet.html | 52 +++++++++++++++ docs/api/react-svg-icons-loader.html | 56 +++++++++++++++++ docs/api/xml-to-json-chunk-processor.html | 51 +++++++++++++++ docs/api/xml-to-mongodb-importer.html | 54 ++++++++++++++++ docs/index.html | 7 +++ 8 files changed, 388 insertions(+) create mode 100644 docs/api/auth-service.html create mode 100644 docs/api/create-mernjs-app.html create mode 100644 docs/api/index.html create mode 100644 docs/api/node-google-sheet.html create mode 100644 docs/api/react-svg-icons-loader.html create mode 100644 docs/api/xml-to-json-chunk-processor.html create mode 100644 docs/api/xml-to-mongodb-importer.html diff --git a/docs/api/auth-service.html b/docs/api/auth-service.html new file mode 100644 index 00000000..c3e7659f --- /dev/null +++ b/docs/api/auth-service.html @@ -0,0 +1,51 @@ + + + + + + + @create-mern-app/auth-service + + + + + +
+ ← Back to API Index +

@create-mern-app/auth-service

+

Simple OAuth2.0 helper: auth URL, token exchange, refresh, profile.

+ +

Install

+
npm install @create-mern-app/auth-service
+ +

Usage

+
import AuthService from '@create-mern-app/auth-service';
+
+const authService = new AuthService({
+  clientId: 'your_client_id',
+  clientSecret: 'your_client_secret',
+  redirectUri: 'http://localhost:5500/callback',
+  authBaseUrl: 'http://localhost:3000'
+});
+
+const url = authService.getAuthUrl();
+// Redirect user to `url`
+
+const { accessToken, refreshToken } = await authService.getAccessToken('auth_code');
+const refreshed = await authService.getRefreshToken(refreshToken);
+const profile = await authService.getUserProfile(accessToken);
+
+ +

API

+
    +
  • constructor({ clientId, clientSecret, redirectUri, authBaseUrl })
  • +
  • getAuthUrl()
  • +
  • getAccessToken(authCode){ accessToken, refreshToken? }
  • +
  • getRefreshToken(refreshToken){ accessToken, refreshToken? }
  • +
  • getUserProfile(accessToken)
  • +
+
+ + + + diff --git a/docs/api/create-mernjs-app.html b/docs/api/create-mernjs-app.html new file mode 100644 index 00000000..ccf9b300 --- /dev/null +++ b/docs/api/create-mernjs-app.html @@ -0,0 +1,77 @@ + + + + + + + CLI: create-mernjs-app + + + + + +
+ ← Back to API Index +

create-mernjs-app (CLI)

+

Scaffold apps, libraries, packages, and snippets from curated templates.

+ +

Requirements

+
    +
  • Node.js 18+
  • +
+ +

Usage

+
npx create-mernjs-app <project-directory> [--template app|library|packages|snippets] [--yes]
+ +

Arguments

+
    +
  • <project-directory>: Name of the folder to create.
  • +
+ +

Options

+
    +
  • -y, --yes: Skip confirmation prompt.
  • +
  • --template <type>: Choose template catalog: app, library, packages, or snippets.
  • +
+ +

Examples

+
# Create an app (interactive category selection)
+npx create-mernjs-app my-app
+
+# Create a library project
+npx create-mernjs-app my-lib --template library
+
+# Create from packages catalog
+npx create-mernjs-app my-tool --template packages
+
+# Create from snippets catalog, auto-confirm
+npx create-mernjs-app my-sample --template snippets --yes
+ +

What it does

+
    +
  1. Validates project name and Node version.
  2. +
  3. Loads live template list from GitHub.
  4. +
  5. Prompts for a template within the chosen catalog.
  6. +
  7. Performs a sparse checkout to copy only the selected template.
  8. +
  9. Rewrites package.json name (and app.json for React Native).
  10. +
  11. Runs npm install --legacy-peer-deps.
  12. +
  13. Prints next steps: cd <project> and npm run dev.
  14. +
+ +

Troubleshooting

+
    +
  • Folder exists: Use a new project-directory.
  • +
  • Git required: Ensure Git is installed for sparse checkout.
  • +
  • Network access: CLI fetches templates via GitHub API.
  • +
+ +

Links

+ +
+ + + + diff --git a/docs/api/index.html b/docs/api/index.html new file mode 100644 index 00000000..5603e8cf --- /dev/null +++ b/docs/api/index.html @@ -0,0 +1,40 @@ + + + + + + + Create MERN App - API Docs + + + + + +
+

Create MERN App - API Documentation

+

Public commands, functions, and components with concise usage examples.

+ +

CLI

+ + +

Packages

+ + +

Templates and Boilerplates

+

See the main site for template catalogs and usage steps.

+ +
+ + + + diff --git a/docs/api/node-google-sheet.html b/docs/api/node-google-sheet.html new file mode 100644 index 00000000..f94abf4f --- /dev/null +++ b/docs/api/node-google-sheet.html @@ -0,0 +1,52 @@ + + + + + + + @mernjs/googlesheets + + + + + +
+ ← Back to API Index +

@mernjs/googlesheets

+

Wrapper for Google Sheets: authorize, manage sheets, and CRUD data.

+ +

Install

+
npm install @mernjs/googlesheets
+ +

Quick start

+
import GoogleSheets from '@mernjs/googlesheets';
+
+const sheets = new GoogleSheets();
+await sheets.authorize('path/to/key.json', 'spreadsheet-id');
+await sheets.connectSheet('MyActiveSheet');
+
+await sheets.createSheet('NewSheetTitle');
+const all = await sheets.getAllSheets();
+const values = await sheets.getSheet('sheetId');
+await sheets.updateSheet('sheetId', 'UpdatedTitle');
+await sheets.deleteSheet('sheetId');
+
+await sheets.addHeader(['Name', 'Email']);
+await sheets.insertData([{ Name: 'Alice', Email: 'a@example.com' }]);
+const found = await sheets.findData({ Email: 'a@example.com' });
+await sheets.updateData({ Email: 'a@example.com' }, { Name: 'Alice A.'});
+await sheets.deleteData({ Email: 'a@example.com' });
+
+ +

Key methods

+
    +
  • authorize(keyFile, spreadsheetId)
  • +
  • connectSheet(sheetName)
  • +
  • createSheet(title), getAllSheets(), getSheet(sheetId), updateSheet(sheetId, newTitle), deleteSheet(sheetId)
  • +
  • addHeader(headers), insertData(rows), findData(query), updateData(filter, update), deleteData(filter)
  • +
+
+ + + + diff --git a/docs/api/react-svg-icons-loader.html b/docs/api/react-svg-icons-loader.html new file mode 100644 index 00000000..74153a6e --- /dev/null +++ b/docs/api/react-svg-icons-loader.html @@ -0,0 +1,56 @@ + + + + + + + react-svg-icons-loader + + + + + +
+ ← Back to API Index +

react-svg-icons-loader

+

Lightweight React SVG icon loader with component and named exports.

+ +

Install

+
npm install react-svg-icons-loader
+ +

Usage

+

Icon component

+
import Icon from 'react-svg-icons-loader';
+
+export default function Example() {
+  return (
+    <div>
+      <Icon name="Hierarchical" size={100} color="blue" />
+      <Icon name="Businessman" size={100} color="blue" />
+    </div>
+  );
+}
+ +

Named icons

+
import { Businessman, Hierarchical } from 'react-svg-icons-loader';
+
+export default function Example() {
+  return (
+    <div>
+      <Hierarchical size={100} color="blue" />
+      <Businessman size={100} color="blue" />
+    </div>
+  );
+}
+ +

Props

+
    +
  • name (Icon only): string icon name
  • +
  • size: number pixels
  • +
  • color: string CSS color
  • +
+
+ + + + diff --git a/docs/api/xml-to-json-chunk-processor.html b/docs/api/xml-to-json-chunk-processor.html new file mode 100644 index 00000000..808b2735 --- /dev/null +++ b/docs/api/xml-to-json-chunk-processor.html @@ -0,0 +1,51 @@ + + + + + + + xml-to-json-chunk-processor + + + + + +
+ ← Back to API Index +

xml-to-json-chunk-processor

+

Split large XML files by tag and convert chunks to JSON with callbacks.

+ +

Install

+
npm install xml-to-json-chunk-processor
+ +

Usage

+
const xmltoJson = require('xml-to-json-chunk-processor');
+
+const params = {
+  xmlUrl: 'path/to/large.xml',
+  openingTag: '<item>',
+  closingTag: '</item>',
+  chunkSize: 2500,
+  callback: (data) => {
+    console.log('Processed data:', data);
+  }
+};
+
+xmltoJson(params)
+  .then(() => console.log('XML Processing Completed'))
+  .catch(console.error);
+
+ +

Parameters

+
    +
  • xmlUrl: string path to XML file
  • +
  • openingTag: string like <item>
  • +
  • closingTag: string like </item>
  • +
  • chunkSize: number, default 2500
  • +
  • callback: function receiving parsed JSON per chunk
  • +
+
+ + + + diff --git a/docs/api/xml-to-mongodb-importer.html b/docs/api/xml-to-mongodb-importer.html new file mode 100644 index 00000000..3955fbf3 --- /dev/null +++ b/docs/api/xml-to-mongodb-importer.html @@ -0,0 +1,54 @@ + + + + + + + xml-to-mongodb-importer + + + + + +
+ ← Back to API Index +

xml-to-mongodb-importer

+

Split large XML files and import parsed JSON into MongoDB.

+ +

Install

+
npm install xml-to-mongodb-importer
+ +

Usage

+
const { runImporter } = require('xml-to-mongodb-importer');
+
+const params = {
+  xmlUrl: 'path/to/file.xml',
+  openingTag: '<item>',
+  closingTag: '</item>',
+  connection: {
+    mongoURI: 'mongodb://localhost:27017',
+    databaseName: 'yourDb',
+    collectionName: 'items'
+  },
+  chunkSize: 2500
+};
+
+runImporter(params)
+  .then(() => console.log('Import completed successfully!'))
+  .catch(console.error);
+
+ +

Parameters

+
    +
  • xmlUrl: string, path to .xml file
  • +
  • openingTag, closingTag: strings like <item>, </item>
  • +
  • connection.mongoURI: Mongo connection URI
  • +
  • connection.databaseName: Database name
  • +
  • connection.collectionName: Collection name
  • +
  • chunkSize: number, default 2500
  • +
+
+ + + + diff --git a/docs/index.html b/docs/index.html index b616bd89..831050ed 100755 --- a/docs/index.html +++ b/docs/index.html @@ -320,6 +320,13 @@

Getting started is easy!

MERN App.

+
+

+ Looking for API and package documentation? Visit the + API Docs for CLI commands and package usage examples. +

+
+

Create MERN App