@@ -46,6 +46,10 @@ const isDev = process.env.NODE_ENV === 'development';
46
46
const isDeployPreview =
47
47
! ! process . env . NETLIFY && process . env . CONTEXT === 'deploy-preview' ;
48
48
49
+ // Netlify branch deploy like "docusaurus-v2"
50
+ const isBranchDeploy =
51
+ ! ! process . env . NETLIFY && process . env . CONTEXT === 'branch-deploy' ;
52
+
49
53
// Used to debug production build issues faster
50
54
const isBuildFast = ! ! process . env . BUILD_FAST ;
51
55
@@ -82,15 +86,16 @@ const config = {
82
86
] ,
83
87
i18n : {
84
88
defaultLocale : 'en' ,
85
- // eslint-disable-next-line no-nested-ternary
86
- locales : isDeployPreview
87
- ? // Deploy preview: keep it fast!
88
- [ 'en' ]
89
- : isI18nStaging
90
- ? // Staging locales: https://docusaurus-i18n-staging.netlify.app/
91
- [ 'en' , 'ja' ]
92
- : // Production locales
93
- [ 'en' , 'fr' , 'pt-BR' , 'ko' , 'zh-CN' ] ,
89
+
90
+ locales :
91
+ isDeployPreview || isBranchDeploy
92
+ ? // Deploy preview and branch deploys: keep them fast!
93
+ [ 'en' ]
94
+ : isI18nStaging
95
+ ? // Staging locales: https://docusaurus-i18n-staging.netlify.app/
96
+ [ 'en' , 'ja' ]
97
+ : // Production locales
98
+ [ 'en' , 'fr' , 'pt-BR' , 'ko' , 'zh-CN' ] ,
94
99
} ,
95
100
webpack : {
96
101
jsLoader : ( isServer ) => ( {
@@ -299,11 +304,15 @@ const config = {
299
304
remarkPlugins : [ math , [ npm2yarn , { sync : true } ] ] ,
300
305
rehypePlugins : [ ] ,
301
306
disableVersioning : isVersioningDisabled ,
302
- lastVersion : isDev || isDeployPreview ? 'current' : undefined ,
307
+ lastVersion :
308
+ isDev || isDeployPreview || isBranchDeploy ? 'current' : undefined ,
303
309
onlyIncludeVersions : ( ( ) => {
304
310
if ( isBuildFast ) {
305
311
return [ 'current' ] ;
306
- } else if ( ! isVersioningDisabled && ( isDev || isDeployPreview ) ) {
312
+ } else if (
313
+ ! isVersioningDisabled &&
314
+ ( isDev || isDeployPreview || isBranchDeploy )
315
+ ) {
307
316
return [ 'current' , ...versions . slice ( 0 , 2 ) ] ;
308
317
}
309
318
return undefined ;
@@ -341,7 +350,7 @@ const config = {
341
350
'./_dogfooding/dogfooding.css' ,
342
351
] ,
343
352
} ,
344
- gtag : ! isDeployPreview
353
+ gtag : ! ( isDeployPreview || isBranchDeploy )
345
354
? {
346
355
trackingID : 'UA-141789564-1' ,
347
356
}
0 commit comments