From 04088878f6e5422beb4c7155f05365266231dfd8 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Mon, 8 Aug 2022 13:29:30 +0200 Subject: [PATCH 1/3] feat(svelte): Add Svelte SDK Package Boilerplate --- package.json | 1 + packages/svelte/.eslintrc.js | 6 ++++ packages/svelte/LICENSE | 29 +++++++++++++++ packages/svelte/README.md | 9 +++++ packages/svelte/jest.config.js | 6 ++++ packages/svelte/package.json | 53 ++++++++++++++++++++++++++++ packages/svelte/rollup.npm.config.js | 3 ++ packages/svelte/src/index.ts | 1 + packages/svelte/test/tsconfig.json | 8 +++++ packages/svelte/tsconfig.json | 7 ++++ packages/svelte/tsconfig.test.json | 12 +++++++ packages/svelte/tsconfig.types.json | 10 ++++++ 12 files changed, 145 insertions(+) create mode 100644 packages/svelte/.eslintrc.js create mode 100644 packages/svelte/LICENSE create mode 100644 packages/svelte/README.md create mode 100644 packages/svelte/jest.config.js create mode 100644 packages/svelte/package.json create mode 100644 packages/svelte/rollup.npm.config.js create mode 100644 packages/svelte/src/index.ts create mode 100644 packages/svelte/test/tsconfig.json create mode 100644 packages/svelte/tsconfig.json create mode 100644 packages/svelte/tsconfig.test.json create mode 100644 packages/svelte/tsconfig.types.json diff --git a/package.json b/package.json index 4df884840b8d..dff4d9e6fc14 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "packages/react", "packages/remix", "packages/serverless", + "packages/svelte", "packages/tracing", "packages/types", "packages/typescript", diff --git a/packages/svelte/.eslintrc.js b/packages/svelte/.eslintrc.js new file mode 100644 index 000000000000..46d8d10cc538 --- /dev/null +++ b/packages/svelte/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + env: { + browser: true, + }, + extends: ['../../.eslintrc.js'], +}; diff --git a/packages/svelte/LICENSE b/packages/svelte/LICENSE new file mode 100644 index 000000000000..81b248b1b42e --- /dev/null +++ b/packages/svelte/LICENSE @@ -0,0 +1,29 @@ +MIT License + +Copyright (c) 2022, Sentry +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/svelte/README.md b/packages/svelte/README.md new file mode 100644 index 000000000000..8f4742d3a37b --- /dev/null +++ b/packages/svelte/README.md @@ -0,0 +1,9 @@ +

+ + Sentry + +

+ +# Official Sentry SDK for Svelte + +This SDK is work in progress, and should not be used before officially released. diff --git a/packages/svelte/jest.config.js b/packages/svelte/jest.config.js new file mode 100644 index 000000000000..cd02790794a7 --- /dev/null +++ b/packages/svelte/jest.config.js @@ -0,0 +1,6 @@ +const baseConfig = require('../../jest/jest.config.js'); + +module.exports = { + ...baseConfig, + testEnvironment: 'jsdom', +}; diff --git a/packages/svelte/package.json b/packages/svelte/package.json new file mode 100644 index 000000000000..b6c62254eb05 --- /dev/null +++ b/packages/svelte/package.json @@ -0,0 +1,53 @@ +{ + "name": "@sentry/svelte", + "version": "7.9.0", + "description": "Official Sentry SDK for Svelte", + "repository": "git://github.com/getsentry/sentry-javascript.git", + "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/svelte", + "author": "Sentry", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "main": "build/cjs/index.js", + "module": "build/esm/index.js", + "types": "build/types/index.d.ts", + "private": "true", + "publishConfig": { + "access": "public" + }, + "dependencies": { + "@sentry/browser": "7.9.0", + "@sentry/types": "7.9.0", + "@sentry/utils": "7.9.0", + "tslib": "^1.9.3" + }, + "peerDependencies": { + "svelte": "3.x" + }, + "scripts": { + "build": "run-p build:rollup build:types", + "build:dev": "run-s build", + "build:rollup": "rollup -c rollup.npm.config.js", + "build:types": "tsc -p tsconfig.types.json", + "build:watch": "run-p build:rollup:watch build:types:watch", + "build:dev:watch": "run-s build:watch", + "build:rollup:watch": "rollup -c rollup.npm.config.js --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", + "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build", + "circularDepCheck": "madge --circular src/index.ts", + "clean": "rimraf build coverage sentry-svelte-*.tgz", + "fix": "run-s fix:eslint fix:prettier", + "fix:eslint": "eslint . --format stylish --fix", + "fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"", + "lint": "run-s lint:prettier lint:eslint", + "lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish", + "lint:prettier": "prettier --check \"{src,test,scripts}/**/*.ts\"", + "test": "jest", + "test:watch": "jest --watch" + }, + "volta": { + "extends": "../../package.json" + }, + "sideEffects": false +} diff --git a/packages/svelte/rollup.npm.config.js b/packages/svelte/rollup.npm.config.js new file mode 100644 index 000000000000..5a62b528ef44 --- /dev/null +++ b/packages/svelte/rollup.npm.config.js @@ -0,0 +1,3 @@ +import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index.js'; + +export default makeNPMConfigVariants(makeBaseNPMConfig()); diff --git a/packages/svelte/src/index.ts b/packages/svelte/src/index.ts new file mode 100644 index 000000000000..7646bbd17d04 --- /dev/null +++ b/packages/svelte/src/index.ts @@ -0,0 +1 @@ +export default null; diff --git a/packages/svelte/test/tsconfig.json b/packages/svelte/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/packages/svelte/test/tsconfig.json @@ -0,0 +1,8 @@ +// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as +// it's purely a placeholder to satisfy VSCode. + +{ + "extends": "../tsconfig.test.json", + + "include": ["./**/*"] +} diff --git a/packages/svelte/tsconfig.json b/packages/svelte/tsconfig.json new file mode 100644 index 000000000000..b0eb9ecb6476 --- /dev/null +++ b/packages/svelte/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.json", + + "include": ["src/**/*"], + + "compilerOptions": {} +} diff --git a/packages/svelte/tsconfig.test.json b/packages/svelte/tsconfig.test.json new file mode 100644 index 000000000000..af7e36ec0eda --- /dev/null +++ b/packages/svelte/tsconfig.test.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + + "include": ["test/**/*"], + + "compilerOptions": { + // should include all types from `./tsconfig.json` plus types for all test frameworks used + "types": ["jest"] + + // other package-specific, test-specific options + } +} diff --git a/packages/svelte/tsconfig.types.json b/packages/svelte/tsconfig.types.json new file mode 100644 index 000000000000..65455f66bd75 --- /dev/null +++ b/packages/svelte/tsconfig.types.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "build/types" + } +} From 115395dd176b2484d00e6c8391c683da0c7c522f Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Mon, 8 Aug 2022 14:56:14 +0200 Subject: [PATCH 2/3] allow jest to pass when no tests exist --- packages/svelte/jest.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/svelte/jest.config.js b/packages/svelte/jest.config.js index cd02790794a7..fe3da65117ca 100644 --- a/packages/svelte/jest.config.js +++ b/packages/svelte/jest.config.js @@ -3,4 +3,5 @@ const baseConfig = require('../../jest/jest.config.js'); module.exports = { ...baseConfig, testEnvironment: 'jsdom', + passWithNoTests: true, // TODO remove once we have something to test and tests }; From 3ca09c221b6abf63f9e5c742a60ed72d4eee5e7d Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Mon, 8 Aug 2022 15:19:09 +0200 Subject: [PATCH 3/3] actually fix CI (pls) --- packages/svelte/jest.config.js | 1 - packages/svelte/package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/svelte/jest.config.js b/packages/svelte/jest.config.js index fe3da65117ca..cd02790794a7 100644 --- a/packages/svelte/jest.config.js +++ b/packages/svelte/jest.config.js @@ -3,5 +3,4 @@ const baseConfig = require('../../jest/jest.config.js'); module.exports = { ...baseConfig, testEnvironment: 'jsdom', - passWithNoTests: true, // TODO remove once we have something to test and tests }; diff --git a/packages/svelte/package.json b/packages/svelte/package.json index b6c62254eb05..0ccd07ff99f7 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -43,7 +43,7 @@ "lint": "run-s lint:prettier lint:eslint", "lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish", "lint:prettier": "prettier --check \"{src,test,scripts}/**/*.ts\"", - "test": "jest", + "test": "jest --passWithNoTests", "test:watch": "jest --watch" }, "volta": {