Skip to content

Commit

Permalink
Merge master into release
Browse files Browse the repository at this point in the history
  • Loading branch information
google-oss-bot authored May 23, 2024
2 parents 7381f21 + 52d6266 commit a8bdda6
Show file tree
Hide file tree
Showing 12 changed files with 660 additions and 23 deletions.
5 changes: 5 additions & 0 deletions .changeset/empty-windows-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/vertexai-preview': patch
---

Change `types` paths to point to rolled-up public `d.ts` files. This fixes some TypeScript compiler errors users are seeing.
5 changes: 5 additions & 0 deletions .changeset/wet-hotels-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/auth': patch
---

Generate dts rollups for auth web extension and cordova
1 change: 1 addition & 0 deletions .github/workflows/canary-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:
NPM_TOKEN_TESTING: ${{secrets.NPM_TOKEN_TESTING}}
NPM_TOKEN_UTIL: ${{secrets.NPM_TOKEN_UTIL}}
NPM_TOKEN_VERTEXAI: ${{secrets.NPM_TOKEN_VERTEXAI}}
NPM_TOKEN_VERTEXAI_PREVIEW: ${{secrets.NPM_TOKEN_VERTEXAI_PREVIEW}}
NPM_TOKEN_WEBCHANNEL_WRAPPER: ${{secrets.NPM_TOKEN_WEBCHANNEL_WRAPPER}}
NPM_TOKEN_FIREBASE: ${{secrets.NPM_TOKEN_FIREBASE}}
NPM_TOKEN_APP_COMPAT: ${{ secrets.NPM_TOKEN_APP_COMPAT }}
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ tsdoc-metadata.json
# generated html docs
docs-rut/
docs/
toc/

# generated Terraform docs
.terraform/*
Expand Down
16 changes: 16 additions & 0 deletions packages/auth/cordova/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../../../config/api-extractor.json",
"mainEntryPointFilePath": "<projectFolder>/dist/cordova/index.cordova.d.ts",
"apiReport": {
"enabled": false
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "<projectFolder>/dist/cordova/<unscopedPackageName>.d.ts",
"publicTrimmedFilePath": "<projectFolder>/dist/cordova/<unscopedPackageName>-public.d.ts"
},
"docModel": {
"enabled": true,
"apiJsonFilePath": "<projectFolder>/temp/subpackages/<unscopedPackageName>.api.json"
}
}
4 changes: 2 additions & 2 deletions packages/auth/cordova/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@firebase/auth/cordova",
"name": "@firebase/auth-cordova",
"description": "A Cordova-specific build of the Firebase Auth JS SDK",
"browser": "../dist/cordova/index.js",
"module": "../dist/cordova/index.js",
"typings": "../dist/cordova/index.cordova.d.ts"
"typings": "../dist/cordova/auth-cordova-public.d.ts"
}
6 changes: 3 additions & 3 deletions packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
"default": "./dist/esm2017/index.js"
},
"./cordova": {
"types": "./dist/cordova/index.cordova.d.ts",
"types": "./dist/cordova/auth-cordova-public.d.ts",
"default": "./dist/cordova/index.js"
},
"./web-extension": {
"types:": "./dist/web-extension-esm2017/index.web-extension.d.ts",
"types:": "./dist/web-extension-esm2017/auth-web-extension-public.d.ts",
"import": "./dist/web-extension-esm2017/index.js",
"require": "./dist/web-extension-cjs/index.js",
"default": "./dist/web-extension-esm2017/index.js"
Expand Down Expand Up @@ -111,7 +111,7 @@
"test:node:integration": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --integration",
"test:node:integration:local": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --integration --local",
"test:webdriver": "rollup -c test/integration/webdriver/static/rollup.config.js && ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --webdriver",
"api-report": "api-extractor run --local --verbose",
"api-report": "api-extractor run --local --verbose --config ./api-extractor.json && api-extractor run --local --verbose --config ./web-extension/api-extractor.json && api-extractor run --local --verbose --config ./cordova/api-extractor.json",
"doc": "api-documenter markdown --input temp --output docs",
"build:doc": "yarn build && yarn doc",
"typings:public": "node ../../scripts/build/use_typings.js ./dist/auth-public.d.ts"
Expand Down
16 changes: 16 additions & 0 deletions packages/auth/web-extension/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../../../config/api-extractor.json",
"mainEntryPointFilePath": "<projectFolder>/dist/web-extension-esm2017/index.web-extension.d.ts",
"apiReport": {
"enabled": false
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "<projectFolder>/dist/web-extension-esm2017/<unscopedPackageName>.d.ts",
"publicTrimmedFilePath": "<projectFolder>/dist/web-extension-esm2017/<unscopedPackageName>-public.d.ts"
},
"docModel": {
"enabled": true,
"apiJsonFilePath": "<projectFolder>/temp/subpackages/<unscopedPackageName>.api.json"
}
}
4 changes: 2 additions & 2 deletions packages/auth/web-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@firebase/auth/web-extension",
"name": "@firebase/auth-web-extension",
"description": "A Chrome-Manifest-v3-specific build of the Firebase Auth JS SDK",
"main": "../dist/web-extension-cjs/index.js",
"browser": "../dist/web-extension-esm2017/index.js",
"module": "../dist/web-extension-esm2017/index.js",
"typings": "../dist/web-extension-esm2017/index.web-extension.d.ts"
"typings": "../dist/web-extension-esm2017/auth-web-extension-public.d.ts"
}
5 changes: 3 additions & 2 deletions packages/vertexai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"module": "dist/esm/index.esm2017.js",
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"types": "./dist/vertexai-preview-public.d.ts",
"node": {
"require": "./dist/index.cjs.js",
"import": "./dist/esm/index.esm2017.js"
Expand All @@ -37,7 +37,8 @@
"test": "run-p --npm-path npm lint test:browser",
"test:ci": "yarn testsetup && node ../../scripts/run_tests_in_ci.js -s test",
"test:browser": "yarn testsetup && karma start --single-run",
"api-report": "api-extractor run --local --verbose"
"api-report": "api-extractor run --local --verbose",
"typings:public": "node ../../scripts/build/use_typings.js ./dist/vertexai-preview-public.d.ts"
},
"peerDependencies": {
"@firebase/app": "0.x",
Expand Down
65 changes: 52 additions & 13 deletions scripts/docgen/docgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,50 @@ yargs
.demandCommand()
.help().argv;

process.on('exit', cleanup);
process.on('SIGINT', cleanup);

let authApiReportOriginal: string;
let authApiConfigOriginal: string;

function cleanup() {
try {
// Restore original auth api-extractor.json contents.
if (authApiReportOriginal) {
console.log(`Restoring original auth api-extractor.json contents.`);
fs.writeFileSync(
`${projectRoot}/packages/auth/api-extractor.json`,
authApiConfigOriginal
);
}
// Restore original auth.api.md
if (authApiConfigOriginal) {
console.log(`Restoring original auth.api.md contents.`);
fs.writeFileSync(
`${projectRoot}/common/api-review/auth.api.md`,
authApiReportOriginal
);
}
for (const excludedPackage of EXCLUDED_PACKAGES) {
if (fs.existsSync(`${projectRoot}/temp/${excludedPackage}.skip`)) {
console.log(
`Restoring json files for excluded package: ${excludedPackage}.`
);
fs.renameSync(
`${projectRoot}/temp/${excludedPackage}.skip`,
`${projectRoot}/temp/${excludedPackage}.api.json`
);
}
}
} catch (e) {
console.error(
'Error cleaning up files on exit - ' +
'check for temp modifications to md and json files.'
);
console.error(e);
}
}

async function generateToc() {
console.log(`Temporarily renaming excluded packages' json files.`);
for (const excludedPackage of EXCLUDED_PACKAGES) {
Expand All @@ -115,15 +159,7 @@ async function generateToc() {
{ stdio: 'inherit' }
);
} finally {
console.log(`Restoring excluded packages' json files.`);
for (const excludedPackage of EXCLUDED_PACKAGES) {
if (fs.existsSync(`${projectRoot}/temp/${excludedPackage}.skip`)) {
fs.renameSync(
`${projectRoot}/temp/${excludedPackage}.skip`,
`${projectRoot}/temp/${excludedPackage}.api.json`
);
}
}
cleanup();
}
}

Expand All @@ -137,12 +173,12 @@ async function generateDocs(

console.log(`Temporarily modifying auth api-extractor.json for docgen.`);
// Use a special d.ts file for auth for doc gen only.
const authApiConfigOriginal = fs.readFileSync(
authApiConfigOriginal = fs.readFileSync(
`${projectRoot}/packages/auth/api-extractor.json`,
'utf8'
);
// Save original auth.md as well.
const authApiReportOriginal = fs.readFileSync(
authApiReportOriginal = fs.readFileSync(
`${projectRoot}/common/api-review/auth.api.md`,
'utf8'
);
Expand Down Expand Up @@ -193,10 +229,13 @@ async function generateDocs(
);
}

if (!fs.existsSync(tmpDir)) {
fs.mkdirSync(tmpDir);
if (fs.existsSync(tmpDir)) {
console.log(`Removing old json temp dir: ${tmpDir}.`);
fs.rmSync(tmpDir, { recursive: true, force: true });
}

fs.mkdirSync(tmpDir);

// TODO: Throw error if path doesn't exist once all packages add markdown support.
const apiJsonDirectories = (
await mapWorkspaceToPackages([`${projectRoot}/packages/*`])
Expand Down
Loading

0 comments on commit a8bdda6

Please sign in to comment.