@@ -16,7 +16,7 @@ import os from 'os';
1616const properties = require ( 'properties' ) ;
1717import { addGitIgnore } from './utils/add-gitignore' ;
1818import { checkLockFiles } from './utils/check-lockfile' ;
19- import { scriptName , tempDir } from './utils/constants' ;
19+ import { isPPKBundleFileName , scriptName , tempDir } from './utils/constants' ;
2020import { depVersions } from './utils/dep-versions' ;
2121import { t } from './utils/i18n' ;
2222import { versionCommands } from './versions' ;
@@ -537,10 +537,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
537537 // isFile
538538 originMap [ entry . crc32 ] = entry . fileName ;
539539
540- if (
541- entry . fileName === 'index.bundlejs' ||
542- entry . fileName === 'bundle.harmony.js'
543- ) {
540+ if ( isPPKBundleFileName ( entry . fileName ) ) {
544541 // This is source.
545542 return readEntry ( entry , zipFile ) . then ( ( v ) => ( originSource = v ) ) ;
546543 }
@@ -589,23 +586,13 @@ async function diffFromPPK(origin: string, next: string, output: string) {
589586 if ( ! originEntries [ entry . fileName ] ) {
590587 addEntry ( entry . fileName ) ;
591588 }
592- } else if ( entry . fileName === 'index.bundlejs' ) {
589+ } else if ( isPPKBundleFileName ( entry . fileName ) ) {
593590 //console.log('Found bundle');
594591 return readEntry ( entry , nextZipfile ) . then ( ( newSource ) => {
595592 //console.log('Begin diff');
596593 zipfile . addBuffer (
597594 diff ( originSource , newSource ) ,
598- 'index.bundlejs.patch' ,
599- ) ;
600- //console.log('End diff');
601- } ) ;
602- } else if ( entry . fileName === 'bundle.harmony.js' ) {
603- //console.log('Found bundle');
604- return readEntry ( entry , nextZipfile ) . then ( ( newSource ) => {
605- //console.log('Begin diff');
606- zipfile . addBuffer (
607- diff ( originSource , newSource ) ,
608- 'bundle.harmony.js.patch' ,
595+ `${ entry . fileName } .patch` ,
609596 ) ;
610597 //console.log('End diff');
611598 } ) ;
@@ -719,23 +706,13 @@ async function diffFromPackage(
719706 if ( / \/ $ / . test ( entry . fileName ) ) {
720707 // Directory
721708 zipfile . addEmptyDirectory ( entry . fileName ) ;
722- } else if ( entry . fileName === 'index.bundlejs' ) {
723- //console.log('Found bundle');
724- return readEntry ( entry , nextZipfile ) . then ( ( newSource ) => {
725- //console.log('Begin diff');
726- zipfile . addBuffer (
727- diff ( originSource , newSource ) ,
728- 'index.bundlejs.patch' ,
729- ) ;
730- //console.log('End diff');
731- } ) ;
732- } else if ( entry . fileName === 'bundle.harmony.js' ) {
709+ } else if ( isPPKBundleFileName ( entry . fileName ) ) {
733710 //console.log('Found bundle');
734711 return readEntry ( entry , nextZipfile ) . then ( ( newSource ) => {
735712 //console.log('Begin diff');
736713 zipfile . addBuffer (
737714 diff ( originSource , newSource ) ,
738- 'bundle.harmony.js. patch' ,
715+ ` ${ entry . fileName } . patch` ,
739716 ) ;
740717 //console.log('End diff');
741718 } ) ;
0 commit comments