Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion apps/shade/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"color": "5.0.3",
"country-flag-icons": "catalog:",
"lucide-react": "catalog:",
"moment-timezone": "^0.5.48",
"moment-timezone": "0.5.48",
"react": "catalog:",
"react-day-picker": "9.14.0",
"react-dom": "catalog:",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const url = require('url');
import * as url from 'node:url';

const _private = {};

_private.removeDoubleCharacters = (character, string) => {
function removeDoubleCharacters(character: string, string: string) {
const stringArray = string.split('');

return stringArray.reduce((newString, currentCharacter, index) => {
Expand All @@ -12,17 +10,17 @@ _private.removeDoubleCharacters = (character, string) => {

return `${newString}${currentCharacter}`;
}, '');
};
}

module.exports.removeOpenRedirectFromUrl = function removeOpenRedirectFromUrl(urlString) {
export function removeOpenRedirectFromUrl(urlString: string): string {
const parsedUrl = url.parse(urlString);

return (
// http://
(parsedUrl.protocol ? parsedUrl.protocol + '//' : '') +
(parsedUrl.auth || '') +
(parsedUrl.host || '') +
_private.removeDoubleCharacters('/', parsedUrl.path) +
removeDoubleCharacters('/', parsedUrl.path ?? '') +
(parsedUrl.hash || '')
);
};
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const fs = require('fs-extra');
const path = require('path');
import * as fs from 'fs-extra';
import * as path from 'node:path';

const adminFiles = [
'built/admin/index.html',
Expand All @@ -9,14 +9,14 @@ const adminFiles = [
'built/admin/assets/vendor.css',
];

module.exports.stubAdminFiles = () => {
export const stubAdminFiles = (): void => {
adminFiles.forEach((file) => {
const filePath = path.resolve(__dirname, '../../core/', file);
fs.ensureFileSync(filePath);
});
};

module.exports.stubAuthFrameFiles = (publicPath) => {
export const stubAuthFrameFiles = (publicPath: string): void => {
const filePath = path.resolve(publicPath, 'admin-auth/index.html');
fs.ensureFileSync(filePath);
};
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
const fs = require('fs-extra');
const path = require('path');
import * as fs from 'fs-extra';
import * as path from 'node:path';

/**
* Set up the redirects file with the extension you want.
*/
module.exports.setupFile = async (contentFolderForTests, ext) => {
export const setupFile = async (
contentFolderForTests: string,
ext: null | string,
): Promise<void> => {
const yamlPath = path.join(contentFolderForTests, 'data', 'redirects.yaml');
const jsonPath = path.join(contentFolderForTests, 'data', 'redirects.json');

Expand Down
Loading