@apso/cli 0.41.1 → 0.41.2
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.
- package/dist/lib/verify/index.d.ts +1 -0
- package/dist/lib/verify/index.js +29 -1
- package/npm-shrinkwrap.json +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -42,6 +42,7 @@ export interface CheckResult {
|
|
|
42
42
|
ok: boolean;
|
|
43
43
|
steps: Step[];
|
|
44
44
|
}
|
|
45
|
+
export declare function supportsPglite(projectDir: string): boolean;
|
|
45
46
|
/**
|
|
46
47
|
* Run a migration on a fresh copy of the deployed schema, then check that the
|
|
47
48
|
* database matches the project's entities (a second generate finds nothing).
|
package/dist/lib/verify/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* the CLI in a WebContainer) share these steps.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.report = exports.cliBinPath = exports.smokeTest = exports.verifyMigration = exports.generateMigration = exports.buildBaseline = exports.pgliteEnv = exports.run = void 0;
|
|
9
|
+
exports.report = exports.cliBinPath = exports.smokeTest = exports.verifyMigration = exports.supportsPglite = exports.generateMigration = exports.buildBaseline = exports.pgliteEnv = exports.run = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const child_process_1 = require("child_process");
|
|
12
12
|
const fs = tslib_1.__importStar(require("fs"));
|
|
@@ -133,11 +133,37 @@ ds.initialize()
|
|
|
133
133
|
.then((ran) => { console.log("ran " + ran.map((m) => m.name).join(", ")); return ds.destroy(); })
|
|
134
134
|
.catch((e) => { console.error(e && e.message ? e.message : e); process.exit(1); });
|
|
135
135
|
`;
|
|
136
|
+
/**
|
|
137
|
+
* Projects from the v1 template have no PGlite support in src/orm.config.ts,
|
|
138
|
+
* so the checks cannot run locally. They pass as skipped rather than block a
|
|
139
|
+
* deploy they cannot judge.
|
|
140
|
+
*/
|
|
141
|
+
const NO_PGLITE = {
|
|
142
|
+
ok: true,
|
|
143
|
+
steps: [
|
|
144
|
+
{
|
|
145
|
+
name: "skipped",
|
|
146
|
+
ok: true,
|
|
147
|
+
output: "This project's database config (src/orm.config.ts) can't use a local PGlite database, so this check was skipped. Projects created from the current template support it.",
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
};
|
|
151
|
+
function supportsPglite(projectDir) {
|
|
152
|
+
try {
|
|
153
|
+
return /typeorm-pglite|PGliteDriver/.test(fs.readFileSync(path.join(projectDir, "src", "orm.config.ts"), "utf8"));
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.supportsPglite = supportsPglite;
|
|
136
160
|
/**
|
|
137
161
|
* Run a migration on a fresh copy of the deployed schema, then check that the
|
|
138
162
|
* database matches the project's entities (a second generate finds nothing).
|
|
139
163
|
*/
|
|
140
164
|
async function verifyMigration(projectDir, baselineApsorc, migrationFile, cliBin, skipBuild = false) {
|
|
165
|
+
if (!supportsPglite(projectDir))
|
|
166
|
+
return NO_PGLITE;
|
|
141
167
|
const dataDir = fs.mkdtempSync(path.join(os.tmpdir(), "apso-pglite-"));
|
|
142
168
|
const steps = [];
|
|
143
169
|
const done = (s) => {
|
|
@@ -193,6 +219,8 @@ const get = (url) => new Promise((resolve) => {
|
|
|
193
219
|
*/
|
|
194
220
|
async function smokeTest(projectDir, entityNames, { skipBuild = false, timeoutMs = 60000 } = {}) {
|
|
195
221
|
var _a, _b;
|
|
222
|
+
if (!supportsPglite(projectDir))
|
|
223
|
+
return NO_PGLITE;
|
|
196
224
|
const dataDir = fs.mkdtempSync(path.join(os.tmpdir(), "apso-pglite-"));
|
|
197
225
|
const steps = [];
|
|
198
226
|
const done = (s) => {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apso/cli",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@apso/cli",
|
|
9
|
-
"version": "0.41.
|
|
9
|
+
"version": "0.41.2",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@apso/schema-tools": "^0.2.0",
|
package/oclif.manifest.json
CHANGED