Skip to content

Conversation

@FurryR
Copy link

@FurryR FurryR commented Mar 24, 2024

What's new

  • build(perf) Used tsup instead of tsc.

Before (CommonJS only):

> yarn run build:main
yarn run v1.22.19
$ tsc -p tsconfig.json
Done in 2.58s.

After (CommonJS & Experimental ES Module):

> yarn build:main
yarn run v1.22.19
$ tsup
[BUTTPLUG-JS] CLI Building entry: src/index.ts
[BUTTPLUG-JS] CLI Using tsconfig: tsconfig.json
[BUTTPLUG-JS] CLI tsup v8.0.2
[BUTTPLUG-JS] CLI Using tsup config: /home/furryr/buttplug-js/js/tsup.config.ts
[BUTTPLUG-JS] CLI Target: es6
[BUTTPLUG-JS] CLI Cleaning output folder
[BUTTPLUG-JS] CJS Build start
[BUTTPLUG-JS] ESM Build start
[BUTTPLUG-JS] ESM dist/main/index.mjs     27.73 KB
[BUTTPLUG-JS] ESM dist/main/index.mjs.map 83.64 KB
[BUTTPLUG-JS] ESM ⚡️ Build success in 48ms
[BUTTPLUG-JS] CJS dist/main/index.js     29.18 KB
[BUTTPLUG-JS] CJS dist/main/index.js.map 86.34 KB
[BUTTPLUG-JS] CJS ⚡️ Build success in 48ms
[BUTTPLUG-JS] DTS Build start
[BUTTPLUG-JS] DTS ⚡️ Build success in 848ms
[BUTTPLUG-JS] DTS dist/main/index.d.ts  22.55 KB
[BUTTPLUG-JS] DTS dist/main/index.d.mts 22.55 KB
Done in 1.39s.
  • chore Updated npmignore, no more Typescript source & eslint.
  • chore build IIFE version for web.
  • chore Removed unnecessary devDependencies (@types/commander)

Partially resolves #267.

IIFE documentation

Not ready becuz im bad at English.

Usually you could import it by:

<script src="https://some-sorta-nice-cdn-like-jsdelivr.com/buttplug/dist/web/buttplug.global.js"></script>

and use it by:

window.buttplug;

Incompatible warning

This is allowed when using tsc (its not recommended btw):

const { ButtplugClientDevice } = require('buttplug/dist/main/src/client/ButtplugClientDevice')

Now you cannot use it anymore becuz the module is 100% bundled.

@CLAassistant
Copy link

CLAassistant commented Mar 24, 2024

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature request] NPM Publish CI & use bundler

2 participants