3.0.9 • Published 4 months ago

@niiwin/core v3.0.9

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
4 months ago

Niiwin

This repo contains the source code for the Niiwin Rails engine and npm package. Find out more about Niiwin at https://niiwin.ca

Getting started for Niiwin Core Developers

Follow these steps if you are a Niiwin Core Developer and you work on the Niiwin RubyGem, npm package, or dev toolchain:

Prerequisites

You'll need the following installed to continue setting up your development environment:

  • A Ruby version manager/switcher (rbenv, rvm, chruby, asdf, etc.)
  • Node.js (14.21.3+)
  • Yarn (1.22.0+)
  • Postgresql (9.6+)
  • Redis (6+)
  • Optional: The 1Password CLI1

Install Ruby

This assumes you have rbenv installed, though another Ruby version manager will also work.

  • Check that the required Ruby version 3.2.2 is installed: rbenv versions
  • Install it if it's not installed yet: rbenv install 3.2.2
  • Set global Ruby version to 3.2.2: rbenv global 3.2.2

Install the Niiwin gem and related repos

Since you are developing the Niiwin gem alongside an application, you will clone the Niiwin code repo and use a locally sourced version of the gem.

The niiwin-test app is configured to use your local Niiwin Engine gem source, and not the one hosted online. This is so that you can test your work in progress. In order for this to work, you need your code repos set up in the following way:

<niiwin-parent-folder>              # A container for the niiwin related repos
├── niiwin                          # The Niiwin Engine gem (this repo)
├── niiwin-technical-documentation  # Niiwin technical documentation
└── niiwin-test                     # THe Niiwin Engine test suite

The niiwin-technical-documentation repo is not required to run tests, however, it uses the niiwin-test repo to generate some automated diagrams, so it needs to fit into this folder structure as well.

  • cd into the <niiwin-parent-folder>
  • Clone the repo git clone git@github.com:animikii/niiwin.git

Optional tip: You can define a shell environment variable to store the path to the niiwin engine gem in your shell profile (ex: ~/.zshrc or ~/.bashrc).

# Set up path to niiwin engine gem source
export NIIWIN_GEM_SOURCE="/Users/momo/Code/niiwin"

Install dependencies

Make sure you are in the Niiwin gem root directory, then:

bundle install
yarn install
yarn build

Generate a new Niiwin App

You will use a locally sourced version of the niiwin-init script. In order to do so you will specify a custom path to the Niiwin gem source (/path/to/local/niiwin). Note that you can use this approach also to test the niiwin-init script itself:

/path/to/local/<niiwin-parent-folder>/niiwin/bin/niiwin-init --name my-awesome-app --path /path/to/local/<niiwin-parent-folder>/niiwin

# OR if you set up the NIIWIN_GEM_PATH environment variable above
$NIIWIN_GEM_SOURCE/bin/niiwin-init --name coworking --path $NIIWIN_GEM_SOURCE

Once the script is done, cd into the new app's root directory and start the app:

.bin/dev

In a browser, visit http://localhost:3000, and use the "Dev Login" button at the bottom of the page to choose a role and log in.

Now you can start working on the new Niiwin App, or on the Niiwin Engine itself.

NOTE: when providing a custom path to the niiwin gem to the niiwin-init script, that absolute path will be inserted into the app's Gemfile for the niiwin entry. If you plan on sharing the app's code with other developers, you should change the absolute path to the niiwin gem to a relative one: Change gem "niiwin", path: "/absolute/path/to/niiwin" to gem "niiwin", path: "../niiwin".