Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions js/.npmignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
tests
web-tests
.rpt2_cache
coverage
build
src
node_modules

.rpt2_cache
yarn-error.log
.yarn
.yarn
yarn.lock
.yarnrc.yml

tests
web-tests
node-test.ts

.jscsrc
.jshintrc
.eslintrc.js
tslint.json

tsfmt.json
.prettierrc.json

tsconfig.json
tsup.config.ts
vite.config.ts
20 changes: 16 additions & 4 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
"version": "3.2.2",
"description": "Buttplug Client Implementation for Typescript/Javascript",
"homepage": "https://github.com/buttplugio/buttplug-js/",
"main": "./dist/main/index.js",
"exports": {
".": {
"import": "./dist/main/index.mjs",
"require": "./dist/main/index.js"
}
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.com"
},
"repository": {
"type": "git",
"url": "git+https://github.com/buttplugio/buttplug-js.git"
Expand All @@ -16,14 +27,14 @@
"bugs": {
"url": "https://github.com/buttplugio/buttplug-js/issues"
},
"main": "./dist/main/src/index.js",
"types": "./dist/main/src/index.d.ts",
"types": "./dist/main/index.d.ts",
"scripts": {
"build": "trash dist dist-bundle && yarn build:all",
"build:all": "yarn build:main && yarn build:web",
"build:main": "tsc -p tsconfig.json",
"build:main": "tsup",
"build:doc": "typedoc --options typedocconfig.js --out doc ./src/index.ts",
"build:web": "vite build",
"lint:type": "tsc --noEmit -p ./tsconfig.json",
"pretest": "yarn build:main",
"test": "jest tests/*",
"web-test": "jest web-tests/test-web-library.ts",
Expand All @@ -36,7 +47,7 @@
"ws": "^8.16.0"
},
"devDependencies": {
"@types/commander": "^2.12.2",
"@swc/core": "^1.4.8",
"@types/expect-puppeteer": "^5.0.6",
"@types/jest": "^29.5.12",
"@types/jest-environment-puppeteer": "^5.0.6",
Expand All @@ -59,6 +70,7 @@
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",
"tsup": "^8.0.2",
"typedoc": "^0.25.9",
"typescript": "^5.3.3",
"vite": "^5.1.4",
Expand Down
14 changes: 14 additions & 0 deletions js/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig } from 'tsup';

export default defineConfig({
name: 'buttplug-js',
entry: ['src/index.ts'],
target: ['es6'],
format: ['cjs', 'esm'],
outDir: 'dist/main',
platform: 'node',
clean: true,
sourcemap: true,
dts: true,
minify: true,
});
3 changes: 3 additions & 0 deletions js/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ export default defineConfig({
fileName: (format): string => {
if (format === 'umd') {
return 'buttplug.js';
} else if (format === 'iife') {
return 'buttplug.global.js';
}
return 'buttplug.mjs';
},
formats: ['es', 'umd', 'iife'],
},
outDir: 'dist/web',
},
Expand Down
Loading