Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function expandSourcePath(pattern) {
if (!pattern) {
return null;
}
// just returns the relative paths
if (pattern.startsWith('.')) {
return pattern;
}
// tries to resolve the packages, handling scoped packages
const splitPattern = pattern.split('/');
const packageName = pattern[0] == '@' ? `${splitPattern[0]}/${splitPattern[1]}` : splitPattern[0];
try {
const resolvedPackageJson = resolveCwd(`${packageName}/package.json`);
if (!resolvedPackageJson) {
// returns pattern if the packageName didn't contain a package.json (not really a package)
return pattern;
}
return pattern.replace(packageName, path.dirname(resolvedPackageJson));
} catch (e) {
console.error(e);
}
}
task('dev', series('clean', 'copy', 'sass', 'webpack-dev-server'));
task('build:node-lib', series('clean', 'copy', series(condition('validate', () => !argv().min), 'ts:commonjs-only'))).cached();
task(
'build',
series(
'clean',
'copy',
'sass',
parallel(
condition('validate', () => !argv().min),
series(
'ts',
parallel(
condition('webpack', () => !argv().min && !!resolveCwd('webpack.config.js')),
condition('lint-imports', () => !argv().min)
)
)
)
)
).cached();
task('no-op', () => {}).cached();
};
const { defaults: tsjPreset } = require('ts-jest/presets')
const { resolveCwd } = require('just-scripts')
const path = require('path')
module.exports = {
transform: {
...tsjPreset.transform,
},
testRegex: '/test/.*-test\\.tsx?$',
globals: {
'ts-jest': {
isolatedModules: true,
tsConfig: resolveCwd('tsconfig.json'),
packageJson: resolveCwd('package.json'),
},
},
coverageDirectory: './coverage/',
coverageReporters: ['json', 'lcov'],
setupFilesAfterEnv: [path.join(__dirname, 'jestSetup.fluent-ui-react.js')],
verbose: false,
}
resolveMergeStylesSerializer: () => resolveCwd('@uifabric/jest-serializer-merge-styles'),
createRawConfig: () => ({
const { defaults: tsjPreset } = require('ts-jest/presets')
const { resolveCwd } = require('just-scripts')
const path = require('path')
module.exports = {
transform: {
...tsjPreset.transform,
},
testRegex: '/test/.*-test\\.tsx?$',
globals: {
'ts-jest': {
isolatedModules: true,
tsConfig: resolveCwd('tsconfig.json'),
packageJson: resolveCwd('package.json'),
},
},
coverageDirectory: './coverage/',
coverageReporters: ['json', 'lcov'],
setupFilesAfterEnv: [path.join(__dirname, 'jestSetup.fluent-ui-react.js')],
verbose: false,
}