Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: correct msal-angular typings path in source package.json [#8544](https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/8544)",
"packageName": "@azure/msal-angular",
"email": "hemoral@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "ci: add typecheck and validate:exports scripts [#8544](https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/8544)",
"packageName": "@azure/msal-browser",
"email": "hemoral@microsoft.com",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "ci: add typecheck and validate:exports scripts [#8544](https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/8544)",
"packageName": "@azure/msal-common",
"email": "hemoral@microsoft.com",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "ci: add typecheck and validate:exports scripts [#8544](https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/8544)",
"packageName": "@azure/msal-node",
"email": "hemoral@microsoft.com",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "ci: add typecheck and validate:exports scripts [#8544](https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/8544)",
"packageName": "@azure/msal-node-extensions",
"email": "hemoral@microsoft.com",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "ci: add typecheck and validate:exports scripts [#8544](https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/8544)",
"packageName": "@azure/msal-react",
"email": "hemoral@microsoft.com",
"dependentChangeType": "none"
}
2 changes: 2 additions & 0 deletions extensions/msal-node-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
"lint:fix": "npm run lint -- --fix",
"format:check": "prettier --ignore-path .gitignore --check src test",
"format:fix": "prettier --ignore-path .gitignore --write src test",
"typecheck": "tsc --noEmit --skipLibCheck -p tsconfig.build.json",
"validate:exports": "node ../../scripts/check-exports.js",
"prepack": "npm run build:all && node ./scripts/checkBinaries.cjs"
},
"author": {
Expand Down
5 changes: 3 additions & 2 deletions lib/msal-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
"prepack": "npm run build:all",
"prepublishOnly": "echo Use npm run deploy && exit 1",
"format:check": "prettier --ignore-path .gitignore --check src",
"format:fix": "prettier --ignore-path .gitignore --write src"
"format:fix": "prettier --ignore-path .gitignore --write src",
"validate:exports": "node ../../scripts/check-exports.js"
},
"typings": "./dist/azure-msal-angular.d.ts",
"typings": "./dist/index.d.ts",
"beachball": {
"disallowedChangeTypes": [
"major"
Expand Down
2 changes: 2 additions & 0 deletions lib/msal-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
"prepack": "npm run build:all",
"format:check": "prettier --ignore-path .gitignore --check src test",
"format:fix": "prettier --ignore-path .gitignore --write src test",
"typecheck": "tsc --noEmit --skipLibCheck -p tsconfig.build.json",
"validate:exports": "node ../../scripts/check-exports.js",
"apiExtractor": "api-extractor run"
},
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions lib/msal-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
"metadata:check": "ts-node scripts/metadata.ts",
"format:check": "prettier --ignore-path .gitignore --check src test",
"format:fix": "prettier --ignore-path .gitignore --write src test",
"typecheck": "tsc --noEmit --skipLibCheck -p tsconfig.build.json",
"validate:exports": "node ../../scripts/check-exports.js",
"apiExtractor": "api-extractor run"
},
"beachball": {
Expand Down
2 changes: 2 additions & 0 deletions lib/msal-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
"prepack": "npm run build:all",
"format:check": "prettier --ignore-path .gitignore --check src test",
"format:fix": "prettier --ignore-path .gitignore --write src test",
"typecheck": "tsc --noEmit --skipLibCheck -p tsconfig.build.json",
"validate:exports": "node ../../scripts/check-exports.js",
"apiExtractor": "api-extractor run"
},
"beachball": {
Expand Down
2 changes: 2 additions & 0 deletions lib/msal-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
"prepack": "npm run build:all",
"format:check": "prettier --ignore-path .gitignore --check src test",
"format:fix": "prettier --ignore-path .gitignore --write src test",
"typecheck": "tsc --noEmit --skipLibCheck -p tsconfig.build.json",
"validate:exports": "node ../../scripts/check-exports.js",
"apiExtractor": "api-extractor run"
},
"peerDependencies": {
Expand Down
75 changes: 75 additions & 0 deletions scripts/check-exports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env node
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/

/**
* Validates that every file path declared in a package's exports map (and top-level
* types/main/module fields) exists on disk after a build. Run from the package directory.
*
* Usage: node ../../scripts/check-exports.js
*/

"use strict";

const fs = require("fs");
const path = require("path");

const pkgDir = process.cwd();
const pkgPath = path.join(pkgDir, "package.json");

if (!fs.existsSync(pkgPath)) {
console.error(`No package.json found at ${pkgDir}`);
process.exit(1);
}

const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
const missing = [];

function checkPath(filePath, context) {
if (typeof filePath !== "string") return;

// Skip URL schemes (e.g. "https://...") and absolute paths.
// Treat everything else as a package-local relative path, including paths
// that omit the leading "./" (e.g. "dist/index.d.ts").
if (/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(filePath) || path.isAbsolute(filePath)) {
return;
}

const resolved = path.resolve(pkgDir, filePath);
if (!fs.existsSync(resolved)) {
missing.push({ path: filePath, context });
}
}

function walk(value, context) {
if (typeof value === "string") {
checkPath(value, context);
} else if (Array.isArray(value)) {
value.forEach((item, i) => walk(item, `${context}[${i}]`));
} else if (value && typeof value === "object") {
for (const [key, val] of Object.entries(value)) {
walk(val, `${context}["${key}"]`);
}
}
}

if (pkg.exports) {
walk(pkg.exports, "exports");
}

for (const field of ["types", "typings", "main", "module"]) {
if (pkg[field]) checkPath(pkg[field], field);
}

if (missing.length > 0) {
console.error(`\nExport path validation failed for ${pkg.name}:`);
for (const { path: p, context } of missing) {
console.error(` ✗ ${p} (referenced by ${context})`);
}
console.error(`\n${missing.length} missing file(s)`);
process.exit(1);
}

console.log(`All export paths exist for ${pkg.name} ✓`);
Loading