TITLE: Start Development Server DESCRIPTION: Initiates the development server for the CKB.tools application. This command compiles and serves the application, allowing for local development and testing. SOURCE: https://github.com/jordanmack/ckb-tools/blob/main/README.md#_snippet_3 LANGUAGE: sh CODE: ``` npm run start ``` ---------------------------------------- TITLE: Install Project Dependencies DESCRIPTION: Installs the necessary project dependencies using npm. The `--force` flag is used to resolve potential dependency conflicts, ensuring all packages are installed. SOURCE: https://github.com/jordanmack/ckb-tools/blob/main/README.md#_snippet_0 LANGUAGE: sh CODE: ``` npm i --force ``` ---------------------------------------- TITLE: Build Project for Production DESCRIPTION: Compiles and bundles the CKB.tools project into a production-ready build. The output files are placed in the `build` directory, ready for deployment. SOURCE: https://github.com/jordanmack/ckb-tools/blob/main/README.md#_snippet_5 LANGUAGE: sh CODE: ``` npm run build ``` ---------------------------------------- TITLE: Define AWS S3 CORS Configuration DESCRIPTION: This JSON snippet sets up Cross-Origin Resource Sharing (CORS) rules for an AWS S3 bucket. It allows all headers, all common HTTP methods (GET, HEAD, PUT, POST, DELETE), and all origins ('*') to interact with the bucket, with a maximum age for preflight requests set to 3000 seconds. SOURCE: https://github.com/jordanmack/ckb-tools/blob/main/assets/s3/config.txt#_snippet_1 LANGUAGE: JSON CODE: ``` [ { "AllowedHeaders": [ "*" ], "AllowedMethods": [ "GET", "HEAD", "PUT", "POST", "DELETE" ], "AllowedOrigins": [ "*" ], "ExposeHeaders": [], "MaxAgeSeconds": 3000 } ] ``` ---------------------------------------- TITLE: Configure AWS S3 Bucket Policy for Public Listing DESCRIPTION: This JSON snippet defines an AWS S3 bucket policy that allows any principal ('*') to perform the 's3:ListBucket' action on the bucket 'arn:aws:s3:::cdn.ckb.tools'. This is typically used to make bucket contents publicly listable. SOURCE: https://github.com/jordanmack/ckb-tools/blob/main/assets/s3/config.txt#_snippet_0 LANGUAGE: JSON CODE: ``` { "Version": "2012-10-17", "Id": "Policy1623126614412", "Statement": [ { "Sid": "Stmt1623126610084", "Effect": "Allow", "Principal": "*", "Action": "s3:ListBucket", "Resource": "arn:aws:s3:::cdn.ckb.tools" } ] } ``` ---------------------------------------- TITLE: JavaScript S3 Bucket Listing Configuration DESCRIPTION: This JavaScript snippet defines configuration variables for an S3 bucket listing tool. It specifies whether to ignore paths, the root directory for listings, the sorting order (newest to oldest), and a regular expression to exclude HTML and JavaScript files from the listing. These settings are crucial for customizing how Nervos CKB snapshots are presented or managed within an S3 environment. SOURCE: https://github.com/jordanmack/ckb-tools/blob/main/assets/s3/snapshots.do.html#_snippet_0 LANGUAGE: JavaScript CODE: ``` var S3BL_IGNORE_PATH = true; // var BUCKET_NAME = 'cdn-ckb-tools'; // var BUCKET_URL = 'https://s3.amazonaws.com'; var S3B_ROOT_DIR = ''; var S3B_SORT = 'NEW2OLD'; // var S3_REGION = 's3'; var EXCLUDE_FILE = /(?:\\.html|\\.js)$/; ``` ---------------------------------------- TITLE: JavaScript S3 Bucket Configuration for CKB Snapshots DESCRIPTION: This JavaScript snippet defines essential variables for configuring access to an S3 bucket containing Nervos CKB snapshots. It includes settings for ignoring path, specifying the bucket name and URL, defining the root directory for snapshots, and setting the sorting order. Commented-out lines show optional region and exclusion file settings. SOURCE: https://github.com/jordanmack/ckb-tools/blob/main/assets/s3/snapshots.s3.html#_snippet_0 LANGUAGE: JavaScript CODE: ``` var S3BL_IGNORE_PATH = true; var BUCKET_NAME = 'cdn.ckb.tools'; var BUCKET_URL = 'https://s3.amazonaws.com'; var S3B_ROOT_DIR = 'snapshots'; var S3B_SORT = 'NEW2OLD'; // var S3_REGION = 's3'; // var EXCLUDE_FILE = 'index.html'; ``` ---------------------------------------- TITLE: Export Node.js OpenSSL Legacy Provider Option DESCRIPTION: Sets an environmental variable to enable the OpenSSL legacy provider. This is often necessary for Node.js versions 17+ when encountering `error:0308010C:digital envelope routines::unsupported` errors during build or start processes. SOURCE: https://github.com/jordanmack/ckb-tools/blob/main/README.md#_snippet_2 LANGUAGE: sh CODE: ``` export NODE_OPTIONS=--openssl-legacy-provider ``` ---------------------------------------- TITLE: Start Development Server with Legacy OpenSSL DESCRIPTION: Starts the development server using a configuration that accommodates older OpenSSL versions or specific Node.js environments. Use this command if `npm run start` fails with OpenSSL-related errors. SOURCE: https://github.com/jordanmack/ckb-tools/blob/main/README.md#_snippet_4 LANGUAGE: sh CODE: ``` npm run start-legacy ``` ---------------------------------------- TITLE: Build Project with Legacy OpenSSL DESCRIPTION: Builds the project for production using a configuration that supports legacy OpenSSL. This alternative build command is useful if `npm run build` encounters OpenSSL-related errors. SOURCE: https://github.com/jordanmack/ckb-tools/blob/main/README.md#_snippet_6 LANGUAGE: sh CODE: ``` npm run build-legacy ``` ---------------------------------------- TITLE: Remove Problematic Node Module File DESCRIPTION: Deletes a specific file (`index.d.ts`) within the `node_modules/hookrouter/dist` directory. This step is required to work around a known issue with the `hookrouter` NPM package. SOURCE: https://github.com/jordanmack/ckb-tools/blob/main/README.md#_snippet_1 LANGUAGE: sh CODE: ``` rm -f node_modules/hookrouter/dist/index.d.ts ```