refactor: migracja wywołań API przeglądarki do abstrakcji browserAPI #127

Open
am0 wants to merge 5 commits from refactor/build_time_abstraction into develop
2 changed files with 29 additions and 44 deletions
Showing only changes of commit 6806537531 - Show all commits

View File

@ -159,7 +159,7 @@ const Sidebar = () => {
onClick={() => { onClick={() => {
if ( if (
window.confirm( window.confirm(
'Czy chcesz wczytać wszystkie domeny w celu „splamienia" twojej przeglądarki? Uwaga przeglądarka może zablokować otwieranie nowych kart. (Ten krok jest opcjonalny)' 'Czy chcesz wczytać wszystkie domeny w celu „splamienia" twojej przeglądarki? Uwaga przeglądarka może zablokować otwieranie nowych kart. (Ten krok jest opcjonalny)'
) )
) { ) {
let deep_copy = JSON.parse( let deep_copy = JSON.parse(
@ -211,8 +211,8 @@ const Sidebar = () => {
<section className="dialog-container dialog-container--warning"> <section className="dialog-container dialog-container--warning">
<span> <span>
<strong>Uwaga!</strong> Niekoniecznie każda przesłana poniżej <strong>Uwaga!</strong> Niekoniecznie każda przesłana poniżej
informacja jest daną osobową. Niektóre z podanych domen mogą informacja jest daną osobową. Niektóre z podanych domen mogą
należeć do właściciela strony i nie reprezentować podmiotów należeć do właściciela strony i nie reprezentować podmiotów
trzecich. trzecich.
</span> </span>
<button <button

View File

@ -56,51 +56,36 @@ const copyStaticFiles = {
copyFileSync(manifestSrc, manifestDest); copyFileSync(manifestSrc, manifestDest);
console.log(` ✓ Skopiowano ${manifestSrc}${manifestDest}`); console.log(` ✓ Skopiowano ${manifestSrc}${manifestDest}`);
// Kopiowanie katalogu components // Kopiowanie katalogów statycznych
if (existsSync('./components')) { for (const dir of ['components', 'assets']) {
copyDir('./components', join(DIST_DIR, 'components')); if (existsSync(`./${dir}`)) {
console.log(' ✓ Skopiowano components/'); copyDir(`./${dir}`, join(DIST_DIR, dir));
} console.log(` ✓ Skopiowano ${dir}/`);
}
// Kopiowanie katalogu assets
if (existsSync('./assets')) {
copyDir('./assets', join(DIST_DIR, 'assets'));
console.log(' ✓ Skopiowano assets/');
} }
// Kopiowanie wymaganych bibliotek z node_modules (potrzebne dla plików HTML z UMD React) // Kopiowanie wymaganych bibliotek z node_modules (potrzebne dla plików HTML z UMD React)
const nodeModulesDest = join(DIST_DIR, 'node_modules'); const nodeModulesDest = join(DIST_DIR, 'node_modules');
const nodeDeps = [
// React { src: 'react/umd', dest: 'react/umd' },
const reactUmdSrc = './node_modules/react/umd'; { src: 'react-dom/umd', dest: 'react-dom/umd' },
const reactUmdDest = join(nodeModulesDest, 'react/umd'); { src: 'survey-react', dest: 'survey-react', files: ['survey.react.min.js', 'survey.react.min.css'] },
if (existsSync(reactUmdSrc)) { ];
copyDir(reactUmdSrc, reactUmdDest); for (const dep of nodeDeps) {
console.log(' ✓ Skopiowano node_modules/react/umd/'); const srcPath = `./node_modules/${dep.src}`;
} const destPath = join(nodeModulesDest, dep.dest);
if (existsSync(srcPath)) {
// React-DOM if (dep.files) {
const reactDomUmdSrc = './node_modules/react-dom/umd'; mkdirSync(destPath, { recursive: true });
const reactDomUmdDest = join(nodeModulesDest, 'react-dom/umd'); dep.files.forEach(file => {
if (existsSync(reactDomUmdSrc)) { const fileSrc = join(srcPath, file);
copyDir(reactDomUmdSrc, reactDomUmdDest); if (existsSync(fileSrc)) copyFileSync(fileSrc, join(destPath, file));
console.log(' ✓ Skopiowano node_modules/react-dom/umd/'); });
} } else {
copyDir(srcPath, destPath);
// Survey-React
const surveyReactSrc = './node_modules/survey-react';
const surveyReactDest = join(nodeModulesDest, 'survey-react');
if (existsSync(surveyReactSrc)) {
// Kopiowanie tylko niezbędnych plików
mkdirSync(surveyReactDest, { recursive: true });
const surveyFiles = ['survey.react.min.js', 'survey.react.min.css'];
surveyFiles.forEach(file => {
const src = join(surveyReactSrc, file);
if (existsSync(src)) {
copyFileSync(src, join(surveyReactDest, file));
} }
}); console.log(` ✓ Skopiowano node_modules/${dep.src}/`);
console.log(' ✓ Skopiowano node_modules/survey-react/'); }
} }
console.log(`✅ Budowanie dla ${TARGET.toUpperCase()} zakończone!`); console.log(`✅ Budowanie dla ${TARGET.toUpperCase()} zakończone!`);