npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

broadside-core

v0.1.4

Published

The core functionality of the broadside framework, bundled as a standalone library

Downloads

4

Readme

broadside-core

The core library that contains all the logic needed to serve different campaigns dynamically

Setup


Prerequisites

To start working on broadside you will need to have a recent version of node and yarn.

To install node use Node Version Manager nvm. To download run the following from your terminal:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash

Then to get the get the latest node version

nvm install stable

Set the version that is returned (ie 13.1.0) as the default

nvm alias default 13.1.0

Install yarn package globally

npm install -g yarn

Development

In order to start developing you will first need to install the project dependencies. But because this app depends on Fractal project (which is a private package in npm registry), you will need to have an npm account, and this account should be added to the Fractal team in npm.

  • Signup in npm from the link here, and activate your account.

  • Ask the team leader to add your account to Fractal team on npm

  • From any where in your machine:

npm login
# Enter your credentials, and make sure that you logged in successfully
  • Install cypressjs globally:
yarn global add cypress
  • From the root of the project:
yarn install
  • Add a .env file, which contains the needed environment variables for the lib to work, you can ask your team leader to send you that file, and place it directly inside broadside-core folder

  • In order to build the library in development mode:

yarn build:dev
  • In order to build in production mode:
yarn build

To generate a campaign that uses this package, kindly take a look at the camgen generator

Testing

There are two types of tests in this project:

  • End-to-end tests: which are using cypress.io, you can invoke them by running:
yarn cy:test

This command will start the application and run the cypress test suite

  • Api and components tests: which are using Jest, you can invoke them by running:
yarn jest:test

Also you can run the two test suites by running:

yarn test:all

Fetching data from Contentful:

This is a very useful feature for testing; as it allows us to fetch the data that is currently in Contentful, and save it locally in json files; to be used in mocking contentful responses during testing.

yarn test:update-mock-data

When running the above command a js file will be executed, and as a result the following will happen:

  • The data of page contentType will be fetched and saved to page.json
  • The data of campaign contentType will be fetched and saved to campaign.json

Note that this operation will override the current existing files

Export/Import Contentful data

We can export the data saved in Contentful to a json file by running:

yarn export-contentful

Which will export to a file with the path ./contentful-backup/exported-master.json

Note that this command depends on the configuration file ./contentful-backup/exçport-config.json

Also we can import the exported data again to Contentful using the command:

yarn import-contentful

And this command depends on the configuration file ./contentful-backup/import-config.json