
Product
Announcing Bun and vlt Support in Socket
Bringing supply chain security to the next generation of JavaScript package managers
@canyaio/common-lib
Advanced tools
Reusable components across all CanApps
If you plan to add a new library component or edit an existing one, your first step should be to update the ./projects/common-lib/package.json version.
This will prevent overwriting the npm package registry and therefore all of the CanApps that use the package.
First, clone or fork this repo and perform a cd Common; npm install command to download the required dependencies.
Use the ng generate component <component-name> --project=common-lib command to add a new component to the common library.
Then, add the component class name to the ./projects/common-lib/src/lib/common-lib.module.ts file.
Create a new file .scss inside ./src/assets/sass/lib//.component.scss
Open a new terminal tab and run gulp watch in the project root.
Gulp should watch for changes in the file you created and output it in the corresponding library component directory.
Look at the header.component.scss reference.
After generating a new common-lib component, you can proceed to add the functionality to it.
The header.component.ts is a good reference of how to add @Input() properties to a component.
Don't forget to add the encapsulation: ViewEncapsulation.Native, line to the @Component declaration. This will encapsulate the component styles during the build.
@Component({
selector: 'canyalib-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.css'],
encapsulation: ViewEncapsulation.Native,
})
Before building your component, make sure that you have added it to the public_api.ts file.
Execute a ng build --prod common-lib command in the project root and add your component tag to app.component.html.
Do ng serve to run the app and see your component.
TODO: how to do unit testing
When your component features are working as expected, it is time to build, package and upload your component to the npm @canyaio registry.
First, run a npm run package command. A *.tgz file will be created with the package version appended to it.
Secondly, do a npm publish dist/common-lib/canyaio-common-lib-<version>.tgz --access public
To use your new component, update or install the @canyaio/common-lib library into your angular ^6.0.0 application: npm i @canyaio/common-lib@<version>
FAQs
README.md
We found that @canyaio/common-lib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Bringing supply chain security to the next generation of JavaScript package managers

Product
A safer, faster way to eliminate vulnerabilities without updating dependencies

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.