2017-08-29 4 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

答えて

関連する問題