Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
series,
option,
argv,
tscTask,
eslintTask,
} = require('just-scripts');
const libPath = path.resolve(process.cwd(), 'lib');
const srcPath = path.resolve(process.cwd(), 'src');
option('production');
option('clean');
task('eslint', () => {
return eslintTask();
});
task('ts', () => {
return tscTask({
pretty: true,
noEmit: true,
...(argv().production && {
inlineSources: true,
sourceRoot: path.relative(libPath, srcPath),
}),
target: 'es6',
module: 'commonjs',
});
});
task('build', series('eslint', 'ts'));
task('apiExtractorVerify', apiExtractorVerifyTask());
task('apiExtractorUpdate', apiExtractorUpdateTask());
task('apiDocumenter', () => {
require('child_process').execSync(
'npx @microsoft/api-documenter markdown -i temp -o docs/api',
{stdio: 'inherit'},
);
});
task('flow-check', () => {
require('child_process').execSync('npx flow check', {stdio: 'inherit'});
});
task('eslint', () => {
return eslintTask();
});
task('copyFlowFiles', () => {
return copyTask(['src/**/*.js'], '.');
});
task('initRNLibraries', () => {
require('./Scripts/copyRNLibraries').copyRNLibraries();
});
task('ts', () => {
return tscTask({
pretty: true,
...(argv().production && {
inlineSources: true,
sourceRoot: path.relative(libPath, srcPath),
}),
task('ts', tscTask({ module: 'commonjs', outDir: './lib' }));
task(
'copy',
copyTask(
[
'../office-ui-fabric-react/src/utilities/exampleData.ts',
'../office-ui-fabric-react/src/components/ExtendedPicker/examples/PeopleExampleData.ts',
'../office-ui-fabric-react/src/common/TestImages.ts'
],
'lib'
)
);
task(
'build',
series('clean', 'copy', parallel('ts', condition('jest', () => !argv().min)))
).cached();
task('generate-version-files', generateVersionFiles);
task('generate-package-manifest', generatePackageManifestTask);
task('ts', () => {
return argv().commonjs
? 'ts:commonjs-only'
: parallel('ts:commonjs', 'ts:esm', condition('ts:amd', () => argv().production && !argv().min));
});
task('validate', fs.existsSync(path.join(process.cwd(), 'jest.config.js')) ? series('tslint', 'jest') : 'tslint');
task('code-style', series('prettier', 'tslint'));
task('update-api', series('clean', 'copy', 'sass', 'ts', 'update-api-extractor'));
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)
)
)
)
)
task,
series,
option,
argv,
tscTask,
eslintTask,
} = require('just-scripts');
const fs = require('fs');
option('production');
option('clean');
task('eslint', () => {
return eslintTask();
});
task('ts', () => {
return tscTask({
pretty: true,
...(argv().production && {
inlineSources: true,
}),
target: 'es6',
module: 'commonjs',
});
});
task('prepareBundle', () => {
const file = 'windows/ReactUWPTestApp/Bundle';
if (!fs.existsSync(file)) {
fs.mkdirSync(file);
}
});
'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();
};