Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore/issue 20 storybook and unit testing development workflows #21

Merged
merged 12 commits into from
Apr 7, 2024
Merged
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Summary

<!-- Brief summary of the issue like steps to reproduce for a bug, or motivation and API design if proposing a new feature. -->

## Details

<!--
Include relevant code samples, example snippets, benefits, complexity, etc. For feature requests, please make sure to provide an actionable outcome. If you're unsure what qualifies, please consider starting a Discussion first, we can always transfer it later :).

For bug reports, please include your configuration file and a sample of your workspace with the minimum amount of code needed to reproduce. For alternative debugging approaches, you can use our test cases as a format to follow for reproducing bugs.
-->
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--
## Submitting a Pull Request
We love contributions and appreciate any help you can offer!
-->

## Related Issue

<!-- Include a link to the issue (e.g. Resolves #12) -->

## Summary of Changes

<!-- Briefly summarize the changes made, lists are appreciated, ideally with checklists

1. [x] Thing I fixed
1. [x] Other thing I updated
1. [x] Docs I updated
-->
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Continuous Integration

on: [pull_request]

jobs:

build:
runs-on: ubuntu-20.04

strategy:
matrix:
node: [18]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Installing project dependencies
run: |
npm ci
# - name: Lint
# run: |
# npm run lint
- name: Test
run: |
npm run test
- name: Build Storybook
run: |
npm run story:build
- name: Build Project
run: |
npm run build
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
.vscode/
coverage/
node_modules/
public/
public/
reports/
storybook-static/
*storybook.log
18 changes: 18 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/** @type { import('@storybook/web-components-vite').StorybookConfig } */
const config = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@chromatic-com/storybook",
],
framework: {
name: "@storybook/web-components-vite",
options: {},
},
docs: {
autodocs: "tag",
},
};

export default config;
15 changes: 15 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import '../src/styles/theme.css';

/** @type { import('@storybook/web-components').Preview } */
const preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
80 changes: 79 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,81 @@
# www.greenwoodjs.dev

Documentation website for Greenwood
Documentation website for [**GreenwoodJS**](https://www.greenwoodjs.dev/), using GreenwoodJS for development.

## Contributing

To contribute to the project, please do the following:

1. Clone the repo
1. If you have **nvm** installed, run `nvm use` to get right version of NodeJS
1. Run `npm ci`

### Workflows

> _See `package.json#scripts` for all available commands._

#### Local Dev

To run the site locally for development, run

```sh
$ npm run dev
```

#### Production

To build the locally for production and view it, run:

```sh
$ npm run serve
```

#### Storybook

To build storybook for local development, you can run:

```sh
$ npm run story:dev
```

#### Testing

To run tests in watch mode, you can use:

```sh
$ npm run test:tdd
```

Otherwise all tests can be run once with:

```sh
$ npm run test
```

### Guidelines

#### Project Structure

- _/components/_ - Custom Element web components to be used throughout the projects
- _/pages/_ - File based routing as provided by Greenwood
- _/stories/- General developer documentation about the project for developers

#### Storybook

For each component, an accompanying Storybook file should be made, e.g.

```sh
footer/
footer.js
footer.stories.js
```

#### Testing

For each component, an accompanying test file should be made, e.g.

```sh
footer/
footer.js
footer.spec.js
```
3 changes: 3 additions & 0 deletions greenwood.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
prerender: true
}
Loading