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 @@ + + +
+ + + +Simple OAuth2.0 helper: auth URL, token exchange, refresh, profile.
+ +npm install @create-mern-app/auth-service
+
+ 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);
+
+
+ constructor({ clientId, clientSecret, redirectUri, authBaseUrl })
getAuthUrl()
getAccessToken(authCode)
→ { accessToken, refreshToken? }
getRefreshToken(refreshToken)
→ { accessToken, refreshToken? }
getUserProfile(accessToken)
Scaffold apps, libraries, packages, and snippets from curated templates.
+ +npx create-mernjs-app <project-directory> [--template app|library|packages|snippets] [--yes]
+
+ <project-directory>
: Name of the folder to create.-y, --yes
: Skip confirmation prompt.--template <type>
: Choose template catalog: app
, library
, packages
, or snippets
.# 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
+
+ package.json
name (and app.json
for React Native).npm install --legacy-peer-deps
.cd <project>
and npm run dev
.project-directory
.Public commands, functions, and components with concise usage examples.
+ +See the main site for template catalogs and usage steps.
+Wrapper for Google Sheets: authorize, manage sheets, and CRUD data.
+ +npm install @mernjs/googlesheets
+
+ 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' });
+
+
+ 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)
Lightweight React SVG icon loader with component and named exports.
+ +npm install react-svg-icons-loader
+
+ 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>
+ );
+}
+
+ 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>
+ );
+}
+
+ name
(Icon only): string icon namesize
: number pixelscolor
: string CSS colorSplit large XML files by tag and convert chunks to JSON with callbacks.
+ +npm install xml-to-json-chunk-processor
+
+ 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);
+
+
+ xmlUrl
: string path to XML fileopeningTag
: string like <item>
closingTag
: string like </item>
chunkSize
: number, default 2500callback
: function receiving parsed JSON per chunkSplit large XML files and import parsed JSON into MongoDB.
+ +npm install xml-to-mongodb-importer
+
+ 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);
+
+
+ xmlUrl
: string, path to .xml
fileopeningTag
, closingTag
: strings like <item>
, </item>
connection.mongoURI
: Mongo connection URIconnection.databaseName
: Database nameconnection.collectionName
: Collection namechunkSize
: number, default 2500+ Looking for API and package documentation? Visit the + API Docs for CLI commands and package usage examples. +
+