Commands

NPM Scripts

  • npm install: Install the dependencies (do this before starting the project)
  • npm start: Run the project in development mode
  • npm build: Create a compiled build of the projects assets
  • npm generate: Used in combination with certain parameters to generate components within the brandplatform
  • prepare: NPM command, should not be executed manually. This command is executed after a npm install
  • npm production: Start the server
  • npm release: Create a package.zip file from the compiled assets of the brandplatform and place its version and the current one in the correct folders

npm generate

The brandplatform has a certain structure when defining components. This is done to create consistency. Now it gets really annoying when you have to create a component because a certain amount of files and configuration is needed. So in order to make this dreadsome process more enjoyable and automagical, we have provided a command to generate a component with its correct configuration.

There are two parts that should be passed into the command:

npm run generate --folder=component

  • folder: The name of the folder can be anything you want but it has to represent one of the folders you used to differentiate the components from each other. So this means if you have a folder called components and you want a
  • button* to be generated into it. You will have to write
  • components=button*.
  • component: The name of the component you want to work in. This can be anything you want. This will generate a couple of files that help you start define your new component.

Examples:

  1. Generate the building-block button. This will result in a building-block being placed within the building-blocks folder.

    npm run generate -- --building-blocks=button

  2. Generate the component collapse. This will result in a component being placed within the components folder.

    npm run generate -- --components=collapse

  3. Generate the layout section. This will result in a layout being placed within the layouts folder.

    npm run generate -- --layouts=section