t1.js 1002 B

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. /**
  4. * @license
  5. * Copyright Google Inc. All Rights Reserved.
  6. *
  7. * Use of this source code is governed by an MIT-style license that can be
  8. * found in the LICENSE file at https://angular.io/license
  9. */
  10. const schematics_1 = require("@angular-devkit/schematics");
  11. function default_1() {
  12. return (tree, context) => {
  13. let content = tree.read('/migrations');
  14. // Append the information to migration file. We then verify the order of execution.
  15. if (!content) {
  16. tree.create('/migrations', '[]');
  17. content = tree.read('/migrations');
  18. if (!content) {
  19. throw new schematics_1.SchematicsException();
  20. }
  21. }
  22. const json = JSON.parse(content.toString('utf-8'));
  23. json.push(context.schematic.description.name);
  24. tree.overwrite('/migrations', JSON.stringify(json));
  25. return tree;
  26. };
  27. }
  28. exports.default = default_1;