@davidlj95/ngx-meta
Version:
Set your Angular site's metadata: standard meta tags, Open Graph, Twitter Cards, JSON-LD structured data and more. Supports SSR (and Angular Universal). Use a service. Use routes' data. Set it up in a flash! 🚀
31 lines • 1.98 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.migrate = migrate;
const update_imports_1 = require("./update-imports");
const update_usages_1 = require("./update-usages");
const apply_changes_1 = require("../../utils/apply-changes");
const get_all_typescript_files_1 = require("../../utils/get-all-typescript-files");
const maybe_get_new_identifier_from_old_identifier_1 = require("./maybe-get-new-identifier-from-old-identifier");
// Sources visited to create this function (and `migrateFile` one):
// https://github.com/angular/angular/blob/19.0.0-next.11/packages/core/schematics/migrations/provide-initializer/index.ts
// https://github.com/angular/angular/blob/19.0.0-next.11/packages/core/schematics/migrations/explicit-standalone-flag/index.ts
// https://github.com/angular/components/blob/19.0.0-next.10/src/google-maps/schematics/ng-update/index.ts
// https://github.com/ngrx/platform/blob/main/modules/store/migrations/18_0_0-beta/index.ts#L20
// https://github.com/ngxtension/ngxtension-platform/blob/4.0.0/libs/plugin/src/migrations/rename-computeds/rename-computeds.ts
// Eventually, generated most of it with ChatGPT though :P
// However, investigated first how folks are doing it around first to see what's the current way to do it
// noinspection JSUnusedGlobalSymbols
function migrate() {
return (tree, context) => {
const typescriptFiles = (0, get_all_typescript_files_1.getAllTypescriptFiles)(tree, {
contentFilter: (content) => content.includes(maybe_get_new_identifier_from_old_identifier_1.OLD_IDENTIFIER_SUFFIX),
});
for (const [filePath, sourceFile] of typescriptFiles) {
(0, apply_changes_1.applyChanges)(tree, filePath, [
...(0, update_imports_1.updateImports)(sourceFile, filePath, context.logger),
...(0, update_usages_1.updateUsages)(sourceFile, filePath),
]);
}
};
}
//# sourceMappingURL=index.js.map