Skip to content

Commit 1325b58

Browse files
authored
Public typings only swapped on build:exp:release (#3082)
1 parent d656e03 commit 1325b58

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
],
2323
"scripts": {
2424
"dev": "lerna run --parallel --scope @firebase/* --scope firebase --scope rxfire dev",
25-
"build": "lerna run --scope @firebase/* --scope firebase --scope rxfire prepare",
25+
"build": "lerna run --scope @firebase/* --scope firebase --scope rxfire build",
2626
"build:exp": "lerna run --scope @firebase/*-exp --scope firebase-exp build",
27+
"build:release": "lerna run --scope @firebase/* --scope firebase --ignore @firebase/*-exp --scope firebase-exp prepare",
28+
"build:exp:release": "lerna run --scope @firebase/*-exp --scope firebase-exp prepare && yarn --cwd packages-exp/app-exp typings:public",
2729
"link:packages": "lerna exec --scope @firebase/* --scope firebase --scope rxfire -- yarn link",
2830
"stage:packages": "./scripts/prepublish.sh",
2931
"repl": "node tools/repl.js",

packages-exp/app-exp/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,21 @@
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 && yarn api-report",
18-
"build:release": "rollup -c rollup.config.release.js && node ./use_public_typings.js",
18+
"build:release": "rollup -c rollup.config.release.js && yarn api-report && yarn typings:public",
1919
"build:deps": "lerna run --scope @firebase/app-exp --include-dependencies build",
2020
"dev": "rollup -c -w",
2121
"test": "yarn type-check && run-p lint test:browser test:node",
2222
"test:ci": "node ../../scripts/run_tests_in_ci.js",
2323
"test:browser": "karma start --single-run",
2424
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.ts --config ../../config/mocharc.node.js",
2525
"type-check": "tsc -p . --noEmit",
26-
"prepare": "yarn build:release",
26+
"prepare": "rollup -c rollup.config.release.js",
2727
"api-report": "api-extractor run --local --verbose",
2828
"predoc": "node ../../scripts/exp/remove-exp.js temp",
2929
"doc": "api-documenter markdown --input temp --output docs",
30-
"build:doc": "yarn build && yarn doc"
30+
"build:doc": "yarn build && yarn doc",
31+
"typings:public": "node ./use_public_typings.js --public",
32+
"typings:internal": "node ./use_public_typings.js"
3133
},
3234
"dependencies": {
3335
"@firebase/app-types-exp": "0.0.800",
@@ -52,7 +54,7 @@
5254
"bugs": {
5355
"url": "https://github.com/firebase/firebase-js-sdk/issues"
5456
},
55-
"typings": "./dist/app-exp-public.d.ts",
57+
"typings": "./dist/app-exp.d.ts",
5658
"nyc": {
5759
"extension": [
5860
".ts"

packages-exp/app-exp/use_public_typings.js renamed to packages-exp/app-exp/use_typings.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-require-imports */
12
/**
23
* @license
34
* Copyright 2020 Google LLC
@@ -16,16 +17,23 @@
1617
*/
1718

1819
const { writeFileSync } = require('fs');
20+
const { argv } = require('yargs');
21+
22+
const path = require('path');
23+
const packageJsonPath = path.resolve(__dirname, './package.json');
1924

2025
// point typings field to the public d.ts file in package.json
21-
const PUBLIC_TYPINGS_PATH = './dist/app-exp-public.d.ts';
26+
const TYPINGS_PATH = argv.public
27+
? './dist/app-exp-public.d.ts'
28+
: './dist/app-exp.d.ts';
2229
console.log(
23-
`Updating the typings field to the public d.ts file ${PUBLIC_TYPINGS_PATH}`
30+
`Updating the packages-exp/app-exp typings field to the ${
31+
argv.public ? 'public' : 'internal'
32+
} d.ts file ${TYPINGS_PATH}`
2433
);
34+
const packageJson = require(packageJsonPath);
35+
packageJson.typings = TYPINGS_PATH;
2536

26-
const packageJson = require('./package.json');
27-
packageJson.typings = PUBLIC_TYPINGS_PATH;
28-
29-
writeFileSync('./package.json', `${JSON.stringify(packageJson, null, 2)}\n`, {
37+
writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`, {
3038
encoding: 'utf-8'
3139
});

scripts/exp/release.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ async function publishExpPackages() {
102102

103103
async function buildPackages() {
104104
const spinner = ora(' Building Packages').start();
105-
await spawn('yarn', ['build:exp'], {
105+
await spawn('yarn', ['build:exp:release'], {
106106
cwd: projectRoot
107107
});
108108
spinner.stopAndPersist({

scripts/release/utils/yarn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ exports.reinstallDeps = async () => {
3636
exports.buildPackages = async () => {
3737
try {
3838
const spinner = ora(' Building Packages').start();
39-
await spawn('yarn', ['build'], {
39+
await spawn('yarn', ['build:release'], {
4040
cwd: root
4141
});
4242
spinner.stopAndPersist({

0 commit comments

Comments
 (0)