Lytics Lab
@lytics/lytics-lab
Just regular packages, containing libraries or pods.
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.
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}
We use Changesets for version management and automated releases. See CONTRIBUTING.md for detailed guidelines.
- Create a feature branch
- Make your changes
- Run quality checks locally:
yarn lint yarn typecheck yarn test yarn build - Create a changeset documenting your changes
- Open a pull request
When you make user-facing changes, create a changeset:
yarn changeset
This will prompt you to:
- Select which packages changed
- Choose the version bump type (major/minor/patch)
- Write a summary of your changes
The changeset will be included in your PR and used to automatically generate changelogs and version bumps when merged.
Example workflow:
# Make your changes
git checkout -b feat/add-new-feature
# Create a changeset
yarn changeset
# Select: @lytics/experience-editor
# Type: minor (for new features)
# Summary: "Add support for custom themes"
# Commit everything
git add .
git commit -m "feat(experience-editor): add custom theme support"
git push
For more details, see CONTRIBUTING.md.
Start an entrypoint or package
yarn start --projects=@lytics/bar
Start the storybook
yarn storybook
Run tests in TDD mode.
yarn tdd --projects=@lytics/bar
Create a package
yarn create-package -n foo
Run the linter on all packages
yarn lint
Run the formatter on all packages
yarn format
Delete dist and build in all packages
yarn clean
Run tests for everything except segbuilder
yarn test
Run tests for a given package
yarn test --projects=@lytics/foo
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
Run the storybook smoke test
yarn test-storybook
Run the storybook snapshot tests
yarn test-storyshots
Build everything in the correct topological order
yarn build
Build a package
yarn build --projects=@lytics/foo
Build the storybook
yarn build-storybook
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.
Placeholder for future deploy automation. Not in use.
Usage: ./scripts/deploy
This script is for creating a new package or entrypoint for the lytics-ui project. It takes several options:
-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.
The script does the following:
- creates a directory for the package/entrypoint based on the blueprint/package or blueprint/entrypoint directory
- replaces all occurrences of the package_pattern '{{PACKAGE_NAME}}' with the given package_name
- removes the '.hbs' suffix from files
- interpolates the package_name in all files
- 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.