Skip to content

Commit

Permalink
SDA-3937 FOUC fix (#1629)
Browse files Browse the repository at this point in the history
* SDA-3937 FOUC fix

* SDA-3937 FOUC fix for title bar on Windows

* SDA-3937 FOUC fix for title bar on Windows

* SDA-3937 FOUC fix for title bar on Windows
  • Loading branch information
sbenmoussati authored Jan 12, 2023
1 parent 7279351 commit 4f9cda0
Show file tree
Hide file tree
Showing 17 changed files with 585 additions and 285 deletions.
8 changes: 4 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@
"outFiles": ["${workspaceFolder}/lib/**/*.js"]
},
{
"name": "st2",
"name": "st3",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "${workspaceFolder}/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron",
"windows": {
"runtimeExecutable": "${workspaceFolder}/node_modules/electron/dist/Electron.exe"
},
"args": [".", "--url=https://st2.symphony.com"],
"args": [".", "--url=https://st3.symphony.com"],
"env": {
"ELECTRON_DEBUGGING": "true",
"ELECTRON_DEV": "true"
Expand All @@ -94,7 +94,7 @@
"outFiles": ["${workspaceFolder}/lib/**/*.js"]
},
{
"name": "st2 (Build & Run)",
"name": "st3 (Build & Run)",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
Expand All @@ -103,7 +103,7 @@
"runtimeExecutable": "${workspaceFolder}/node_modules/electron/dist/Electron.exe"
},
"preLaunchTask": "build",
"args": [".", "--url=https://st2.symphony.com"],
"args": [".", "--url=https://st3.symphony.com"],
"env": {
"ELECTRON_DEBUGGING": "true",
"ELECTRON_DEV": "true"
Expand Down
53 changes: 51 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ const sourcemaps = require('gulp-sourcemaps');
const tsc = require('gulp-typescript');
const del = require('del');
const path = require('path');

const replace = require('gulp-replace');
const template = require('gulp-template');
const tap = require('gulp-tap');
const rename = require('gulp-rename');
const tsProject = tsc.createProject('./tsconfig.json');

gulp.task('clean', function () {
Expand Down Expand Up @@ -35,6 +38,49 @@ gulp.task('less', function () {
.pipe(gulp.dest(path.join(__dirname, 'lib/src')));
});

const extractFileNameFromPath = (filePath) => {
const basename = path.basename(filePath);
const filename = basename.split('.');
return filename[0];
};

gulp.task('templates', () => {
return (
gulp
.src('./lib/src/renderer/components/*.js', { base: './lib' })
// tap into the stream to get the current file and compile
// the template according to that
.pipe(
tap(function (file) {
const jsFilename = extractFileNameFromPath(file.path);
return gulp
.src('./src/renderer/react-window.html')
.pipe(
template({
sourcefile: file.path,
}),
)
.pipe(
replace(
/(<link rel="stylesheet" href="*"[^>]*>)/g,
function (_s, _match) {
const cssFilePath = `lib/src/renderer/styles/${jsFilename}.css`;
const doesFileExist = fs.existsSync(cssFilePath);
if (doesFileExist) {
const style = fs.readFileSync(cssFilePath, 'utf8');
return '<style>\n' + style + '\n</style>';
}
return '';
},
),
)
.pipe(rename(`${jsFilename}.html`))
.pipe(gulp.dest('./lib/src/renderer'));
}),
)
);
});

/**
* Copy all assets to JS codebase
*/
Expand Down Expand Up @@ -91,4 +137,7 @@ gulp.task('setExpiry', function (done) {
});
});

gulp.task('build', gulp.series('clean', 'compile', 'less', 'copy'));
gulp.task(
'build',
gulp.series('clean', 'compile', 'less', 'templates', 'copy'),
);
44 changes: 17 additions & 27 deletions jest-config.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
{
"roots": [
"<rootDir>/spec"
],
"roots": ["<rootDir>/spec"],
"transform": {
"^.+\\.tsx?$": "ts-jest"
"^.+\\.tsx?$": "ts-jest",
"^.+\\.svg$": "<rootDir>/svgTransform.js"
},
"testRegex": "(test|spec)\\.tsx?$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
"verbose": true,
"collectCoverage": true,
"coverageReporters": [
"text",
"html"
],
"coverageReporters": ["text", "html"],
"coverageDirectory": "dist/coverage",
"collectCoverageFrom": [
"src/**/*.{ts,tsx}",
Expand All @@ -28,17 +17,18 @@
],
"reporters": [
"default",
["./node_modules/jest-html-reporter", {
"pageTitle": "Symphony Electron Test Result",
"includeFailureMsg": true,
"includeConsoleLog": true,
"theme": "lightTheme",
"sort": "status",
"outputPath": "./dist/coverage/UnitTestsReport.html"
}]
],
"setupFiles": [
"./spec/setup/test-setup.js"
[
"./node_modules/jest-html-reporter",
{
"pageTitle": "Symphony Electron Test Result",
"includeFailureMsg": true,
"includeConsoleLog": true,
"theme": "lightTheme",
"sort": "status",
"outputPath": "./dist/coverage/UnitTestsReport.html"
}
]
],
"setupFiles": ["./spec/setup/test-setup.js"],
"snapshotSerializers": ["enzyme-to-json/serializer"]
}
Loading

0 comments on commit 4f9cda0

Please sign in to comment.