@@ -6,6 +6,7 @@ import { registry } from '../src/registry'
6
6
import { generateTpcContent } from './utils'
7
7
8
8
export interface TpcDescriptor {
9
+ fileName : string
9
10
label : string
10
11
tpcKey : string
11
12
tpcData : Output
@@ -23,11 +24,12 @@ export interface TpcDescriptor {
23
24
const scripts : Array < TpcDescriptor > = [
24
25
// GTM
25
26
{
27
+ fileName : 'google-tag-manager' ,
26
28
label : 'Google Tag Manager' ,
27
29
tpcKey : 'gtm' ,
28
30
tpcData : GoogleTagManagerData as Output ,
29
31
tpcTypeImport : 'GoogleTagManagerApi' ,
30
- key : 'google-tag-manager ' ,
32
+ key : 'googleTagManager ' ,
31
33
performanceMarkFeature : 'nuxt-third-parties-gtm' ,
32
34
returnUse : '{ dataLayer: window.dataLayers[options.dataLayerName!], google_tag_manager: window.google_tag_manager }' ,
33
35
returnStub : 'fn === \'dataLayer\' ? [] : void 0' ,
@@ -37,10 +39,11 @@ const scripts: Array<TpcDescriptor> = [
37
39
} ,
38
40
// GA
39
41
{
42
+ fileName : 'google-analytics' ,
40
43
label : 'Google Analytics' ,
41
44
tpcKey : 'gtag' ,
42
45
tpcData : GooglaAnalyticsData as Output ,
43
- key : 'google-analytics ' ,
46
+ key : 'googleAnalytics ' ,
44
47
tpcTypeImport : 'GoogleAnalyticsApi' ,
45
48
performanceMarkFeature : 'nuxt-third-parties-ga' ,
46
49
returnUse : '{ dataLayer: window.dataLayers[options.dataLayerName!], gtag: window.gtag }' ,
@@ -55,7 +58,7 @@ export async function generate() {
55
58
for ( const script of scripts ) {
56
59
script . registry = registry ( ) . find ( r => r . label === script . label )
57
60
const content = await generateTpcContent ( script )
58
- await writeFile ( resolve ( `./src/runtime/registry/${ script . key } .ts` ) , content )
61
+ await writeFile ( resolve ( `./src/runtime/registry/${ script . fileName } .ts` ) , content )
59
62
}
60
63
}
61
64
0 commit comments