From 493334b030df2c816fa5940f5c446e3478c946b0 Mon Sep 17 00:00:00 2001 From: Daniel Salazar Date: Fri, 19 Sep 2025 02:34:33 -0700 Subject: [PATCH] chore: update README for puter.js to publish on npm --- src/puter-js/README.md | 86 +++++++++++++++++++++++++++++++-------- src/puter-js/package.json | 51 +++++++++++++---------- 2 files changed, 97 insertions(+), 40 deletions(-) diff --git a/src/puter-js/README.md b/src/puter-js/README.md index 446de8017..157e2dd9c 100644 --- a/src/puter-js/README.md +++ b/src/puter-js/README.md @@ -1,21 +1,72 @@ -

Puter.js

-

The official JavaScript SDK for Puter.com. Cloud and AI features right from your frontend code!

-

- « LIVE DEMO » -
-
- Docs - · - Puter.com - · - Discord - · - Reddit - · - X (Twitter) -

+# Puter.js + +The official JavaScript SDK for [Puter.com](https://puter.com) — access cloud and AI features directly from your frontend code. + +--- + +## Installation (npm) + +```sh +npm install @heyputer/puterjs +``` + +### Importing + +#### ES Modules + +```js +import puter from '@heyputer/puterjs'; +``` + +#### CommonJS + +```js +const puter = require('@heyputer/puterjs'); +``` + +## Usage Example + +```js +// Print a message +puter.print('Hello from Puter.js!'); + +// Chat with GPT-3.5 Turbo +puter.ai.chat('What color was Napoleon\'s white horse?').then(response => { + puter.print(response); +}); +``` + +--- + +## CDN Usage + +Include Puter.js directly in your HTML via CDN: + +```html + + +``` + +--- + +## Documentation & Community + +- [Docs](https://docs.puter.com) +- [Live Demo](https://docs.puter.com/playground/) +- [Puter.com](https://puter.com) +- [Discord](https://discord.com/invite/PQcx7Teh8u) +- [Reddit](https://reddit.com/r/puter) +- [X (Twitter)](https://twitter.com/HeyPuter) + +--- + +## Local Development Example -### Example Make sure the development server is running. ```html @@ -33,4 +84,3 @@ Make sure the development server is running. -``` diff --git a/src/puter-js/package.json b/src/puter-js/package.json index 82e9d724b..ec634f694 100644 --- a/src/puter-js/package.json +++ b/src/puter-js/package.json @@ -1,23 +1,30 @@ { - "name": "@heyputer/puterjs", - "version": "1.0.0", - "description": "", - "main": "index.js", - "type": "module", - "scripts": { - "start-server": "npx http-server --cors -c-1", - "start-webpack": "webpack && webpack --output-filename puter.dev.js --watch --devtool source-map", - "start": "concurrently \"npm run start-server\" \"npm run start-webpack\"", - "build": "webpack && { echo \"// Copyright 2024-present Puter Technologies Inc. All rights reserved.\"; echo \"// Generated on $(date '+%Y-%m-%d %H:%M')\n\"; cat ./dist/puter.js; } > temp && mv temp ./dist/puter.js" - }, - "keywords": [], - "author": "", - "license": "Apache-2.0", - "devDependencies": { - "concurrently": "^8.2.2", - "webpack-cli": "^5.1.4" - }, - "dependencies": { - "@heyputer/kv.js": "^0.1.92" - } -} + "name": "@heyputer/puterjs", + "version": "1.0.0", + "description": "Puter.js - A JavaScript library for interacting with Puter services.", + "main": "index.js", + "type": "module", + "publishConfig": { + "registry": "https://registry.npmjs.org/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/HeyPuter/puter.git" + }, + "scripts": { + "start-server": "npx http-server --cors -c-1", + "start-webpack": "webpack && webpack --output-filename puter.dev.js --watch --devtool source-map", + "start": "concurrently \"npm run start-server\" \"npm run start-webpack\"", + "build": "webpack && { echo \"// Copyright 2024-present Puter Technologies Inc. All rights reserved.\"; echo \"// Generated on $(date '+%Y-%m-%d %H:%M')\n\"; cat ./dist/puter.js; } > temp && mv temp ./dist/puter.js" + }, + "keywords": [], + "author": "Puter Technologies Inc.", + "license": "Apache-2.0", + "devDependencies": { + "concurrently": "^8.2.2", + "webpack-cli": "^5.1.4" + }, + "dependencies": { + "@heyputer/kv.js": "^0.1.92" + } +} \ No newline at end of file