Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ob theme #1

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
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
81 changes: 39 additions & 42 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,6 @@ const getTemplate = (templatePath) => {
return path.resolve(paths.appSrc, templatePath);
};

const localAliases = (paths) =>
paths
// Remove paths which are not overridden
.filter((localPath) => {
const fullPath = path.resolve(process.cwd(), `./${localPath}`);
try {
fs.statSync(fullPath);
return true;
} catch (error) {
return false;
}
})
.map(
(localPath) =>
new webpack.NormalModuleReplacementPlugin(
new RegExp(localPath),
path.resolve(process.cwd(), `./${localPath}`)
)
);

// This is the production and development configuration.
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
module.exports = function (webpackEnv) {
Expand Down Expand Up @@ -845,34 +825,51 @@ module.exports = function (webpackEnv) {
fs.existsSync(`${newPath}${originalExt}`) &&
!fs.lstatSync(`${newPath}${originalExt}`).isDirectory()
) {
console.log(
`Overwritten ${originalPath} -> ${newPath}${originalExt}`
);
// Skip override logic if issuer is itself
if (
result.contextInfo.issuer ===
`${newPath}${originalExt}`
) {
console.log(
`Self reference ${originalPath} -> ${newPath}${originalExt}`
);
return;
}

if (result.createData) {
result.createData.resource = `${newPath}${originalExt}`;
result.createData.context = path.dirname(
`${newPath}.${originalExt}`
console.log(
`Overwritten ${originalPath} -> ${newPath}${originalExt}`
);
result.request = result.request.replace(
originalPath,
`${newPath}${originalExt}`
);
result.context = path.dirname(
`${newPath}${originalExt}`
);
if (result.createData.request) {
result.createData.resource =
result.createData.resource.replace(
paths.appSrc,
paths.appExtensions
);
result.createData.request =
result.createData.request.replace(
originalPath,
`${newPath}`
);
result.createData.context = path.dirname(
`${newPath}${originalExt}`
);
}
} else {
console.log(
`No createData ${originalPath} -> ${newPath}${originalExt}`
);
}
}
}
),
...localAliases([
'src/resources/img/illustrations/answer.svg',
'src/resources/img/illustrations/arrow.svg',
'src/resources/img/illustrations/bad-request.svg',
'src/resources/img/illustrations/check.svg',
'src/resources/img/illustrations/consultant.svg',
'src/resources/img/illustrations/envelope-check.svg',
'src/resources/img/illustrations/internal-server-error.svg',
'src/resources/img/illustrations/not-found.svg',
'src/resources/img/illustrations/unauthorized.svg',
'src/resources/img/illustrations/waiting.svg',
'src/resources/img/illustrations/waving.svg',
'src/resources/img/illustrations/welcome.svg',
'src/resources/img/illustrations/x.svg'
])
)
].filter(Boolean),
// Turn off performance processing because we utilize
// our own hints via the FileSizeReporter
Expand Down
61 changes: 39 additions & 22 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const _ = require('lodash');
const { defineConfig } = require('cypress');

// @ts-ignore
Expand All @@ -20,25 +21,41 @@ const options = {
}
};

module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:9001',
supportFile: 'cypress/support/e2e.{js,jsx,ts,tsx}',
setupNodeEvents(on, config) {
on('file:preprocessor', wp(options));
}
},
env: {
CYPRESS_WS_URL:
process.env.CYPRESS_WS_URL || process.env.REACT_APP_API_URL
},
retries: {
runMode: 2
},
video: false,
chromeWebSecurity: false,
viewportWidth: 1200,
viewportHeight: 800,
defaultCommandTimeout: 30000,
modifyObstructiveCode: false
});
let conf;
try {
conf = require('./src/extensions/cypress/cypress.json') || {};
} catch (e) {
console.log('No cypress.json file found, using default configuration');
conf = {};
}

module.exports = defineConfig(
_.mergeWith(
{
e2e: {
baseUrl: 'http://localhost:9001',
supportFile: 'cypress/support/e2e.{js,jsx,ts,tsx}',
setupNodeEvents(on, config) {
on('file:preprocessor', wp(options));
},
specPattern: ['cypress/e2e/**/*.cy.ts']
},
env: {
CYPRESS_WS_URL:
process.env.CYPRESS_WS_URL || process.env.REACT_APP_API_URL
},
retries: {
runMode: 2
},
video: false,
chromeWebSecurity: false,
viewportWidth: 1200,
viewportHeight: 800,
defaultCommandTimeout: 30000,
modifyObstructiveCode: false
},
conf,
(objValue, srcValue) =>
_.isArray(objValue) ? objValue.concat(srcValue) : undefined
)
);
Loading