Skip to content

Commit 83d652a

Browse files
committed
Lower EC2 instance
1 parent e3ac200 commit 83d652a

File tree

8 files changed

+1829
-11
lines changed

8 files changed

+1829
-11
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules
22
.turbo
3-
.idea
3+
.idea
4+
*storybook.log
5+
storybook-static

.storybook/main.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
3+
import { join, dirname } from "path"
4+
5+
/**
6+
* This function is used to resolve the absolute path of a package.
7+
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
8+
*/
9+
function getAbsolutePath(value) {
10+
return dirname(require.resolve(join(value, 'package.json')))
11+
}
12+
13+
/** @type { import('@storybook/react-vite').StorybookConfig } */
14+
const config = {
15+
"stories": [
16+
"../stories/**/*.mdx",
17+
"../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"
18+
],
19+
"addons": [
20+
getAbsolutePath('@chromatic-com/storybook'),
21+
getAbsolutePath('@storybook/addon-docs'),
22+
getAbsolutePath("@storybook/addon-a11y"),
23+
getAbsolutePath("@storybook/addon-vitest")
24+
],
25+
"framework": {
26+
"name": getAbsolutePath('@storybook/react-vite'),
27+
"options": {}
28+
}
29+
};
30+
export default config;

.storybook/preview.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/** @type { import('@storybook/react-vite').Preview } */
2+
const preview = {
3+
parameters: {
4+
controls: {
5+
matchers: {
6+
color: /(background|color)$/i,
7+
date: /Date$/i,
8+
},
9+
},
10+
11+
a11y: {
12+
// 'todo' - show a11y violations in the test UI only
13+
// 'error' - fail CI on a11y violations
14+
// 'off' - skip a11y checks entirely
15+
test: 'todo',
16+
},
17+
},
18+
};
19+
20+
export default preview;

.storybook/vitest.setup.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import * as a11yAddonAnnotations from "@storybook/addon-a11y/preview";
2+
import { setProjectAnnotations } from '@storybook/react-vite';
3+
import * as projectAnnotations from './preview';
4+
5+
// This is an important step to apply the right configuration when testing your stories.
6+
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
7+
setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]);

infrastructure/terraform/live/production/compute/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module "web" {
4848
source = "../../../modules/ec2"
4949

5050
name_prefix = "internship-app-production"
51-
instance_type = "t3a.small"
51+
instance_type = "t3a.nano"
5252
instance_count = 1
5353
instance_root_device_size = 20
5454
subnets = data.aws_subnets.public_subnets.ids

package.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,22 @@
1111
"build": "turbo run build",
1212
"lint": "turbo run lint",
1313
"start": "yarn workspace api run start",
14-
"prisma": "yarn workspace api run prisma"
14+
"prisma": "yarn workspace api run prisma",
15+
"storybook": "storybook dev -p 6006",
16+
"build-storybook": "storybook build"
1517
},
1618
"devDependencies": {
17-
"turbo": "^1.10.13"
19+
"@chromatic-com/storybook": "^4.1.1",
20+
"@storybook/addon-a11y": "^9.1.15",
21+
"@storybook/addon-docs": "^9.1.15",
22+
"@storybook/addon-vitest": "^9.1.15",
23+
"@storybook/react-vite": "^9.1.15",
24+
"prop-types": "^15.8.1",
25+
"storybook": "^9.1.15",
26+
"turbo": "^1.10.13",
27+
"vitest": "^4.0.3",
28+
"playwright": "^1.56.1",
29+
"@vitest/browser-playwright": "^4.0.3",
30+
"@vitest/coverage-v8": "^4.0.3"
1831
}
1932
}

vitest.config.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import path from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
4+
import { defineConfig } from 'vitest/config';
5+
6+
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
7+
8+
import { playwright } from '@vitest/browser-playwright';
9+
10+
const dirname =
11+
typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
12+
13+
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
14+
export default defineConfig({
15+
test: {
16+
projects: [
17+
{
18+
extends: true,
19+
plugins: [
20+
// The plugin will run tests for the stories defined in your Storybook config
21+
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
22+
storybookTest({ configDir: path.join(dirname, '.storybook') }),
23+
],
24+
test: {
25+
name: 'storybook',
26+
browser: {
27+
enabled: true,
28+
headless: true,
29+
provider: playwright({}),
30+
instances: [{ browser: 'chromium' }],
31+
},
32+
setupFiles: ['.storybook/vitest.setup.js'],
33+
},
34+
},
35+
],
36+
},
37+
});

0 commit comments

Comments
 (0)