Skip to content

Commit

Permalink
Merge pull request #63 from syakoo/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
syakoo authored Nov 23, 2023
2 parents dfa4439 + 2d29802 commit d23f86e
Show file tree
Hide file tree
Showing 54 changed files with 1,128 additions and 557 deletions.
2 changes: 2 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
NEXT_PUBLIC_API_BASE_PATH="http://localhost:8000"
NEXT_PUBLIC_API_KEY="dummy-api-key"
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=
API_ADMIN_PASS="dummy-admin-pass"
ENABLE_BUILD_CONTENTS=
85 changes: 85 additions & 0 deletions .scaffdog/component.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
name: "component"
root: "."
output: "./src/**/*"
ignore: []
questions:
name: "コンポーネント名を入力してください"
---

# `{{ inputs.name | pascal }}/index.ts`

```typescript
export { {{ inputs.name | pascal }} } from "./{{ inputs.name | pascal }}";
```

# `{{ inputs.name | pascal }}/{{ inputs.name | pascal }}.tsx`

```tsx
type {{ inputs.name | pascal }}Props = {
children: React.ReactNode;
};

export const {{ inputs.name | pascal }}: React.FC<{{ inputs.name | pascal }}Props> = ({ children }) => {
return <div>{children}</div>;
};

```

# `{{ inputs.name | pascal }}/{{ inputs.name | pascal }}.css.ts`

```typescript

```

# `{{ inputs.name | pascal }}/{{ inputs.name | pascal }}.stories.tsx`

```tsx
import type { Meta, StoryObj } from "@storybook/react";

import { {{ inputs.name | pascal }} } from ".";

const meta = {
component: {{ inputs.name | pascal }},
parameters: {
layout: "fullscreen",
},
} satisfies Meta<typeof {{ inputs.name | pascal }}>;

export default meta;

type Story = StoryObj<typeof meta>;
export const Sample: Story = {
args: {
children: <div>children</div>,
},
};

```

# `{{ inputs.name | pascal }}/{{ inputs.name | pascal }}.test.tsx`

```tsx
import { composeStories } from "@storybook/react";
import { act, render } from "@testing-library/react";

import * as stories from "./{{ inputs.name | pascal }}.stories";

const { ...otherStories } = composeStories(stories);

describe("{{ inputs.name | pascal }}", () => {
const testCases = Object.values(otherStories).map(
(Story) => [Story.storyName, Story] as const,
);
test.each(testCases)("renders %s", async (_, Story) => {
const tree = render(<Story />);
await act(async () => {
if (Story.play) {
await Story.play({ canvasElement: tree.container });
}
});

expect(tree.baseElement).toMatchSnapshot();
});
});
```
3 changes: 3 additions & 0 deletions .scaffdog/config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
files: ["*"],
};
14 changes: 13 additions & 1 deletion .env.template → .scaffdog/env.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
---
name: "env"
root: "."
output: "."
ignore: []
---

# `.env.local`

```bash
NEXT_PUBLIC_API_BASE_PATH="http://localhost:8000"
NEXT_PUBLIC_API_KEY="dummy-api-key"
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=
API_ADMIN_PASS=
ENABLE_BUILD_CONTENTS=
ENABLE_BUILD_CONTENTS=

```
38 changes: 38 additions & 0 deletions .scaffdog/writing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: "writing"
root: "./src/contents/writings"
output: "."
ignore: []
questions:
id: "id を入力してください: (例 20231118)"
type:
message: "writing の種類はどれですか?"
choices:
- "diary"
- "note"
- "article"
initial: "note"
index:
confirm: "検索結果に表示しますか?"
initial: false
---

# `{{ inputs.id }}/index.mdx`

```mdx
---
id: "{{ inputs.id }}"
type: "{{ inputs.type }}"
title: "Sample Writing"
published: "{{ date "YYYY-MM-DD" }}"
{{ inputs.index ? "" : "noindex: true" }}
tags:
- "雑記"
---

導入文

## Sample title

本文
```
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"autodocs",
"commitlint",
"ress",
"hygen",
"metas",
"katex",
"rehype",
"fontsource",
"noto-sans-jp",
"fira-code",
"roboto"
"roboto",
"scaffdog"
]
}
10 changes: 0 additions & 10 deletions _templates/component/new/component.tsx.t

This file was deleted.

3 changes: 0 additions & 3 deletions _templates/component/new/css.ts.t

This file was deleted.

4 changes: 0 additions & 4 deletions _templates/component/new/index.ts.t

This file was deleted.

22 changes: 0 additions & 22 deletions _templates/component/new/prompt.cjs

This file was deleted.

21 changes: 0 additions & 21 deletions _templates/component/new/story.tsx.t

This file was deleted.

24 changes: 0 additions & 24 deletions _templates/component/new/test.tsx.t

This file was deleted.

19 changes: 0 additions & 19 deletions _templates/writings/new/index.mdx.t

This file was deleted.

23 changes: 0 additions & 23 deletions _templates/writings/new/prompt.cjs

This file was deleted.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"type-check": "tsc --noEmit",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"generate:component": "hygen component new",
"generate:writing": "hygen writings new"
"generate": "scaffdog generate"
},
"simple-git-hooks": {
"commit-msg": "pnpm exec commitlint --edit ${1} && pnpm exec emoji-prefix-commit",
Expand Down Expand Up @@ -103,7 +102,6 @@
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-unused-imports": "^3.0.0",
"hygen": "^6.2.11",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^14.0.1",
Expand All @@ -112,6 +110,7 @@
"npm-run-all": "^4.1.5",
"prettier": "^3.1.0",
"prop-types": "^15.8.1",
"scaffdog": "^3.0.0",
"simple-git-hooks": "^2.9.0",
"storybook": "^7.5.3",
"ts-jest": "^29.1.1",
Expand Down
Loading

0 comments on commit d23f86e

Please sign in to comment.