@@ -439,49 +439,55 @@ function copySamples(cb) {
439
439
} exports . copySamples = copySamples ;
440
440
441
441
442
- function updateSampleReadme ( cb ) {
442
+ function updateReadme ( cb ) {
443
443
444
- // log('updating readme files... ') ;
444
+ var changeFilesCount = 0 ;
445
445
var template = fs . readFileSync ( "./browser/templates/sample/ReadMe.md" , "utf8" ) ;
446
446
for ( const sample of samples ) {
447
447
448
- // let outputPath = sampleOutputFolder + '/' + sample.SampleFolderPath;
449
- let outputPath = sampleOutputFolder + sample . SampleFolderPath + "/ReadMe.md" ;
450
- makeDirectoryFor ( outputPath ) ;
451
- // log(outputPath);
452
- let readmeFile = Transformer . updateReadme ( sample , template ) ;
453
- fs . writeFileSync ( outputPath , readmeFile ) ;
454
- // break;
455
- }
456
- cb ( ) ;
457
- } exports . updateSampleReadme = updateSampleReadme ;
458
-
459
- // updating package.json files for all sample using a template
460
- function updateSamplePackages ( cb ) {
461
-
462
- // getting content of package.json file from templates
463
- let templatePackageFile = fs . readFileSync ( "./browser/templates/sample/package.json" ) ;
464
- let templatePackageJson = JSON . parse ( templatePackageFile . toString ( ) ) ;
465
-
466
- // let last = samples[samples.length - 1];
467
- // let content = Transformer.getPackage(last, templatePackageJson);
468
- // fs.writeFileSync(sampleOutputFolder + "package.json", content);
469
-
470
- for ( const sample of samples ) {
471
- let outputPath = sampleOutputFolder + sample . SampleFolderPath + "/package.json" ;
472
- let packageFileOld = fs . readFileSync ( outputPath ) . toString ( ) ;
473
-
474
- // makeDirectoryFor(outputPath);
475
-
476
- let packageFileNew = Transformer . getPackage ( sample , templatePackageJson ) ;
477
- if ( packageFileNew !== packageFileOld ) {
478
- console . log ( 'file updated: ' + outputPath ) ;
479
- fs . writeFileSync ( outputPath , packageFileNew ) ;
448
+ let readmePath = sampleOutputFolder + sample . SampleFolderPath + "/ReadMe.md" ;
449
+ makeDirectoryFor ( readmePath ) ;
450
+
451
+ let readmeNewFile = Transformer . updateReadme ( sample , template ) ;
452
+
453
+ let readmeOldFile = "" ;
454
+ if ( fs . existsSync ( readmePath ) ) {
455
+ readmeOldFile = fs . readFileSync ( readmePath ) . toString ( ) ;
456
+ }
457
+
458
+ if ( readmeNewFile !== readmeOldFile ) {
459
+ console . log ( 'UPDATED: ' + readmePath )
460
+ changeFilesCount ++ ;
461
+ fs . writeFileSync ( readmePath , readmeNewFile ) ;
480
462
}
481
463
}
482
464
465
+ if ( changeFilesCount > 0 ) {
466
+ console . log ( 'WARNING: you must commit above ' + changeFilesCount + ' readme files in a pull request' )
467
+ }
483
468
cb ( ) ;
484
- } exports . updateSamplePackages = updateSamplePackages ;
469
+ } exports . updateReadme = updateReadme ;
470
+
471
+ // // updating package.json files for all sample using a template
472
+ // function updateSamplePackages(cb) {
473
+ // // getting content of package.json file from templates
474
+ // let templatePackageFile = fs.readFileSync("./browser/templates/sample/package.json");
475
+ // let templatePackageJson = JSON.parse(templatePackageFile.toString());
476
+ // // let last = samples[samples.length - 1];
477
+ // // let content = Transformer.getPackage(last, templatePackageJson);
478
+ // // fs.writeFileSync(sampleOutputFolder + "package.json", content);
479
+ // for (const sample of samples) {
480
+ // let outputPath = sampleOutputFolder + sample.SampleFolderPath + "/package.json";
481
+ // let packageFileOld = fs.readFileSync(outputPath).toString();
482
+ // // makeDirectoryFor(outputPath);
483
+ // let packageFileNew = Transformer.getPackage(sample, templatePackageJson);
484
+ // if (packageFileNew !== packageFileOld) {
485
+ // console.log('file updated: ' + outputPath);
486
+ // fs.writeFileSync(outputPath, packageFileNew);
487
+ // }
488
+ // }
489
+ // cb();
490
+ // } exports.updateSamplePackages = updateSamplePackages;
485
491
486
492
// updating browser's package.json file using template's package.json
487
493
function copyPackageJson ( cb ) {
@@ -939,9 +945,8 @@ function updateIG(cb) {
939
945
del . sync ( "./samples/**/node_modules" , { force :true } ) ;
940
946
941
947
// NOTE: change this array with new version of packages and optionally use "@infragistics/" proget prefix, e.g.
942
- // "igniteui-angular-charts" instead of "igniteui-angular-charts", e.g.
943
- // { name: "@infragistics/igniteui-webcomponents-core", version: "22.1.62" }, // proget
944
- // { name: "igniteui-webcomponents-core", version: "3.2.2" }, // npm
948
+ // { name: "@infragistics/igniteui-webcomponents-core", version: "22.1.62" }, // LOCAL PROGET
949
+ // { name: "igniteui-webcomponents-core", version: "3.2.2" }, // PUBLIC NPM
945
950
let packageUpgrades = [
946
951
// these IG packages are often updated:
947
952
{ name : "@infragistics/igniteui-webcomponents-core" , version : "23.2.17" } ,
@@ -968,27 +973,19 @@ function updateIG(cb) {
968
973
'./package.json' , // browser
969
974
'./samples/**/package.json' ,
970
975
// './samples/charts/**/package.json',
971
- // './samples/editors/**/package.json',
972
- // './samples/excel/**/package.json',
973
976
// './samples/gauges/**/package.json',
974
- // './samples/grids/**/package.json',
975
- // './samples/inputs/**/package.json',
976
- // './samples/layouts/**/package.json',
977
- // './samples/maps/**/package.json',
978
- // './samples/menus/**/package.json',
979
- // './samples/notifications/**/package.json',
980
- // './samples/scheduling/**/package.json',
981
- // './samples/charts/category-chart/**/package.json',
982
- // './samples/maps/geo-map/type-scatter-bubble-series/package.json',
977
+
978
+ // skip packages in node_modules folders
983
979
'!./samples/**/node_modules/**/package.json' ,
980
+ '!./samples/**/node_modules/**' ,
981
+ '!./samples/**/node_modules' ,
984
982
] ;
985
983
986
984
// creating package mapping without proget prefix so we can upgrade to/from proget packages
987
985
let packageMappings = { } ;
988
986
for ( const item of packageUpgrades ) {
989
987
item . id = item . name . replace ( "@infragistics/" , "" ) ;
990
- let name = item . name . replace ( "@infragistics/" , "" ) ;
991
- packageMappings [ name ] = item ;
988
+ packageMappings [ item . id ] = item ;
992
989
}
993
990
// console.log(packageMappings);
994
991
0 commit comments