-
Go to https://github.com/nrwl/nx/blob/master/package.json and Search for the most recent tag that uses the angular version desired (TAG)
-
Once you found the tag, run the following command:
npx create-nx-workspace@{TAG} sam-layouts --preset=angular --appName=sam-layouts --style=scss --linter=eslint --nx-cloud=no
-
Generate initial library code
nx g @nrwl/angular:library --name=layouts --importPath=@gsa-sam/layouts --publishable
-
Add Storybook
npm install --save-dev @nrwl/storybook@{TAG}
(Same tag version as above) -
Generate Storybook Configuration files
nx g @nrwl/angular:storybook-configuration sam-layouts
- ✔ Configure a Cypress e2e app to run against the storybook instance? (Y/n) · n
- ✔ Automatically generate *.stories.ts files for components declared in this project? (Y/n) · n
- ✔ Automatically generate *.spec.ts files in the generated Cypress e2e app? (Y/n) · n
-
Add library stories to storybook config (/apps/sam-layouts/.storybook/main.js -> stories array)
'../../../libs/layouts/src/lib/**/*.stories.mdx', '../../../libs/layouts/src/lib/**/*.stories.@(js|jsx|ts|tsx)'
-
Include library files in storybook tsconfig include array
../../../libs/layouts/src/**/*
-
In a different location clone sam-layouts repo
git clone https://github.com/GSA/sam-layouts.git
-
Run the migration and fix possible issues in the recently cloned repo
nx migrate @nrwl/workspace@{TAG}
nx migrate --run-migrations
-
Replace the following from the cloned repo to the new nx workspace
- libs/layouts/src/lib
- libs/layouts/package.json
- libs/layouts/src/index.ts
- Install GSA-SAM dependencies in the new nx workspace All these dependencies should be already be working in the angular version desired
- @gsa-sam/components
- @gsa-sam/ngx-uswds-icons
- @gsa-sam/sam-formly
- @gsa-sam/sam-material-extensions
- @gsa-sam/sam-styles
-
Go to https://github.com/angular/components/blob/main/package.json and Search for the most recent tag that uses the angular version desired (MATERIAL TAG)
-
Install Angular Material dependencies in the new workspace
- @angular/material@{MATERIAL TAG}
- @angular/cdk@{MATERIAL TAG}
- Install other dependencies
- lodash-es
- @ckeditor/ckeditor5-angular
- @ckeditor/ckeditor5-build-classic
- ngx-toastr <== (check for same angular version)
-
Disable "strict", "strictTemplates" and "noPropertyAccessFromIndexSignature" from
sam-layouts/libs/layouts/tsconfig.js
andsam-layouts/apps/sam-layouts/tsconfig.js
-
Enable sam-styles copy /sam-layouts/blob/master/apps/sam-layouts/src/styles.scss
-
Copy the img folder located in the 'assets' directory
-
Set up compodoc for storybook on nx https://nx.dev/packages/storybook/documents/angular-storybook-compodoc
-
Change output directory for documentation to 'docs'
-
Test everything
nx run layouts:build:production
nx storybook sam-layouts
nx build-storybook sam-layouts