Skip to content

Starterfile

Trenton Young edited this page Aug 20, 2024 · 2 revisions

Example Starterfile.yaml

# Looks at the same level as this Starterfile for files
env_file:
  - .env
  - prod.env

tools:
  nodejs:
#    optional: False    # Do not need to specify non-optional, defaults to required
    scripts:
      check: |  # This script will be run on any platform, note however...
        node --version
        npm --version
      windows:
        install: scoop install nodejs
        uninstall: scoop uninstall nodejs
      mac:
        install: brew install node
        uninstall: brew uninstall node
      linux:
        install: sudo apt install npm
        uninstall: sudo apt remove npm
        check: npm --version  # ..that on Linux, this one will run instead!
  pnpm:
    depends_on: nodejs  # We use npm to install this tool, so it must depend on `nodejs`
    scripts:
      install: npm install -g pnpm
      uninstall: npm uninstall -g pnpm
      check: pnpm --version

modules:
  postgresql:
    depends_on: random. # Dependencies can be a single other Module...
    dest: postgres
    source:
      git: [email protected]:Start-Out/path.module-postgresql.git
    scripts:
      init: cd ./postgres && git-bash ./setup_postgresql.sh
      destroy: rm -rf ./postgres
  express:
    depends_on:  # ...or multiple (though in this case, logically it could be reduced to just one)
      - postgresql
      - random
    dest: express
    source:
      git: [email protected]:Start-Out/path.module-express.git
    scripts:
      init: cd ./express && npm install  # REQUIRED
      destroy: rm -rf ./express  # REQUIRED
      windows:
        destroy: rm ./express -r -fo  # On Windows, this one will be used
  random:
    dest: random
    init_options:
      - env_name: WORDS_OF_WISDOM
        default: Life happens wherever you are, whether you make it or not.
        prompt: Have you any sage advice?
    source:
      script: |
        echo "I will not fail!"
        exit 0
    scripts:
      init: echo "I have begun! And I say ${WORDS_OF_WISDOM}"
      destroy: echo "I am going!"

env_replace:  # OPTIONAL - Each of these files will have environment variable replacement performed after the Path is fully opened
  - a.txt
  - b.txt

env_dump:  # OPTIONAL - After the Path is fully opened, all new environment variables will be dumped to the specified file.
  target: final.env 
  mode: a  # May be a (for append) or w (for overwrite)
Clone this wiki locally