-
Notifications
You must be signed in to change notification settings - Fork 22
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
APP-2280 Add @viamrobotics/prime-core package #282
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ dist | |
prime | ||
*.local | ||
.storybook/workers | ||
.svelte-kit | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
|
ethanlook marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/build | ||
/.svelte-kit | ||
/package | ||
dist |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
root: true, | ||
extends: ['@viamrobotics/eslint-config/svelte'], | ||
parserOptions: { | ||
project: ['./tsconfig.json'], | ||
tsconfigRootDir: __dirname, | ||
}, | ||
env: { | ||
browser: true, | ||
node: true, | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
engine-strict=true | ||
resolution-mode=highest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haven't messed with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the default for |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/build | ||
/.svelte-kit | ||
/package | ||
dist |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'use strict'; | ||
|
||
module.exports = '@viamrobotics/prettier-config/svelte'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# `@viamrobotics/prime-core` | ||
|
||
## Getting started | ||
|
||
`@viamrobotics/prime-core` is a collection of core Svelte components. | ||
|
||
## Installation | ||
|
||
Add PRIME core using your package manager of choice: | ||
|
||
``` | ||
pnpm add --save-dev @viamrobotics/prime-core | ||
``` | ||
|
||
Install [Tailwind][]. In the `tailwind.config.js`, add the components to the content and include the theme: | ||
ethanlook marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```js | ||
import { theme } from '@viamrobotics/prime-core/theme'; | ||
|
||
/** @type {import('tailwindcss').Config} */ | ||
export default { | ||
content: [ | ||
'./src/**/*.{html,js,svelte,ts}', | ||
'./node_modules/@viamrobotics/prime-core/**/*.{ts,svelte}', | ||
], | ||
theme, | ||
plugins: [], | ||
}; | ||
``` | ||
|
||
Import the stylesheet. If you are using [SvelteKit][], you can do this in `src/routes/+layout.svelte`. | ||
|
||
```js | ||
import '@viamrobotics/prime-core/prime.css'; | ||
``` | ||
|
||
You can now use the components in your app: | ||
|
||
```html | ||
<script lang="ts"> | ||
import { Badge } from '@viamrobotics/prime-core'; | ||
</script> | ||
|
||
<Badge | ||
variant="green" | ||
label="Active" | ||
/> | ||
``` | ||
|
||
[tailwind]: https://tailwindcss.com/ | ||
[sveltekit]: https://kit.svelte.dev/ | ||
|
||
## Playground | ||
|
||
The playground can be used during development but is not used outside of the package. | ||
|
||
```bash | ||
pnpm install | ||
pnpm -C packages/core dev | ||
``` | ||
|
||
## Linting | ||
|
||
To lint and typecheck: | ||
|
||
```bash | ||
pnpm -C packages/core check # check svelte and lint | ||
pnpm -C packages/core check-svelte # check svelte only | ||
pnpm -C packages/core check-lint # check lint only with prettier and eslint | ||
pnpm -C packages/core format # format with prettier | ||
``` | ||
|
||
## Testing | ||
|
||
To test with [vitest][]: | ||
|
||
```bash | ||
pnpm -C packages/core test # run once | ||
pnpm -C packages/core test:watch # watch tests | ||
``` | ||
|
||
[vitest]: https://vitest.dev/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
"name": "@viamrobotics/prime-core", | ||
"version": "0.0.1", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
ethanlook marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"dev": "vite dev", | ||
"build": "vite build && pnpm run package", | ||
"preview": "vite preview", | ||
"package": "svelte-kit sync && svelte-package && publint", | ||
"prepublishOnly": "pnpm run package", | ||
"check": "concurrently -g pnpm:check-*", | ||
"check-svelte": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||
"check-lint": "prettier --plugin-search-dir . --check . && eslint .", | ||
"format": "prettier --plugin-search-dir . --write .", | ||
"test": "vitest run", | ||
"test:watch": "vitest" | ||
}, | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"svelte": "./dist/index.js" | ||
ethanlook marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
"./theme": "./theme.ts", | ||
"./prime.css": "./prime.css" | ||
}, | ||
"files": [ | ||
"dist", | ||
"!dist/**/*.test.*", | ||
"!dist/**/*.spec.*", | ||
"theme.ts", | ||
"prime.css" | ||
], | ||
"peerDependencies": { | ||
"svelte": ">=4.0.0 <5" | ||
}, | ||
"devDependencies": { | ||
"@sveltejs/adapter-auto": "^2.1.0", | ||
"@sveltejs/kit": "^1.22.3", | ||
"@sveltejs/package": "^2.2.0", | ||
"@sveltejs/vite-plugin-svelte": "^2.4.2", | ||
"@testing-library/dom": "^9.3.1", | ||
"@testing-library/jest-dom": "^5.17.0", | ||
"@testing-library/svelte": "^4.0.3", | ||
"@types/testing-library__jest-dom": "^5.14.9", | ||
"@typescript-eslint/eslint-plugin": "^5.45.0", | ||
"@typescript-eslint/parser": "^5.45.0", | ||
"@viamrobotics/eslint-config": "^0.1.0", | ||
"@viamrobotics/prettier-config": "^0.1.0", | ||
"@viamrobotics/typescript-config": "^0.0.3", | ||
"autoprefixer": "^10.4.14", | ||
"classnames": "^2.3.2", | ||
"concurrently": "^8.0.1", | ||
"eslint": "^8.45.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-svelte": "^2.32.4", | ||
"eslint-plugin-tailwindcss": "^3.13.0", | ||
"jsdom": "^22.1.0", | ||
"postcss": "^8.4.27", | ||
"prettier": "^2.8.8", | ||
"prettier-plugin-svelte": "^2.10.1", | ||
"prettier-plugin-tailwindcss": "^0.4.1", | ||
"publint": "^0.1.16", | ||
"svelte": "^4.1.1", | ||
"svelte-check": "^3.4.6", | ||
"tailwindcss": "^3.3.3", | ||
"tslib": "^2.6.0", | ||
"typescript": "^5.1.6", | ||
"vite": "^4.4.7", | ||
"vitest": "^0.33.0" | ||
}, | ||
"svelte": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"type": "module" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
*, | ||
input, | ||
button { | ||
font-family: inherit; | ||
} | ||
|
||
:host { | ||
display: block; | ||
} | ||
|
||
:host([hidden]) { | ||
display: none; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* See https://kit.svelte.dev/docs/types#app | ||
* for information about these interfaces | ||
*/ | ||
declare global { | ||
namespace App { | ||
/* | ||
* interface Error {} | ||
* interface Locals {} | ||
* interface PageData {} | ||
* interface Platform {} | ||
*/ | ||
} | ||
} | ||
|
||
export {}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link | ||
rel="icon" | ||
href="%sveltekit.assets%/favicon.png" | ||
/> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1" | ||
/> | ||
%sveltekit.head% | ||
</head> | ||
<body data-sveltekit-preload-data="hover"> | ||
<div>%sveltekit.body%</div> | ||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Node 16 is EOL'ing in a few months; was this change intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope - copy pasta