Skip to content

Commit ce41a64

Browse files
authored
Release scripts for exp packages (#2887)
* update script name * produce build artifacts without -exp in package names * Script to release exp pkgs experimentally * save progress * reset workingtree * testing * update prepare scripts * save * save * update * await promise * make npm publishing nicer * await promise * correct variable name * implement commitandpush * add missing import * Publish firebase@exp * fix variable name * Publish firebase@exp * revert versions * add comments * add comment * more comments * [AUTOMATED]: Prettier Code Styling * [AUTOMATED]: License Headers * fix typo * remove --dry-run flag
1 parent 7f69b70 commit ce41a64

File tree

7 files changed

+442
-6
lines changed

7 files changed

+442
-6
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
"scripts": {
2424
"dev": "lerna run --parallel --scope @firebase/* --scope firebase --scope rxfire dev",
2525
"build": "lerna run --scope @firebase/* --scope firebase --scope rxfire prepare",
26-
"build:exp": "lerna run --scope @firebase/*-exp prepare",
26+
"build:exp": "lerna run --scope @firebase/*-exp --scope firebase-exp build",
2727
"link:packages": "lerna exec --scope @firebase/* --scope firebase --scope rxfire -- yarn link",
2828
"stage:packages": "./scripts/prepublish.sh",
2929
"repl": "node tools/repl.js",
3030
"release": "node scripts/release/cli.js",
3131
"pretest": "node tools/pretest.js",
3232
"test": "lerna run --concurrency 4 --stream test",
33-
"test:exp": "lerna run --concurrency 4 --stream --scope @firebase/*-exp test",
33+
"test:exp": "lerna run --concurrency 4 --stream --scope @firebase/*-exp --scope firebase-exp test",
3434
"pretest:coverage": "mkdirp coverage",
3535
"ci:coverage": "lcov-result-merger 'packages/**/lcov.info' 'lcov-all.info'",
3636
"test:coverage": "lcov-result-merger 'packages/**/lcov.info' | coveralls",

packages-exp/app-exp/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
1616
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
1717
"build": "rollup -c",
18+
"build:release": "rollup -c rollup.config.release.js",
1819
"dev": "rollup -c -w",
1920
"test": "yarn type-check && run-p lint test:browser test:node",
2021
"test:browser": "karma start --single-run",
2122
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.ts --opts ../../config/mocha.node.opts",
2223
"type-check": "tsc -p . --noEmit",
23-
"prepare": "yarn build",
24+
"prepare": "yarn build:release",
2425
"api-report": "api-extractor run --local --verbose",
25-
"predoc": "node ../../scripts/exp/remove_exp.js temp",
26+
"predoc": "node ../../scripts/exp/remove-exp.js temp",
2627
"doc": "api-documenter markdown --input temp --output docs",
2728
"build:doc": "yarn build && yarn api-report && yarn doc"
2829
},
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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 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+
transformers: [importPathTransformer]
36+
}),
37+
json()
38+
];
39+
40+
const es5Builds = [
41+
/**
42+
* Browser Builds
43+
*/
44+
{
45+
input: {
46+
index: 'src/index.ts',
47+
internal: 'src/internal.ts'
48+
},
49+
output: [{ dir: 'dist/esm5', format: 'es', sourcemap: true }],
50+
plugins: es5BuildPlugins,
51+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)),
52+
treeshake: {
53+
moduleSideEffects: false
54+
}
55+
},
56+
/**
57+
* Node.js Build
58+
*/
59+
{
60+
input: {
61+
index: 'src/index.ts',
62+
internal: 'src/internal.ts'
63+
},
64+
output: [{ dir: 'dist/cjs', format: 'cjs', sourcemap: true }],
65+
plugins: es5BuildPlugins,
66+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
67+
}
68+
];
69+
70+
/**
71+
* ES2017 Builds
72+
*/
73+
const es2017BuildPlugins = [
74+
typescriptPlugin({
75+
typescript,
76+
tsconfigOverride: {
77+
compilerOptions: {
78+
target: 'es2017'
79+
}
80+
},
81+
clean: true,
82+
transformers: [importPathTransformer]
83+
}),
84+
json({
85+
preferConst: true
86+
})
87+
];
88+
89+
const es2017Builds = [
90+
/**
91+
* Browser Builds
92+
*/
93+
{
94+
input: {
95+
index: 'src/index.ts',
96+
internal: 'src/internal.ts'
97+
},
98+
output: {
99+
dir: 'dist/esm2017',
100+
format: 'es',
101+
sourcemap: true
102+
},
103+
plugins: es2017BuildPlugins,
104+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
105+
}
106+
];
107+
108+
export default [...es5Builds, ...es2017Builds];

packages-exp/app-types-exp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"scripts": {
99
"test": "tsc",
1010
"api-report": "api-extractor run --local --verbose",
11-
"predoc": "node ../../scripts/exp/remove_exp.js temp",
11+
"predoc": "node ../../scripts/exp/remove-exp.js temp",
1212
"doc": "api-documenter markdown --input temp --output docs",
1313
"build:doc": "yarn api-report && yarn doc"
1414
},

0 commit comments

Comments
 (0)