diff --git a/.github/workflows/npm-deploy.yml b/.github/workflows/npm-deploy.yml index b03d0f60..40a443eb 100644 --- a/.github/workflows/npm-deploy.yml +++ b/.github/workflows/npm-deploy.yml @@ -22,10 +22,13 @@ jobs: run: npm ci - name: Build - run: npm run build + run: npm run build -- --config vite-publish.config.js + + - name: Copy index.js + run: npx ncp dist/dist/elements/out/index.mjs dist/dist/elements/index.js - name: Delete irrelevant files - run: npx rimraf dist/assets dist/*.* dist/dist/index.js + run: npx rimraf dist/dist/elements/out - name: Copy custom-elements.json run: npx ncp custom-elements.json dist/custom-elements.json diff --git a/vite-publish.config.js b/vite-publish.config.js new file mode 100644 index 00000000..ef84b93a --- /dev/null +++ b/vite-publish.config.js @@ -0,0 +1,10 @@ +export default { + build: { + lib: { + entry: 'src/elements/index.ts', + fileName: 'index', + formats: ['es'], + }, + outDir: 'dist/dist/elements/out', + }, +};