@@ -65,6 +65,10 @@ describe('AddLicenseHeadersExecutor E2E', () => {
6565 expect ( indexContent ) . toContain ( 'test-package' ) ;
6666 expect ( indexContent ) . toContain ( 'Version: 1.0.0' ) ;
6767 expect ( indexContent ) . toContain ( 'Developer Express Inc.' ) ;
68+ expect ( indexContent ) . toContain ( 'MIT license' ) ;
69+ const currentYear = new Date ( ) . getFullYear ( ) ;
70+ expect ( indexContent ) . toContain ( `2012 - ${ currentYear } ` ) ;
71+ expect ( indexContent ) . toMatch ( / B u i l d d a t e : / ) ;
6872
6973 const utilsContent = await readFileText ( path . join ( npmDir , 'utils.js' ) ) ;
7074 expect ( utilsContent ) . toMatch ( / ^ \/ \* ! / ) ;
@@ -107,6 +111,46 @@ describe('AddLicenseHeadersExecutor E2E', () => {
107111
108112 expect ( newContent ) . toContain ( originalContent . trim ( ) ) ;
109113 } ) ;
114+
115+ it ( 'should support custom license template' , async ( ) => {
116+ const projectDir = path . join ( tempDir , 'packages' , 'test-lib' ) ;
117+ const buildDir = path . join ( projectDir , 'build' , 'gulp' ) ;
118+ fs . mkdirSync ( buildDir , { recursive : true } ) ;
119+
120+ await writeFileText (
121+ path . join ( buildDir , 'license-header.txt' ) ,
122+ `/*!
123+ * DevExtreme (<%= file.relative %>)
124+ * Version: <%= version %>
125+ * Build date: <%= date %>
126+ *
127+ * Copyright (c) 2012 - <%= year %> Developer Express Inc. ALL RIGHTS RESERVED
128+ * Read about DevExtreme licensing here: <%= eula %>
129+ */
130+ ` ,
131+ ) ;
132+
133+ const options : AddLicenseHeadersExecutorSchema = {
134+ targetDirectory : './npm' ,
135+ packageJsonPath : './package.json' ,
136+ licenseTemplateFile : './build/gulp/license-header.txt' ,
137+ eulaUrl : 'https://js.devexpress.com/Licensing/' ,
138+ prependAfterLicense : '"use strict";\n\n' ,
139+ includePatterns : [ '**/*.js' ] ,
140+ } ;
141+
142+ const result = await executor ( options , context ) ;
143+ expect ( result . success ) . toBe ( true ) ;
144+
145+ const npmDir = path . join ( projectDir , 'npm' ) ;
146+ const content = await readFileText ( path . join ( npmDir , 'index.js' ) ) ;
147+
148+ expect ( content ) . toMatch ( / ^ \/ \* ! / ) ;
149+ expect ( content ) . toContain ( 'DevExtreme (index.js)' ) ;
150+ expect ( content ) . toContain ( 'https://js.devexpress.com/Licensing/' ) ;
151+ expect ( content ) . toContain ( '"use strict";' ) ;
152+ expect ( content ) . toContain ( "return 'Hello'" ) ;
153+ } ) ;
110154 } ) ;
111155
112156 describe ( 'Idempotence' , ( ) => {
@@ -159,65 +203,6 @@ describe('AddLicenseHeadersExecutor E2E', () => {
159203 } ) ;
160204 } ) ;
161205
162- describe ( 'Header content validation' , ( ) => {
163- it ( 'should include package name in header' , async ( ) => {
164- const options : AddLicenseHeadersExecutorSchema = {
165- targetDirectory : './npm' ,
166- packageJsonPath : './package.json' ,
167- } ;
168-
169- await executor ( options , context ) ;
170-
171- const npmDir = path . join ( tempDir , 'packages' , 'test-lib' , 'npm' ) ;
172- const content = await readFileText ( path . join ( npmDir , 'index.js' ) ) ;
173-
174- expect ( content ) . toContain ( 'test-package' ) ;
175- } ) ;
176-
177- it ( 'should include version in header' , async ( ) => {
178- const options : AddLicenseHeadersExecutorSchema = {
179- targetDirectory : './npm' ,
180- packageJsonPath : './package.json' ,
181- } ;
182-
183- await executor ( options , context ) ;
184-
185- const npmDir = path . join ( tempDir , 'packages' , 'test-lib' , 'npm' ) ;
186- const content = await readFileText ( path . join ( npmDir , 'index.js' ) ) ;
187-
188- expect ( content ) . toContain ( 'Version: 1.0.0' ) ;
189- } ) ;
190-
191- it ( 'should include current year in header' , async ( ) => {
192- const options : AddLicenseHeadersExecutorSchema = {
193- targetDirectory : './npm' ,
194- packageJsonPath : './package.json' ,
195- } ;
196-
197- await executor ( options , context ) ;
198-
199- const npmDir = path . join ( tempDir , 'packages' , 'test-lib' , 'npm' ) ;
200- const content = await readFileText ( path . join ( npmDir , 'index.js' ) ) ;
201-
202- const currentYear = new Date ( ) . getFullYear ( ) ;
203- expect ( content ) . toContain ( `2012 - ${ currentYear } ` ) ;
204- } ) ;
205-
206- it ( 'should include build date in header' , async ( ) => {
207- const options : AddLicenseHeadersExecutorSchema = {
208- targetDirectory : './npm' ,
209- packageJsonPath : './package.json' ,
210- } ;
211-
212- await executor ( options , context ) ;
213-
214- const npmDir = path . join ( tempDir , 'packages' , 'test-lib' , 'npm' ) ;
215- const content = await readFileText ( path . join ( npmDir , 'index.js' ) ) ;
216-
217- expect ( content ) . toMatch ( / B u i l d d a t e : / ) ;
218- } ) ;
219- } ) ;
220-
221206 describe ( 'Error handling' , ( ) => {
222207 it ( 'should fail gracefully with missing package.json' , async ( ) => {
223208 const options : AddLicenseHeadersExecutorSchema = {
0 commit comments