- automated sales check (default 10 mins) - manual reconciliation menu - updates 'status' and 'shopify_status' in sheet - updated docs
72 lines
2.2 KiB
Markdown
72 lines
2.2 KiB
Markdown
# Setup Guide
|
|
|
|
## Local Development Environment
|
|
|
|
1. **Install Node.js**
|
|
This project uses `fnm` to manage Node versions.
|
|
```powershell
|
|
# Install fnm (if not installed)
|
|
winget install Schniz.fnm
|
|
# Configure environment
|
|
fnm env --use-on-cd | Out-String | Invoke-Expression
|
|
# Install Node version
|
|
fnm use --install-if-missing 22
|
|
```
|
|
|
|
2. **Install Dependencies**
|
|
```bash
|
|
npm install
|
|
npm install -g @google/clasp
|
|
```
|
|
|
|
3. **Clasp Login**
|
|
Authenticate with Google to allow pushing code.
|
|
|
|
```powershell
|
|
clasp login
|
|
```
|
|
|
|
4. **Initialize Project**
|
|
You must either create a new Apps Script project or clone an existing one.
|
|
- **Option A: New Project**
|
|
```bash
|
|
clasp create --type sheets --title "Product Inventory" --rootDir ./dist
|
|
```
|
|
- **Option B: Existing Project**
|
|
```bash
|
|
clasp clone <scriptId> --rootDir ./dist
|
|
```
|
|
*Note: The `--rootDir ./dist` flag is crucial so that clasp knows where to look for files.*
|
|
|
|
## Google Sheets Configuration
|
|
|
|
1. **Create a Google Sheet** (or use existing).
|
|
2. **"vars" Sheet**:
|
|
Create a tab named `vars` with the following columns: `key`, `value`.
|
|
Add the following rows:
|
|
- `productPhotosFolderId`: ID of the Drive folder for photos.
|
|
- `shopifyApiKey`: Your Shopify API Key.
|
|
- `shopifyApiSecretKey`: Your Shopify API Secret.
|
|
- `shopifyAdminApiAccessToken`: The Admin API access token.
|
|
- `shopifyApiURI`: e.g., `https://your-store.myshopify.com`
|
|
- `shopifyLocationId`: Location ID for inventory.
|
|
- `shopifyCountryCodeOfOrigin`: Two-letter country code (e.g., `US`).
|
|
- `shopifyProvinceCodeOfOrigin`: Two-letter province code (e.g., `NY`).
|
|
- `SalesSyncFrequency`: Interval (in minutes) to check for new sales. Valid: 1, 5, 10, 15, 30.
|
|
|
|
## Deployment
|
|
|
|
1. **Build**
|
|
```bash
|
|
npm run build
|
|
```
|
|
|
|
2. **Push to Apps Script**
|
|
```bash
|
|
npm run deploy
|
|
```
|
|
|
|
3. **Install Triggers**
|
|
Open the Apps Script editor (Extensions > Apps Script).
|
|
Run the `reinstallTriggers` function manually once to set up the automation.
|