From cde23bbf9853ddd2935338cb27834473b2ec4186 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 28 Jan 2023 22:27:18 +0100 Subject: [PATCH] csound build --- packages/csound/{csound.mjs => index.mjs} | 0 packages/csound/package.json | 17 ++++++++++++----- packages/csound/vite.config.js | 19 +++++++++++++++++++ pnpm-lock.yaml | 3 +++ 4 files changed, 34 insertions(+), 5 deletions(-) rename packages/csound/{csound.mjs => index.mjs} (100%) create mode 100644 packages/csound/vite.config.js diff --git a/packages/csound/csound.mjs b/packages/csound/index.mjs similarity index 100% rename from packages/csound/csound.mjs rename to packages/csound/index.mjs diff --git a/packages/csound/package.json b/packages/csound/package.json index 8770558a..b7c1ed04 100644 --- a/packages/csound/package.json +++ b/packages/csound/package.json @@ -1,10 +1,14 @@ { "name": "@strudel.cycles/csound", - "version": "0.5.1", + "version": "0.6.0", "description": "csound bindings for strudel", - "main": "csound.mjs", + "main": "index.mjs", + "publishConfig": { + "main": "dist/index.js", + "module": "dist/index.mjs" + }, "scripts": { - "test": "echo \"No tests present.\" && exit 0" + "build": "vite build" }, "repository": { "type": "git", @@ -27,8 +31,11 @@ }, "homepage": "https://github.com/tidalcycles/strudel#readme", "dependencies": { + "@csound/browser": "^6.18.3", "@strudel.cycles/core": "workspace:*", - "@strudel.cycles/webaudio": "workspace:*", - "@csound/browser": "^6.18.3" + "@strudel.cycles/webaudio": "workspace:*" + }, + "devDependencies": { + "vite": "^3.2.2" } } diff --git a/packages/csound/vite.config.js b/packages/csound/vite.config.js new file mode 100644 index 00000000..0fc63a6b --- /dev/null +++ b/packages/csound/vite.config.js @@ -0,0 +1,19 @@ +import { defineConfig } from 'vite'; +import { dependencies } from './package.json'; +import { resolve } from 'path'; + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [], + build: { + lib: { + entry: resolve(__dirname, 'index.mjs'), + formats: ['es', 'cjs'], + fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' }[ext]), + }, + rollupOptions: { + external: [...Object.keys(dependencies)], + }, + target: 'esnext', + }, +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 111bd9f3..781b060b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -65,10 +65,13 @@ importers: '@csound/browser': ^6.18.3 '@strudel.cycles/core': workspace:* '@strudel.cycles/webaudio': workspace:* + vite: ^3.2.2 dependencies: '@csound/browser': 6.18.5 '@strudel.cycles/core': link:../core '@strudel.cycles/webaudio': link:../webaudio + devDependencies: + vite: 3.2.5 packages/embed: specifiers: {}