Giter Club home page Giter Club logo

circleci-demo-javascript-react-app's Introduction

Quickstart: Demo JavaScript Node.js Reference Project

We maintain a reference JavaScript Node.js project to show how to build an Express.js app on CircleCI with version: 2.1 configuration: Demo JavaScript Node Project on GitHub Demo JavaScript Node Project building on CircleCI

In the project you will find a CircleCI configuration file .circleci/config.yml. This file shows best practice for using version 2.1 config with Node projects. Build the Demo JavaScript Node Project Yourself A good way to start using CircleCI is to build a project yourself. Here’s how to build the demo project with your own account: Fork the project on GitHub to your own account. Go to the Add Projects page in the CircleCI application and click the Set Up Project button next to the project you just forked. To make changes you can edit the .circleci/config.yml file and make a commit. When you push a commit to GitHub, CircleCI will build and test the project.

Sample Configuration

Below is the .circleci/config.yml file in the demo project.

version: 2.1
orbs:
  node: circleci/[email protected]
  heroku: circleci/[email protected]

jobs:
  build_and_test:
    docker:
      - image: cimg/node:17.2.0
    steps:
      - checkout
      - node/install-packages:
          pkg-manager: yarn
      - run:
          command: yarn test
          name: Run tests
      - run:
          command: yarn build
          name: Build app
      - persist_to_workspace:
          root: ~/project
          paths:
            - .
  deploy: # this can be any name you choose
    docker:
      - image: cimg/node:17.2.0
    steps:
      - attach_workspace:
          at: ~/project
      - heroku/deploy-via-git:
          force: true # force push when pushing to the heroku remote, see: https://devcenter.heroku.com/articles/git

workflows:
  on_commit:
    jobs:
      - build_and_test
      - deploy:
          requires:
            - build_and_test # only deploy if the build_and_test job has completed
          filters:
            branches:
              only: master # only deploy when on main/master
  nightly:
    triggers:
      - schedule:
          cron: "0 0 * * *"       
          filters:
            branches:
              only:
                - master
                - docs-node-js-language-guide
    jobs:
      - build_and_test
      - deploy:
          requires:
            - build_and_test # only deploy if the build_and_test job has completed
          filters:
            branches:
              only: master # only deploy when on main/master

Config Walkthrough

By using the Node orb, it sets an executor from CircleCI's highly cached convenience images built for CI and allows you to set the version of NodeJS to use. Any available tag from this list can be used: https://hub.docker.com/r/cimg/node/tags.

The Node Orb test command will test your code with a one-line command, with optional parameters.

Matrix jobs are a simple way to test your Node app on various node environments. For a more in depth example of how the Node orb utilizes matrix jobs, see our blog on matrix jobs. See documentation on pipeline parameters to learn how to set a node version via Pipeline parameters.

Success! You just set up a Node.js app to build on CircleCI with version: 2.1 configuration. Check out our project’s Job page to see how this looks when building on CircleCI.

circleci-demo-javascript-react-app's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

circleci-demo-javascript-react-app's Issues

Correct YAML Configuration

Hi - not sure if this is the right place but the config.yml on master really deviates from whats noted in the read me (involving slack and some scheduled job).

Additionally, referencing the readme alone doesn't really seem to match what is noted as "[the] best practice for using version 2.1" as it looks like its just running the node test(?)

Going back in the history there seems to be some pretty distinct versions of this file too. As someone new and looking for what the best practices are I cant really make sense of what that might be.

Is there any available reference that does show what the best practice for a node app might be? or if it is here can we have a little more of an explanation of the parts that are not in any of the tutorials leading up to here? (- slack/notify, cron: "0 0 * * *" , etc.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.