Skip to content
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

add new lib #7463

Open
wants to merge 31 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6e81055
add new lib
nguyencuong2596 Dec 12, 2024
ad3fc16
Add native auth
nguyencuong2596 Dec 12, 2024
e8aa206
Install dependencies for msal native-auth
nguyencuong2596 Dec 12, 2024
54c4a1f
Configure build targets
nguyencuong2596 Dec 12, 2024
b215b97
Configure jest
nguyencuong2596 Dec 12, 2024
79d9529
Add test-sample to msal-native-auth-samples
nguyencuong2596 Dec 13, 2024
fbe7734
Change files
nguyencuong2596 Dec 13, 2024
caf7dc2
Add api extractor
nguyencuong2596 Dec 13, 2024
0c484f5
Update native auth
nguyencuong2596 Dec 13, 2024
87805b3
Add readme
nguyencuong2596 Dec 17, 2024
4b45e54
Merge branch 'dev' into cuong/new-lib-skel
hectormmg Dec 18, 2024
4117b6a
Change reference to match 1p
nguyencuong2596 Dec 18, 2024
c7256ab
Add ref to 1p
nguyencuong2596 Dec 18, 2024
7bac503
Add msal-native-auth samples to package.json
nguyencuong2596 Dec 18, 2024
ac9d220
Add msal-native-auth samples to package.json
nguyencuong2596 Dec 19, 2024
042c8c8
Add clean
nguyencuong2596 Dec 19, 2024
1f0675a
Add shx
nguyencuong2596 Dec 19, 2024
a9ba58b
Format source code
nguyencuong2596 Dec 19, 2024
1c0eaa1
Print npm installed packages
nguyencuong2596 Dec 19, 2024
e5f2751
Add @azure/msal-browser as peer dependency
nguyencuong2596 Dec 19, 2024
c3dd334
Add msal-browser
nguyencuong2596 Dec 19, 2024
84549f4
Change build:all
nguyencuong2596 Dec 19, 2024
aaf8d52
Downgrade msal-browser
nguyencuong2596 Dec 19, 2024
4a0e287
Add msal-browser as dev dependency
nguyencuong2596 Dec 19, 2024
a29101c
Upgrade version
nguyencuong2596 Dec 19, 2024
80e7130
Customize npm run build for native-auth
nguyencuong2596 Dec 19, 2024
2fbb5af
Upgrade rollup
nguyencuong2596 Dec 19, 2024
637332c
Build msal-common
nguyencuong2596 Dec 19, 2024
0b33e5a
Set up test-sample
nguyencuong2596 Dec 19, 2024
fbf771e
Set up test-sample
nguyencuong2596 Dec 19, 2024
b612f57
Set up test-sample
nguyencuong2596 Dec 20, 2024
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
5 changes: 5 additions & 0 deletions .github/issue_template_bot.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
"@azure/msal-react"
]
},
"msal-native-auth": {
"searchStrings": [
"@azure/msal-native-auth"
]
},
"msal-node-extensions": {
"searchStrings": [
"@azure/msal-node-extensions"
Expand Down
2 changes: 2 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ msal-browser:
- lib/msal-browser/**/*
msal-react:
- lib/msal-react/**/*
msal-native-auth:
- lib/msal-native-auth/**/*
samples:
- samples/**/*
documentation:
Expand Down
6 changes: 5 additions & 1 deletion .pipelines/1p-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resources:
- repository: 1P
type: git
name: IDDP/msal-javascript-1p
ref: master
ref: cuong/new-lib-skel # change it back to master when it passes

extends:
template: v2/OneBranch.NonOfficial.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates
Expand Down Expand Up @@ -51,6 +51,10 @@ extends:
parameters:
libName: msal-react
path: "lib/"
- template: .pipelines/templates/ci-template.yml@1P
parameters:
libName: msal-native-auth
path: "lib/"
- template: .pipelines/templates/ci-template.yml@1P
parameters:
libName: msal-angular
Expand Down
19 changes: 18 additions & 1 deletion .pipelines/3p-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ parameters:
displayName: "Run React Tests"
type: boolean
default: true
- name: "runNativeAuthTests"
displayName: "Run Native Auth Tests"
type: boolean
default: true
- name: "runAngularTests"
displayName: "Run Angular Tests"
type: boolean
Expand All @@ -46,7 +50,7 @@ resources:
- repository: 1P
type: git
name: IDDP/msal-javascript-1p
ref: master
ref: cuong/new-lib-skel # change it back to master when it passes, this will reflect the new msal-browser option added to e2e-tests.yml
extends:
template: v2/OneBranch.NonOfficial.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates
parameters:
Expand Down Expand Up @@ -111,6 +115,19 @@ extends:
- "typescript-sample"
- "b2c-sample"
debug: ${{ parameters.debug }}
- ${{ if eq(parameters.runNativeAuthTests, true) }}:
- template: .pipelines/templates/e2e-tests.yml@1P
parameters:
jobName: "validate_msal_native_auth"
targetLib: "msal-native-auth"
poolType: ${{ parameters.poolType }}
stage: "CI"
sourceRepo: ${{ variables.sourceRepo }}
sourceBranch: ${{ variables.sourceBranch }}
workspace: "samples/msal-native-auth-samples"
samples:
- "test-sample"
debug: ${{ parameters.debug }}
- ${{ if eq(parameters.runAngularTests, true) }}:
- template: .pipelines/templates/e2e-tests.yml@1P
parameters:
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
"name": "msal-react",
"rootPath": "lib/msal-react"
},
{
"name": "msal-native-auth",
"rootPath": "lib/msal-native-auth"
},
{
"name": "msal-node-extensions",
"rootPath": "extensions/msal-node-extensions"
Expand Down
4 changes: 4 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
/samples/msal-node-samples/ @sameerag @tnorling @hectormmg @peterzenz @AzureAD/id4s-msal-team
/extensions/msal-node-extensions/ @sameerag @tnorling @hectormmg @peterzenz

# MSAL Native Auth
/lib/msal-native-auth/ @nguyenluan3017 @shenj
/samples/msal-native-auth-samples/ @nguyenluan3017 @shenj

# MSAL React
/lib/msal-react/ @tnorling @jo-arroyo @peterzenz
/samples/msal-react-samples/ @tnorling @jo-arroyo @peterzenz
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Add test-sample to msal-native-auth-samples",
"packageName": "msal-native-auth",
"email": "[email protected]",
"dependentChangeType": "none"
}
4 changes: 4 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ Once installed, you have the option to configure the jest environment for furthe
"name": "msal-react",
"rootPath": "lib/msal-react"
},
{
"name": "msal-native-auth",
"rootPath": "lib/msal-native-auth"
},
{
"name": "msal-node-extensions",
"rootPath": "extensions/msal-node-extensions"
Expand Down
3 changes: 3 additions & 0 deletions lib/msal-native-auth/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "eslint-config-msal"
}
11 changes: 11 additions & 0 deletions lib/msal-native-auth/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

*.log
.DS_Store
/node_modules
.cache
/dist
/lib

# Type docs
ref/
Empty file.
4 changes: 4 additions & 0 deletions lib/msal-native-auth/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "../../api-extractor-base.json"
}
8 changes: 8 additions & 0 deletions lib/msal-native-auth/jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/

const jestConfig = require("../../shared-configs/jest-config/jest.config.cjs");

module.exports = jestConfig;
77 changes: 77 additions & 0 deletions lib/msal-native-auth/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"name": "msal-native-auth",
"version": "1.0.0",
"author": {
"name": "Microsoft",
"email": "[email protected]",
"url": "https://www.microsoft.com"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
},
"description": "Microsoft Authentication Library Native Authentication",
"type": "module",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"main": "lib/msal-native-auth.cjs",
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./lib/types/index.d.ts",
"default": "./lib/msal-native-auth.cjs"
}
},
"./package.json": "./package.json"
},
"files": [
"dist",
"lib",
"src"
],
"scripts": {
"apiExtractor": "api-extractor run",
"build:all": "npm run build:browser && npm run build",
"build:common": "cd ../.. && npm run build --workspace=@azure/msal-common",
"build:browser": "npm run build:common && npm run build --workspace=@azure/msal-browser",
"build:modules:watch": "rollup -cw --bundleConfigAsCjs",
"build:modules": "rollup -c --strictDeprecations --bundleConfigAsCjs",
"build": "rollup -c --strictDeprecations --bundleConfigAsCjs",
"clean": "shx rm -rf dist lib",
"format:check": "prettier --ignore-path .gitignore --check src test",
"format:fix": "prettier --ignore-path .gitignore --write src test",
"lint:fix": "npm run lint -- --fix",
"lint": "eslint src --ext .ts --ext .tsx",
"prepack": "npm run build:all",
"test:coverage": "jest --coverage",
"test": "jest"
},
"peerDependencies": {
"@azure/msal-browser": "^3.28.0"
},
"dependencies": {
"@azure/msal-browser": "^3.28.0",
"@microsoft/api-extractor": "^7.48.0",
"@rollup/plugin-typescript": "^12.1.2",
"@testing-library/jest-dom": "^6.6.3",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.2",
"eslint-config-msal": "file:../../shared-configs/eslint-config-msal",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"prettier": "^3.4.2",
"rollup": "^4.28.1",
"shx": "^0.3.4",
"ts-jest": "^29.2.5",
"ts-jest-resolver": "^2.0.1",
"tslib": "^2.8.1"
},
"devDependencies": {
"typescript": "^5.7.2"
}
}
67 changes: 67 additions & 0 deletions lib/msal-native-auth/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/

import typescript from "@rollup/plugin-typescript";
import pkg from "./package.json";
import { createPackageJson } from "rollup-msal";

const libraryHeader = `/*! ${pkg.name} v${pkg.version} ${new Date().toISOString().split("T")[0]} */`;
const useStrictHeader = "'use strict';";
const fileHeader = `${libraryHeader}\n${useStrictHeader}`;

export default [
{
// for es build
input: "src/index.ts",
output: {
dir: "dist",
preserveModules: true,
preserveModulesRoot: "src",
format: "es",
banner: fileHeader,
sourcemap: true,
},
treeshake: {
moduleSideEffects: false,
propertyReadSideEffects: false
},
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {})
],
plugins: [
typescript({
typescript: require("typescript"),
tsconfig: "tsconfig.build.json"
})
]
},
{
input: "src/index.ts",
output: {
dir: "lib",
format: "cjs",
entryFileNames: "msal-native-auth.cjs",
banner: fileHeader,
sourcemap: true,
},
treeshake: {
moduleSideEffects: false,
propertyReadSideEffects: false
},
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {})
],
plugins: [
typescript({
typescript: require("typescript"),
tsconfig: "tsconfig.build.json",
compilerOptions: { outDir: "lib/types" }
}),
createPackageJson({ libPath: __dirname})
]
}
];
8 changes: 8 additions & 0 deletions lib/msal-native-auth/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/

export function say(): string {
return "Hello";
}
7 changes: 7 additions & 0 deletions lib/msal-native-auth/test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { say } from "../src/index.js";

describe("say function", () => {
it('should return "Hello"', () => {
expect(say()).toBe("Hello");
});
});
12 changes: 12 additions & 0 deletions lib/msal-native-auth/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"types": [
"react"
]
},
"include": [
"src"
]
}
36 changes: 36 additions & 0 deletions lib/msal-native-auth/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"include": [
"src",
"types",
"test"
],
"compilerOptions": {
"moduleResolution": "nodenext",
"module": "nodenext",
"target": "es2020",
"lib": [
"dom",
"esnext"
],
"importHelpers": true,
"declaration": true,
"sourceMap": true,
"rootDir": "./",
"outDir": "./dist",
"strict": true,
"composite": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"resolveJsonModule": true,
"baseUrl": "./",
"jsx": "react",
"esModuleInterop": true,
"types": [
"node",
"jest",
"react"
]
}
}
10 changes: 10 additions & 0 deletions lib/msal-native-auth/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": [
"../../typedoc.base.json"
],
"entryPoints": [
"src/index.ts"
],
"tsconfig": "tsconfig.build.json",
"readme": "./README.md"
}
Loading
Loading