xref: /expo/tools/taskfile.js (revision cd9c29bc)
1const { boolish } = require('getenv');
2const process = require('process');
3
4export async function build(task, opts) {
5  // Process JS/TS files with SWC
6  await task
7    .source('src/**/*.+(js|ts)', {
8      ignore: ['**/__tests__/**', '**/__mocks__/**'],
9    })
10    .swc('cli', { dev: opts.dev })
11    .target('build');
12
13  // Copy over JSON files
14  await task
15    .source('src/**/*.+(json)', {
16      ignore: ['**/__tests__/**', '**/__mocks__/**'],
17    })
18    .target('build');
19}
20
21export default async function (task) {
22  await task.clear('build');
23  await task.start('build', { dev: true });
24}
25
26export async function watch(task) {
27  const opts = { dev: true };
28  await task.clear('build');
29  await task.start('build', opts);
30  if (process.stdout.isTTY && !boolish('CI', false) && !boolish('EXPO_NONINTERACTIVE', false)) {
31    // Watch source folder
32    await task.watch('src/**/*.+(js|ts|json)', 'build', opts);
33  }
34}
35
36export async function release(task) {
37  await task.clear('build').start('build');
38}
39