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

feat: remove mgt-loader #2963

Merged
merged 7 commits into from
Jan 25, 2024
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
66 changes: 29 additions & 37 deletions index.html
gavinbarron marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,39 @@
<title>Microsoft Graph Toolkit Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" rel="stylesheet" />
<!-- <link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" rel="stylesheet" /> -->
<!-- <script src="./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script> -->

<script src="https://unpkg.com/@microsoft/teams-js@2/dist/MicrosoftTeams.min.js" crossorigin="anonymous"></script>
<!--
<script src="./packages/mgt/dist/bundle/mgt-loader.js"></script> -->
<!-- <script src="https://unpkg.com/@microsoft/teams-js@2/dist/MicrosoftTeams.min.js" crossorigin="anonymous"></script> -->

<script type="module" src="./packages/mgt-element/dist/es6/index.js"></script>
<script type="module" src="./packages/mgt-components/dist/es6/index.js"></script>
<script type="module" src="./packages/providers/mgt-msal2-provider/dist/es6/index.js"></script>
<script type="module" src="./packages/providers/mgt-mock-provider/dist/es6/index.js"></script>
<script type="module">
import { registerMgtComponents } from './packages/mgt-components/dist/es6/index.js';
// import { Msal2Provider } from './packages/providers/mgt-msal2-provider/dist/es6/index.js';
import { Providers } from './packages/mgt-element/dist/es6/index.js';
import { MockProvider } from './packages/mgt-element/dist/es6/index.js';
Providers.globalProvider = new MockProvider(true);
// Providers.globalProvider = new Msal2Provider({
// clientId: '2dfea037-938a-4ed8-9b35-c05708a1b241',
// redirectUri: "http://localhost:3000",
// scopes: [
// 'user.read',
// 'user.read.all',
// 'mail.readBasic',
// 'people.read',
// 'people.read.all',
// 'sites.read.all',
// 'user.readbasic.all',
// 'contacts.read',
// 'presence.read',
// 'presence.read.all',
// 'tasks.readwrite',
// 'tasks.read',
// 'calendars.read',
// 'group.read.all',
// 'files.read',
// 'files.read.all',
// 'files.readwrite',
// 'files.readwrite.all'
// ]
// });
// import { registerMgtComponents, Providers, MockProvider, Msal2Provider } from 'https://unpkg.com/@microsoft/mgt@next/dist/bundle/mgt.es6.js';
import { registerMgtComponents, Providers, MockProvider, Msal2Provider } from './packages/mgt/dist/bundle/mgt.es6.js';
// Providers.globalProvider = new MockProvider(true);
Providers.globalProvider = new Msal2Provider({
clientId: '2dfea037-938a-4ed8-9b35-c05708a1b241',
redirectUri: "http://localhost:3000",
scopes: [
'user.read',
'user.read.all',
'mail.readBasic',
'people.read',
'people.read.all',
'sites.read.all',
'user.readbasic.all',
'contacts.read',
'presence.read',
'presence.read.all',
'tasks.readwrite',
'tasks.read',
'calendars.read',
'group.read.all',
'files.read',
'files.read.all',
'files.readwrite',
'files.readwrite.all'
]
});
registerMgtComponents();
</script>

Expand Down
4 changes: 2 additions & 2 deletions packages/mgt/package.json
gavinbarron marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"scripts": {
"build": "npm-run-all clean build:compile build:bundle",
"build:bundle": "npm-run-all copy:loader copy:wc sass rollup",
"build:bundle": "npm-run-all sass rollup",
"build:compile": "npm-run-all sass compile",
"build:watch": "npm-run-all -p sass:watch compile:watch",
"clean": "shx rm -rf ./dist && shx rm -rf ./tsconfig.tsbuildinfo",
Expand Down Expand Up @@ -55,4 +55,4 @@
"publishConfig": {
"directory": "dist"
}
}
}
68 changes: 6 additions & 62 deletions packages/mgt/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import json from 'rollup-plugin-json';

const extensions = ['.js', '.ts'];

const getBabelConfig = isEs5 => {
const getBabelConfig = () => {
return {
plugins: [
['@babel/plugin-proposal-decorators', isEs5 ? { legacy: true } : { decoratorsBeforeExport: true, legacy: false }],
['@babel/proposal-class-properties', { loose: isEs5 }],
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true, legacy: false }],
['@babel/proposal-class-properties', { loose: false }],
'@babel/proposal-object-rest-spread'
],
include: [
Expand All @@ -37,8 +37,7 @@ const es6Bundle = {
output: {
dir: 'dist/bundle',
entryFileNames: 'mgt.es6.js',
gavinbarron marked this conversation as resolved.
Show resolved Hide resolved
format: 'iife',
name: 'mgt',
format: 'esm',
sourcemap: false
},
plugins: [
Expand All @@ -53,65 +52,10 @@ const es6Bundle = {
],
'@babel/typescript'
],
...getBabelConfig(false)
...getBabelConfig()
}),
...commonPlugins
]
};

const es5Bundle = {
input: ['src/bundle/index.es5.ts'],
output: {
dir: 'dist/bundle',
entryFileNames: 'mgt.es5.js',
format: 'iife',
name: 'mgt',
sourcemap: false
},
plugins: [
babel({
extensions,
presets: [
[
'@babel/preset-env',
{
targets: 'last 2 versions',
useBuiltIns: 'entry',
corejs: 3
}
],
'@babel/typescript'
],
...getBabelConfig(true)
}),
...commonPlugins
]
};

const cjsBundle = {
input: ['src/bundle/index.es5.ts'],
output: {
dir: 'dist/commonjs',
entryFileNames: 'index.js',
format: 'cjs',
sourcemap: true
},
plugins: [
babel({
extensions,
presets: [
[
'@babel/preset-env',
{
targets: 'last 2 versions'
}
],
'@babel/typescript'
],
...getBabelConfig(true)
}),
...commonPlugins
]
};

export default [es6Bundle, es5Bundle, cjsBundle];
export default [es6Bundle];
12 changes: 0 additions & 12 deletions packages/mgt/src/bundle/index.es5.ts

This file was deleted.

76 changes: 0 additions & 76 deletions packages/mgt/src/bundle/mgt-loader.js

This file was deleted.

Loading