Skip to content

Commit 3a02456

Browse files
Undo clean, add functions
1 parent b004221 commit 3a02456

File tree

3 files changed

+108
-97
lines changed

3 files changed

+108
-97
lines changed

packages/firestore/rollup.config.exp.js

Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18+
import tmp from 'tmp';
1819
import json from '@rollup/plugin-json';
1920
import alias from '@rollup/plugin-alias';
2021
import typescriptPlugin from 'rollup-plugin-typescript2';
@@ -29,51 +30,55 @@ import pkg from './exp/package.json';
2930

3031
const util = require('./rollup.shared');
3132

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

59-
const browserPlugins = [
60-
typescriptPlugin({
61-
typescript,
62-
tsconfigOverride: {
63-
compilerOptions: {
64-
target: 'es2017'
65-
}
66-
},
67-
clean: true,
68-
abortOnError: false,
69-
transformers: [
70-
util.removeAssertAndPrefixInternalTransformer,
71-
importPathTransformer
72-
]
73-
}),
74-
json({ preferConst: true }),
75-
terser(util.manglePrivatePropertiesOptions)
76-
];
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+
};
7782

7883
const allBuilds = [
7984
// Node ESM build
@@ -84,7 +89,7 @@ const allBuilds = [
8489
format: 'es',
8590
sourcemap: true
8691
},
87-
plugins: [alias(util.generateAliasConfig('node')), ...nodePlugins],
92+
plugins: [alias(util.generateAliasConfig('node')), ...nodePlugins()],
8893
external: util.resolveNodeExterns,
8994
treeshake: {
9095
moduleSideEffects: false
@@ -113,7 +118,7 @@ const allBuilds = [
113118
format: 'es',
114119
sourcemap: true
115120
},
116-
plugins: [alias(util.generateAliasConfig('browser')), ...browserPlugins],
121+
plugins: [alias(util.generateAliasConfig('browser')), ...browserPlugins()],
117122
external: util.resolveBrowserExterns,
118123
treeshake: {
119124
moduleSideEffects: false
@@ -127,7 +132,7 @@ const allBuilds = [
127132
format: 'es',
128133
sourcemap: true
129134
},
130-
plugins: [alias(util.generateAliasConfig('rn')), ...browserPlugins],
135+
plugins: [alias(util.generateAliasConfig('rn')), ...browserPlugins()],
131136
external: util.resolveBrowserExterns,
132137
treeshake: {
133138
moduleSideEffects: false

packages/firestore/rollup.config.lite.js

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18+
import tmp from 'tmp';
1819
import path from 'path';
1920
import json from '@rollup/plugin-json';
2021
import alias from '@rollup/plugin-alias';
@@ -30,50 +31,54 @@ import pkg from './lite/package.json';
3031

3132
const util = require('./rollup.shared');
3233

33-
const nodePlugins = [
34-
typescriptPlugin({
35-
typescript,
36-
tsconfigOverride: {
37-
compilerOptions: {
38-
target: 'es2017'
39-
}
40-
},
41-
clean: true,
42-
abortOnError: false,
43-
transformers: [util.removeAssertTransformer, importPathTransformer]
44-
}),
45-
json({ preferConst: true }),
46-
copy({
47-
targets: [
48-
{
49-
src: 'src/protos',
50-
dest: 'dist/lite/src'
51-
}
52-
]
53-
}),
54-
replace({
55-
'process.env.FIRESTORE_PROTO_ROOT': JSON.stringify('src/protos')
56-
})
57-
];
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+
};
5861

59-
const browserPlugins = [
60-
typescriptPlugin({
61-
typescript,
62-
tsconfigOverride: {
63-
compilerOptions: {
64-
target: 'es2017'
65-
}
66-
},
67-
clean: true,
68-
abortOnError: false,
69-
transformers: [
70-
util.removeAssertAndPrefixInternalTransformer,
71-
importPathTransformer
72-
]
73-
}),
74-
json({ preferConst: true }),
75-
terser(util.manglePrivatePropertiesOptions)
76-
];
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+
};
7782

7883
const allBuilds = [
7984
// Node ESM build
@@ -84,7 +89,7 @@ const allBuilds = [
8489
format: 'es',
8590
sourcemap: true
8691
},
87-
plugins: [alias(util.generateAliasConfig('node_lite')), ...nodePlugins],
92+
plugins: [alias(util.generateAliasConfig('node_lite')), ...nodePlugins()],
8893
external: util.resolveNodeExterns,
8994
treeshake: {
9095
moduleSideEffects: false
@@ -126,7 +131,7 @@ const allBuilds = [
126131
},
127132
plugins: [
128133
alias(util.generateAliasConfig('browser_lite')),
129-
...browserPlugins
134+
...browserPlugins()
130135
],
131136
external: util.resolveBrowserExterns,
132137
treeshake: {
@@ -141,7 +146,7 @@ const allBuilds = [
141146
format: 'es',
142147
sourcemap: true
143148
},
144-
plugins: [alias(util.generateAliasConfig('rn_lite')), ...browserPlugins],
149+
plugins: [alias(util.generateAliasConfig('rn_lite')), ...browserPlugins()],
145150
external: util.resolveBrowserExterns,
146151
treeshake: {
147152
moduleSideEffects: false

packages/firestore/rollup.shared.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18+
const tmp = require('tmp');
1819
const json = require('@rollup/plugin-json');
1920
const alias = require('@rollup/plugin-alias');
2021
const typescriptPlugin = require('rollup-plugin-typescript2');
@@ -213,7 +214,7 @@ exports.es2017Plugins = function (platform, mangled = false) {
213214
target: 'es2017'
214215
}
215216
},
216-
clean: true,
217+
cacheDir: tmp.dirSync(),
217218
transformers: [removeAssertAndPrefixInternalTransformer]
218219
}),
219220
json({ preferConst: true }),
@@ -229,7 +230,7 @@ exports.es2017Plugins = function (platform, mangled = false) {
229230
target: 'es2017'
230231
}
231232
},
232-
clean: true,
233+
cacheDir: tmp.dirSync(),
233234
transformers: [removeAssertTransformer]
234235
}),
235236
json({ preferConst: true })
@@ -248,7 +249,7 @@ exports.es2017ToEs5Plugins = function (mangled = false) {
248249
}
249250
},
250251
include: ['dist/*.js', 'dist/exp/*.js'],
251-
clean: true
252+
cacheDir: tmp.dirSync()
252253
}),
253254
terser({
254255
output: {
@@ -269,7 +270,7 @@ exports.es2017ToEs5Plugins = function (mangled = false) {
269270
}
270271
},
271272
include: ['dist/*.js', 'dist/exp/*.js'],
272-
clean: true
273+
cacheDir: tmp.dirSync()
273274
}),
274275
sourcemaps()
275276
];

0 commit comments

Comments
 (0)