2019-08-27 01:05:54 +03:00
|
|
|
// @ts-check
|
|
|
|
|
2021-06-18 03:22:39 +03:00
|
|
|
const { task, series, parallel, option, argv, tscTask, cleanTask, eslintTask, prettierTask, prettierCheckTask } = require('just-scripts');
|
2019-08-27 01:05:54 +03:00
|
|
|
|
|
|
|
const path = require('path');
|
|
|
|
|
2020-08-20 01:52:37 +03:00
|
|
|
const srcPath = path.join(process.cwd(), 'src');
|
|
|
|
const libPath = path.join(process.cwd(), 'lib');
|
2020-02-20 04:25:37 +03:00
|
|
|
|
2020-08-25 23:59:27 +03:00
|
|
|
const checkPublishing = () => {
|
|
|
|
const { checkPublishingTask } = require('./lib/tasks/checkPublishingTask');
|
|
|
|
return checkPublishingTask();
|
|
|
|
};
|
|
|
|
|
2022-02-17 00:13:09 +03:00
|
|
|
const checkForModifiedFiles = () => {
|
|
|
|
const { checkForModifiedFiles } = require('./lib/tasks/checkForModifiedFilesTask');
|
|
|
|
return checkForModifiedFiles();
|
|
|
|
};
|
|
|
|
|
2019-08-27 01:05:54 +03:00
|
|
|
module.exports = function preset() {
|
|
|
|
option('production');
|
|
|
|
|
2020-08-20 01:52:37 +03:00
|
|
|
task(
|
|
|
|
'ts',
|
|
|
|
tscTask({
|
|
|
|
pretty: true,
|
|
|
|
allowJs: true,
|
|
|
|
target: 'es6',
|
|
|
|
outDir: 'lib',
|
|
|
|
module: 'commonjs',
|
|
|
|
...(argv().production && { inlineSources: true, sourceRoot: path.relative(libPath, srcPath) }),
|
|
|
|
}),
|
2020-04-03 23:21:30 +03:00
|
|
|
);
|
2019-08-27 01:05:54 +03:00
|
|
|
|
2020-08-25 23:59:27 +03:00
|
|
|
task('depcheck', checkPublishing);
|
2021-07-27 21:43:49 +03:00
|
|
|
task('lint', eslintTask({ files: ['src/'] }));
|
2021-06-18 03:22:39 +03:00
|
|
|
task('prettier', () => (argv().fix ? prettierTask : prettierCheckTask));
|
2020-08-20 01:52:37 +03:00
|
|
|
task('cleanlib', cleanTask([libPath]));
|
2022-02-17 00:13:09 +03:00
|
|
|
task('checkForModifiedFiles', checkForModifiedFiles);
|
2020-08-20 01:52:37 +03:00
|
|
|
task('build', series('cleanlib', parallel('lint', 'ts')));
|
2020-04-03 23:21:30 +03:00
|
|
|
task('no-op', () => {});
|
2020-08-20 01:52:37 +03:00
|
|
|
task('clean', 'no-op');
|
2019-08-27 01:05:54 +03:00
|
|
|
};
|