@bodar/terra-ratchet
Advanced tools
Comparing version 0.39.28 to 0.40.29
export * from "./api"; | ||
export { TerraRatchet } from "./TerraRatchet"; | ||
export { FileRunnableScripts } from "./FileRunnableScripts"; | ||
export { FileExecutedScripts } from "./FileExecutedScripts"; | ||
export { ShellScriptRunner } from "./ShellScriptRunner"; | ||
export { NoOpScriptRunner } from "./NoOpScriptRunner"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NoOpScriptRunner = exports.ShellScriptRunner = exports.FileRunnableScripts = exports.TerraRatchet = void 0; | ||
exports.NoOpScriptRunner = exports.ShellScriptRunner = exports.FileExecutedScripts = exports.FileRunnableScripts = exports.TerraRatchet = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -10,2 +10,4 @@ (0, tslib_1.__exportStar)(require("./api"), exports); | ||
Object.defineProperty(exports, "FileRunnableScripts", { enumerable: true, get: function () { return FileRunnableScripts_1.FileRunnableScripts; } }); | ||
var FileExecutedScripts_1 = require("./FileExecutedScripts"); | ||
Object.defineProperty(exports, "FileExecutedScripts", { enumerable: true, get: function () { return FileExecutedScripts_1.FileExecutedScripts; } }); | ||
var ShellScriptRunner_1 = require("./ShellScriptRunner"); | ||
@@ -12,0 +14,0 @@ Object.defineProperty(exports, "ShellScriptRunner", { enumerable: true, get: function () { return ShellScriptRunner_1.ShellScriptRunner; } }); |
{ | ||
"name": "@bodar/terra-ratchet", | ||
"version": "0.39.28", | ||
"version": "0.40.29", | ||
"repository": { | ||
@@ -27,3 +27,3 @@ "type": "git", | ||
"scripts": {}, | ||
"readme": "# TerraRatchet\n\n[![<Triptease>](https://circleci.com/gh/triptease/terra-ratchet.svg?style=svg)](https://app.circleci.com/pipelines/github/triptease/terra-ratchet) [![npm version](https://badge.fury.io/js/@bodar%2Fterra-ratchet.svg)](https://www.npmjs.com/package/@bodar/terra-ratchet)\n\nMigrate your environments with real code today!\n\n## Why?\n\n* Have you ever wanted to write real code instead of declarative configuration files?\n* Have you ever wanted to use a migration tool for something other than a DB?\n* Have you ever wanted to run a single command just once against each environment?\n* Have you ever waited for a plugin to be upgraded to use a new feature that was just released?\n\nIf the answer to any of those question is yes then TerraRatchet may be what you have been waiting for.\n\n## How?\n\nIf you have used a DB migration tool recently you probably already know how to use TerraRatchet, you have a folder with \na bunch of scripts that need to be run once in a certain order (these are normally checked in):\n\n```shell\nscripts\n 001-deploy-postgres.sh\n 002-create-database.postgres.sql\n 003-create-bigquery-dataset.sh\n 004-add-permissions-to-dataset.sh\n 005-import-table.bigquery.sql\n 006-create-redis-server.sh\n 007-create-timeseries.redis\n```\n\nYou have a DB or file server than can store which scripts have been run, normally part of the environment you are deploying.\n\nNow just add TerraRatchet to your build.\n\n## Example (ratchet.ts)\n\n```typescript\nimport { File } from '@bodar/totallylazy/files';\nimport { TerraRatchet, FileRunnableScripts, NoOpScriptRunner, ShellScriptRunner } from '@bodar/terra-ratchet';\nimport { BigQueryExecutedScripts, BigQueryScriptRunner } from '@bodar/terra-ratchet-big-query';\n\nconst projectId = process.env.GOOGLE_CLOUD_PROJECT;\nconst datasetId = process.env.CI === 'true' ? 'production' : 'development';\nconst tableId = 'ratchet-table-id';\n\n(async () => {\n const env = { ...process.env, projectId, datasetId };\n const executedScripts = new BigQueryExecutedScripts(projectId, datasetId, tableId);\n await executedScripts.setup();\n\n const scripts = new File('scripts', __dirname);\n\n await new TerraRatchet(new FileRunnableScripts(scripts), executedScripts)\n .ignore('d.ts', 'js', 'map') // ignore generated code\n .register('006-create-redis-server.sh', new NoOpScriptRunner()) // skip manually ran script\n .register('sql', new BigQueryScriptRunner(scripts, projectId, datasetId))\n .register('sh', new ShellScriptRunner(scripts, env))\n .run();\n})();\n```\n\n\n## Details\n\nTerraRatchet is made up of a couple of different parts:\n\n### Script location (RunnableScripts)\n\n| RunnableScripts | Status | Description |\n|-------------------------|----------|-------------------------|\n| InMemoryRunnableScripts | Released | Can be used for testing |\n| FileRunnableScripts | Released | Point to a folder |\n\n### Record which script have been run (ExecutedScripts)\n\n| ExecutedScripts | Status | Description |\n|-------------------------|----------|---------------------------------------------------------|\n| InMemoryExecutedScripts | Released | Can be used for testing |\n| BigQueryExecutedScripts | Released | Records which scripts have been run in a BigQuery table |\n| FileExecutedScripts | Planned | Records which scripts have been run in a json file |\n| PostgresExecutedScripts | Planned | Records which scripts have been run in a Postgres table |\n\n\n### How each script should run (ScriptRunner)\n\nIt's worth remember than any command can be run if it has a command line, the SQL runners are just convenient\n\n| ScriptRunner | Status | Description |\n|----------------------|-----------|-------------------------------------------------------------|\n| NoOpScriptRunner | Released | Does nothing. Can be used to ignore a manually run script |\n| ShellScriptRunner | Released | Used to run a shell command (anything, no plugins required) |\n| BigQueryScriptRunner | Released | Used to run BigQuery SQL statements |\n| PostgresScriptRunner | Planned | Used to run Postgres SQL statements |\n\n\n" | ||
"readme": "# TerraRatchet\n\n[![<Triptease>](https://circleci.com/gh/triptease/terra-ratchet.svg?style=svg)](https://app.circleci.com/pipelines/github/triptease/terra-ratchet) [![npm version](https://badge.fury.io/js/@bodar%2Fterra-ratchet.svg)](https://www.npmjs.com/package/@bodar/terra-ratchet)\n\nMigrate your environments with real code today!\n\n## Why?\n\n* Have you ever wanted to write real code instead of declarative configuration files?\n* Have you ever wanted to use a migration tool for something other than a DB?\n* Have you ever wanted to run a single command just once against each environment?\n* Have you ever waited for a plugin to be upgraded to use a new feature that was just released?\n\nIf the answer to any of those question is yes then TerraRatchet may be what you have been waiting for.\n\n## How?\n\nIf you have used a DB migration tool recently you probably already know how to use TerraRatchet, you have a folder with \na bunch of scripts that need to be run once in a certain order (these are normally checked in):\n\n```shell\nscripts\n 001-deploy-postgres.sh\n 002-create-database.postgres.sql\n 003-create-bigquery-dataset.sh\n 004-add-permissions-to-dataset.sh\n 005-import-table.bigquery.sql\n 006-create-redis-server.sh\n 007-create-timeseries.redis\n```\n\nYou have a DB or file server than can store which scripts have been run, normally part of the environment you are deploying.\n\nNow just add TerraRatchet to your build.\n\n## Example (ratchet.ts)\n\n```typescript\nimport { File } from '@bodar/totallylazy/files';\nimport { TerraRatchet, FileRunnableScripts, NoOpScriptRunner, ShellScriptRunner } from '@bodar/terra-ratchet';\nimport { BigQueryExecutedScripts, BigQueryScriptRunner } from '@bodar/terra-ratchet-big-query';\n\nconst projectId = process.env.GOOGLE_CLOUD_PROJECT;\nconst datasetId = process.env.CI === 'true' ? 'production' : 'development';\nconst tableId = 'ratchet-table-id';\n\n(async () => {\n const env = { ...process.env, projectId, datasetId };\n const executedScripts = new BigQueryExecutedScripts(projectId, datasetId, tableId);\n await executedScripts.setup();\n\n const scripts = new File('scripts', __dirname);\n\n await new TerraRatchet(new FileRunnableScripts(scripts), executedScripts)\n .ignore('d.ts', 'js', 'map') // ignore generated code\n .register('006-create-redis-server.sh', new NoOpScriptRunner()) // skip manually ran script\n .register('sql', new BigQueryScriptRunner(scripts, projectId, datasetId))\n .register('sh', new ShellScriptRunner(scripts, env))\n .run();\n})();\n```\n\n\n## Details\n\nTerraRatchet is made up of a couple of different parts:\n\n### Script location (RunnableScripts)\n\n| RunnableScripts | Status | Description |\n|-------------------------|----------|-------------------------|\n| InMemoryRunnableScripts | Released | Can be used for testing |\n| FileRunnableScripts | Released | Point to a folder |\n\n### Record which script have been run (ExecutedScripts)\n\n| ExecutedScripts | Status | Description |\n|-------------------------|----------|---------------------------------------------------------|\n| InMemoryExecutedScripts | Released | Can be used for testing |\n| FileExecutedScripts | Released | Records which scripts have been run in a json file |\n| BigQueryExecutedScripts | Released | Records which scripts have been run in a BigQuery table |\n| PostgresExecutedScripts | Planned | Records which scripts have been run in a Postgres table |\n\n\n### How each script should run (ScriptRunner)\n\nIt's worth remember than any command can be run if it has a command line, the SQL runners are just convenient\n\n| ScriptRunner | Status | Description |\n|----------------------|-----------|-------------------------------------------------------------|\n| NoOpScriptRunner | Released | Does nothing. Can be used to ignore a manually run script |\n| ShellScriptRunner | Released | Used to run a shell command (anything, no plugins required) |\n| BigQueryScriptRunner | Released | Used to run BigQuery SQL statements |\n| PostgresScriptRunner | Planned | Used to run Postgres SQL statements |\n\n\n" | ||
} |
@@ -80,4 +80,4 @@ # TerraRatchet | ||
| InMemoryExecutedScripts | Released | Can be used for testing | | ||
| FileExecutedScripts | Released | Records which scripts have been run in a json file | | ||
| BigQueryExecutedScripts | Released | Records which scripts have been run in a BigQuery table | | ||
| FileExecutedScripts | Planned | Records which scripts have been run in a json file | | ||
| PostgresExecutedScripts | Planned | Records which scripts have been run in a Postgres table | | ||
@@ -84,0 +84,0 @@ |
22801
24
328