mirror of
https://github.com/stoatchat/javascript-solid-livekit-components.git
synced 2026-06-30 21:47:55 -04:00
feat: initial commit
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"root": true,
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": ["@typescript-eslint", "no-only-tests", "eslint-comments"],
|
||||
"ignorePatterns": ["node_modules", "dist", "dev", "tsup.config.ts", "vitest.config.ts"],
|
||||
"plugins": ["@typescript-eslint", "eslint-comments"],
|
||||
"ignorePatterns": ["node_modules", "dist", "dev", "tsup.config.ts"],
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json",
|
||||
"tsconfigRootDir": ".",
|
||||
@@ -23,7 +23,6 @@
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
|
||||
"@typescript-eslint/no-unnecessary-condition": "warn",
|
||||
"@typescript-eslint/no-useless-empty-export": "warn",
|
||||
"no-only-tests/no-only-tests": "warn",
|
||||
"eslint-comments/no-unused-disable": "warn"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,201 @@
|
||||
MIT License
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
Copyright (c) 2022 {{me}}
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
1. Definitions.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2024 insertish
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@@ -1,36 +1,27 @@
|
||||
<p>
|
||||
<img width="100%" src="https://assets.solidjs.com/banner?type={{name_of_lib}}&background=tiles&project=%20" alt="{{name_of_lib}}">
|
||||
<img width="100%" src="https://assets.solidjs.com/banner?type=solid-livekit-components&background=tiles&project=%20" alt="solid-livekit-components">
|
||||
</p>
|
||||
|
||||
# {{name_of_lib}}
|
||||
# solid-livekit-components
|
||||
|
||||
[](https://pnpm.io/)
|
||||
|
||||
{{desc_of_lib}}
|
||||
|
||||
> **Note** After using this template, you have to search and replace all `{{name_of_lib}}` and similar strings
|
||||
> with appropriate texts.
|
||||
>
|
||||
> `{{name_of_lib}}` should be a **kebab-case** string representing the name of you monorepo.
|
||||
>
|
||||
> `{{desc_of_lib}}` should be a **Normal case** string with the description of the repository.
|
||||
>
|
||||
> `{{me}}` should be a **kebab-case** string from your profile URL.
|
||||
Solid components for building applications with LiveKit
|
||||
|
||||
## Quick start
|
||||
|
||||
Install it:
|
||||
|
||||
```bash
|
||||
npm i {{name_of_lib}}
|
||||
npm i solid-livekit-components
|
||||
# or
|
||||
yarn add {{name_of_lib}}
|
||||
yarn add solid-livekit-components
|
||||
# or
|
||||
pnpm add {{name_of_lib}}
|
||||
pnpm add solid-livekit-components
|
||||
```
|
||||
|
||||
Use it:
|
||||
|
||||
```tsx
|
||||
import {{name_of_lib}} from '{{name_of_lib}}'
|
||||
import solid-livekit-components from 'solid-livekit-components'
|
||||
```
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { Component } from 'solid-js'
|
||||
import logo from './logo.svg'
|
||||
import styles from './App.module.css'
|
||||
import { Hello } from '../src'
|
||||
|
||||
@@ -7,7 +6,6 @@ const App: Component = () => {
|
||||
return (
|
||||
<div class={styles.App}>
|
||||
<header class={styles.header}>
|
||||
<img src={logo} class={styles.logo} alt="logo" />
|
||||
<h1>
|
||||
<Hello></Hello>
|
||||
</h1>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 166 155.3"><path d="M163 35S110-4 69 5l-3 1c-6 2-11 5-14 9l-2 3-15 26 26 5c11 7 25 10 38 7l46 9 18-30z" fill="#76b3e1"/><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="27.5" y1="3" x2="152" y2="63.5"><stop offset=".1" stop-color="#76b3e1"/><stop offset=".3" stop-color="#dcf2fd"/><stop offset="1" stop-color="#76b3e1"/></linearGradient><path d="M163 35S110-4 69 5l-3 1c-6 2-11 5-14 9l-2 3-15 26 26 5c11 7 25 10 38 7l46 9 18-30z" opacity=".3" fill="url(#a)"/><path d="M52 35l-4 1c-17 5-22 21-13 35 10 13 31 20 48 15l62-21S92 26 52 35z" fill="#518ac8"/><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="95.8" y1="32.6" x2="74" y2="105.2"><stop offset="0" stop-color="#76b3e1"/><stop offset=".5" stop-color="#4377bb"/><stop offset="1" stop-color="#1f3b77"/></linearGradient><path d="M52 35l-4 1c-17 5-22 21-13 35 10 13 31 20 48 15l62-21S92 26 52 35z" opacity=".3" fill="url(#b)"/><linearGradient id="c" gradientUnits="userSpaceOnUse" x1="18.4" y1="64.2" x2="144.3" y2="149.8"><stop offset="0" stop-color="#315aa9"/><stop offset=".5" stop-color="#518ac8"/><stop offset="1" stop-color="#315aa9"/></linearGradient><path d="M134 80a45 45 0 00-48-15L24 85 4 120l112 19 20-36c4-7 3-15-2-23z" fill="url(#c)"/><linearGradient id="d" gradientUnits="userSpaceOnUse" x1="75.2" y1="74.5" x2="24.4" y2="260.8"><stop offset="0" stop-color="#4377bb"/><stop offset=".5" stop-color="#1a336b"/><stop offset="1" stop-color="#1a336b"/></linearGradient><path d="M114 115a45 45 0 00-48-15L4 120s53 40 94 30l3-1c17-5 23-21 13-34z" fill="url(#d)"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.6 KiB |
+13
-14
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"name": "{{name_of_lib}}",
|
||||
"version": "0.0.0",
|
||||
"description": "{{desc_of_lib}}",
|
||||
"name": "solid-livekit-components",
|
||||
"version": "0.0.1",
|
||||
"description": "Solid components for building applications with LiveKit",
|
||||
"license": "MIT",
|
||||
"author": "{{me}}",
|
||||
"author": "insertish",
|
||||
"contributors": [],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/{{me}}/{{name_of_lib}}.git"
|
||||
"url": "git+https://github.com/insertish/solid-livekit-components.git"
|
||||
},
|
||||
"homepage": "https://github.com/{{me}}/{{name_of_lib}}#readme",
|
||||
"homepage": "https://github.com/insertish/solid-livekit-components#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/{{me}}/{{name_of_lib}}/issues"
|
||||
"url": "https://github.com/insertish/solid-livekit-components/issues"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
@@ -43,9 +43,6 @@
|
||||
"scripts": {
|
||||
"dev": "vite serve dev",
|
||||
"build": "tsup",
|
||||
"test": "concurrently pnpm:test:*",
|
||||
"test:client": "vitest",
|
||||
"test:ssr": "pnpm run test:client --mode ssr",
|
||||
"prepublishOnly": "pnpm build",
|
||||
"format": "prettier --ignore-path .gitignore -w \"src/**/*.{js,ts,json,css,tsx,jsx}\" \"dev/**/*.{js,ts,json,css,tsx,jsx}\"",
|
||||
"lint": "concurrently pnpm:lint:*",
|
||||
@@ -57,6 +54,7 @@
|
||||
"solid-js": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.12.2",
|
||||
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
||||
"@typescript-eslint/parser": "^6.1.0",
|
||||
"concurrently": "^8.2.0",
|
||||
@@ -64,16 +62,13 @@
|
||||
"esbuild-plugin-solid": "^0.5.0",
|
||||
"eslint": "^8.45.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-no-only-tests": "^3.1.0",
|
||||
"jsdom": "^22.1.0",
|
||||
"prettier": "3.0.0",
|
||||
"solid-js": "^1.7.8",
|
||||
"tsup": "^7.1.0",
|
||||
"tsup-preset-solid": "^2.0.1",
|
||||
"typescript": "^5.1.6",
|
||||
"vite": "^4.4.6",
|
||||
"vite-plugin-solid": "^2.7.0",
|
||||
"vitest": "^0.33.0"
|
||||
"vite-plugin-solid": "^2.7.0"
|
||||
},
|
||||
"keywords": [
|
||||
"solid"
|
||||
@@ -82,5 +77,9 @@
|
||||
"engines": {
|
||||
"node": ">=18",
|
||||
"pnpm": ">=8.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@livekit/components-core": "^0.9.2",
|
||||
"livekit-client": "^2.0.10"
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+126
-621
File diff suppressed because it is too large
Load Diff
@@ -1,51 +0,0 @@
|
||||
import { createRoot, createSignal } from 'solid-js'
|
||||
import { isServer } from 'solid-js/web'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { Hello, createHello } from '../src'
|
||||
|
||||
describe('environment', () => {
|
||||
it('runs on server', () => {
|
||||
expect(typeof window).toBe('object')
|
||||
expect(isServer).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('createHello', () => {
|
||||
it('Returns a Hello World signal', () =>
|
||||
createRoot(dispose => {
|
||||
const [hello] = createHello()
|
||||
expect(hello()).toBe('Hello World!')
|
||||
dispose()
|
||||
}))
|
||||
|
||||
it('Changes the hello target', () =>
|
||||
createRoot(dispose => {
|
||||
const [hello, setHello] = createHello()
|
||||
setHello('Solid')
|
||||
expect(hello()).toBe('Hello Solid!')
|
||||
dispose()
|
||||
}))
|
||||
})
|
||||
|
||||
describe('Hello', () => {
|
||||
it('renders a hello component', () => {
|
||||
createRoot(() => {
|
||||
const container = (<Hello />) as HTMLDivElement
|
||||
expect(container.outerHTML).toBe('<div>Hello World!</div>')
|
||||
})
|
||||
})
|
||||
|
||||
it('changes the hello target', () =>
|
||||
createRoot(dispose => {
|
||||
const [to, setTo] = createSignal('Solid')
|
||||
const container = (<Hello to={to()} />) as HTMLDivElement
|
||||
expect(container.outerHTML).toBe('<div>Hello Solid!</div>')
|
||||
setTo('Tests')
|
||||
|
||||
// rendering is async
|
||||
queueMicrotask(() => {
|
||||
expect(container.outerHTML).toBe('<div>Hello Tests!</div>')
|
||||
dispose()
|
||||
})
|
||||
}))
|
||||
})
|
||||
@@ -1,30 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { isServer, renderToString } from 'solid-js/web'
|
||||
import { Hello, createHello } from '../src'
|
||||
|
||||
describe('environment', () => {
|
||||
it('runs on server', () => {
|
||||
expect(typeof window).toBe('undefined')
|
||||
expect(isServer).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('createHello', () => {
|
||||
it('Returns a Hello World signal', () => {
|
||||
const [hello] = createHello()
|
||||
expect(hello()).toBe('Hello World!')
|
||||
})
|
||||
|
||||
it('Changes the hello target', () => {
|
||||
const [hello, setHello] = createHello()
|
||||
setHello('Solid')
|
||||
expect(hello()).toBe('Hello Solid!')
|
||||
})
|
||||
})
|
||||
|
||||
describe('Hello', () => {
|
||||
it('renders a hello component', () => {
|
||||
const string = renderToString(() => <Hello />)
|
||||
expect(string).toBe('<div>Hello World!</div>')
|
||||
})
|
||||
})
|
||||
@@ -1,3 +1,5 @@
|
||||
import '@types/node'
|
||||
|
||||
import { defineConfig } from 'tsup'
|
||||
import * as preset from 'tsup-preset-solid'
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import { defineConfig } from 'vitest/config'
|
||||
import solidPlugin from 'vite-plugin-solid'
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
// to test in server environment, run with "--mode ssr" or "--mode test:ssr" flag
|
||||
// loads only server.test.ts file
|
||||
const testSSR = mode === 'test:ssr' || mode === 'ssr'
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
solidPlugin({
|
||||
// https://github.com/solidjs/solid-refresh/issues/29
|
||||
hot: false,
|
||||
// For testing SSR we need to do a SSR JSX transform
|
||||
solid: { generate: testSSR ? 'ssr' : 'dom' },
|
||||
}),
|
||||
],
|
||||
test: {
|
||||
watch: false,
|
||||
isolate: !testSSR,
|
||||
env: {
|
||||
NODE_ENV: testSSR ? 'production' : 'development',
|
||||
DEV: testSSR ? '' : '1',
|
||||
SSR: testSSR ? '1' : '',
|
||||
PROD: testSSR ? '1' : '',
|
||||
},
|
||||
environment: testSSR ? 'node' : 'jsdom',
|
||||
transformMode: { web: [/\.[jt]sx$/] },
|
||||
...(testSSR
|
||||
? {
|
||||
include: ['test/server.test.{ts,tsx}'],
|
||||
}
|
||||
: {
|
||||
include: ['test/*.test.{ts,tsx}'],
|
||||
exclude: ['test/server.test.{ts,tsx}'],
|
||||
}),
|
||||
},
|
||||
resolve: {
|
||||
conditions: testSSR ? ['node'] : ['browser', 'development'],
|
||||
},
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user