From 8d5daf130d8cc6d8d27f74256e5963753e7d0cb6 Mon Sep 17 00:00:00 2001 From: Greg Taylor Date: Fri, 12 Aug 2022 15:38:51 -0700 Subject: [PATCH] Feature/gt update core (#62) * Fixed service layer * downgrade react; fresh cra template; Co-authored-by: Greg Taylor Co-authored-by: Aaron Davida --- README.md | 4 +- client/.gitignore | 5 +- client/.npmrc | 3 - client/.vscode/extensions.json | 9 - client/.vscode/launch.json | 15 - client/.vscode/settings.json | 3 - client/README.md | 46 + client/config/env.js | 91 - client/config/jest/cssTransform.js | 14 - client/config/jest/fileTransform.js | 40 - client/config/modules.js | 84 - client/config/paths.js | 72 - client/config/pnpTs.js | 17 - client/config/webpack.config.js | 702 - .../persistentCache/createEnvironmentHash.js | 9 - client/config/webpackDevServer.config.js | 122 - client/package-lock.json | 66491 ++++++---------- client/package.json | 211 +- client/public/robots.txt | 3 + client/scripts/build.js | 174 - client/scripts/start.js | 124 - client/scripts/test.js | 47 - client/src/MsalComponent.tsx | 16 +- client/src/app/App.tsx | 16 +- client/src/app/pages/groups/Groups.tsx | 32 +- client/src/reportWebVitals.ts | 15 + client/src/setupTests.ts | 5 + client/tsconfig.json | 46 +- client/tsconfig.tsbuildinfo | 1 - .../Microsoft.DSX.ProjectTemplate.API.csproj | 16 +- .../nswag.json | 2 +- ...crosoft.DSX.ProjectTemplate.Command.csproj | 4 +- .../Microsoft.DSX.ProjectTemplate.Data.csproj | 12 +- .../Microsoft.DSX.ProjectTemplate.Test.csproj | 18 +- 34 files changed, 25998 insertions(+), 42471 deletions(-) delete mode 100644 client/.npmrc delete mode 100644 client/.vscode/extensions.json delete mode 100644 client/.vscode/launch.json delete mode 100644 client/.vscode/settings.json create mode 100644 client/README.md delete mode 100644 client/config/env.js delete mode 100644 client/config/jest/cssTransform.js delete mode 100644 client/config/jest/fileTransform.js delete mode 100644 client/config/modules.js delete mode 100644 client/config/paths.js delete mode 100644 client/config/pnpTs.js delete mode 100644 client/config/webpack.config.js delete mode 100644 client/config/webpack/persistentCache/createEnvironmentHash.js delete mode 100644 client/config/webpackDevServer.config.js create mode 100644 client/public/robots.txt delete mode 100644 client/scripts/build.js delete mode 100644 client/scripts/start.js delete mode 100644 client/scripts/test.js create mode 100644 client/src/reportWebVitals.ts create mode 100644 client/src/setupTests.ts delete mode 100644 client/tsconfig.tsbuildinfo diff --git a/README.md b/README.md index 6a90b9a..ab98467 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Web app template by the Microsoft Devices Software Experiences team. # Service (back-end) -- [ASP.NET Core 3.1](https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/intro) +- [.NET 6.0](https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/intro) - [MediatR](https://github.com/jbogard/MediatR) as [CQRS](https://docs.microsoft.com/en-us/azure/architecture/patterns/cqrs) implementation - [AutoMapper](https://github.com/AutoMapper/AutoMapper) handling Entity-to-DTO mapping - Unit and integration tests using [Moq](https://github.com/moq/moq4) and [MSTest](https://docs.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-mstest) @@ -52,7 +52,7 @@ npm start 1. Migrate to MSAL.js 2. Include Authentication and Authorization logic -3. Add Docker file +3. Update dockerfile 4. Move away from localdb 5. Create a CLI setup wizard diff --git a/client/.gitignore b/client/.gitignore index e7245ea..4d29575 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -13,7 +13,10 @@ # misc .DS_Store -.vscode +.env.local +.env.development.local +.env.test.local +.env.production.local npm-debug.log* yarn-debug.log* diff --git a/client/.npmrc b/client/.npmrc deleted file mode 100644 index 3292481..0000000 --- a/client/.npmrc +++ /dev/null @@ -1,3 +0,0 @@ -registry=https://1es4devices.pkgs.visualstudio.com/DSX/_packaging/DSXLibraries/npm/registry/ - -always-auth=true \ No newline at end of file diff --git a/client/.vscode/extensions.json b/client/.vscode/extensions.json deleted file mode 100644 index 1326435..0000000 --- a/client/.vscode/extensions.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - // See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. - // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp - - // List of extensions which should be recommended for users of this workspace. - "recommendations": ["clinyong.vscode-css-modules"], - // List of extensions recommended by VS Code that should not be recommended for users of this workspace. - "unwantedRecommendations": [] -} diff --git a/client/.vscode/launch.json b/client/.vscode/launch.json deleted file mode 100644 index 4b1147d..0000000 --- a/client/.vscode/launch.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "chrome", - "request": "launch", - "name": "Launch Chrome against localhost", - "url": "http://localhost:3000", - "webRoot": "${workspaceFolder}" - } - ] -} diff --git a/client/.vscode/settings.json b/client/.vscode/settings.json deleted file mode 100644 index 00ad71f..0000000 --- a/client/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "typescript.tsdk": "node_modules\\typescript\\lib" -} \ No newline at end of file diff --git a/client/README.md b/client/README.md new file mode 100644 index 0000000..b87cb00 --- /dev/null +++ b/client/README.md @@ -0,0 +1,46 @@ +# Getting Started with Create React App + +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +## Available Scripts + +In the project directory, you can run: + +### `npm start` + +Runs the app in the development mode.\ +Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.\ +You will also see any lint errors in the console. + +### `npm test` + +Launches the test runner in the interactive watch mode.\ +See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +### `npm run build` + +Builds the app for production to the `build` folder.\ +It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.\ +Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +### `npm run eject` + +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** + +If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. + +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. + +You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. + +## Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). diff --git a/client/config/env.js b/client/config/env.js deleted file mode 100644 index ee33ff1..0000000 --- a/client/config/env.js +++ /dev/null @@ -1,91 +0,0 @@ -'use strict'; - -const fs = require('fs'); -const path = require('path'); -const paths = require('./paths'); - -// Make sure that including paths.js after env.js will read .env variables. -delete require.cache[require.resolve('./paths')]; - -const NODE_ENV = process.env.NODE_ENV; -if (!NODE_ENV) { - throw new Error('The NODE_ENV environment variable is required but was not specified.'); -} - -// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use -var dotenvFiles = [ - `${paths.dotenv}.${NODE_ENV}.local`, - `${paths.dotenv}.${NODE_ENV}`, - // Don't include `.env.local` for `test` environment - // since normally you expect tests to produce the same - // results for everyone - NODE_ENV !== 'test' && `${paths.dotenv}.local`, - paths.dotenv -].filter(Boolean); - -// Load environment variables from .env* files. Suppress warnings using silent -// if this file is missing. dotenv will never modify any environment variables -// that have already been set. Variable expansion is supported in .env files. -// https://github.com/motdotla/dotenv -// https://github.com/motdotla/dotenv-expand -dotenvFiles.forEach((dotenvFile) => { - if (fs.existsSync(dotenvFile)) { - require('dotenv-expand')( - require('dotenv').config({ - path: dotenvFile - }) - ); - } -}); - -// We support resolving modules according to `NODE_PATH`. -// This lets you use absolute paths in imports inside large monorepos: -// https://github.com/facebook/create-react-app/issues/253. -// It works similar to `NODE_PATH` in Node itself: -// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders -// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored. -// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims. -// https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421 -// We also resolve them to make sure all tools using them work consistently. -const appDirectory = fs.realpathSync(process.cwd()); -process.env.NODE_PATH = (process.env.NODE_PATH || '') - .split(path.delimiter) - .filter((folder) => folder && !path.isAbsolute(folder)) - .map((folder) => path.resolve(appDirectory, folder)) - .join(path.delimiter); - -// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be -// injected into the application via DefinePlugin in Webpack configuration. -const REACT_APP = /^REACT_APP_/i; - -function getClientEnvironment(publicUrl) { - const raw = Object.keys(process.env) - .filter((key) => REACT_APP.test(key)) - .reduce( - (env, key) => { - env[key] = process.env[key]; - return env; - }, - { - // Useful for determining whether we’re running in production mode. - // Most importantly, it switches React into the correct mode. - NODE_ENV: process.env.NODE_ENV || 'development', - // Useful for resolving the correct path to static assets in `public`. - // For example, . - // This should only be used as an escape hatch. Normally you would put - // images into the `src` and `import` them in code to get their paths. - PUBLIC_URL: publicUrl - } - ); - // Stringify all values so we can feed into Webpack DefinePlugin - const stringified = { - 'process.env': Object.keys(raw).reduce((env, key) => { - env[key] = JSON.stringify(raw[key]); - return env; - }, {}) - }; - - return { raw, stringified }; -} - -module.exports = getClientEnvironment; diff --git a/client/config/jest/cssTransform.js b/client/config/jest/cssTransform.js deleted file mode 100644 index bef27a0..0000000 --- a/client/config/jest/cssTransform.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -// This is a custom Jest transformer turning style imports into empty objects. -// http://facebook.github.io/jest/docs/en/webpack.html - -module.exports = { - process() { - return 'module.exports = {};'; - }, - getCacheKey() { - // The output is always the same. - return 'cssTransform'; - } -}; diff --git a/client/config/jest/fileTransform.js b/client/config/jest/fileTransform.js deleted file mode 100644 index 3105f17..0000000 --- a/client/config/jest/fileTransform.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; - -const path = require('path'); -const camelcase = require('camelcase'); - -// This is a custom Jest transformer turning file imports into filenames. -// http://facebook.github.io/jest/docs/en/webpack.html - -module.exports = { - process(src, filename) { - const assetFilename = JSON.stringify(path.basename(filename)); - - if (filename.match(/\.svg$/)) { - // Based on how SVGR generates a component name: - // https://github.com/smooth-code/svgr/blob/01b194cf967347d43d4cbe6b434404731b87cf27/packages/core/src/state.js#L6 - const pascalCaseFileName = camelcase(path.parse(filename).name, { - pascalCase: true - }); - const componentName = `Svg${pascalCaseFileName}`; - return `const React = require('react'); - module.exports = { - __esModule: true, - default: ${assetFilename}, - ReactComponent: React.forwardRef(function ${componentName}(props, ref) { - return { - $$typeof: Symbol.for('react.element'), - type: 'svg', - ref: ref, - key: null, - props: Object.assign({}, props, { - children: ${assetFilename} - }) - }; - }), - };`; - } - - return `module.exports = ${assetFilename};`; - } -}; diff --git a/client/config/modules.js b/client/config/modules.js deleted file mode 100644 index 0b2a337..0000000 --- a/client/config/modules.js +++ /dev/null @@ -1,84 +0,0 @@ -'use strict'; - -const fs = require('fs'); -const path = require('path'); -const paths = require('./paths'); -const chalk = require('react-dev-utils/chalk'); - -/** - * Get the baseUrl of a compilerOptions object. - * - * @param {Object} options - */ -function getAdditionalModulePaths(options = {}) { - const baseUrl = options.baseUrl; - - // We need to explicitly check for null and undefined (and not a falsy value) because - // TypeScript treats an empty string as `.`. - if (baseUrl == null) { - // If there's no baseUrl set we respect NODE_PATH - // Note that NODE_PATH is deprecated and will be removed - // in the next major release of create-react-app. - - const nodePath = process.env.NODE_PATH || ''; - return nodePath.split(path.delimiter).filter(Boolean); - } - - const baseUrlResolved = path.resolve(paths.appPath, baseUrl); - - // We don't need to do anything if `baseUrl` is set to `node_modules`. This is - // the default behavior. - if (path.relative(paths.appNodeModules, baseUrlResolved) === '') { - return null; - } - - // Allow the user set the `baseUrl` to `appSrc`. - if (path.relative(paths.appSrc, baseUrlResolved) === '') { - return [paths.appSrc]; - } - - // Otherwise, throw an error. - throw new Error( - chalk.red.bold( - "Your project's `baseUrl` can only be set to `src` or `node_modules`." + - ' Create React App does not support other values at this time.' - ) - ); -} - -function getModules() { - // Check if TypeScript is setup - const hasTsConfig = fs.existsSync(paths.appTsConfig); - const hasJsConfig = fs.existsSync(paths.appJsConfig); - - if (hasTsConfig && hasJsConfig) { - throw new Error( - 'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.' - ); - } - - let config; - - // If there's a tsconfig.json we assume it's a - // TypeScript project and set up the config - // based on tsconfig.json - if (hasTsConfig) { - config = require(paths.appTsConfig); - // Otherwise we'll check if there is jsconfig.json - // for non TS projects. - } else if (hasJsConfig) { - config = require(paths.appJsConfig); - } - - config = config || {}; - const options = config.compilerOptions || {}; - - const additionalModulePaths = getAdditionalModulePaths(options); - - return { - additionalModulePaths: additionalModulePaths, - hasTsConfig - }; -} - -module.exports = getModules(); diff --git a/client/config/paths.js b/client/config/paths.js deleted file mode 100644 index 3e5229a..0000000 --- a/client/config/paths.js +++ /dev/null @@ -1,72 +0,0 @@ -'use strict'; - -const path = require('path'); -const fs = require('fs'); -const url = require('url'); - -// Make sure any symlinks in the project folder are resolved: -// https://github.com/facebook/create-react-app/issues/637 -const appDirectory = fs.realpathSync(process.cwd()); -const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath); - -const envPublicUrl = process.env.PUBLIC_URL; - -function ensureSlash(inputPath, needsSlash) { - const hasSlash = inputPath.endsWith('/'); - if (hasSlash && !needsSlash) { - return inputPath.substr(0, inputPath.length - 1); - } else if (!hasSlash && needsSlash) { - return `${inputPath}/`; - } else { - return inputPath; - } -} - -const getPublicUrl = (appPackageJson) => envPublicUrl || require(appPackageJson).homepage; - -// We use `PUBLIC_URL` environment variable or "homepage" field to infer -// "public path" at which the app is served. -// Webpack needs to know it to put the right