In this repository you can find anything you need to work on the developer portal project.
Before you start, make sure you have complete the following steps:
# install dependencies
npm i
You have 2 ways of accomplish it, the first one consists in downloading the whole docs as zip, using
npm run download-docs -w nextjs-website
Or you can initialize a git submodule on .tmp-docs directory:
git submodule add --force https://github.com/pagopa/devportal-docs.git apps/nextjs-website/.tmp-docs
and then run the script to checkout docs to the right branch
npm run update-docs -w nextjs-website
You can update the doc by downloading it again or, if you chose the submodule way, by running again the update command:
npm run update-docs -w nextjs-website
Finally:
- in the
nextjs-website
app (apps/nextjs-websites
), create a.env.local
starting from.env.default
and fill all the environment variables. - in the
strapi-cms
app (apps/strapi-cms
), create a.env
starting from.env.default
and fill all the environment variables.
Run the following command from the root folder.
npm run dev
Open http://localhost:3000 with your browser to see the website.
Open http://localhost:1337/admin/ with your browser to see the CMS website.
Run the following command from the root folder.
npm run test
or run the following command to execute test of single workspace
npm run test -w <workspace>
or run the following command to keep watching changes while updating code or test
npm run test -w <workspace> -- --watch
For more information check npm CLI workspace documentation.
Run the chosen command in each workspace.
npm run <command> --workspaces
Run the chosen command
on workspace <workspace>
.
npm -w <workspace> run <command>
Add to the root the dependency <dependency>
.
npm install <dependency>
Add to the package <package>
the dependency <dependency>
as devDependencies
.
npm -w <package> install <dependency> -D
To access the Storybook and view the available React components, follow these instructions:
npm run storybook
and you will get a message like this:
╭────────────────────────────────────────────────────╮
│ │
│ Storybook 7.6.17 for nextjs started │
│ 584 ms for manager and 17 s for preview │
│ │
│ Local: http://localhost:6006/ │
│ │
╰────────────────────────────────────────────────────╯
Open http://localhost:6006 with your browser to see the result.
This project utilizes changesets to generate the changelog. Here's how you can use it:
-
Adding Changelog Information: to add entries to the changelog, execute
npx changeset
ornpm run changeset
.
This will initiate a wizard that guides you through the process. -
Defining the Change Type: the wizard will ask you to specify the type of changes made (major, minor, patch).
The summary you provide here will be added to theCHANGELOG.md
file. Follow the semver specification in order to choose the proper type of change. -
Generating the Changelog: the Changelog workflow uses the changeset's action to convert the changes tracked with
npm run changeset
into aCHANGELOG.md
file. -
Creating a Pull Request: after generating the changelog, the workflow will create a PR with the proposed changes, which include version bumping and updating the
CHANGELOG.md
file. -
Updating the PR: if additional changes are made while the PR is open, the changeset's bot will automatically update the PR based on the changes in the
.changeset
folder.