Skip to content

Commit 0f25b1d

Browse files
committed
add release build to analytics exp
1 parent 3c1c40c commit 0f25b1d

File tree

4 files changed

+140
-27
lines changed

4 files changed

+140
-27
lines changed

packages-exp/analytics-exp/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
1313
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
1414
"build": "rollup -c && yarn api-report",
15+
"build:release": "rollup -c rollup.config.release.js && yarn api-report",
1516
"build:deps": "lerna run --scope @firebase/analytics-exp --include-dependencies build",
1617
"dev": "rollup -c -w",
1718
"test": "run-p lint test:all",

packages-exp/analytics-exp/rollup.config.js

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import json from '@rollup/plugin-json';
1919
import typescriptPlugin from 'rollup-plugin-typescript2';
2020
import typescript from 'typescript';
2121
import pkg from './package.json';
22+
import { es2017BuildsNoPlugin, es5BuildsNoPlugin } from './rollup.shared';
2223

2324
const deps = Object.keys(
2425
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
@@ -34,20 +35,13 @@ const es5BuildPlugins = [
3435
json()
3536
];
3637

37-
const es5Builds = [
38-
/**
39-
* Browser Builds
40-
*/
41-
{
42-
input: './src/index.ts',
43-
output: [
44-
{ file: pkg.main, format: 'cjs', sourcemap: true },
45-
{ file: pkg.module, format: 'es', sourcemap: true }
46-
],
47-
plugins: es5BuildPlugins,
48-
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
38+
const es5Builds = es5BuildsNoPlugin.map(build => ({
39+
...build,
40+
plugins: es5BuildPlugins,
41+
treeshake: {
42+
moduleSideEffects: false
4943
}
50-
];
44+
}));
5145

5246
/**
5347
* ES2017 Builds
@@ -64,20 +58,12 @@ const es2017BuildPlugins = [
6458
json({ preferConst: true })
6559
];
6660

67-
const es2017Builds = [
68-
/**
69-
* Browser Builds
70-
*/
71-
{
72-
input: './src/index.ts',
73-
output: {
74-
file: pkg.esm2017,
75-
format: 'es',
76-
sourcemap: true
77-
},
78-
plugins: es2017BuildPlugins,
79-
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
61+
const es2017Builds = es2017BuildsNoPlugin.map(build => ({
62+
...build,
63+
plugins: es2017BuildPlugins,
64+
treeshake: {
65+
moduleSideEffects: false
8066
}
81-
];
67+
}));
8268

8369
export default [...es5Builds, ...es2017Builds];
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/**
2+
* @license
3+
* Copyright 2019 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import typescriptPlugin from 'rollup-plugin-typescript2';
19+
import typescript from 'typescript';
20+
import json from '@rollup/plugin-json';
21+
import { importPathTransformer } from '../../scripts/exp/ts-transform-import-path';
22+
import { es2017BuildsNoPlugin, es5BuildsNoPlugin } from './rollup.shared';
23+
24+
/**
25+
* ES5 Builds
26+
*/
27+
const es5BuildPlugins = [
28+
typescriptPlugin({
29+
typescript,
30+
clean: true,
31+
abortOnError: false,
32+
transformers: [importPathTransformer]
33+
}),
34+
json()
35+
];
36+
37+
const es5Builds = es5BuildsNoPlugin.map(build => ({
38+
...build,
39+
plugins: es5BuildPlugins,
40+
treeshake: {
41+
moduleSideEffects: false
42+
}
43+
}));
44+
45+
/**
46+
* ES2017 Builds
47+
*/
48+
const es2017BuildPlugins = [
49+
typescriptPlugin({
50+
typescript,
51+
tsconfigOverride: {
52+
compilerOptions: {
53+
target: 'es2017'
54+
}
55+
},
56+
abortOnError: false,
57+
clean: true,
58+
transformers: [importPathTransformer]
59+
}),
60+
json({
61+
preferConst: true
62+
})
63+
];
64+
65+
const es2017Builds = es2017BuildsNoPlugin.map(build => ({
66+
...build,
67+
plugins: es2017BuildPlugins,
68+
treeshake: {
69+
moduleSideEffects: false
70+
}
71+
}));
72+
73+
export default [...es5Builds, ...es2017Builds];
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* @license
3+
* Copyright 2018 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
import pkg from './package.json';
18+
19+
const deps = Object.keys(
20+
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
21+
);
22+
23+
export const es5BuildsNoPlugin = [
24+
/**
25+
* Browser Builds
26+
*/
27+
{
28+
input: 'src/index.ts',
29+
output: [
30+
{ file: pkg.main, format: 'cjs', sourcemap: true },
31+
{ file: pkg.module, format: 'es', sourcemap: true }
32+
],
33+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
34+
}
35+
];
36+
37+
/**
38+
* ES2017 Builds
39+
*/
40+
export const es2017BuildsNoPlugin = [
41+
{
42+
/**
43+
* Browser Build
44+
*/
45+
input: 'src/index.ts',
46+
output: {
47+
file: pkg.esm2017,
48+
format: 'es',
49+
sourcemap: true
50+
},
51+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
52+
}
53+
];

0 commit comments

Comments
 (0)