Skip to content

letuankiet212/fe-us-app

Repository files navigation

Nuxt 3 Minimal Starter

Look at the Nuxt 3 documentation to learn more.

Setup


  • Make sure to install the dependencies:

    # yarn
    npx husky-init  && yarn install

Husky


Setup :

  • Install commitlint with a config, which will be used to lint your commit message:

    yarn add @commitlint/{cli,config-conventional}
  • As we are using config-conventional we are automatically following the Angular commit convention. Now we need to tell Husky to run commitlint during the Git commit hook. Therefore, we need to add a commit-msg file to the .husky folder:

    #!/bin/sh
    . "$(dirname "$0")/_/husky.sh"
    npx --no-install commitlint --edit "$1"
  • Finally, we create a .commitlintrc.json file which extends the rules from config-conventional:

    {
      "extends": ["@commitlint/config-conventional"]
    }

Alert :

  • Fix "The '.husky/commit-msg' hook was ignored because it's not set as executable."

    #terminal
    chmod ug+x .husky/*

Generate Changelog


Install

  •   npm i --save-dev standard-version

    Now we can create some npm scripts in our package.json:

      "scripts": {
        "release": "standard-version",
        "release:minor": "standard-version --release-as minor",
        "release:patch": "standard-version --release-as patch",
        "release:major": "standard-version --release-as major"
      },

    The changelog generation can be configured via a .versionrc.json file or placing a standard-version stanza in your package.json.

    In our demo we use a .versionrc.json file based on the Conventional Changelog Configuration Spec:

    {
      "types": [
        { "type": "feat", "section": "Features" },
        { "type": "fix", "section": "Bug Fixes" },
        { "type": "chore", "hidden": true },
        { "type": "docs", "hidden": true },
        { "type": "style", "hidden": true },
        { "type": "refactor", "hidden": true },
        { "type": "perf", "hidden": true },
        { "type": "test", "hidden": true }
      ],
      "commitUrlFormat": "https://github.com/mokkapps/changelog-generator-demo/commits/{{hash}}",
      "compareUrlFormat": "https://github.com/mokkapps/changelog-generator-demo/compare/{{previousTag}}...{{currentTag}}"
    }

An array of type objects represents the explicitly supported commit message types, and whether they should show up in the generated changelog file. commitUrlFormat is an URL representing a specific commit at a hash and compareUrlFormat is an URL representing the comparison between two git shas.

Release

  • The first release can be created by running npm run release -- --first-release in the terminal:
  ▶ npm run release -- --first-release

  > changelog-generator-demo@0.0.0 release /Users/mhoffman/workspace/changelog-generator-demo
  > standard-version "--first-release"

  ✖ skip version bump on first release
  ✔ created CHANGELOG.md
  ✔ outputting changes to CHANGELOG.md
  ✔ committing CHANGELOG.md
  ✔ tagging release v0.0.0
  ℹ Run `git push --follow-tags origin master` to publish

Development Server


Start the development server on http://localhost:3000

npm run dev

Production

Build the application for production:

npm run build

Locally preview production build:

npm run preview

Check out the deployment documentation for more information.