diff options
author | Matthew Strapp <matt@mattstrapp.net> | 2024-10-30 16:53:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-30 16:53:20 -0500 |
commit | c544dffb148f08518600ea6b7096450e978304ff (patch) | |
tree | 14c19442520239cdb8ae387990d1f371c57950c5 /src | |
parent | version bump the gemfile lock too (diff) | |
download | locusts-c544dffb148f08518600ea6b7096450e978304ff.tar locusts-c544dffb148f08518600ea6b7096450e978304ff.tar.gz locusts-c544dffb148f08518600ea6b7096450e978304ff.tar.bz2 locusts-c544dffb148f08518600ea6b7096450e978304ff.tar.lz locusts-c544dffb148f08518600ea6b7096450e978304ff.tar.xz locusts-c544dffb148f08518600ea6b7096450e978304ff.tar.zst locusts-c544dffb148f08518600ea6b7096450e978304ff.zip |
feat: Svelte (#34)
* feat: Svelte
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
* oopsie
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
* add docs
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
* dev dependency
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
* Lint
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
* CI: Check formatting
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
* Add line ending thingy
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
* Update prettier and typescript versions in package.json
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
---------
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to 'src')
23 files changed, 297 insertions, 5 deletions
diff --git a/src/packages/locusts/README.md b/src/packages/locusts/README.md index 4b6a90b..6bcd1b6 100644 --- a/src/packages/locusts/README.md +++ b/src/packages/locusts/README.md @@ -1,4 +1,4 @@ -# TODO +# Locusts [![CI](https://github.com/locusts-r-us/locusts/actions/workflows/node.yml/badge.svg)](https://github.com/locusts-r-us/locusts/actions/workflows/node.yml) [![NPM Version](https://img.shields.io/npm/v/locusts?logo=npm&label=NPM%20Package)](https://www.npmjs.com/package/locusts) @@ -6,3 +6,28 @@ [![Deno](https://github.com/locusts-r-us/locusts/actions/workflows/deno.yml/badge.svg)](https://github.com/locusts-r-us/locusts/actions/workflows/deno.yml) [![JSR](https://jsr.io/badges/@locusts-r-us/locusts)](https://jsr.io/@locusts-r-us/locusts) +## Description + +Locusts is a series of libraries that allows you to introduce locusts into your codebase. +Why would you want to do that? I don't know. + +## Installation + +```sh +npm add locusts +``` + +## Example + +```typescript +import introduceLocusts from "locusts"; + +function main() { + introduceLocusts(); + // Locusts are now in your codebase! +} +``` + +## JavaScript Frameworks + +- [Svelte](../svelte/README.md) diff --git a/src/packages/locusts/mod.ts b/src/packages/locusts/mod.ts index 0071fb2..f003203 100644 --- a/src/packages/locusts/mod.ts +++ b/src/packages/locusts/mod.ts @@ -12,4 +12,4 @@ * @module */ -export * from "./src/index.ts"
\ No newline at end of file +export * from "./src/index.ts"; diff --git a/src/packages/locusts/mod_test.ts b/src/packages/locusts/mod_test.ts index 3b15eba..470dd40 100644 --- a/src/packages/locusts/mod_test.ts +++ b/src/packages/locusts/mod_test.ts @@ -5,7 +5,7 @@ import { introduceLocusts } from "./mod.ts"; describe("Locusts", () => { it("should be introduced", () => { - const result = introduceLocusts() + const result = introduceLocusts(); expect(result).toBe(undefined); }); }); diff --git a/src/packages/locusts/package.json b/src/packages/locusts/package.json index f31021a..5fb6a7f 100644 --- a/src/packages/locusts/package.json +++ b/src/packages/locusts/package.json @@ -12,7 +12,7 @@ "tsx": "^4.19.2", "typescript": "^5.6.3" }, - "keywords": [], + "keywords": ["why", "joke"], "license": "0BSD", "main": "./dist/index.js", "module": "./dist/index.mjs", diff --git a/src/packages/locusts/src/index.ts b/src/packages/locusts/src/index.ts index 4491602..68f894d 100644 --- a/src/packages/locusts/src/index.ts +++ b/src/packages/locusts/src/index.ts @@ -14,4 +14,4 @@ export function introduceLocusts() { // This space intentionally left blank } -export default introduceLocusts;
\ No newline at end of file +export default introduceLocusts; diff --git a/src/packages/svelte/.gitignore b/src/packages/svelte/.gitignore new file mode 100644 index 0000000..715b548 --- /dev/null +++ b/src/packages/svelte/.gitignore @@ -0,0 +1,22 @@ +node_modules + +# Output +.output +.vercel +/.svelte-kit +/build +/dist + +# OS +.DS_Store +Thumbs.db + +# Env +.env +.env.* +!.env.example +!.env.test + +# Vite +vite.config.js.timestamp-* +vite.config.ts.timestamp-* diff --git a/src/packages/svelte/.npmrc b/src/packages/svelte/.npmrc new file mode 100644 index 0000000..b6f27f1 --- /dev/null +++ b/src/packages/svelte/.npmrc @@ -0,0 +1 @@ +engine-strict=true diff --git a/src/packages/svelte/.prettierignore b/src/packages/svelte/.prettierignore new file mode 100644 index 0000000..ab78a95 --- /dev/null +++ b/src/packages/svelte/.prettierignore @@ -0,0 +1,4 @@ +# Package Managers +package-lock.json +pnpm-lock.yaml +yarn.lock diff --git a/src/packages/svelte/.prettierrc b/src/packages/svelte/.prettierrc new file mode 100644 index 0000000..3f7802c --- /dev/null +++ b/src/packages/svelte/.prettierrc @@ -0,0 +1,15 @@ +{ + "useTabs": true, + "singleQuote": true, + "trailingComma": "none", + "printWidth": 100, + "plugins": ["prettier-plugin-svelte"], + "overrides": [ + { + "files": "*.svelte", + "options": { + "parser": "svelte" + } + } + ] +} diff --git a/src/packages/svelte/README.md b/src/packages/svelte/README.md new file mode 100644 index 0000000..e638873 --- /dev/null +++ b/src/packages/svelte/README.md @@ -0,0 +1,25 @@ +# @locusts/svelte + +[![CI](https://github.com/locusts-r-us/locusts/actions/workflows/node.yml/badge.svg)](https://github.com/locusts-r-us/locusts/actions/workflows/node.yml) +[![NPM Version](https://img.shields.io/npm/v/locusts?logo=svelte&label=NPM%20Package)](https://www.npmjs.com/package/locusts) + +## Description + +Locusts is a series of libraries that allows you to introduce locusts into your codebase. +Why would you want to do that? I don't know. + +## Installation + +```sh +npm add -D @locusts/svelte +``` + +## Example + +```svelte +<script> + import Locusts from '@locusts/svelte'; +</script> + +<Locusts /> +``` diff --git a/src/packages/svelte/eslint.config.js b/src/packages/svelte/eslint.config.js new file mode 100644 index 0000000..a526565 --- /dev/null +++ b/src/packages/svelte/eslint.config.js @@ -0,0 +1,33 @@ +import prettier from 'eslint-config-prettier'; +import js from '@eslint/js'; +import svelte from 'eslint-plugin-svelte'; +import globals from 'globals'; +import ts from 'typescript-eslint'; + +export default ts.config( + js.configs.recommended, + ...ts.configs.recommended, + ...svelte.configs['flat/recommended'], + prettier, + ...svelte.configs['flat/prettier'], + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.node + } + } + }, + { + files: ['**/*.svelte'], + + languageOptions: { + parserOptions: { + parser: ts.parser + } + } + }, + { + ignores: ['build/', '.svelte-kit/', 'dist/'] + } +); diff --git a/src/packages/svelte/package.json b/src/packages/svelte/package.json new file mode 100644 index 0000000..863f062 --- /dev/null +++ b/src/packages/svelte/package.json @@ -0,0 +1,77 @@ +{ + "name": "@locusts/svelte", + "description": "A svelte component that introduces locusts into your website.", + "version": "0.0.0", + "author": "Matt Strapp <matt+locusts@mattstrapp.net> (https://mattstrapp.net)", + "bugs": "https://github.com/locusts-r-us/locusts/issues", + "scripts": { + "dev": "vite dev", + "build": "vite build && npm run package", + "preview": "vite preview", + "package": "svelte-kit sync && svelte-package && publint", + "prepublishOnly": "npm run package", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "format": "prettier --write .", + "lint": "prettier --check . && eslint .", + "test:unit": "vitest", + "test": "npm run test:unit -- --run" + }, + "keywords": [ + "svelte", + "component", + "why", + "joke" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/locusts-r-us/locusts.git", + "directory": "packages/svelte" + }, + "license": "0BSD", + "files": [ + "dist", + "!dist/**/*.test.*", + "!dist/**/*.spec.*" + ], + "sideEffects": [ + "**/*.css" + ], + "svelte": "./dist/index.js", + "types": "./dist/index.d.ts", + "type": "module", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "svelte": "./dist/index.js" + } + }, + "peerDependencies": { + "svelte": "^5.0.0" + }, + "devDependencies": { + "@repo/eslint-config": "workspace:*", + "@repo/typescript-config": "workspace:*", + "@sveltejs/adapter-auto": "^3.0.0", + "@sveltejs/kit": "^2.0.0", + "@sveltejs/package": "^2.0.0", + "@sveltejs/vite-plugin-svelte": "^4.0.0", + "@types/eslint": "^9.6.0", + "eslint": "^9.7.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-svelte": "^2.36.0", + "globals": "^15.0.0", + "prettier": "^3.3.2", + "prettier-plugin-svelte": "^3.2.6", + "publint": "^0.2.0", + "svelte": "^5.0.0", + "svelte-check": "^4.0.0", + "typescript": "^5.6.3", + "typescript-eslint": "^8.0.0", + "vite": "^5.0.11", + "vitest": "^2.0.4" + }, + "publishConfig": { + "access": "public" + } +}
\ No newline at end of file diff --git a/src/packages/svelte/src/app.d.ts b/src/packages/svelte/src/app.d.ts new file mode 100644 index 0000000..da08e6d --- /dev/null +++ b/src/packages/svelte/src/app.d.ts @@ -0,0 +1,13 @@ +// See https://svelte.dev/docs/kit/types#app.d.ts +// for information about these interfaces +declare global { + namespace App { + // interface Error {} + // interface Locals {} + // interface PageData {} + // interface PageState {} + // interface Platform {} + } +} + +export {}; diff --git a/src/packages/svelte/src/app.html b/src/packages/svelte/src/app.html new file mode 100644 index 0000000..f22aeaa --- /dev/null +++ b/src/packages/svelte/src/app.html @@ -0,0 +1,12 @@ +<!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> diff --git a/src/packages/svelte/src/demo.spec.ts b/src/packages/svelte/src/demo.spec.ts new file mode 100644 index 0000000..682c26c --- /dev/null +++ b/src/packages/svelte/src/demo.spec.ts @@ -0,0 +1,7 @@ +import { describe, it, expect } from 'vitest'; + +describe('Locusts should exist', () => { + it('Locusts should exist', () => { + expect(true); + }); +}); diff --git a/src/packages/svelte/src/lib/Locusts.svelte b/src/packages/svelte/src/lib/Locusts.svelte new file mode 100644 index 0000000..1a8f875 --- /dev/null +++ b/src/packages/svelte/src/lib/Locusts.svelte @@ -0,0 +1 @@ +<!--Locusts!!--> diff --git a/src/packages/svelte/src/lib/index.ts b/src/packages/svelte/src/lib/index.ts new file mode 100644 index 0000000..4303746 --- /dev/null +++ b/src/packages/svelte/src/lib/index.ts @@ -0,0 +1 @@ +export { default as Locusts } from './Locusts.svelte'; diff --git a/src/packages/svelte/src/routes/+page.svelte b/src/packages/svelte/src/routes/+page.svelte new file mode 100644 index 0000000..7c027d4 --- /dev/null +++ b/src/packages/svelte/src/routes/+page.svelte @@ -0,0 +1,9 @@ +<script lang="ts"> + import Locusts from '$lib/Locusts.svelte'; +</script> + +<Locusts /> + +<h1>Welcome to your library project</h1> +<p>Create your package using @sveltejs/package and preview/showcase your work with SvelteKit</p> +<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p> diff --git a/src/packages/svelte/static/favicon.png b/src/packages/svelte/static/favicon.png Binary files differnew file mode 100644 index 0000000..825b9e6 --- /dev/null +++ b/src/packages/svelte/static/favicon.png diff --git a/src/packages/svelte/svelte.config.js b/src/packages/svelte/svelte.config.js new file mode 100644 index 0000000..1295460 --- /dev/null +++ b/src/packages/svelte/svelte.config.js @@ -0,0 +1,18 @@ +import adapter from '@sveltejs/adapter-auto'; +import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; + +/** @type {import('@sveltejs/kit').Config} */ +const config = { + // Consult https://svelte.dev/docs/kit/integrations + // for more information about preprocessors + preprocess: vitePreprocess(), + + kit: { + // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list. + // If your environment is not supported, or you settled on a specific environment, switch out the adapter. + // See https://svelte.dev/docs/kit/adapters for more information about adapters. + adapter: adapter() + } +}; + +export default config; diff --git a/src/packages/svelte/tsconfig.json b/src/packages/svelte/tsconfig.json new file mode 100644 index 0000000..cc1d5e0 --- /dev/null +++ b/src/packages/svelte/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": ["@repo/typescript-config/base.json", "./.svelte-kit/tsconfig.json"], + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "sourceMap": true, + "strict": true, + "module": "NodeNext", + "moduleResolution": "NodeNext" + } +} diff --git a/src/packages/svelte/vite.config.ts b/src/packages/svelte/vite.config.ts new file mode 100644 index 0000000..d76fc8a --- /dev/null +++ b/src/packages/svelte/vite.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from 'vitest/config'; +import { sveltekit } from '@sveltejs/kit/vite'; + +export default defineConfig({ + plugins: [sveltekit()], + + test: { + include: ['src/**/*.{test,spec}.{js,ts}'] + } +}); diff --git a/src/packages/typescript-config/base.json b/src/packages/typescript-config/base.json index 0f80cfd..d5ac453 100644 --- a/src/packages/typescript-config/base.json +++ b/src/packages/typescript-config/base.json @@ -2,9 +2,12 @@ "$schema": "https://json.schemastore.org/tsconfig", "display": "Default", "compilerOptions": { + "allowJs": true, + "checkJs": true, "declaration": true, "declarationMap": true, "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, "incremental": false, "isolatedModules": true, "lib": ["es2022", "DOM", "DOM.Iterable"], @@ -14,6 +17,7 @@ "noUncheckedIndexedAccess": true, "resolveJsonModule": true, "skipLibCheck": true, + "sourceMap": true, "strict": true, "target": "ES2022" } |