Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

1.1 KB
Raw Blame
import { cpSync } from 'node:fs'
import { defineConfig } from 'tsup'
import { pluginPeerRanges } from './scripts/plugin-peer-ranges.mjs'
import { releaseLine } from './scripts/release-line.mjs'

export default defineConfig({
  entry: ['src/index.ts'],
  format: ['esm'],
  target: 'node20',
  platform: 'node',
  noExternal: [/.*/],
  splitting: false,
  define: {
    __SPREE_PLUGIN_PEER_RANGES__: JSON.stringify(pluginPeerRanges()),
    __SPREE_RELEASE_LINE__: JSON.stringify(releaseLine()),
  },
  clean: true,
  minify: true,
  banner: {
    js: [
      '#!/usr/bin/env node',
      'import { createRequire as __createRequire } from "node:module";',
      'const require = __createRequire(import.meta.url);',
    ].join('\n'),
  },
  // Copy the scaffolding templates into dist/ so the published tarball ships
  // them. `src/commands/plugin.ts` resolves the path relative to the running
  // file via `resolveTemplatePath()` — both `src/commands → ../../templates`
  // (dev) and `dist/index.js → ../templates` (published) work.
  async onSuccess() {
    cpSync('templates', 'dist/templates', { recursive: true })
  },
})