-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing error when there are non svelte files (#26)
* Fixing error when there are non svelte files * Apply suggestions from code review Co-authored-by: Eric Liu <ericyl.us@gmail.com> Co-authored-by: neelneelneel <> Co-authored-by: Eric Liu <ericyl.us@gmail.com>
- Loading branch information
1 parent
5986dd8
commit 955845c
Showing
15 changed files
with
624 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/lib | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"total": 1, | ||
"components": [ | ||
{ | ||
"moduleName": "Button", | ||
"filePath": "src/button/Button.svelte", | ||
"props": [ | ||
{ | ||
"name": "type", | ||
"kind": "let", | ||
"type": "string", | ||
"value": "\"button2\"", | ||
"isFunction": false, | ||
"constant": false, | ||
"reactive": false | ||
}, | ||
{ | ||
"name": "primary", | ||
"kind": "let", | ||
"type": "boolean", | ||
"value": "false", | ||
"isFunction": false, | ||
"constant": false, | ||
"reactive": false | ||
} | ||
], | ||
"slots": [ | ||
{ | ||
"name": "__default__", | ||
"default": true, | ||
"fallback": "Click me", | ||
"slot_props": "{}" | ||
} | ||
], | ||
"events": [{ "type": "forwarded", "name": "click", "element": "button" }], | ||
"typedefs": [], | ||
"rest_props": { "type": "Element", "name": "button" } | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Component Index | ||
|
||
> 1 components exported from glob@0.0.1. | ||
## Components | ||
|
||
- [`Button`](#button) | ||
|
||
--- | ||
|
||
## `Button` | ||
|
||
### Props | ||
|
||
| Prop name | Kind | Reactive | Type | Default value | Description | | ||
| :-------- | :--------------- | :------- | :------------------- | ---------------------- | ----------- | | ||
| type | <code>let</code> | No | <code>string</code> | <code>"button2"</code> | -- | | ||
| primary | <code>let</code> | No | <code>boolean</code> | <code>false</code> | -- | | ||
|
||
### Slots | ||
|
||
| Slot name | Default | Props | Fallback | | ||
| :-------- | :------ | :---- | :-------------------- | | ||
| -- | Yes | -- | <code>Click me</code> | | ||
|
||
### Events | ||
|
||
| Event name | Type | Detail | | ||
| :--------- | :-------- | :----- | | ||
| click | forwarded | -- | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "glob", | ||
"version": "0.0.1", | ||
"private": true, | ||
"svelte": "./src/index.js", | ||
"module": "./lib/index.mjs", | ||
"types": "./types/index.d.ts", | ||
"scripts": { | ||
"svelte-check": "svelte-check --workspace test", | ||
"build": "rollup -c" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^10.0.0", | ||
"@tsconfig/svelte": "^1.0.10", | ||
"rollup": "^2.32.1", | ||
"rollup-plugin-svelte": "^6.1.1", | ||
"svelte": "^3.31.0", | ||
"svelte-check": "^1.1.17", | ||
"typescript": "^4.0.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pkg from "./package.json"; | ||
import svelte from "rollup-plugin-svelte"; | ||
import resolve from "@rollup/plugin-node-resolve"; | ||
import sveld from "sveld"; | ||
|
||
const production = !process.env.ROLLUP_WATCH; | ||
|
||
export default { | ||
input: "src/index.js", | ||
output: { format: "es", file: pkg.module }, | ||
plugins: [ | ||
svelte(), | ||
resolve(), | ||
production && | ||
sveld({ | ||
glob:true, | ||
markdown: true, | ||
markdownOptions: { | ||
onAppend: (type, document, components) => { | ||
if (type === "h1") | ||
document.append("quote", `${components.size} components exported from ${pkg.name}@${pkg.version}.`); | ||
}, | ||
}, | ||
json: true, | ||
}), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function () { | ||
console.log('hello'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as Action } from "./Action.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script> | ||
export let type = "button2"; | ||
export let primary = false; | ||
</script> | ||
|
||
<button {...$$restProps} {type} class:primary on:click> | ||
<slot>Click me</slot> | ||
</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as Button } from "./Button.svelte"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { Action } from "./action/"; | ||
export { Button } from "./button/"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@tsconfig/svelte", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/// <reference types="svelte" /> | ||
import { SvelteComponentTyped } from "svelte"; | ||
|
||
export interface ButtonProps | ||
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["button"]> { | ||
/** | ||
* @default "button2" | ||
*/ | ||
type?: string; | ||
|
||
/** | ||
* @default false | ||
*/ | ||
primary?: boolean; | ||
} | ||
|
||
export default class Button extends SvelteComponentTyped< | ||
ButtonProps, | ||
{ click: WindowEventMap["click"] }, | ||
{ default: {} } | ||
> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as Action } from "./action/"; | ||
export { default as Button } from "./button/Button"; |
Oops, something went wrong.