csc-breeann-webcomponents-stencil v0.0.103
Columbia Sportswear Company Web Components with AEM + SFCC
CSC Web Components library - taking basic AEM configurations values that can be passed and previewed using StencilJS and then viewed as a published SFCC Content Asset that can be useable in SFCC Content Slots.
Prerequisites:
StencilJS - Installation of StencilJS in your local development environment
AEM - Access to local AEM instance
SFCC - Access to a local SFCC sandbox environment
Stencil
Stencil is a compiler for building fast web apps using Web Components.
Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than run-time tool. Stencil takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components that run in any browser supporting the Custom Elements v1 spec.
Stencil components are just Web Components, so they work in any major framework or with no framework at all.
Getting Started
To start building a new web component using Stencil, clone this repo to a new directory:
git clone git@bitbucket.org:columbiasportswear/webcomponents.git
cd webcomponents
and run:
npm install
npm start
To build the component for production, run:
npm run build
Need help?
Naming Components
Prefix your component tag names with csc
(ex: <csc-text>
<csc-hero>
, etc.) Later on, if we need specific components for specific brands we can look into branching off and naming them according to brand name (ex: <pra-text>
<pra-hero>
, <sor-text>
<sor-hero>
, <mhw-text>
<mhw-hero>
etc.)
When creating new component tags, we recommend not using stencil
in the component name (ex: <stencil-datepicker>
). This is because the generated component has little to nothing to do with Stencil; it's just a web component!
Instead, use a prefix that fits your company or any name for a group of related components. For example, all of the Ionic generated web components use the prefix ion
.
Unit Testing
To run the unit tests for the components, run:
npm test
This will test all .spec.ts
and .e2e.ts
files in the components
directory.
When creating a new component, be sure to create these two files for Unit Testing (.spec.ts
) and End to End Testing (.e2e.ts
) your code.
Be sure to test the code prior to making a PR.
- For more information on Unit Testing in Stencil here
Linting
To run ESLint, run:
npm run lint
This will validate all .ts,.tsx
files in the code base.
If there are eny warnings/errors, it will report the files that need to be fixed. A successful linting should result in no warnings or errors.
Script tag
- Put a script tag similar to this
<script type='module' src='https://unpkg.com/webcomponents@0.0.1/dist/webcomponents.esm.js'></script>
in the head of your index.html - Then you can use the element anywhere in your template, JSX, html etc
Node Modules
- Run
npm install csc-webcomponents --save
- Put a script tag similar to this
<script type='module' src='node_modules/webcomponents/dist/webcomponents.esm.js'></script>
in the head of your index.html - Then you can use the element anywhere in your template, JSX, html etc
In a stencil-starter app
- Run
npm install csc-webcomponents --save
- Add an import to the npm packages
import my-component;
- Then you can use the element anywhere in your template, JSX, html etc
Production Build
This repository is being built using our Production Jenkins cluster at here. The build checks out the master branch and then does a replace on the version number in package.json and the .npmrc_config file has the token field replaced with a valid deployment token. Then the following:
mv .npmrc_config .npmrc
npm ci
npm run build
npm run lint
npm test
npm publish
Slack notifications are sent to the #auto-deploy-webcomponents channel on Build Start, Build Success, and Build aborted
There is a custom Docker image built for this currently in the public Docker account Name: columbiaecomm/jnlp-agent-node:latest that we use but in the future we will migrate this to our Private ECR images
Note: it is named .npmrc_config to prevent credentials being introduced into the repository
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago