Skip to content

Commit 3754371

Browse files
Use distinct cache dirs for all builds (#4166)
1 parent ff9dc34 commit 3754371

File tree

3 files changed

+105
-95
lines changed

3 files changed

+105
-95
lines changed

packages/firestore/rollup.config.exp.js

+51-47
Original file line numberDiff line numberDiff line change
@@ -30,51 +30,55 @@ import pkg from './exp/package.json';
3030

3131
const util = require('./rollup.shared');
3232

33-
const nodePlugins = [
34-
typescriptPlugin({
35-
typescript,
36-
tsconfigOverride: {
37-
compilerOptions: {
38-
target: 'es2017'
39-
}
40-
},
41-
cacheDir: tmp.dirSync(),
42-
abortOnError: false,
43-
transformers: [util.removeAssertTransformer, importPathTransformer]
44-
}),
45-
json({ preferConst: true }),
46-
// Needed as we also use the *.proto files
47-
copy({
48-
targets: [
49-
{
50-
src: 'src/protos',
51-
dest: 'dist/exp/src'
52-
}
53-
]
54-
}),
55-
replace({
56-
'process.env.FIRESTORE_PROTO_ROOT': JSON.stringify('../src/protos')
57-
})
58-
];
33+
const nodePlugins = function () {
34+
return [
35+
typescriptPlugin({
36+
typescript,
37+
tsconfigOverride: {
38+
compilerOptions: {
39+
target: 'es2017'
40+
}
41+
},
42+
cacheDir: tmp.dirSync(),
43+
abortOnError: false,
44+
transformers: [util.removeAssertTransformer, importPathTransformer]
45+
}),
46+
json({ preferConst: true }),
47+
// Needed as we also use the *.proto files
48+
copy({
49+
targets: [
50+
{
51+
src: 'src/protos',
52+
dest: 'dist/exp/src'
53+
}
54+
]
55+
}),
56+
replace({
57+
'process.env.FIRESTORE_PROTO_ROOT': JSON.stringify('../src/protos')
58+
})
59+
];
60+
};
5961

60-
const browserPlugins = [
61-
typescriptPlugin({
62-
typescript,
63-
tsconfigOverride: {
64-
compilerOptions: {
65-
target: 'es2017'
66-
}
67-
},
68-
cacheDir: tmp.dirSync(),
69-
abortOnError: false,
70-
transformers: [
71-
util.removeAssertAndPrefixInternalTransformer,
72-
importPathTransformer
73-
]
74-
}),
75-
json({ preferConst: true }),
76-
terser(util.manglePrivatePropertiesOptions)
77-
];
62+
const browserPlugins = function () {
63+
return [
64+
typescriptPlugin({
65+
typescript,
66+
tsconfigOverride: {
67+
compilerOptions: {
68+
target: 'es2017'
69+
}
70+
},
71+
cacheDir: tmp.dirSync(),
72+
abortOnError: false,
73+
transformers: [
74+
util.removeAssertAndPrefixInternalTransformer,
75+
importPathTransformer
76+
]
77+
}),
78+
json({ preferConst: true }),
79+
terser(util.manglePrivatePropertiesOptions)
80+
];
81+
};
7882

7983
const allBuilds = [
8084
// Node ESM build
@@ -85,7 +89,7 @@ const allBuilds = [
8589
format: 'es',
8690
sourcemap: true
8791
},
88-
plugins: [alias(util.generateAliasConfig('node')), ...nodePlugins],
92+
plugins: [alias(util.generateAliasConfig('node')), ...nodePlugins()],
8993
external: util.resolveNodeExterns,
9094
treeshake: {
9195
moduleSideEffects: false
@@ -114,7 +118,7 @@ const allBuilds = [
114118
format: 'es',
115119
sourcemap: true
116120
},
117-
plugins: [alias(util.generateAliasConfig('browser')), ...browserPlugins],
121+
plugins: [alias(util.generateAliasConfig('browser')), ...browserPlugins()],
118122
external: util.resolveBrowserExterns,
119123
treeshake: {
120124
moduleSideEffects: false
@@ -128,7 +132,7 @@ const allBuilds = [
128132
format: 'es',
129133
sourcemap: true
130134
},
131-
plugins: [alias(util.generateAliasConfig('rn')), ...browserPlugins],
135+
plugins: [alias(util.generateAliasConfig('rn')), ...browserPlugins()],
132136
external: util.resolveBrowserExterns,
133137
treeshake: {
134138
moduleSideEffects: false

packages/firestore/rollup.config.lite.js

+50-46
Original file line numberDiff line numberDiff line change
@@ -31,50 +31,54 @@ import pkg from './lite/package.json';
3131

3232
const util = require('./rollup.shared');
3333

34-
const nodePlugins = [
35-
typescriptPlugin({
36-
typescript,
37-
tsconfigOverride: {
38-
compilerOptions: {
39-
target: 'es2017'
40-
}
41-
},
42-
cacheDir: tmp.dirSync(),
43-
abortOnError: false,
44-
transformers: [util.removeAssertTransformer, importPathTransformer]
45-
}),
46-
json({ preferConst: true }),
47-
copy({
48-
targets: [
49-
{
50-
src: 'src/protos',
51-
dest: 'dist/lite/src'
52-
}
53-
]
54-
}),
55-
replace({
56-
'process.env.FIRESTORE_PROTO_ROOT': JSON.stringify('src/protos')
57-
})
58-
];
34+
const nodePlugins = function () {
35+
return [
36+
typescriptPlugin({
37+
typescript,
38+
tsconfigOverride: {
39+
compilerOptions: {
40+
target: 'es2017'
41+
}
42+
},
43+
cacheDir: tmp.dirSync(),
44+
abortOnError: false,
45+
transformers: [util.removeAssertTransformer, importPathTransformer]
46+
}),
47+
json({ preferConst: true }),
48+
copy({
49+
targets: [
50+
{
51+
src: 'src/protos',
52+
dest: 'dist/lite/src'
53+
}
54+
]
55+
}),
56+
replace({
57+
'process.env.FIRESTORE_PROTO_ROOT': JSON.stringify('src/protos')
58+
})
59+
];
60+
};
5961

60-
const browserPlugins = [
61-
typescriptPlugin({
62-
typescript,
63-
tsconfigOverride: {
64-
compilerOptions: {
65-
target: 'es2017'
66-
}
67-
},
68-
cacheDir: tmp.dirSync(),
69-
abortOnError: false,
70-
transformers: [
71-
util.removeAssertAndPrefixInternalTransformer,
72-
importPathTransformer
73-
]
74-
}),
75-
json({ preferConst: true }),
76-
terser(util.manglePrivatePropertiesOptions)
77-
];
62+
const browserPlugins = function () {
63+
return [
64+
typescriptPlugin({
65+
typescript,
66+
tsconfigOverride: {
67+
compilerOptions: {
68+
target: 'es2017'
69+
}
70+
},
71+
cacheDir: tmp.dirSync(),
72+
abortOnError: false,
73+
transformers: [
74+
util.removeAssertAndPrefixInternalTransformer,
75+
importPathTransformer
76+
]
77+
}),
78+
json({ preferConst: true }),
79+
terser(util.manglePrivatePropertiesOptions)
80+
];
81+
};
7882

7983
const allBuilds = [
8084
// Node ESM build
@@ -85,7 +89,7 @@ const allBuilds = [
8589
format: 'es',
8690
sourcemap: true
8791
},
88-
plugins: [alias(util.generateAliasConfig('node_lite')), ...nodePlugins],
92+
plugins: [alias(util.generateAliasConfig('node_lite')), ...nodePlugins()],
8993
external: util.resolveNodeExterns,
9094
treeshake: {
9195
moduleSideEffects: false
@@ -127,7 +131,7 @@ const allBuilds = [
127131
},
128132
plugins: [
129133
alias(util.generateAliasConfig('browser_lite')),
130-
...browserPlugins
134+
...browserPlugins()
131135
],
132136
external: util.resolveBrowserExterns,
133137
treeshake: {
@@ -142,7 +146,7 @@ const allBuilds = [
142146
format: 'es',
143147
sourcemap: true
144148
},
145-
plugins: [alias(util.generateAliasConfig('rn_lite')), ...browserPlugins],
149+
plugins: [alias(util.generateAliasConfig('rn_lite')), ...browserPlugins()],
146150
external: util.resolveBrowserExterns,
147151
treeshake: {
148152
moduleSideEffects: false

packages/firestore/rollup.shared.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ exports.es2017ToEs5Plugins = function (mangled = false) {
248248
allowJs: true
249249
}
250250
},
251-
include: ['dist/*.js', 'dist/exp/*.js']
251+
include: ['dist/*.js', 'dist/exp/*.js'],
252+
cacheDir: tmp.dirSync()
252253
}),
253254
terser({
254255
output: {
@@ -268,7 +269,8 @@ exports.es2017ToEs5Plugins = function (mangled = false) {
268269
allowJs: true
269270
}
270271
},
271-
include: ['dist/*.js', 'dist/exp/*.js']
272+
include: ['dist/*.js', 'dist/exp/*.js'],
273+
cacheDir: tmp.dirSync()
272274
}),
273275
sourcemaps()
274276
];

0 commit comments

Comments
 (0)