version = 0.1

default-task = 'build'

[[task]]
name = 'build'
run = 'tsup src/loader.ts --format esm --dts'
dep = 'src/#.ts'
target = 'dist/loader.js'

[[task]]
name = 'npm:install'
run = 'npm install'
dep = 'package.json'
target = 'package-lock.json'

[[task]]
name = 'clean'
run = 'rm -rf dist'

[[task]]
name = 'commit'
run = 'git-cz'

[[task]]
name = 'default'
run = 'npm install --no-save react-dom@17.0.2 @teleporthq/teleport-project-generator-react@0.25.4 @teleporthq/teleport-project-generator-preact@0.20.0 chalk express morgan react-router@5.2.1 react-router-dom@5.2.1'

[[task]]
name = 'format'
run = 'prettier --write **/*.{ts,json,md}'

[[task]]
name = 'lint'
run = 'eslint src --ext .ts'
deps = ['src/#.ts']

[[task]]
name = 'lint:fix'
run = 'eslint src --ext .ts --fix'
deps = ['src/#.ts']

[[task]]
name = 'post-merge'
deps = ['npm:install', 'build']

[[task]]
name = 'pre-commit'
deps = ['typecheck', 'test:changed', 'lint:fix', 'format']

[[task]]
name = 'prepare'
run = 'husky install'

[[task]]
name = 'prepublishOnly'
deps = ['test', 'build']

[[task]]
name = 'release'
run = 'release-it'

[[task]]
name = 'server'
deps = ['server:build', 'server:start']

[[task]]
name = 'server:build'
run = "echo 'Building...' && chomp build && echo 'Build complete.'"

[[task]]
name = 'server:start'
run = '''
echo "Starting server..."
node --loader ./dist/loader.js tests/e2e/test-server.js
echo "Server started."
'''

[[task]]
name = 'test'
deps = ['test:unit', 'test:e2e']

[[task]]
name = 'test:e2e'
run = 'node --loader ./dist/loader.js tests/e2e/test.js'
deps = ['default', 'build']

[[task]]
name = 'test:unit'
run = 'jest'

[[task]]
name = 'test:changed'
run = 'jest --bail --changesince=main'

[[task]]
name = 'typecheck'
run = 'tsc --noEmit'

[[task]]
name = 'upgrade'
run = 'npm update --latest'

[[task]]
name = 'dir-size'
run = 'du -hs .cache'
