npm package: @modulusv/scripts
Description: Utility scripts for ModulusV project
Author: Andrey Vyalkov
Latest version: 1.0.7

# @modulusv/scripts

Utility scripts for the ModulusV project.

## Installation

```bash
# Using npm
npm install @modulusv/scripts

# Using yarn
yarn add @modulusv/scripts

# Using pnpm
pnpm add @modulusv/scripts
```

## CLI Commands

This package provides several command-line utilities that can be used in your project:

### Deploy to S3

Deploy your project to an S3-compatible storage:

```bash
# Using npx
npx modulusv-deploy-s3 <test|prod|dev> [--select-build <build_name_from_history>]

# In package.json scripts
"deploy:dev:s3": "modulusv-deploy-s3 dev",
"deploy:prod:s3": "modulusv-deploy-s3 prod --select-build latest"

# Example of full path to deployed application
After deployment, your application will be available at:
https://your-s3-endpoint.com/your-bucket-name/your-package-name/dev/index.html
```

### Deploy to GitHub Pages

Deploy your project to GitHub Pages:

```bash
# Using npx
npx modulusv-deploy-github <test|prod|dev> [--select-build <build_name_from_history>]

# In package.json scripts
"deploy:dev:github": "modulusv-deploy-github dev",
"deploy:prod:github": "modulusv-deploy-github prod --select-build latest"

# Example of full path to deployed application
After deployment, your application will be available at:
https://your-github-username.github.io/your-repository-name/your-package-name/dev/index.html
```

### Deploy to Azure Blob Storage

Deploy your project to Azure Blob Storage:

```bash
# Using npx
npx modulusv-deploy-azure <test|prod|dev> [--select-build <build_name_from_history>]

# In package.json scripts
"deploy:dev:azure": "modulusv-deploy-azure dev",
"deploy:prod:azure": "modulusv-deploy-azure prod --select-build latest"

# Example of full path to deployed application
After deployment, your application will be available at:
https://yourstorageaccount.blob.core.windows.net/your-container-name/your-package-name/dev/index.html
```

### Create Build Info

Generate build information for your project. This creates an `applicationInfo.json` file in the `src` directory that contains application metadata, package information, and manifest details:

```bash
# Using npx
npx modulusv-create-build-info

# In package.json scripts
"prebuild": "modulusv-create-build-info"
```

This script should typically be run before building the project, which is why it's recommended to add it as a `prebuild` script.

### Create Deploy Info

Generate deployment information for your project. This creates a `deploy-info.json` file in the `dist` directory that contains information about the files in the build, including file sizes, hashes, and GitHub Pages URLs:

```bash
# Using npx
npx modulusv-create-deploy-info

# In package.json scripts
"createDeployInfo": "modulusv-create-deploy-info"
```

This script should be run after building the project, but before deploying it.

## Configuration

### GitHub Authentication

To deploy to GitHub Pages, you need to set up authentication. Create a `.privat/github-deploy-config.json` file in your project root:

```json
{
  "token": "your_personal_access_token",
  "username": "your_github_username",
  "repositoryUrl": "username/repository-name"
}
```

The `.privat` directory is used to store sensitive configuration files that should not be committed to your repository. Make sure to add `.privat` to your `.gitignore` file.

You can also use environment variables instead:

```
GITHUB_TOKEN=your_personal_access_token
GITHUB_USERNAME=your_github_username
GITHUB_REPO=your_repository_name
```

### S3 Authentication

To deploy to S3-compatible storage, create a `.privat/s3ConnectionConfig.json` file in your project root:

```json
{
  "region": "us-east-1",
  "endpoint": "https://your-s3-endpoint.com",
  "credentials": {
    "accessKeyId": "YOUR_ACCESS_KEY",
    "secretAccessKey": "YOUR_SECRET_KEY"
  },
  "bucket": "your-bucket-name"
}
```

You can also use environment variables instead:

```
AWS_REGION=us-east-1
AWS_ENDPOINT=https://your-s3-endpoint.com
AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY
AWS_SECRET_ACCESS_KEY=YOUR_SECRET_KEY
S3_BUCKET_NAME=your-bucket-name
```

### Azure Blob Storage Authentication

To deploy to Azure Blob Storage, create a `.privat/azureConnectionConfig.json` file in your project root:

```json
{
  "storageAccount": "yourstorageaccount",
  "storageAccountKey": "YOUR_STORAGE_ACCOUNT_KEY",
  "containerName": "your-container-name"
}
```

You can also use environment variables instead:

```
AZURE_STORAGE_ACCOUNT=yourstorageaccount
AZURE_STORAGE_ACCOUNT_KEY=YOUR_STORAGE_ACCOUNT_KEY
AZURE_CONTAINER_NAME=your-container-name
```