Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Main #31

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
Binary file added .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
.vscode/
build/
.VSCodeCounter/
.DS_Store
.DS_Store/
dist/

# User-specific files
*.rsuser
Expand Down
59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,62 @@ SenseUI is a Web Components & Custom Elements for Future Web Applications.
- 基础样式采用stylus;
- 支持typescript开发。

```bash
npm i @sense/timer
```

## Usage

```html
<script type="module">
import '@sense/s-timer.js';
</script>

<s-timer></s-timer>
```

## Linting and formatting

To scan the project for linting and formatting errors, run

```bash
npm run lint
```

To automatically fix linting and formatting errors, run

```bash
npm run format
```

## Testing with Web Test Runner

To execute a single test run:

```bash
npm run test
```

To run the tests in interactive watch mode run:

```bash
npm run test:watch
```
## Tooling configs

For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.

If you customize the configuration a lot, you can consider moving them to individual files.

## Local Demo with `web-dev-server`

```bash
npm start
```

To run a local development server that serves the basic demo located in `demo/index.html`


## Browser Support

The polyfills are intended to work in the latest versions of evergreen browsers. See below
Expand Down Expand Up @@ -60,7 +116,8 @@ npm run build //打包
- language-stylus
- [开发备忘文档](./public/doc.md)

##
## base on
This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.

http://flatfull.com/themes/flatkit/#home

Expand Down
27 changes: 27 additions & 0 deletions config/web-dev-server.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';

/** Use Hot Module replacement by adding --hmr to the start command */
const hmr = process.argv.includes('--hmr');

export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
open: '/demo/',
/** Use regular watch mode if HMR is not enabled. */
watch: !hmr,
/** Resolve bare module imports */
nodeResolve: {
exportConditions: ['browser', 'development'],
},

/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
// esbuildTarget: 'auto'

/** Set appIndex to enable SPA routing */
// appIndex: 'demo/index.html',

plugins: [
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
],

// See documentation for all available options
});
41 changes: 41 additions & 0 deletions config/web-test-runner.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// import { playwrightLauncher } from '@web/test-runner-playwright';

const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];

export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
/** Test files to run */
files: 'dist/test/**/*.test.js',

/** Resolve bare module imports */
nodeResolve: {
exportConditions: ['browser', 'development'],
},

/** Filter out lit dev mode logs */
filterBrowserLogs(log) {
for (const arg of log.args) {
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
return false;
}
}
return true;
},

/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
// esbuildTarget: 'auto',

/** Amount of browsers to run concurrently */
// concurrentBrowsers: 2,

/** Amount of test files per browser to test concurrently */
// concurrency: 1,

/** Browsers to run tests on */
// browsers: [
// playwrightLauncher({ product: 'chromium' }),
// playwrightLauncher({ product: 'firefox' }),
// playwrightLauncher({ product: 'webkit' }),
// ],

// See documentation for all available options
});
Loading