Standard Mac IT frameworks often leave much to be desired when you need to interact with end users. Tools like Notifier provide a way to do push notifictions, but rich notifications or interactive UX tends to require unsavory mixes of Apple Script or depricated tools like CocoaDialog.
Thankfully, Tania's fantastic Trigger family of applications provides a simple and flexible way to interact with end users via HTML and the Shell. But while Trigger apps make it easy to display a UX, you have to build one first, and that can be a daunting challenge.
Trigger-EUI helps bridge this gap by combing the powerful, well documented, and accessible Elastic UI framework with a Static Site Generator. Mac Admins can quickly build beautiful UIs, display them with Trigger, and bask in the warm glow of a job well done.
Install yarn
This starter expects to use yarn to manage dependencies, so go install it.
Copy the Next.js starter
Clone the repository:
git clone https://github.com/elastic/trigger-eui.git
Start developing.
Navigate into your new siteβs directory and start it up.
cd trigger-eui/
# Install depdendencies.
yarn
# Optional: start a new git project
rm -rf .git && git add . && git commit -m "Initial commit"
# Start the dev server
yarn dev
Open the source code and start editing!
Your site is now running at http://localhost:3000
!
Open the trigger-eui
directory in your code editor of choice and edit the files under src/pages/
. Save your changes and the browser will update in real time!
A quick look at the top-level files and directories you'll see in this project.
.
βββ .eslintrc.js
βββ .gitignore
βββ .next/
βββ .prettierrc
βββ LICENSE
βββ README.md
βββ next.config.js
βββ node_modules/
βββ package.json
βββ public/
βββ src/
βββ tsconfig.json
βββ yarn.lock
.eslintrc.js
: This file configures ESLint, which will check the code for potential problems and style issues. It also integrates with Prettier for formatting.
.gitignore
: This file tells git which files it should not track / not maintain a version history for.
.next
: The next
command line tool uses this for various purposes. You should never need to touch it, but you can delete it without causing any problems.
.prettierrc
: This is a configuration file for Prettier. Prettier is a tool to help keep the formatting of your code consistent.
LICENSE
: Gatsby is licensed under the MIT license.
README.md
: A text file containing useful reference information about your project.
docs/
: When you build your project so that it can be shared, this is where the final result is generated.
next.config.js
: This file customizes the Next.js build process so that it can work with EUI.
node_modules/
: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed.
package.json
: A manifest file for Node.js projects, which includes things like metadata (the projectβs name, author, etc). This manifest is how npm knows which packages to install for your project.
public/
: Files that will never change can be put here. The EUI Theme Files are here!
src/
: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. src
is a convention for βsource codeβ. /src/pages
holds most of the magic you're worried about.
tsconfig.json
: This file configures the TypeScript compiler
yarn.lock
(See package.json
below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. (You wonβt change this file directly).
Looking for more guidance? Full documentation for Next.js lives on the website. You probably want to being by following the Getting Started Guide.
Once you have the UX you want, you'll need to build and distribute them. To help with this, we've included a pre-made build script and Packages file. To make your package, you'll need to do a few things:
Download and install Packages! You won't be able to edit the file or build it otherwise. Grab it from the link above and run the installer. Easy!
Edit the Code Signing Certificate
The default package file config is set to sign the generated installer .pkg files using Elastic's Code Signing Certificate. You don't have that, so you'll need to set it to use your own. Open TriggerEuiResourceBin.pkgproj
and choose Project > Set Certificate from the Menu Bar. You can also just chose to remove the certificate entirely, but then your package won't be signed and it many not install on newer versions of macOS.
Edit anything else you'd like
By default, your trigger-eui files will be installed to /usr/local/itops/srv/trigger-eui
. You can change this path if you prefer, this is just what we use at Elastic.
Run the build script with the -v argument
To build a package, just run yarn build-pkg -v VERSION_NUMBER
. Node will build the site, export it, build an installer package, and put everything in the builds
folder.
The VERSION_NUMBER
is important! The number you put here will be used to name the package, AND be hidden in a file called version
wherever your trigger-eui files are ultimately installed (e.g. /usr/local/itops/srv/trigger-eui/version
if you use the defaults). When you run a script to display a Trigger message, you can programmatically check this file to ensure the trigger-eui files on a given Mac are at the minimum version to have the content you're trying to display.