@goldstack/template-dynamodb 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamoDBTableCli.d.ts","sourceRoot":"","sources":["../../src/dynamoDBTableCli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dynamoDBTableCli.d.ts","sourceRoot":"","sources":["../../src/dynamoDBTableCli.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,WAAW,SAAgB,MAAM,EAAE,KAAG,QAAQ,IAAI,CAkC9D,CAAC"}
|
|
@@ -2,12 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dynamoDBCli = void 0;
|
|
4
4
|
const utils_sh_1 = require("@goldstack/utils-sh");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
5
7
|
const templateDynamoDBTable_1 = require("./templateDynamoDBTable");
|
|
8
|
+
const loadMigrations = () => {
|
|
9
|
+
const jsPath = (0, path_1.resolve)(`${path_1.posix.dirname(process.cwd())}/dist/src/migrations.js`);
|
|
10
|
+
if ((0, fs_1.existsSync)(jsPath)) {
|
|
11
|
+
return require(jsPath);
|
|
12
|
+
}
|
|
13
|
+
const tsPath = (0, path_1.resolve)(`${path_1.posix.dirname(process.cwd())}/src/migrations.ts`);
|
|
14
|
+
if ((0, fs_1.existsSync)(tsPath)) {
|
|
15
|
+
return require(tsPath);
|
|
16
|
+
}
|
|
17
|
+
throw new Error(`Cannot find migrations file at ${jsPath} or ${tsPath}`);
|
|
18
|
+
};
|
|
6
19
|
const dynamoDBCli = async (args) => {
|
|
7
20
|
const goldstackConfig = JSON.parse((0, utils_sh_1.read)(`${process.cwd()}/goldstack.json`));
|
|
8
21
|
const packageSchema = JSON.parse((0, utils_sh_1.read)(`${process.cwd()}/schemas/package.schema.json`));
|
|
9
|
-
|
|
10
|
-
const migrations = require(`${process.cwd()}/src/migrations`).createMigrations();
|
|
22
|
+
const migrations = loadMigrations().createMigrations();
|
|
11
23
|
if (args[0] === 'init') {
|
|
12
24
|
await (0, templateDynamoDBTable_1.connect)({
|
|
13
25
|
goldstackConfig,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamoDBTableCli.js","sourceRoot":"","sources":["../../src/dynamoDBTableCli.ts"],"names":[],"mappings":";;;AAAA,kDAA2C;AAC3C,mEAA8E;
|
|
1
|
+
{"version":3,"file":"dynamoDBTableCli.js","sourceRoot":"","sources":["../../src/dynamoDBTableCli.ts"],"names":[],"mappings":";;;AAAA,kDAA2C;AAC3C,2BAAgC;AAChC,+BAAsC;AACtC,mEAA8E;AAE9E,MAAM,cAAc,GAAG,GAAQ,EAAE;IAC/B,MAAM,MAAM,GAAG,IAAA,cAAO,EACpB,GAAG,YAAK,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,yBAAyB,CACzD,CAAC;IACF,IAAI,IAAA,eAAU,EAAC,MAAM,CAAC,EAAE;QACtB,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;KACxB;IACD,MAAM,MAAM,GAAG,IAAA,cAAO,EAAC,GAAG,YAAK,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,CAAC;IAC5E,IAAI,IAAA,eAAU,EAAC,MAAM,CAAC,EAAE;QACtB,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;KACxB;IACD,MAAM,IAAI,KAAK,CAAC,kCAAkC,MAAM,OAAO,MAAM,EAAE,CAAC,CAAC;AAC3E,CAAC,CAAC;AAEK,MAAM,WAAW,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACjE,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,eAAI,EAAC,GAAG,OAAO,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAC5E,M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