Files
plugins/scripts/new-to-npm.sh
T
yetone f5308cdb0f publish: every version is packed onto the dist branch, so a new plugin merges without waiting for npm
A new package's first npm version can't go through trusted publishing
(a Trusted Publisher is set on a package that exists, with an owner's
2FA), so reviewed plugin PRs (#84 and others) sat unmerged until an owner
published by hand. Now publish.yml's dist job packs every package's
version (scripts/dist.mjs, npm pack --ignore-scripts) onto the dist
branch: tgz/<file> and index.json with each tarball's sha512. magpie
installs a @magpie-community package from there when npm doesn't have
the version. A new package without NPM_TOKEN is a notice, not a failed
run; a version npm refuses still fails it, now naming the stage-only
default of trusts made since 2026-09-03 and --allow-publish.

Run: node scripts/dist.mjs into an empty folder packed all 22 packages
(index.json 164K); the zed tarball's sha512 equals npm pack's integrity;
a second run packs nothing. The workflow itself is tried on main after
this push (workflow_dispatch).
2026-10-15 04:42:51 +08:00

22 lines
878 B
Bash
Executable File

#!/bin/sh
# Names any package here that has never been published to npm. Trusted
# publishing can't create a package. Merging doesn't wait for it: magpie
# installs the package from the dist branch until an owner publishes its
# first version (README, Publishing). A pull request runs this so the
# reviewer knows a merge brings a new name.
set -e
cd "$(dirname "$0")/.."
export npm_config_registry=https://registry.npmjs.org
for dir in packages/*/; do
name=$(node -p "require('./${dir}package.json').name")
if [ "$(npm view "$name" name 2>/dev/null)" != "$name" ]; then
echo "::notice file=${dir}package.json::$name is not on npm yet. Merging serves it to magpie from the dist branch; npm gets its first version from an owner (README, Publishing)."
new="$new $name"
fi
done
if [ -n "$new" ]; then
echo "new to npm:$new"
else
echo "every package is on npm"
fi