2017-08-29 75 views
0

我們現在開始採購我們的項目,並且作爲開源要求,項目中的每個文件都需要在文件頂部包含許可評論。角度生成到特定格式或自定義生成的代碼

一旦用戶下載了代碼,他們可以將更多的組件,指令,管道等添加到項目中。我們希望,當用戶在項目目錄中運行任何ng命令時,新創建的組件,指令或堆也將在文件頂部使用許可證註釋生成。其中所產生的組分它具有下面的代碼格式

import { Component, OnInit } from '@angular/core'; 

@Component({ 
    selector: 'app-restaurant', 
    templateUrl: './restaurant.component.html', 
    styleUrls: ['./restaurant.component.scss'] 
}) 
export class RestaurantComponent implements OnInit { 

    constructor() { } 

    ngOnInit() { 
    } 

} 

例如我希望它是這樣的。

/* 
* Copyright 2017 shepherd contributors 
* 
* Licensed under the Apache License, Version 2.0 (the "License"); 
* you may not use this file except in compliance with the License. 
* You may obtain a copy of the License at 
* 
*  http://www.apache.org/licenses/LICENSE-2.0 
* 
* Unless required by applicable law or agreed to in writing, software 
* distributed under the License is distributed on an "AS IS" BASIS, 
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
* See the License for the specific language governing permissions and 
* limitations under the License. 
*/ 
import { Component, OnInit } from '@angular/core'; 

@Component({ 
    selector: 'app-restaurant', 
    templateUrl: './restaurant.component.html', 
    styleUrls: ['./restaurant.component.scss'] 
}) 
export class RestaurantComponent implements OnInit { 

    constructor() { } 

    ngOnInit() { 
    } 

} 

有沒有一種方法可以在目前的角度cli?

+0

爲什麼你需要這個來源? –

+0

只需添加一些後處理器並在構建中添加一些標頭。 –

+0

你必須分叉CLI,它[目前不支持](https://github.com/angular/angular-cli/issues/2377)。 – jonrsharpe

回答