Skip to content

Public typings only swapped on build:exp:release #3082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
],
"scripts": {
"dev": "lerna run --parallel --scope @firebase/* --scope firebase --scope rxfire dev",
"build": "lerna run --scope @firebase/* --scope firebase --scope rxfire prepare",
"build": "lerna run --scope @firebase/* --scope firebase --scope rxfire build",
"build:exp": "lerna run --scope @firebase/*-exp --scope firebase-exp build",
"build:release": "lerna run --scope @firebase/* --scope firebase --ignore @firebase/*-exp --scope firebase-exp prepare",
"build:exp:release": "lerna run --scope @firebase/*-exp --scope firebase-exp prepare && yarn --cwd packages-exp/app-exp typings:public",
"link:packages": "lerna exec --scope @firebase/* --scope firebase --scope rxfire -- yarn link",
"stage:packages": "./scripts/prepublish.sh",
"repl": "node tools/repl.js",
Expand Down
10 changes: 6 additions & 4 deletions packages-exp/app-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,21 @@
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"build": "rollup -c && yarn api-report",
"build:release": "rollup -c rollup.config.release.js && node ./use_public_typings.js",
"build:release": "rollup -c rollup.config.release.js && yarn typings:public",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add yarn api-report as the second step? It generates the rollup d.ts files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

"build:deps": "lerna run --scope @firebase/app-exp --include-dependencies build",
"dev": "rollup -c -w",
"test": "yarn type-check && run-p lint test:browser test:node",
"test:ci": "node ../../scripts/run_tests_in_ci.js",
"test:browser": "karma start --single-run",
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.ts --config ../../config/mocharc.node.js",
"type-check": "tsc -p . --noEmit",
"prepare": "yarn build:release",
"prepare": "rollup -c rollup.config.release.js",
"api-report": "api-extractor run --local --verbose",
"predoc": "node ../../scripts/exp/remove-exp.js temp",
"doc": "api-documenter markdown --input temp --output docs",
"build:doc": "yarn build && yarn doc"
"build:doc": "yarn build && yarn doc",
"typings:public": "node ./use_public_typings.js --public",
"typings:internal": "node ./use_public_typings.js"
},
"dependencies": {
"@firebase/app-types-exp": "0.0.800",
Expand All @@ -52,7 +54,7 @@
"bugs": {
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"typings": "./dist/app-exp-public.d.ts",
"typings": "./dist/app-exp.d.ts",
"nyc": {
"extension": [
".ts"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-require-imports */
/**
* @license
* Copyright 2020 Google LLC
Expand All @@ -16,16 +17,23 @@
*/

const { writeFileSync } = require('fs');
const { argv } = require('yargs');

const path = require('path');
const packageJsonPath = path.resolve(__dirname, './package.json');

// point typings field to the public d.ts file in package.json
const PUBLIC_TYPINGS_PATH = './dist/app-exp-public.d.ts';
const TYPINGS_PATH = argv.public
? './dist/app-exp-public.d.ts'
: './dist/app-exp.d.ts';
console.log(
`Updating the typings field to the public d.ts file ${PUBLIC_TYPINGS_PATH}`
`Updating the packages-exp/app-exp typings field to the ${
argv.public ? 'public' : 'internal'
} d.ts file ${TYPINGS_PATH}`
);
const packageJson = require(packageJsonPath);
packageJson.typings = TYPINGS_PATH;

const packageJson = require('./package.json');
packageJson.typings = PUBLIC_TYPINGS_PATH;

writeFileSync('./package.json', `${JSON.stringify(packageJson, null, 2)}\n`, {
writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`, {
encoding: 'utf-8'
});
2 changes: 1 addition & 1 deletion scripts/exp/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async function publishExpPackages() {

async function buildPackages() {
const spinner = ora(' Building Packages').start();
await spawn('yarn', ['build:exp'], {
await spawn('yarn', ['build:exp:release'], {
cwd: projectRoot
});
spinner.stopAndPersist({
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/utils/yarn.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports.reinstallDeps = async () => {
exports.buildPackages = async () => {
try {
const spinner = ora(' Building Packages').start();
await spawn('yarn', ['build'], {
await spawn('yarn', ['build:release'], {
cwd: root
});
spinner.stopAndPersist({
Expand Down