UNPKG

ngx-scrolltop

Version:

Lightweight, Material Design inspired button for scroll-to-top of the page. No dependencies. Pure Angular!

22 lines 979 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ngAdd = ngAdd; const schematics_1 = require("@angular-devkit/schematics"); const fs = require("fs"); const add_declaration_to_module_rule_1 = require("./add-declaration-to-module.rule"); // TODO hardcoded. Read from config. const DEFAULT_NAME = 'app'; const ROOT_URL = '/src/app/'; const NGX_TEMPLATE = '<ngx-scrolltop></ngx-scrolltop>'; function ngAdd() { return (tree, context) => { const rootModule = `${ROOT_URL}${DEFAULT_NAME}.module.ts`; const rootComponent = `./${ROOT_URL}${DEFAULT_NAME}.component.html`; // TODO use schematics api if exists fs.appendFileSync(rootComponent, NGX_TEMPLATE); return (0, schematics_1.chain)([ (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([(0, add_declaration_to_module_rule_1.addDeclarationToAppModule)(rootModule)])), ])(tree, context); }; } //# sourceMappingURL=index.js.map