Skip to content

Commit

Permalink
Update readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenTeaCake committed Apr 10, 2024
1 parent bd52ca7 commit fafe212
Show file tree
Hide file tree
Showing 7 changed files with 180 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
'plugin:storybook/recommended',
'prettier',
],
ignorePatterns: ['!.storybook', 'dist', 'loader', 'www', '.eslintrc.cjs'],
ignorePatterns: ['!.storybook', 'dist', 'loader', 'www', '.eslintrc.cjs', 'stencil.config.ts'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
Expand Down
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
# Web Components Library

List of components:

- [switch](/src/components/switch/readme.md)

## Build Flow

### Pre-requisites

- [Node 20 'Iron' (LTS)](https://nodejs.org/en/download) is installed

> There is `.nvmrc` so you can go like this:
>
> ```shell
> # in workspace root
> $ nvm use
> ```
### Build and Check Code

```shell
# go to workspace root
$ cd <workspace_root>
# install dependencies
$ npm install
# (optional) lint code
$ npm run lint
# (optional) format code
$ npm run format
# (optional) run tests
$ npm run test
# build the code
$ pnpm run build
# start development environment at http://localhost:3333/
# ! code should be pre-built for that
$ pnpm run build && pnpm run start
# start storybook to access it at http://localhost:6006/
# ! code should be pre-built for that
$ pnpm run build && pnpm run storybook
```
166 changes: 121 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"scripts": {
"build": "stencil build",
"clean": "npx rimraf -g **/.DS_Store .stencil dist docs loader node_modules storybook-static www",
"lint": "eslint . --ext js,jsx,ts,tsx --fix --ignore-path .gitignore --report-unused-disable-directives --max-warnings 0",
"format": "prettier --write --ignore-unknown .",
"start": "stencil build --dev --watch --serve",
Expand All @@ -23,7 +24,6 @@
"test:unit:watch": "stencil test --spec --watchAll",
"test:e2e": "stencil test --e2e",
"test:e2e:watch": "stencil test --e2e --watchAll",
"generate": "stencil generate",
"prepare": "husky",
"storybook": "storybook dev -p 6006",
"storybook:build": "storybook build",
Expand Down Expand Up @@ -61,6 +61,7 @@
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"puppeteer": "^21.11.0",
"rimraf": "^5.0.5",
"serve": "^14.2.1",
"storybook": "^8.0.6"
},
Expand All @@ -86,7 +87,7 @@
],
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
"eslint --fix --ignore-path .gitignore --report-unused-disable-directives --max-warnings 0"
"eslint --fix --ignore-path .gitignore --report-unused-disable-directives"
],
"*": [
"prettier --write --ignore-unknown"
Expand Down
3 changes: 2 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<script type="module" src="/build/gtc-components.esm.js"></script>
<script nomodule src="/build/gtc-components.js"></script>
</head>

<body>
<gtc-switch />
<gtc-switch checked="false" />
</body>
</html>
6 changes: 5 additions & 1 deletion stencil.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ import { sass } from '@stencil/sass';
export const config: Config = {
namespace: 'gtc-components',
plugins: [sass()],
extras: {
enableImportInjection: true,
},
outputTargets: [
{
type: 'dist',
esmLoaderPath: '../loader',
},
{
type: 'dist-custom-elements',
customElementsExportBehavior: 'auto-define-custom-elements',
// customElementsExportBehavior: 'auto-define-custom-elements',
customElementsExportBehavior: 'single-export-module',
externalRuntime: false,
},
{
Expand Down
12 changes: 8 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
"target": "es2017",
"lib": ["dom", "es2017"],
"module": "esnext",

/* Bundler mode */
"moduleResolution": "node",
"resolveJsonModule": true,
"jsx": "react",
"jsxFactory": "h",

/* Linting */
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
Expand All @@ -33,6 +31,12 @@
"strictPropertyInitialization": false,
"useUnknownInCatchVariables": true
},
"include": [".storybook/main.js", ".storybook/preview.js", "src", "stencil.config.ts"],
"exclude": ["node_modules"]
"include": ["src"],
"exclude": [
".storybook",
"node_modules",
"src/stories",
"src/**/*.stories.ts",
"stencil.config.ts"
]
}

0 comments on commit fafe212

Please sign in to comment.