Home

Awesome

Developers Portal

Summary

About

Objective

This repository implements the new VTEX Developers Portal with better navigability, content centralization and search facility to improve developers experience as they consult our applications documentation, guides and API references.

Concepts and Features

As the Developer Portal provides VTEX documentation to users, some of its main features are:

Versioning

The versioning process of this repository was built to automate version releases and standardize its contributions. The following goals are currently implemented:

flowchart TB
    startState(PR is merged into main) --> setReleaseEnvVar(1. Extract release type from PR labels)
    setReleaseEnvVar(Extract release type from PR labels) --If PR has 'release-auto', 'release-patch', 'release-minor' or 'release-major' label--> releaseVersionScript(Run release script)
    setReleaseEnvVar(Extract release type from PR labels) --If PR has no release label--> setDefaultAutoRelease(Set default auto release)
    setDefaultAutoRelease(Set default auto release) --> releaseVersionScript(Run release script)
    setReleaseEnvVar(Extract release type from PR labels) --If PR has 'release-no' label--> endState(Finish workflow)
    releaseVersionScript(Run release script) --> |Commit changes to CHANGELOG.md and package.json with the new version and create a new version tag| pushReleaseVersionScriptResult(Push script results to the remote repository)
    pushReleaseVersionScriptResult(Push script results to the remote repository) --> createRelease(Create new GitHub Release)
    createRelease(Create new GitHub Release) --> endState(Finish workflow)

Tests

Development

Clone this repo, access the command line at its root directory and install all dependencies:

yarn install

To start the application development server, run:

yarn dev

Open http://localhost:3000 with your browser to see the result.

Project Pattern

The Developers Portal is a Next.js app based on React and Typescript.

Directory tree

The diagram below represents the base structure defined to organize the files and folders of the repository, where all file names must follow the kebab-case convention.

flowchart TB
    devportal --> src & public
    src --> messages & components & pages & styles & posts & utils & tests
    messages --> msgJson{{messages.json}}
    components --> some-component --> stylesCompCss{{styles.component.css}} & compOther{{functions/other.ts}} & compIndex{{indext.tsx}} & compStyle{{styles.ts}}
    pages --> search & pagesLanding{{landing-page}} & docs
    search --> searchSearchPage{{search-page}}
    docs --> VTEX-IO & API & etc...
    API --> apiIndex{{index}}
    VTEX-IO --> vtexIoIndex{{index}}
    styles --> stylesGlobal{{global.css}}
    posts --> postsPost{{post.md/mdx}}
    utils --> utilsChildren{{Global functions, types and constants}}
    tests --> testsChildren{{tests files}}

React preferences

Code linting and format

You might want to configure ESLint and Prettier in your code editor to see errors and correction suggestions at development time.

Commits

By simplicity, we have three types of commits:

How to make a commit

Branches

Currently, we have one fixed branch: main .

The main branch must reflect exactly what is deployed in production, it should be treated as the single source of truth. It is from main where every development branch is created.

Important note: Only merge commits should be made by developers on main branch.

Feature branches

You must create a branch based on main to start a feature, improvement, or fix. This branch is called a feature branch. It must have the following structure name: <type>/<description> Choose the type that best summarizes your contribution at the Commit Types Table.

The feature branch description must be short and written with kebab-case. It should give a basic understanding of what is being developed on the branch.

E.g.: git checkout -b feature/landing-page.

Important note: Only commits should be made in a feature branch. None release or merge commits should be made.

Contributing

How to develop and propose a new contribution

What to do when someone updated the main branch and I'm developing something on my feature branch

Make rebase of your feature branch on main:

# Bring to local main branch the remote main latest updates
git checkout main
git pull origin main

# Checkout your feature branch and rebase it onto main (solve possible conflicts)
git checkout feature/new-nice-thing
git rebase main

# Force push your rebased feature branch
git push --force origin feature/new-nice-thing

Important note: Always maintain your feature branch rebased on main.