Skip to content

Commit bdf937d

Browse files
committed
fix compat packages
1 parent 0dfd516 commit bdf937d

File tree

3 files changed

+132
-12
lines changed

3 files changed

+132
-12
lines changed

packages-exp/app-compat/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
1818
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
1919
"build": "rollup -c",
20+
"build:release": "rollup -c rollup.config.release.js",
2021
"build:deps": "lerna run --scope @firebase/app-compat --include-dependencies build",
2122
"dev": "rollup -c -w",
2223
"test": "run-p lint test:all",
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
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+
18+
import typescriptPlugin from 'rollup-plugin-typescript2';
19+
import json from 'rollup-plugin-json';
20+
import typescript from 'typescript';
21+
import pkg from './package.json';
22+
import { importPathTransformer } from '../../scripts/exp/ts-transform-import-path';
23+
24+
const deps = Object.keys(
25+
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
26+
);
27+
28+
/**
29+
* ES5 Builds
30+
*/
31+
const es5BuildPlugins = [
32+
typescriptPlugin({
33+
typescript,
34+
clean: true,
35+
abortOnError: false,
36+
transformers: [importPathTransformer]
37+
}),
38+
json()
39+
];
40+
41+
const es5Builds = [
42+
{
43+
input: 'src/index.ts',
44+
output: [
45+
{ file: pkg.main, format: 'cjs', sourcemap: true },
46+
{ file: pkg.module, format: 'es', sourcemap: true }
47+
],
48+
plugins: es5BuildPlugins,
49+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)),
50+
treeshake: {
51+
moduleSideEffects: false
52+
}
53+
},
54+
{
55+
input: 'src/index.lite.ts',
56+
output: {
57+
file: pkg.lite,
58+
format: 'es',
59+
sourcemap: true
60+
},
61+
plugins: es5BuildPlugins,
62+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)),
63+
treeshake: {
64+
moduleSideEffects: false
65+
}
66+
}
67+
];
68+
69+
/**
70+
* ES2017 Builds
71+
*/
72+
const es2017BuildPlugins = [
73+
typescriptPlugin({
74+
typescript,
75+
clean: true,
76+
abortOnError: false,
77+
tsconfigOverride: {
78+
compilerOptions: {
79+
target: 'es2017'
80+
}
81+
},
82+
transformers: [importPathTransformer]
83+
}),
84+
json({
85+
preferConst: true
86+
})
87+
];
88+
89+
const es2017Builds = [
90+
/**
91+
* Browser Builds
92+
*/
93+
{
94+
input: 'src/index.ts',
95+
output: {
96+
file: pkg.esm2017,
97+
format: 'es',
98+
sourcemap: true
99+
},
100+
plugins: es2017BuildPlugins,
101+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)),
102+
treeshake: {
103+
moduleSideEffects: false
104+
}
105+
},
106+
{
107+
input: 'src/index.lite.ts',
108+
output: {
109+
file: pkg['lite-esm2017'],
110+
format: 'es',
111+
sourcemap: true
112+
},
113+
plugins: es2017BuildPlugins,
114+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)),
115+
treeshake: {
116+
moduleSideEffects: false
117+
}
118+
}
119+
];
120+
121+
export default [...es5Builds, ...es2017Builds];

scripts/exp/release.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,18 @@ async function buildPackages() {
135135
}
136136
);
137137

138-
// Build exp packages except for firebase-exp
138+
// Build exp and compat packages except for firebase-exp
139139
await spawn(
140140
'yarn',
141-
['lerna', 'run', '--scope', '@firebase/*-exp', 'build:release'],
141+
[
142+
'lerna',
143+
'run',
144+
'--scope',
145+
'@firebase/*-exp',
146+
'--scope',
147+
'@firebase/*-compat',
148+
'build:release'
149+
],
142150
{
143151
cwd: projectRoot,
144152
stdio: 'inherit'
@@ -156,16 +164,6 @@ async function buildPackages() {
156164
}
157165
);
158166

159-
// Build compat packages
160-
await spawn(
161-
'yarn',
162-
['lerna', 'run', '--scope', '@firebase/*-compat', 'build'],
163-
{
164-
cwd: projectRoot,
165-
stdio: 'inherit'
166-
}
167-
);
168-
169167
// Build firebase-exp
170168
await spawn(
171169
'yarn',

0 commit comments

Comments
 (0)