首页 文章

创建NativeScript和Angular应用程序模板时出现钩子问题

提问于
浏览
1

我正在尝试使用Angular 2创建一个新模板来创建新的NativeScript应用程序,非常像https://github.com/NativeScript/template-hello-world-ng .

这是问题所在:无论出于什么原因,我使用模板创建新应用程序后,最终会有两个 hooks 文件夹 - 一个位于根文件夹中,另一个位于 app/ 中 . 根 hooks 很酷,但是当我尝试运行我从模板创建的应用程序时, app/hooks/before-livesync/nativescript-angular-sync.js 会导致TypeScript问题 .

所以这是我的问题:为什么 app/hooks 存在?当我使用 tns create test --ng (使用https://github.com/NativeScript/template-hello-world-ng)创建应用程序时,它不会 . 我包括我正在使用的完整 package.json . 任何帮助,将不胜感激 .

{
  "name": "tns-template-tutorial-ng",
  "version": "1.0.0",
  "description": "A template for the NativeScript & Angular tutorial on nativescript.org",
  "repository": {
    "type": "git",
    "url": "https://github.com/nativescript/tns-template-tutorial-ng.git"
  },
  "keywords": [
    "NativeScript"
  ],
  "author": "Telerik <support@telerik.com>",
  "license": "Apache-2.0",
  "bugs": {
    "url": "https://github.com/nativescript/tns-template-tutorial-ng/issues"
  },
  "homepage": "https://github.com/nativescript/tns-template-tutorial-ng/groceries",
  "dependencies": {
    "@angular/common": "2.1.2",
    "@angular/compiler": "2.1.2",
    "@angular/core": "2.1.2",
    "@angular/http": "2.1.2",
    "@angular/platform-browser": "2.1.2",
    "@angular/platform-browser-dynamic": "2.1.2",
    "@angular/platform-server": "2.1.2",
    "@angular/router": "3.1.2",
    "nativescript-angular": "1.1.2",
    "reflect-metadata": "0.1.8",
    "rxjs": "5.0.0-beta.12",
    "tns-core-modules": "2.4.2"
  },
  "devDependencies": {
    "nativescript-dev-typescript": "^0.3.2",
    "nativescript-dev-android-snapshot": "^0.*.*",
    "typescript": "^2.0.10",
    "zone.js": "0.6.21"
  }
}

1 回答

  • 2

    这是因为TNS命令在提取模板时的行为方式,它会再次应用某些操作(不正确) .

    有关该问题的讨论,请参见:https://github.com/NativeScript/theme/issues/95的顶部 . 不幸的是,关于删除/离开安装后脚本的讨论,这个问题很快就被扫除了 . 但实际的潜在问题是因为TNS在安装模板时会做一些奇怪的事情,这会破坏事情 .

相关问题