"use strict";
var _this = this;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var version = require("../../package.json").version;
exports.default = function (options) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
    var src, dest, editor, manifestJson, migratedAt, support;
    return tslib_1.__generator(this, function (_a) {
        src = options.get("src");
        dest = options.get("dest");
        editor = options.get("editor");
        manifestJson = editor.readJSON(src + "/manifest.json");
        migratedAt = new Date().toDateString();
        manifestJson.frameworkVersion = "2.0";
        manifestJson.migrator = {
            migratedAt: migratedAt,
            version: version
        };
        // Update the location(s) to point to the v2 html
        // Note: all locations will reference the same file
        if (!Array.isArray(manifestJson.location)) {
            manifestJson.location = [manifestJson.location];
        }
        support = manifestJson.location.reduce(function (memo, location) {
            memo[location] = "assets/index.html";
            return memo;
        }, {});
        manifestJson.location = { support: support };
        editor.writeJSON(dest + "/dist/manifest.json", manifestJson);
        return [2 /*return*/];
    });
}); };
