Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy

on:
push:
branches:
- master
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

permissions:
contents: read
id-token: write

jobs:
# Build job
build:
environment: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npm run build
- name: Deploy bookstore to S3 production
uses: jakejarvis/s3-sync-action@v0.5.1
with:
args: --acl public-read --follow-symlinks
env:
AWS_S3_BUCKET: testplane-bookstore
AWS_ACCESS_KEY_ID: ${{ secrets.S3_PRODUCTION_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_PRODUCTION_SECRET_ACCESS_KEY }}
AWS_S3_ENDPOINT: https://s3.yandexcloud.net/
SOURCE_DIR: "dist"
31 changes: 31 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run build
- run: npm run lint
- run: npm run format:check
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22
22
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
dist
build
coverage
.next
*.min.js
package-lock.json
public/mockServiceWorker.js
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"semi": true,
"singleQuote": true,
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "es5",
"bracketSpacing": true,
"arrowParens": "avoid",
"endOfLine": "lf"
}
8 changes: 2 additions & 6 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
/** @type { import('@storybook/react-vite').StorybookConfig } */
const config = {
stories: ['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-interactions'],
framework: {
name: '@storybook/react-vite',
options: {},
Expand All @@ -14,4 +10,4 @@ const config = {
autodocs: 'tag',
},
};
export default config;
export default config;
2 changes: 1 addition & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ const preview = {
},
};

export default preview;
export default preview;
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[Book Store](https://testplane-bookstore.website.yandexcloud.net/) for Testplane examples

### Getting started

1. nvm use
2. npm ci
3. npm run build
Expand Down
90 changes: 90 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import js from '@eslint/js';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import prettierConfig from 'eslint-config-prettier';

export default [
{
ignores: ['dist', 'node_modules', 'public/mockServiceWorker.js'],
},
// Config files (Node.js environment)
{
files: ['*.config.js', '*.config.cjs'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
__dirname: 'readonly',
__filename: 'readonly',
require: 'readonly',
module: 'readonly',
exports: 'writable',
process: 'readonly',
},
},
rules: {
...js.configs.recommended.rules,
},
},
// React application files
{
files: ['src/**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
window: 'readonly',
document: 'readonly',
navigator: 'readonly',
console: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
fetch: 'readonly',
localStorage: 'readonly',
sessionStorage: 'readonly',
FormData: 'readonly',
URL: 'readonly',
URLSearchParams: 'readonly',
alert: 'readonly',
confirm: 'readonly',
prompt: 'readonly',
},
},
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...js.configs.recommended.rules,
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'react/prop-types': 'off',
'react/no-unescaped-entities': 'off',
'no-unused-vars': [
'error',
{
varsIgnorePattern: '^React$',
argsIgnorePattern: '^_',
},
],
// Disable formatting rules that conflict with Prettier
...prettierConfig.rules,
},
settings: {
react: {
version: 'detect',
},
},
},
];
22 changes: 8 additions & 14 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">

<head>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="BookStore - Online bookstore for all your reading needs" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Merriweather:wght@400;700&display=swap"
rel="stylesheet">
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
<link rel="stylesheet" href="https://testplane-bookstore.website.yandexcloud.net/assets/fonts/index.css" />
<title>BookStore</title>
</head>
</head>

<body>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>

</html>
</body>
</html>
Loading