UNPKG

mili

Version:

Scaffolding with continuous control over the development of the project.

21 lines (20 loc) 748 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.migrate = void 0; const semver = require("semver"); const fs = require("fs-extra"); const path = require("path"); const child_process_1 = require("child_process"); function migrate(cwd, repository, fromVersion) { if (fromVersion === repository.version) return; if (!semver.valid(fromVersion)) throw new Error(`Invalid version ${fromVersion}`); if (!fs.pathExistsSync(path.join(repository.storage, 'migration'))) return; const files = fs.readdirSync(path.join(repository.storage, 'migration')); for (const file of files) { (0, child_process_1.execFileSync)(file, [], { cwd }); } } exports.migrate = migrate;