@@ -36,9 +36,9 @@ function _copyFileToStaging(fileList) {
3636 const destDir = fileList [ i ] . dest ;
3737 const srcDir = fileList [ i ] . src ;
3838 if ( _isSvgFile ( srcDir ) ) {
39- fs . copySync ( srcDir , destDir , { overwrite : false , errorOnExist : false } ) ;
39+ fs . copySync ( srcDir , destDir , { overwrite : false , errorOnExist : false , dereference : true } ) ;
4040 } else {
41- fs . copySync ( srcDir , destDir , { overwrite : true } ) ;
41+ fs . copySync ( srcDir , destDir , { overwrite : true , dereference : true } ) ;
4242 }
4343 }
4444 return Promise . resolve ( ) ;
@@ -94,7 +94,7 @@ function _copyThemeCommonToStaging(theme, stagingPath) {
9494 resolve ( ) ;
9595 } else {
9696 try {
97- fs . copySync ( src , dest ) ;
97+ fs . copySync ( src , dest , { dereference : true } ) ;
9898 resolve ( ) ;
9999 } catch ( error ) {
100100 reject ( error ) ;
@@ -117,10 +117,10 @@ function _copyDefaultResourcesToStaging(theme, stagingPath, themeName) {
117117 if ( config ( 'defaultTheme' ) === CONSTANTS . DEFAULT_THEME && themeName !== CONSTANTS . DEFAULT_PCSS_THEME && themeName !== CONSTANTS . DEFAULT_STABLE_THEME ) {
118118 const commonSrc = path . join ( srcBase , CONSTANTS . COMMON_THEME_DIRECTORY ) ;
119119 const commonDest = path . join ( destBase , CONSTANTS . COMMON_THEME_DIRECTORY ) ;
120- fs . copySync ( commonSrc , commonDest ) ;
120+ fs . copySync ( commonSrc , commonDest , { dereference : true } ) ;
121121 }
122- fs . copySync ( defaultFontsSrc , defaultFontsDest ) ;
123- fs . copySync ( defaultImagesSrc , defaultImagesDest ) ;
122+ fs . copySync ( defaultFontsSrc , defaultFontsDest , { dereference : true } ) ;
123+ fs . copySync ( defaultImagesSrc , defaultImagesDest , { dereference : true } ) ;
124124}
125125
126126function _copyExchangeComponentsToStaging ( { context, componentsSource } ) {
@@ -148,7 +148,7 @@ function _copyExchangeComponentsToStaging({ context, componentsSource }) {
148148 root : context . opts . stagingPath ,
149149 scripts : configPaths . src . javascript
150150 } ) ;
151- fs . copySync ( componentDirPath , destPath ) ;
151+ fs . copySync ( componentDirPath , destPath , { dereference : true } ) ;
152152 }
153153 return Promise . resolve ( ) ;
154154 }
@@ -176,7 +176,7 @@ function _copyFilesExcludeScss(srcBase, destBase) {
176176 const fileStat = fs . statSync ( path . join ( srcBase , file ) ) ;
177177 // if file is not scss file, copy to themes
178178 if ( fileStat . isDirectory ( ) || ! / s c s s / . test ( path . extname ( file ) ) ) {
179- fs . copySync ( path . join ( srcBase , file ) , path . join ( destBase , file ) ) ;
179+ fs . copySync ( path . join ( srcBase , file ) , path . join ( destBase , file ) , { dereference : true } ) ;
180180 }
181181 } ) ;
182182 }
@@ -212,13 +212,13 @@ function _copyMultiThemesToStaging(opts, stagingPath, livereload) {
212212
213213 const src = path . join ( srcBase , singleTheme . name , themePlatform ) ;
214214 const dest = util . destPath ( path . join ( stagingPath , config ( 'paths' ) . src . styles , singleTheme . name , singleTheme . version , themePlatform , '/' ) ) ;
215- fs . copySync ( src , dest ) ;
215+ fs . copySync ( src , dest , { dereference : true } ) ;
216216
217217 // copy common dir
218218 const commonSrc = `${ srcBase } /${ singleTheme . name } /${ CONSTANTS . COMMON_THEME_DIRECTORY } ` ;
219219 const commonDest = util . destPath ( path . join ( stagingPath , config ( 'paths' ) . src . styles , singleTheme . name , singleTheme . version , CONSTANTS . COMMON_THEME_DIRECTORY ) ) ;
220220 if ( util . fsExistsSync ( commonSrc ) ) {
221- fs . copySync ( commonSrc , commonDest ) ;
221+ fs . copySync ( commonSrc , commonDest , { dereference : true } ) ;
222222 }
223223 } ) ;
224224 }
@@ -248,15 +248,15 @@ function _copyThemesToStaging(context) {
248248 if ( ( opts . theme . cssGeneratedType === 'add-on' && opts . theme . basetheme === CONSTANTS . DEFAULT_PCSS_THEME ) || ( opts . themes && opts . themes . length > 1 ) ) {
249249 const rwsrc = _getThemeSrcPath ( rwood , ext , livereload ) ;
250250 const rwdest = _getThemeDestPath ( rwood , stgPath , ext , livereload , platform , opts . destination ) ;
251- fs . copySync ( rwsrc , rwdest ) ;
251+ fs . copySync ( rwsrc , rwdest , { dereference : true } ) ;
252252 }
253253
254254 const stable = Object . assign ( { } ,
255255 { name : 'stable' , platform : 'web' , compile : false , version : util . getJETVersion ( ) } ) ;
256256 if ( ( opts . theme . cssGeneratedType === 'add-on' && opts . theme . basetheme === CONSTANTS . DEFAULT_STABLE_THEME ) || ( opts . themes && opts . themes . length > 1 ) ) {
257257 const stsrc = _getThemeSrcPath ( stable , ext , livereload ) ;
258258 const stdest = _getThemeDestPath ( stable , stgPath , ext , livereload , platform , opts . destination ) ;
259- fs . copySync ( stsrc , stdest ) ;
259+ fs . copySync ( stsrc , stdest , { dereference : true } ) ;
260260 }
261261 // copy to themes
262262 if ( ( theme . name !== CONSTANTS . DEFAULT_THEME || theme . name !== CONSTANTS . DEFAULT_PCSS_THEME ||
@@ -291,10 +291,10 @@ function _copyThemesToStaging(context) {
291291 fs . copySync ( src , dest ) ;
292292 // Copy preact theme if present
293293 if ( fs . existsSync ( preactSrc ) ) {
294- fs . copySync ( preactSrc , preactDest ) ;
294+ fs . copySync ( preactSrc , preactDest , { dereference : true } ) ;
295295 if ( buildType === 'release' ) {
296296 // Preact images need to be a peer of the code bundle.js
297- fs . copySync ( path . join ( preactSrc , 'images' ) , path . join ( stgPath , 'images' ) ) ;
297+ fs . copySync ( path . join ( preactSrc , 'images' ) , path . join ( stgPath , 'images' ) , { dereference : true } ) ;
298298 }
299299 }
300300
@@ -310,7 +310,7 @@ function _renameNlsDirs() {
310310 match . forEach ( ( file ) => {
311311 const src = path . join ( srcBase , file ) ;
312312 const dest = path . join ( srcBase , `locale_${ file } ` ) ;
313- fs . copySync ( src , dest , { overwrite : true } ) ;
313+ fs . copySync ( src , dest , { overwrite : true , dereference : true } ) ;
314314 fs . removeSync ( src ) ;
315315 } ) ;
316316}
@@ -702,7 +702,7 @@ module.exports = {
702702 } ) ;
703703 if ( paths . length ) {
704704 paths . forEach ( ( [ src , dest ] ) => {
705- fs . copySync ( src , dest ) ;
705+ fs . copySync ( src , dest , { dereference : true } ) ;
706706 } ) ;
707707 util . log ( 'Copied local resource components' ) ;
708708 }
@@ -852,9 +852,9 @@ module.exports = {
852852 const destNpmpckgDirPath = `${ destBasePath } /${ npmPckgName } /${ npmPckgInitFileName } ` ;
853853
854854 if ( util . fsExistsSync ( npmPckgSrcPath ) ) {
855- fs . copySync ( npmPckgSrcPath , destNpmpckgDirPath ) ;
855+ fs . copySync ( npmPckgSrcPath , destNpmpckgDirPath , { dereference : true } ) ;
856856 } else if ( util . fsExistsSync ( npmPckgSrcPath . concat ( '.js' ) ) ) {
857- fs . copySync ( npmPckgSrcPath . concat ( '.js' ) , destNpmpckgDirPath . concat ( '.js' ) ) ;
857+ fs . copySync ( npmPckgSrcPath . concat ( '.js' ) , destNpmpckgDirPath . concat ( '.js' ) , { dereference : true } ) ;
858858 }
859859 }
860860 }
0 commit comments