Skip to content

Latest commit

 

History

History
244 lines (160 loc) · 4.64 KB

README.md

File metadata and controls

244 lines (160 loc) · 4.64 KB

@lytics/lytics-lab

Lytics Lab

Table of Contents


Workspaces

packages

Just regular packages, containing libraries or pods.


Configuration

.env

This workspace supports three levels of environment variables ( .env.development, .env.production, .env.staging ). Duplicate the base helper (SAMPLE-env) file and enter valid details to configure.

nx-cloud.env

To build, run tests, storybook, etc., you may be required to create a local nx-cloud.env file to configure NX caching. Do do so create a new file at the root named nx-cloud.env and format the contents:

# Authentication Token for Nx Cloud
NX_CLOUD_ACCESS_TOKEN={VALID_READ_WRITE_TOKEN}

Iterating

yarn start

Start an entrypoint or package

yarn start --projects=@lytics/bar

yarn storybook

Start the storybook

yarn storybook

yarn tdd

Run tests in TDD mode.

yarn tdd --projects=@lytics/bar

Blueprints

yarn create-package

Create a package

yarn create-package -n foo

Code Maintenance

yarn lint

Run the linter on all packages

yarn lint

yarn format

Run the formatter on all packages

yarn format

yarn clean

Delete dist and build in all packages

yarn clean

Testing

yarn test

Run tests for everything except segbuilder

yarn test

Run tests for a given package

yarn test --projects=@lytics/foo

yarn cover

Run tests and generate coverage reports for all packages

yarn cover

Run tests and generate coverage reports for a package

yarn cover --projects=@lytics/foo

yarn test-storybook

Run the storybook smoke test

yarn test-storybook

yarn test-storyshots

Run the storybook snapshot tests

yarn test-storyshots

Building

yarn build

Build everything in the correct topological order

yarn build

Build a package

yarn build --projects=@lytics/foo

yarn build-storybook

Build the storybook

yarn build-storybook

Pods

Pods are a code organization convention. Code is organized by pod when, within a package, directly under the src directory, a single directory contains all relevant code including tests, stories, styles, types, and an index.ts file declaring all its exports.


Scripts

scripts/deploy

Placeholder for future deploy automation. Not in use.

Usage: ./scripts/deploy

scripts/create-package

This script is for creating a new package or entrypoint for the lytics-ui project. It takes several options:

Flags

  • -n <package_name>: Required. the name of the package to create.
  • -g <global_name>: Optional. the global variable name of the package. Defaults to "Lytics<PackageName>".
  • -e <entrypoint>: Optional. if set, creates an entrypoint instead of a package.
  • -v <verbose>: Optional. if set, enables verbose output.

Execution

The script does the following:

  1. creates a directory for the package/entrypoint based on the blueprint/package or blueprint/entrypoint directory
  2. replaces all occurrences of the package_pattern '{{PACKAGE_NAME}}' with the given package_name
  3. removes the '.hbs' suffix from files
  4. interpolates the package_name in all files
  5. if creating a package, it also updates the globals.json and tsconfig.json files to include the new package

The script also includes a trap to clean up the tmp directory and remove the package directory if the script exits with a non-zero status code.