Skip to content

Commit

Permalink
Merge branch 'vnext' into skrastev/fix-546
Browse files Browse the repository at this point in the history
  • Loading branch information
dkamburov authored Nov 11, 2024
2 parents ef9d5c4 + 732420d commit f4a7b69
Show file tree
Hide file tree
Showing 3,351 changed files with 817,344 additions and 144,133 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
9 changes: 8 additions & 1 deletion azure-pipelines/build-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ parameters:
displayName: 'Get verbose output from steps - where configurable'
type: boolean
default: false
- name: shouldCleanPostExectuion
displayName: 'Clean all pipeline dirs after the pipeline finishes?'
type: boolean
default: true

name: $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)

Expand Down Expand Up @@ -83,7 +87,7 @@ stages:
command: custom
workingDir: '$(Build.SourcesDirectory)\browser'
verbose: ${{ parameters.isVerbose }}
customCommand: 'install --legacy-peer-deps'
customCommand: 'install'
customEndpoint: 'public proget'

- task: PowerShell@2
Expand Down Expand Up @@ -133,3 +137,6 @@ stages:
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/ReactSamples.zip'
artifact: 'ReactSamplesBrowser'

- ${{ if eq(parameters.shouldCleanPostExectuion, true) }}:
- task: PostBuildCleanup@4
80 changes: 79 additions & 1 deletion browser/config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
const path = require('path');
let pathsConfig = require("./tsconfig.paths.json");
const {alias, configPaths, expandResolveAlias, expandRulesInclude, expandPluginsScope} = require('react-app-rewire-alias')
const resolve = require('resolve');
const shouldUseSourceMap = false; // process.env.GENERATE_SOURCEMAP !== 'false';
const ForkTsCheckerWebpackPlugin =
process.env.TSC_COMPILE_ON_ERROR === 'true'
? require('react-dev-utils/ForkTsCheckerWarningWebpackPlugin')
: require('react-dev-utils/ForkTsCheckerWebpackPlugin');

//this works around the fact that alias doesn't support multiple paths
function aliasMultiple(aliasMap) {
Expand All @@ -26,6 +32,15 @@ function aliasMultiple(aliasMap) {
/* eslint-disable @typescript-eslint/no-var-requires */
module.exports = function override(config, env) {
console.log("config-overrides.js started");
console.log("env: " + env);
const isEnvDevelopment = env === 'development';
const isEnvProduction = env === 'production';

// Variable used for enabling profiling in Production
// passed into alias object. Uses a flag if passed into the build command
const isEnvProductionProfile =
isEnvProduction && process.argv.includes('--profile');

const paths = require('./node_modules/react-scripts/config/paths');
// console.log("config-overrides.js paths");
console.log(paths);
Expand Down Expand Up @@ -166,7 +181,70 @@ module.exports = function override(config, env) {
//let newConfig = alias(configPathsMultiple('./tsconfig.paths.json'))(config);
//console.log(newConfig);

if (!config.resolve) {
config.resolve = {};
}
config.resolve.mainFields = ["esm2015", "module", "main"];

let checkerInd = -1;
for (var i = 0; i < config.plugins.length; i++) {
if (config.plugins[i] instanceof ForkTsCheckerWebpackPlugin) {
checkerInd = i;
break;
}
}
if (checkerInd >= 0) {
let checker = new ForkTsCheckerWebpackPlugin({
async: isEnvDevelopment,
typescript: {
memoryLimit: 10240,
typescriptPath: resolve.sync('typescript', {
basedir: paths.appNodeModules,
}),
configOverwrite: {
compilerOptions: {
sourceMap: isEnvProduction
? shouldUseSourceMap
: isEnvDevelopment,
skipLibCheck: true,
inlineSourceMap: false,
declarationMap: false,
noEmit: true,
incremental: true,
tsBuildInfoFile: paths.appTsBuildInfoFile,
},
},
context: paths.appPath,
diagnosticOptions: {
syntactic: true,
},
mode: 'write-references',
// profile: true,
},
issue: {
// This one is specifically to match during CI tests,
// as micromatch doesn't match
// '../cra-template-typescript/template/src/App.tsx'
// otherwise.
include: [
{ file: '../**/src/**/*.{ts,tsx}' },
{ file: '**/src/**/*.{ts,tsx}' },
],
exclude: [
{ file: '**/src/**/__tests__/**' },
{ file: '**/src/**/?(*.){spec|test}.*' },
{ file: '**/src/setupProxy.*' },
{ file: '**/src/setupTests.*' },
],
},
logger: {
infrastructure: 'silent',
},
});
config.plugins[checkerInd] = checker;
}

let newConfig = aliasMultiple(tspaths)(config);
console.log(newConfig);
return newConfig;
}
}
Loading

0 comments on commit f4a7b69

Please sign in to comment.