當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Tree.get方法代碼示例

本文整理匯總了TypeScript中@angular-devkit/schematics.Tree.get方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Tree.get方法的具體用法?TypeScript Tree.get怎麽用?TypeScript Tree.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular-devkit/schematics.Tree的用法示例。


在下文中一共展示了Tree.get方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getUpdateFiles

function getUpdateFiles(localFiles: Tree) {
    return [
        { path: "src/app/app.module.ts", file: localFiles.get("code/module")! },
        { path: "src/app/app.component.ts", file: localFiles.get("code/component")! },
        { path: "src/app/app.component.html", file: localFiles.get("code/component_template")! },
        { path: "src/styles.css", file: localFiles.get("assets/styles.css")! },
        { path: "src/index.html", file: localFiles.get("assets/index.html")! },
    ];
}
開發者ID:NakedObjectsGroup,項目名稱:NakedObjectsFramework,代碼行數:9,代碼來源:index.ts

示例2: getFileContent

export function getFileContent(tree: Tree, path: string): string {
  const fileEntry = tree.get(path);

  if (!fileEntry) {
    throw new Error(`The file (${path}) does not exist.`);
  }

  return fileEntry.content.toString();
}
開發者ID:AlexChar,項目名稱:platform,代碼行數:9,代碼來源:get-file-content.ts

示例3: envConfig

function envConfig(host: Tree, options: PluginOptions) {
  const defEnvPath = `${options.sourceRoot}/environments/environment.ts`;
  const defContent = host.get(defEnvPath).content;
  if (!host.exists(defEnvPath)) return ;
  // 1. update default env file
  addValueToVariable(host, defEnvPath, 'environment', 'hmr: false');
  // 2. update prod env file
  addValueToVariable(host, `${options.sourceRoot}/environments/environment.prod.ts`, 'environment', 'hmr: false');
  // 3. copy default env file to hmr file
  const hmrEnvPath = `${options.sourceRoot}/environments/environment.hmr.ts`;
  host.create(hmrEnvPath, defContent);
  addValueToVariable(host, hmrEnvPath, 'environment', 'hmr: true');
}
開發者ID:wexz,項目名稱:delon,代碼行數:13,代碼來源:plugin.hmr.ts

示例4: getCreateFiles

function getCreateFiles(localFiles: Tree) {
    return [
        { path: "src/app/app-routing.module.ts", file: localFiles.get("code/routing")! },
        { path: "src/config.json", file: localFiles.get("code/config")! },
        { path: "src/assets/alt.calendar.png", file: localFiles.get("assets/alt.calendar.png")! },
        { path: "src/assets/alt.list.png", file: localFiles.get("assets/alt.list.png")! },
        { path: "src/assets/alt.summary.png", file: localFiles.get("assets/alt.summary.png")! },
        { path: "src/assets/alt.table.png", file: localFiles.get("assets/alt.table.png")! },
        { path: "src/assets/calendar.png", file: localFiles.get("assets/calendar.png")! },
        { path: "src/assets/list.png", file: localFiles.get("assets/list.png")! },
        { path: "src/assets/summary.png", file: localFiles.get("assets/summary.png")! },
        { path: "src/assets/table.png", file: localFiles.get("assets/table.png")! },
        { path: "src/fonts/iconFont.eot", file: localFiles.get("fonts/iconFont.eot")! },
        { path: "src/fonts/iconFont.svg", file: localFiles.get("fonts/iconFont.svg")! },
        { path: "src/fonts/iconFont.ttf", file: localFiles.get("fonts/iconFont.ttf")! },
        { path: "src/fonts/iconFont.woff", file: localFiles.get("fonts/iconFont.woff")! },
        { path: "src/fonts/license.txt", file: localFiles.get("fonts/license.txt")! },
        { path: "src/theme.css", file: localFiles.get("assets/theme.css")! },
        { path: "src/theme.alt.css", file: localFiles.get("assets/theme.alt.css")! },
    ];
}
開發者ID:NakedObjectsGroup,項目名稱:NakedObjectsFramework,代碼行數:21,代碼來源:index.ts


注:本文中的@angular-devkit/schematics.Tree.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。