xref: /expo/packages/@expo/cli/taskfile.js (revision dad749c2)
1const { boolish } = require('getenv');
2const process = require('process');
3
4export async function bin(task, opts) {
5  await task
6    .source(opts.src || 'bin/*')
7    .swc('cli', { stripExtension: true, dev: opts.dev })
8    .target('build/bin', { mode: '0755' });
9}
10
11export async function cli(task, opts) {
12  await task
13    .source('src/**/*.+(js|ts)', {
14      ignore: ['**/__tests__/**', '**/__mocks__/**'],
15    })
16    .swc('cli', { dev: opts.dev })
17    .target('build/src');
18}
19
20export async function build(task, opts) {
21  await task.parallel(['cli', 'bin'], opts);
22}
23
24export default async function (task) {
25  const opts = { dev: true };
26  await task.clear('build');
27  await task.start('build', opts);
28  if (process.stdout.isTTY && !boolish('CI', false) && !boolish('EXPO_NONINTERACTIVE', false)) {
29    await task.watch('bin/*', 'bin', opts);
30    await task.watch('src/**/*.+(js|ts)', 'cli', opts);
31  }
32}
33
34export async function release(task) {
35  await task.clear('build').start('build');
36}
37