Skip to content

AI-native design editor. Open-source Figma alternative.

Fix package publishing pipeline

Danila Poyarkov36bc87942193
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c03ec5b55..8087ac0bf 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -177,6 +177,25 @@ jobs:
fi
done
+ - name: Pack packages for publish
+ run: |
+ mkdir -p .npm-packages
+ pack_if_new() {
+ local dir=$1
+ local name=$(node -p "require('./$dir/package.json').name")
+ local version=$(node -p "require('./$dir/package.json').version")
+ if npm view "${name}@${version}" version 2>/dev/null; then
+ echo "${name}@${version} already published, skipping pack"
+ else
+ (cd "$dir" && npm pack --pack-destination ../../.npm-packages)
+ fi
+ }
+ pack_if_new packages/core
+ pack_if_new packages/cli
+ pack_if_new packages/mcp
+ pack_if_new packages/vue
+ ls -la .npm-packages
+
- name: Publish packages to npm
run: |
publish_if_new() {
@@ -186,7 +205,9 @@ jobs:
if npm view "${name}@${version}" version 2>/dev/null; then
echo "${name}@${version} already published, skipping"
else
- npm publish "./$dir" --access public --provenance --ignore-scripts
+ local tarball
+ tarball=$(cd .npm-packages && ls open-pencil-$(basename "$dir")-${version}.tgz)
+ npm publish "./.npm-packages/${tarball}" --access public --provenance
fi
}
publish_if_new packages/core
diff --git a/packages/mcp/package.json b/packages/mcp/package.json
index 8b2a463e6..2678c8f4e 100644
--- a/packages/mcp/package.json
+++ b/packages/mcp/package.json
@@ -3,12 +3,11 @@
"version": "0.11.0",
"license": "MIT",
"type": "module",
- "main": "./src/server.ts",
+ "main": "./dist/server.js",
"bin": {
"openpencil-mcp": "./dist/index.js"
},
"files": [
- "src",
"dist"
],
"scripts": {
diff --git a/packages/vue/package.json b/packages/vue/package.json
index 706e03a87..1da8c3df3 100644
--- a/packages/vue/package.json
+++ b/packages/vue/package.json
@@ -5,18 +5,18 @@
"type": "module",
"exports": {
".": {
- "types": "./src/index.ts",
- "bun": "./src/index.ts",
- "default": "./src/index.ts"
+ "types": "./dist/index.d.ts",
+ "import": "./dist/index.js",
+ "default": "./dist/index.js"
}
},
- "main": "./src/index.ts",
- "types": "./src/index.ts",
+ "main": "./dist/index.js",
+ "types": "./dist/index.d.ts",
"sideEffects": false,
- "files": ["src", "dist"],
+ "files": ["dist", "README.md"],
"scripts": {
- "build": "bunx tsdown --config ../vue/tsdown.config.ts",
- "prepublishOnly": "bun run build"
+ "build": "bunx tsdown --config tsdown.config.ts",
+ "prepack": "bun run build"
},
"repository": {
"type": "git",
@@ -25,16 +25,7 @@
},
"publishConfig": {
"access": "public",
- "provenance": true,
- "exports": {
- ".": {
- "types": "./dist/index.d.ts",
- "import": "./dist/index.js",
- "default": "./dist/index.js"
- }
- },
- "main": "./dist/index.js",
- "types": "./dist/index.d.ts"
+ "provenance": true
},
"peerDependencies": {
"vue": "^3.4.0",
diff --git a/packages/vue/tsdown.config.ts b/packages/vue/tsdown.config.ts
index 8d1edd8b8..e41017342 100644
--- a/packages/vue/tsdown.config.ts
+++ b/packages/vue/tsdown.config.ts
@@ -15,7 +15,7 @@ export default defineConfig({
sourcemap: true,
hash: false,
clean: true,
- outDir: './packages/vue/dist',
+ outDir: './dist',
treeshake: {
moduleSideEffects: false
},
diff --git a/tsconfig.json b/tsconfig.json
index 3286ccaa3..a10106f91 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -17,7 +17,9 @@
"noFallthroughCasesInSwitch": true,
"paths": {
"@/*": ["./src/*"],
+ "@open-pencil/vue": ["./packages/vue/src/index.ts"],
"@open-pencil/vue/*": ["./packages/vue/src/*"],
+ "@open-pencil/core": ["./packages/core/src/index.ts"],
"@open-pencil/core/*": ["./packages/core/src/*"]
}
},