#!/bin/env zsh

#
# Commands and shortcuts for Meteor core development, you can load these in your terminal by running `source .envrc`.
# Or by adding `[[ -s .envrc ]] && source .envrc` to your `.zshrc` or `.bashrc`.
#

export ROOT_DIR=$(git rev-parse --show-toplevel)

########
# Core #
########

function @meteor {
   "$ROOT_DIR/meteor" "$@"
}

function @test-package {
   @meteor test-packages "$@" --exclude-archs=web.browser.legacy,web.cordova
}

function @test-packages {
  TINYTEST_FILTER="$1" @meteor test-packages --exclude-archs=web.browser.legacy,web.cordova
}

function @test-self {
  @meteor self-test "$@"
}

function @check-syntax {
  node "$ROOT_DIR/scripts/admin/check-legacy-syntax/check-syntax.js"
}

function @generate-dev-bundle {
  rm -rf $ROOT_DIR/dev_bundle*
  "$ROOT_DIR/scripts/generate-dev-bundle.sh"
}

function @init-submodule {
  git submodule update --init --recursive
}

#################
# Documentation #
#################

function @docs-migration-start {
  npm run docs:dev --prefix "$ROOT_DIR/v3-docs/v3-migration-docs"
}