From 5ae02ef7dab35d553b69a285452b632dcbddc04a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=BChringer?= <51900829+puehringer@users.noreply.github.com> Date: Thu, 9 Nov 2023 20:17:09 +0100 Subject: [PATCH] Prepare no_dist version (#110) * Prepare no_dist version * Make getRandomInt public * Refactor getRandomInt * Update package.json --- package.json | 38 +++++++++++++++++++++++++++++++++++--- src/base/BaseUtils.ts | 4 ++-- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 046381b..c2cae0f 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,41 @@ "type": "git", "url": "git@github.com:Caleydo/tourdino.git" }, - "main": "dist/index.js", - "types": "dist/index.d.ts", + "main": "src/index.ts", + "types": "src/index.ts", + "exports": { + ".": { + "types": [ + "./dist/index.d.ts", + "./src/index.ts" + ], + "import": [ + "./dist/index.js", + "./src/index.ts" + ], + "default": [ + "./dist/index.js", + "./src/index.ts" + ] + }, + "./phovea_registry": [ + "./dist/phovea_registry.js", + "./src/phovea_registry.ts" + ], + "./dist/phovea_registry": [ + "./dist/phovea_registry.js", + "./src/phovea_registry.ts" + ], + "./src/scss/*": [ + "./dist/scss/*", + "./src/scss/*" + ], + "./dist/scss/*": [ + "./dist/scss/*", + "./src/scss/*" + ], + "./package.json": "./package.json" + }, "files": [ "src", "dist" @@ -48,7 +81,6 @@ "docs": "visyn_scripts docs", "lint:fix": "visyn_scripts lint --fix", "lint": "visyn_scripts lint", - "prepack": "npm run build", "start": "visyn_scripts start --env workspace_mode=single", "storybook:build": "NODE_OPTIONS=--max_old_space_size=4096 build-storybook", "storybook": "NODE_OPTIONS=--max_old_space_size=4096 start-storybook -p 6006", diff --git a/src/base/BaseUtils.ts b/src/base/BaseUtils.ts index 0d72508..8918de4 100644 --- a/src/base/BaseUtils.ts +++ b/src/base/BaseUtils.ts @@ -137,13 +137,13 @@ export class BaseUtils { while (integers.length !== n) { // skipped if n = max+1 --> all integers between 0 and max - integers.splice(getRandomInt(0, integers.length), 1); // definetly one hit per iteration + integers.splice(BaseUtils.getRandomInt(0, integers.length), 1); // definetly one hit per iteration } return integers; } const integers = []; while (integers.length < n) { - const integer = getRandomInt(0, max); + const integer = BaseUtils.getRandomInt(0, max); if (integers.indexOf(integer) === -1) { // not every iteration might add an element integers.push(integer);