create-stencil-components 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/LICENSE.md +21 -0
- package/README.md +55 -0
- package/dist/index.mjs +396 -0
- package/dist/index.mjs.map +1 -0
- package/dist/templates/base/.editorconfig +15 -0
- package/dist/templates/base/.eslintignore +4 -0
- package/dist/templates/base/.gemini/settings.json +13 -0
- package/dist/templates/base/.husky/commit-msg +1 -0
- package/dist/templates/base/.husky/install.mjs +6 -0
- package/dist/templates/base/.husky/pre-commit +2 -0
- package/dist/templates/base/.mcp.json +12 -0
- package/dist/templates/base/.nvmrc +1 -0
- package/dist/templates/base/.prettierignore +2 -0
- package/dist/templates/base/.stylelintignore +0 -0
- package/dist/templates/base/AGENTS.md +118 -0
- package/dist/templates/base/CLAUDE.md +16 -0
- package/dist/templates/base/README.md +83 -0
- package/dist/templates/base/commitlint.config.mjs +1 -0
- package/dist/templates/base/docs/CODE_OF_CONDUCT.md +122 -0
- package/dist/templates/base/docs/CONTRIBUTING.md +103 -0
- package/dist/templates/base/docs/LICENSE.md +21 -0
- package/dist/templates/base/docs/RELEASE.md +95 -0
- package/dist/templates/base/docs/STYLE_GUIDE.md +128 -0
- package/dist/templates/base/eslint.config.mjs +37 -0
- package/dist/templates/base/gitignore +32 -0
- package/dist/templates/base/nx.json +36 -0
- package/dist/templates/base/package.json +43 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/CHANGELOG.md +0 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/README.md +74 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/project.json +144 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/src/components/my-component/my-component.scss +3 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/src/components/my-component/my-component.tsx +32 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/src/components/my-component/readme.md +19 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/src/components/my-component/test/my-component.e2e.ts +32 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/src/components/my-component/test/my-component.spec.ts +36 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/src/components.d.ts +61 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/src/index.html +14 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/src/index.ts +12 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/src/main.scss +0 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/src/utils/utils.spec.ts +19 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/src/utils/utils.ts +3 -0
- package/dist/templates/base/packages/components-{{PROJECT_NAME_KEBAB}}-core/tsconfig.json +12 -0
- package/dist/templates/base/prettier.config.mjs +19 -0
- package/dist/templates/base/stylelint.config.mjs +25 -0
- package/dist/templates/base/tsconfig.base.json +23 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-angular/CHANGELOG.md +0 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-angular/README.md +108 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-angular/ng-package.json +6 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-angular/package.json +27 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-angular/project.json +93 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-angular/src/components-{{PROJECT_NAME_KEBAB}}.module.ts +20 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-angular/src/directives/.gitkeep +0 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-angular/src/index.ts +3 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-angular/standalone/ng-package.json +6 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-angular/standalone/src/directives/.gitkeep +0 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-angular/standalone/src/index.ts +1 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-angular/tsconfig.json +41 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-core/package.json +85 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-core/stencil.config.ts +90 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-react/CHANGELOG.md +0 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-react/README.md +97 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-react/package.json +48 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-react/project.json +92 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-react/src/components/index.ts +1 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-react/src/index.ts +1 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-react/tsconfig.json +36 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-vue/CHANGELOG.md +0 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-vue/README.md +78 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-vue/package.json +43 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-vue/project.json +92 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-vue/src/components/index.ts +1 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-vue/src/index.ts +1 -0
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-vue/tsconfig.json +39 -0
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-angular/CHANGELOG.md +0 -0
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-angular/README.md +108 -0
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-angular/ng-package.json +6 -0
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-angular/package.json +27 -0
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-angular/project.json +93 -0
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-angular/src/components-{{PROJECT_NAME_KEBAB}}.module.ts +20 -0
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-angular/src/directives/.gitkeep +0 -0
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-angular/src/index.ts +3 -0
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-angular/standalone/ng-package.json +6 -0
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-angular/standalone/src/directives/.gitkeep +0 -0
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-angular/standalone/src/index.ts +1 -0
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-angular/tsconfig.json +41 -0
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-core/package.json +83 -0
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-core/stencil.config.ts +72 -0
- package/dist/templates/variants/react/packages/components-{{PROJECT_NAME_KEBAB}}-core/package.json +83 -0
- package/dist/templates/variants/react/packages/components-{{PROJECT_NAME_KEBAB}}-core/stencil.config.ts +67 -0
- package/dist/templates/variants/react/packages/components-{{PROJECT_NAME_KEBAB}}-react/CHANGELOG.md +0 -0
- package/dist/templates/variants/react/packages/components-{{PROJECT_NAME_KEBAB}}-react/README.md +97 -0
- package/dist/templates/variants/react/packages/components-{{PROJECT_NAME_KEBAB}}-react/package.json +48 -0
- package/dist/templates/variants/react/packages/components-{{PROJECT_NAME_KEBAB}}-react/project.json +92 -0
- package/dist/templates/variants/react/packages/components-{{PROJECT_NAME_KEBAB}}-react/src/components/index.ts +1 -0
- package/dist/templates/variants/react/packages/components-{{PROJECT_NAME_KEBAB}}-react/src/index.ts +1 -0
- package/dist/templates/variants/react/packages/components-{{PROJECT_NAME_KEBAB}}-react/tsconfig.json +36 -0
- package/dist/templates/variants/vue/packages/components-{{PROJECT_NAME_KEBAB}}-core/package.json +83 -0
- package/dist/templates/variants/vue/packages/components-{{PROJECT_NAME_KEBAB}}-core/stencil.config.ts +67 -0
- package/dist/templates/variants/vue/packages/components-{{PROJECT_NAME_KEBAB}}-vue/CHANGELOG.md +0 -0
- package/dist/templates/variants/vue/packages/components-{{PROJECT_NAME_KEBAB}}-vue/README.md +78 -0
- package/dist/templates/variants/vue/packages/components-{{PROJECT_NAME_KEBAB}}-vue/package.json +43 -0
- package/dist/templates/variants/vue/packages/components-{{PROJECT_NAME_KEBAB}}-vue/project.json +92 -0
- package/dist/templates/variants/vue/packages/components-{{PROJECT_NAME_KEBAB}}-vue/src/components/index.ts +1 -0
- package/dist/templates/variants/vue/packages/components-{{PROJECT_NAME_KEBAB}}-vue/src/index.ts +1 -0
- package/dist/templates/variants/vue/packages/components-{{PROJECT_NAME_KEBAB}}-vue/tsconfig.json +39 -0
- package/dist/templates/variants/web-components/packages/components-{{PROJECT_NAME_KEBAB}}-core/package.json +82 -0
- package/dist/templates/variants/web-components/packages/components-{{PROJECT_NAME_KEBAB}}-core/stencil.config.ts +58 -0
- package/package.json +60 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Agent Instructions for this repository
|
|
2
|
+
|
|
3
|
+
This repository is an Nx monorepo that utilizes StencilJS, TypeScript, and SCSS for building web components.
|
|
4
|
+
|
|
5
|
+
You are an expert in Nx, StencilJS, TypeScript, SCSS and scalable web application development. You write functional, maintainable, performant, and
|
|
6
|
+
accessible code following StencilJS, TypeScript, and SCSS best practices. When assisting with this codebase, adhere to these standards to ensure
|
|
7
|
+
compatibility, performance, and type safety.
|
|
8
|
+
|
|
9
|
+
## 1. Project Overview
|
|
10
|
+
|
|
11
|
+
- **Framework:** StencilJS (latest)
|
|
12
|
+
- **Language:** TypeScript
|
|
13
|
+
- **Styling:** CSS/SASS (Shadow DOM enabled by default)
|
|
14
|
+
- **Testing:** Vitest / Jest / Puppeteer
|
|
15
|
+
|
|
16
|
+
## 2. Component Structure
|
|
17
|
+
|
|
18
|
+
Always follow the standard Stencil component decorator pattern:
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { Component, Host, h, Prop, State, Event, EventEmitter } from '@stencil/core';
|
|
22
|
+
|
|
23
|
+
@Component({
|
|
24
|
+
tag: 'my-component',
|
|
25
|
+
styleUrl: 'my-component.scss',
|
|
26
|
+
shadow: true,
|
|
27
|
+
})
|
|
28
|
+
export class MyComponent {
|
|
29
|
+
/** Public properties */
|
|
30
|
+
@Prop() label: string;
|
|
31
|
+
|
|
32
|
+
/** Internal state */
|
|
33
|
+
@State() isActive: boolean = false;
|
|
34
|
+
|
|
35
|
+
/** Custom events */
|
|
36
|
+
@Event() clicked: EventEmitter<void>;
|
|
37
|
+
|
|
38
|
+
private handleClick = () => {
|
|
39
|
+
this.isActive = !this.isActive;
|
|
40
|
+
this.clicked.emit();
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
render() {
|
|
44
|
+
return (
|
|
45
|
+
<Host>
|
|
46
|
+
<button onClick={this.handleClick}>
|
|
47
|
+
{this.label} - {this.isActive ? 'Active' : 'Inactive'}
|
|
48
|
+
</button>
|
|
49
|
+
</Host>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 3. TypeScript Guidelines
|
|
56
|
+
|
|
57
|
+
- **Strict Typing:** Avoid `any`. Define interfaces for all complex Prop types.
|
|
58
|
+
- **Decorators:** Use `@Prop()`, `@State()`, `@Method()`, `@Watch()`, and `@Listen()` correctly.
|
|
59
|
+
- **Null Safety:** Use optional chaining `?.` and nullish coalescing `??`.
|
|
60
|
+
- **Enums:** Use `const enum` for performance or literal types for simplicity in Props.
|
|
61
|
+
|
|
62
|
+
## 4. Best Practices
|
|
63
|
+
|
|
64
|
+
- **Shadow DOM:** Use `shadow: true` unless there is a specific requirement to use scoped or global CSS.
|
|
65
|
+
- **Functional Components:** Use simple functional components (returning JSX) for UI-only elements that don't need the Stencil lifecycle.
|
|
66
|
+
- **Reactivity:** Remember that Stencil only tracks changes to `@State` and `@Prop`. Arrays and objects must be reassigned (immutable patterns) to trigger a re-render:
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// Correct
|
|
70
|
+
this.items = [...this.items, newItem];
|
|
71
|
+
// Incorrect
|
|
72
|
+
this.items.push(newItem);
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- **Performance:** Minimize use of `@Watch` to avoid unnecessary renders. Use the `render()` method efficiently.
|
|
76
|
+
|
|
77
|
+
## 5. Styling Rules
|
|
78
|
+
|
|
79
|
+
- Use CSS Variables for theming to allow consumers to style components from outside the Shadow DOM.
|
|
80
|
+
- Prefer the `:host` selector for base component styling.
|
|
81
|
+
- Use the `<Host>` functional component in the `render()` method to apply classes or attributes to the component container itself.
|
|
82
|
+
|
|
83
|
+
## 6. Testing
|
|
84
|
+
|
|
85
|
+
- **Spec Tests:** Focus on logic and rendering.
|
|
86
|
+
- **E2E Tests:** Use for interaction and cross-browser behavior.
|
|
87
|
+
- Ensure all new components include a `.spec.ts` file.
|
|
88
|
+
|
|
89
|
+
## 7. Documentation
|
|
90
|
+
|
|
91
|
+
- Use JSDoc comments for all `@Prop`, `@Method`, and `@Event` definitions. Stencil's compiler uses these to generate the `readme.md` files.
|
|
92
|
+
|
|
93
|
+
## 8. Useful Commands
|
|
94
|
+
|
|
95
|
+
| Command | Description |
|
|
96
|
+
| ----------------------- | ------------------------------------------- |
|
|
97
|
+
| `npx run-many -t clean` | Deletes build outputs for all the packages. |
|
|
98
|
+
| `npx run-many -t build` | Builds all the packages. |
|
|
99
|
+
| `npx run-many -t lint` | Validates the code for all the packages. |
|
|
100
|
+
| `npx run-many -t test` | Performs a test run for all the packages. |
|
|
101
|
+
|
|
102
|
+
## When stuck
|
|
103
|
+
|
|
104
|
+
- Ask a clarifying question, propose a short plan, or open a draft PR with notes
|
|
105
|
+
|
|
106
|
+
<!-- nx configuration start-->
|
|
107
|
+
<!-- Leave the start & end comments to automatically receive updates. -->
|
|
108
|
+
|
|
109
|
+
## General Guidelines for working with Nx
|
|
110
|
+
|
|
111
|
+
- When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through `nx` (i.e. `nx run`, `nx run-many`, `nx affected`) instead of using the underlying tooling directly
|
|
112
|
+
- You have access to the Nx MCP server and its tools, use them to help the user
|
|
113
|
+
- When answering questions about the repository, use the `nx_workspace` tool first to gain an understanding of the workspace architecture where applicable.
|
|
114
|
+
- When working in individual projects, use the `nx_project_details` mcp tool to analyze and understand the specific project structure and dependencies
|
|
115
|
+
- For questions around nx configuration, best practices or if you're unsure, use the `nx_docs` tool to get relevant, up-to-date docs. Always use this instead of assuming things about nx configuration
|
|
116
|
+
- If the user needs help with an Nx configuration or project graph error, use the `nx_workspace` tool to get any errors
|
|
117
|
+
|
|
118
|
+
<!-- nx configuration end-->
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
Strictly follow the rules in ./AGENTS.md
|
|
3
|
+
|
|
4
|
+
<!-- nx configuration start-->
|
|
5
|
+
<!-- Leave the start & end comments to automatically receive updates. -->
|
|
6
|
+
|
|
7
|
+
# General Guidelines for working with Nx
|
|
8
|
+
|
|
9
|
+
- When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through `nx` (i.e. `nx run`, `nx run-many`, `nx affected`) instead of using the underlying tooling directly
|
|
10
|
+
- You have access to the Nx MCP server and its tools, use them to help the user
|
|
11
|
+
- When answering questions about the repository, use the `nx_workspace` tool first to gain an understanding of the workspace architecture where applicable.
|
|
12
|
+
- When working in individual projects, use the `nx_project_details` mcp tool to analyze and understand the specific project structure and dependencies
|
|
13
|
+
- For questions around nx configuration, best practices or if you're unsure, use the `nx_docs` tool to get relevant, up-to-date docs. Always use this instead of assuming things about nx configuration
|
|
14
|
+
- If the user needs help with an Nx configuration or project graph error, use the `nx_workspace` tool to get any errors
|
|
15
|
+
|
|
16
|
+
<!-- nx configuration end-->
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# @{{ORGANIZATION_NAME}}/{{PROJECT_NAME_KEBAB}}
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Build modern, lightning-fast web applications for any platform using a single codebase. This toolkit utilizes [web components](https://www.webcomponents.org/introduction) to ensure premium quality and streamlined development.
|
|
6
|
+
|
|
7
|
+
Stencil is a specialized compiler designed to generate standards-compliant Web Components (Custom Elements) compatible with any browser. By integrating premium features from modern frontend frameworks—including TypeScript, JSX, a virtual DOM, and reactive one-way data binding—into a compile-time engine, Stencil produces high-performance components. These components are framework-agnostic, allowing them to integrate seamlessly with any existing stack or operate as standalone elements.
|
|
8
|
+
|
|
9
|
+
**Core Tech Stack:**
|
|
10
|
+
|
|
11
|
+
- **Stencil**: The underlying Web Component compiler.
|
|
12
|
+
- **TypeScript**: Ensures type safety and robust development.
|
|
13
|
+
- **Nx**: Manages the build system and monorepo architecture.
|
|
14
|
+
- **Sass**: Handles advanced, scalable CSS styling.
|
|
15
|
+
- **Eslint & Stylelint**: Maintain code quality through static analysis for scripts and styles.
|
|
16
|
+
- **Prettier**: Enforces consistent code formatting across the project.
|
|
17
|
+
|
|
18
|
+
## Build / Setup
|
|
19
|
+
|
|
20
|
+
Follow these steps to set up and run the project locally.
|
|
21
|
+
|
|
22
|
+
### Prerequisites
|
|
23
|
+
|
|
24
|
+
- **Volta:** The workspace uses [volta](https://volta.sh) to manage its npm and Node versions. [Install it](https://docs.volta.sh/guide/getting-started) before proceeding.
|
|
25
|
+
- There's no need to install a specific version of npm or Node right now, it shall be done automatically for you.
|
|
26
|
+
- **IDE:** We recommend [VS Code](https://code.visualstudio.com/) with the [Stencil Tools](https://marketplace.visualstudio.com/items?itemName=ionic.stencil-helper) extension.
|
|
27
|
+
|
|
28
|
+
### Installation & Running
|
|
29
|
+
|
|
30
|
+
1. **Install dependencies:**
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
2. **Build for production:**
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx nx run-many -t build
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
3. **Run unit tests:**
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx nx run-many -t test
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Folder Hierarchy
|
|
49
|
+
|
|
50
|
+
The repository structure is organized as follows:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
├── .eslintignore/ # ESLint ignore rules
|
|
54
|
+
├── .gitignore # Git ignore rules
|
|
55
|
+
├── .husky/ # Git hooks configuration
|
|
56
|
+
├── .mcp.json # MCP configuration
|
|
57
|
+
├── .nvmrc # NVM configuration
|
|
58
|
+
├── .prettierignore # Prettier ignore rules
|
|
59
|
+
├── .stylelintignore # Stylelint ignore rules
|
|
60
|
+
├── docs/ # Documentation files
|
|
61
|
+
│ ├── CONTRIBUTING.md # Contributing guidelines
|
|
62
|
+
│ ├── CODE_OF_CONDUCT.md # Contributor Code of Conduct
|
|
63
|
+
| ├── LICENSE.md # License file
|
|
64
|
+
│ └── STYLE_GUIDE.md # Stencil Style Guide
|
|
65
|
+
├── packages/ # Directory for npm workspaces
|
|
66
|
+
│ └── [package-name]/ # Individual Stencil component library
|
|
67
|
+
├── AGENTS.md # AI context and guidelines for Nx
|
|
68
|
+
├── CLAUDE.md # AI context and guidelines for Nx
|
|
69
|
+
├── commitlint.config.mjs # Commitlint configuration
|
|
70
|
+
├── eslint.config.mjs # ESLint configuration
|
|
71
|
+
├── nx.json # Nx build system configuration
|
|
72
|
+
├── package-lock.json # NPM lock file
|
|
73
|
+
├── package.json # Root configuration: workspaces, dependencies, and scripts
|
|
74
|
+
├── prettier.config.mjs # Prettier configuration
|
|
75
|
+
├── stylelint.config.mjs # Stylelint configuration
|
|
76
|
+
├── tsconfig.base.json # Base TypeScript configuration
|
|
77
|
+
└── README.md # Project documentation
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Contributing
|
|
81
|
+
|
|
82
|
+
Thanks for your interest in contributing!
|
|
83
|
+
Please take a moment to read up on our guidelines for [contributing](/docs/CONTRIBUTING.md). Please note that this project is released with a [Contributor Code of Conduct](/docs/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default { extends: ['@commitlint/config-conventional'] };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Contributor Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include the ability to:
|
|
19
|
+
|
|
20
|
+
* Demonstrate empathy and kindness towards people
|
|
21
|
+
* Be respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Give and gracefully accept constructive feedback
|
|
23
|
+
* Accept responsibility and apologize to those affected by our mistakes,
|
|
24
|
+
and learn from the experience
|
|
25
|
+
* Focus on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement.
|
|
63
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
64
|
+
|
|
65
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
66
|
+
reporter of any incident.
|
|
67
|
+
|
|
68
|
+
## Enforcement Guidelines
|
|
69
|
+
|
|
70
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
71
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
72
|
+
|
|
73
|
+
### 1. Correction
|
|
74
|
+
|
|
75
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
76
|
+
unprofessional or unwelcome in the community.
|
|
77
|
+
|
|
78
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
79
|
+
clarity around the nature of the violation and an explanation of why the
|
|
80
|
+
behavior was inappropriate. A public apology may be requested.
|
|
81
|
+
|
|
82
|
+
### 2. Warning
|
|
83
|
+
|
|
84
|
+
**Community Impact**: A violation through a single incident or series
|
|
85
|
+
of actions.
|
|
86
|
+
|
|
87
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
88
|
+
interaction with the people involved, including unsolicited interaction with
|
|
89
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
90
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
91
|
+
like social media. Violating these terms may lead to a temporary or
|
|
92
|
+
permanent ban.
|
|
93
|
+
|
|
94
|
+
### 3. Temporary Ban
|
|
95
|
+
|
|
96
|
+
**Community Impact**: A serious violation of community standards, including
|
|
97
|
+
sustained inappropriate behavior.
|
|
98
|
+
|
|
99
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
100
|
+
communication with the community for a specified period of time. No public or
|
|
101
|
+
private interaction with the people involved, including unsolicited interaction
|
|
102
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
103
|
+
Violating these terms may lead to a permanent ban.
|
|
104
|
+
|
|
105
|
+
### 4. Permanent Ban
|
|
106
|
+
|
|
107
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
108
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
109
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
110
|
+
|
|
111
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
112
|
+
the community.
|
|
113
|
+
|
|
114
|
+
## Attribution
|
|
115
|
+
|
|
116
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
|
|
117
|
+
version 2.0, available at [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html).
|
|
118
|
+
|
|
119
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
120
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
121
|
+
|
|
122
|
+
For answers to common questions about this code of conduct, see the [FAQ](https://www.contributor-covenant.org/faq). Translations are available [at](https://www.contributor-covenant.org/translations).
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
First off, thank you for considering contributing! It is people like you who make this a great tool for the community.
|
|
4
|
+
|
|
5
|
+
## 1. Development Environment
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- **Volta:** The workspace uses [volta](https://volta.sh) to manage its npm and Node versions. [Install it](https://docs.volta.sh/guide/getting-started) before proceeding.
|
|
10
|
+
- There's no need to install a specific version of npm or Node right now, it shall be done automatically for you.
|
|
11
|
+
- **IDE:** We recommend [VS Code](https://code.visualstudio.com/) with the [Stencil Tools](https://marketplace.visualstudio.com/items?itemName=ionic.stencil-helper) extension.
|
|
12
|
+
|
|
13
|
+
### Setup
|
|
14
|
+
|
|
15
|
+
1. Clone the repository:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
git clone https://github.com/your-repo/project-name.git
|
|
19
|
+
cd project-name
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
2. Install dependencies:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
3. Build:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx nx run-many -t build
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This will open a browser window with your component library's collection.
|
|
35
|
+
|
|
36
|
+
## 2. Creating a New Component
|
|
37
|
+
|
|
38
|
+
To maintain consistency, please use the Stencil CLI to generate new components:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx nx run components-{{PROJECT_NAME_KEBAB}}-core:generate
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
*(Enter the component name in kebab-case, e.g., `my-new-button`)*
|
|
45
|
+
|
|
46
|
+
Ensure your new component includes:
|
|
47
|
+
|
|
48
|
+
- A `.tsx` file for logic and rendering.
|
|
49
|
+
- A `.css` or `.scss` file for styling.
|
|
50
|
+
- A `.spec.ts` file for unit tests.
|
|
51
|
+
- A `.e2e.ts` file for end-to-end tests.
|
|
52
|
+
|
|
53
|
+
## 3. Standards & Style
|
|
54
|
+
|
|
55
|
+
Please review our [STYLE_GUIDE.md](./STYLE_GUIDE.md) before submitting code. Key highlights include:
|
|
56
|
+
|
|
57
|
+
- **TypeScript:** Use strict typing; avoid `any`.
|
|
58
|
+
- **Naming:** Components must be `kebab-case`.
|
|
59
|
+
- **Documentation:** Use JSDoc comments on `@Prop`, `@State`, and `@Event`. Stencil uses these to auto-generate `readme.md` files. **Do not manually edit the `readme.md` files in component folders.**
|
|
60
|
+
|
|
61
|
+
## 4. Testing Requirements
|
|
62
|
+
|
|
63
|
+
We cannot accept pull requests without passing tests.
|
|
64
|
+
|
|
65
|
+
- **Run Unit Tests:**
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx nx run-many -t test
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
- **Run E2E Tests:**
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npx nx run-many -t test:e2e
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- **Build Verification:**
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npx nx run-many -t build
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Ensure that your component remains accessible (A11y). Use tools like Axe to verify that your web components meet WCAG standards.
|
|
84
|
+
|
|
85
|
+
## 5. Pull Request Process
|
|
86
|
+
|
|
87
|
+
1. **Branching:** Create a feature branch from `main` (e.g., `feat/add-datepicker` or `fix/button-alignment`).
|
|
88
|
+
2. **Commits:** Follow [Conventional Commits](https://www.conventionalcommits.org/) (e.g., `feat: added shadow-dom support`).
|
|
89
|
+
3. **Draft PR:** If your work is in progress, open it as a "Draft".
|
|
90
|
+
4. **Review:** At least one maintainer must review and approve your PR before it can be merged.
|
|
91
|
+
5. **CI:** Ensure the Github Actions (or CI of choice) pass successfully.
|
|
92
|
+
|
|
93
|
+
## 6. Code of Conduct
|
|
94
|
+
|
|
95
|
+
By contributing, you agree to uphold our [Code of Conduct](./CODE_OF_CONDUCT.md). Please be respectful and professional in all interactions.
|
|
96
|
+
|
|
97
|
+
## 7. Useful Scripts
|
|
98
|
+
|
|
99
|
+
- `npx nx run-many -t build`: Production build of the components.
|
|
100
|
+
- `npx nx run-many -t test`: Runs unit tests.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
Questions? Feel free to open an issue or reach out to the maintainers!
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Release Process
|
|
2
|
+
|
|
3
|
+
This project uses [Nx Release](https://nx.dev/features/manage-releases) to manage versioning, changelog generation, and publishing of our StencilJS components.
|
|
4
|
+
|
|
5
|
+
## 1. Prerequisites
|
|
6
|
+
|
|
7
|
+
Before initiating a release, ensure you have the following:
|
|
8
|
+
|
|
9
|
+
- Permissions to push to the `main` branch.
|
|
10
|
+
- A valid `NPM_TOKEN` if publishing to a registry.
|
|
11
|
+
- Clean working directory (all changes committed).
|
|
12
|
+
|
|
13
|
+
## 2. Standard Release Workflow (Dry Run)
|
|
14
|
+
|
|
15
|
+
Always perform a dry run first to inspect what Nx will do without making permanent changes.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx nx release --dry-run
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This command will:
|
|
22
|
+
|
|
23
|
+
1. **Version:** Determine the next version based on [Conventional Commits](https://www.conventionalcommits.org/).
|
|
24
|
+
2. **Changelog:** Generate or update `CHANGELOG.md` files.
|
|
25
|
+
3. **Plan:** Show the summary of changes without committing or tagging.
|
|
26
|
+
|
|
27
|
+
## 3. Executing a Full Release
|
|
28
|
+
|
|
29
|
+
If the dry run looks correct, execute the release. By default, this handles versioning, changelogs, and committing.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx nx release
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### What happens during execution:
|
|
36
|
+
|
|
37
|
+
- **Versioning:** Updates `package.json` in individual component projects and the root.
|
|
38
|
+
- **Changelog:** Updates the root and per-project `CHANGELOG.md` files.
|
|
39
|
+
- **Git:** Commits the changes and creates a Git tag (e.g., `v1.2.3`).
|
|
40
|
+
- **Build:** Nx automatically triggers the `build` target for all affected projects.
|
|
41
|
+
- **Publish:** Uploads the built artifacts to the NPM registry.
|
|
42
|
+
|
|
43
|
+
## 4. Specific Release Scenarios
|
|
44
|
+
|
|
45
|
+
### Preview/Prerelease
|
|
46
|
+
|
|
47
|
+
To create an alpha or beta release:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx nx release --specifier next --preid alpha
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Versioning without Publishing
|
|
54
|
+
|
|
55
|
+
If you want to version the code but manually handle the publish step later:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx nx release version
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Publishing Only
|
|
62
|
+
|
|
63
|
+
If the versions are already bumped and you just need to push to the registry:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx nx release publish
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 5. Continuous Integration (CI)
|
|
70
|
+
|
|
71
|
+
Our CI pipeline (GitHub Actions) is configured to handle releases automatically when code is merged into `main`.
|
|
72
|
+
|
|
73
|
+
1. **Validation:** CI runs `lint`, `test`, and `build`.
|
|
74
|
+
2. **Release:** If validation passes, `nx release` is called.
|
|
75
|
+
3. **Provenance:** We use `--first-release` or standard flags to ensure NPM provenance is recorded where supported.
|
|
76
|
+
|
|
77
|
+
## 6. StencilJS Specifics
|
|
78
|
+
|
|
79
|
+
When releasing Stencil components in an Nx monorepo:
|
|
80
|
+
|
|
81
|
+
- **Distribution Folder:** Ensure the `dist` and `www` folders are correctly defined in each project's `project.json`.
|
|
82
|
+
- **Peer Dependencies:** Nx Release correctly handles internal dependency updates. If `component-a` depends on `component-b`, it will ensure versions remain in sync according to your `nx.json` release configuration.
|
|
83
|
+
|
|
84
|
+
## 7. Troubleshooting
|
|
85
|
+
|
|
86
|
+
- **Version Mismatch:** If versions get out of sync, check the `release` configuration in `nx.json`. We typically use "fixed" versioning (all packages share one version).
|
|
87
|
+
- **Build Failures:** Stencil builds may fail if TypeScript types are missing. Ensure `nx build` passes locally for all affected components before running the release.
|
|
88
|
+
- **OTP:** If your NPM account requires 2FA, use:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npx nx release --otp 123456
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
*For details on configuring the release logic, see the `release` object in `nx.json`.*
|