From fdce40ea5844af4a6641eec6e436b3941ea4acf0 Mon Sep 17 00:00:00 2001 From: Rev Albrecht von Nullpointer <160512015+revxshafi@users.noreply.github.com> Date: Fri, 21 Aug 2026 07:43:00 +0000 Subject: [PATCH] Move to creative-softworks org + add scoped alias package - point every repo URL (package.json, CHANGELOG, CONTRIBUTING, issue template) at github.com/creative-softworks/sql-switch after the transfer - add scoped/ => @creative-softworks/sql-switch, a re-export alias that forwards the unscoped sql-switch package (named exports + default) so both names are the same API from one source. no build step, three tiny files. - publish.yml now ships both packages (unscoped real code, then the scoped alias) via NPM_TOKEN, and guards that root + scoped versions and the alias pin all match the tag before anything publishes - version left at the 0.0.0 placeholder, bumped at release time --- .github/ISSUE_TEMPLATE/config.yml | 4 +-- .github/workflows/publish.yml | 53 ++++++++++++++++++++----------- CHANGELOG.md | 6 ++-- CONTRIBUTING.md | 2 +- README.md | 7 ++++ package.json | 8 ++--- scoped/README.md | 18 +++++++++++ scoped/index.cjs | 4 +++ scoped/index.d.ts | 4 +++ scoped/index.js | 5 +++ scoped/package.json | 51 +++++++++++++++++++++++++++++ 11 files changed, 134 insertions(+), 28 deletions(-) create mode 100644 scoped/README.md create mode 100644 scoped/index.cjs create mode 100644 scoped/index.d.ts create mode 100644 scoped/index.js create mode 100644 scoped/package.json diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 7301739..dbd912b 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,8 +1,8 @@ blank_issues_enabled: false contact_links: - name: Report a security vulnerability - url: https://github.com/revxshafi/sql-switch/security/advisories/new + url: https://github.com/creative-softworks/sql-switch/security/advisories/new about: Please do not open a public issue for security problems. Report privately as described in SECURITY.md (the repository's Security tab). - name: Questions & discussion - url: https://github.com/revxshafi/sql-switch/discussions + url: https://github.com/creative-softworks/sql-switch/discussions about: Have a question or an idea to talk through? Start a discussion instead of filing an issue. diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e190f16..6666e4a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,8 +1,10 @@ name: Publish # fires when you push a version tag (git tag v0.2.0 && git push origin v0.2.0), or by hand from the -# Actions tab. the actual publish is gated on the same typecheck/test/smoke/build a PR ran (via the -# package.json prepublishOnly hook), so a tag can't ship something that wouldn't have merged. +# Actions tab. two packages ship from this one repo => the real code as `sql-switch` (unscoped), and +# `@creative-softworks/sql-switch` (in scoped/) which just re-exports it. the actual publish is gated +# on the same typecheck/test/smoke/build a PR ran (package.json prepublishOnly), so a tag can't ship +# something that wouldn't have merged. on: push: tags: @@ -19,7 +21,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read - # OIDC => npm trusted publishing + provenance, so no long lived NPM_TOKEN has to live in secrets + # provenance attestation is signed with this even on token auth => keep it on id-token: write steps: @@ -34,28 +36,43 @@ jobs: with: node-version: 22 cache: pnpm + # writes the ~/.npmrc that NODE_AUTH_TOKEN below fills in, for both publishes registry-url: https://registry.npmjs.org - name: Install dependencies run: pnpm install --frozen-lockfile - # a tag that doesn't match package.json is almost always a slip => cheaper to stop here than to - # unpublish. only runs for a real tag push, a manual workflow_dispatch run has no tag to check. - - name: Tag must match package.json version + # a tag that doesn't match is almost always a slip => cheaper to stop here than to unpublish. + # both package.json versions have to agree with the tag, and the scoped alias has to pin the + # unscoped version it re-exports, otherwise the two packages drift apart. tag push only. + - name: Versions must match the tag if: github.ref_type == 'tag' run: | - pkg="v$(node -p "require('./package.json').version")" - tag="${GITHUB_REF_NAME}" - echo "package.json=$pkg tag=$tag" - if [ "$pkg" != "$tag" ]; then - echo "::error::tag $tag does not match package.json version $pkg" - exit 1 - fi - - # npm (not pnpm) does the OIDC handshake for trusted publishing, and it needs a recent npm. - # prepublishOnly reruns typecheck/test/smoke/build first, and publishConfig.provenance is on => - # the id-token: write permission above is what lets the provenance attestation get signed. - - name: Publish to npm + tag="${GITHUB_REF_NAME#v}" + root="$(node -p "require('./package.json').version")" + scoped="$(node -p "require('./scoped/package.json').version")" + pin="$(node -p "require('./scoped/package.json').dependencies['sql-switch']")" + echo "tag=$tag root=$root scoped=$scoped pin=$pin" + fail=0 + [ "$root" = "$tag" ] || { echo "::error::package.json ($root) != tag ($tag)"; fail=1; } + [ "$scoped" = "$tag" ] || { echo "::error::scoped/package.json ($scoped) != tag ($tag)"; fail=1; } + [ "$pin" = "$tag" ] || { echo "::error::scoped pins sql-switch@$pin, expected $tag"; fail=1; } + exit $fail + + # npm (not pnpm) does the publish + provenance, and it needs a recent npm. prepublishOnly reruns + # typecheck/test/smoke/build first => the gate is the same one a PR passed. + - name: Publish sql-switch (unscoped, the real code) + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} run: | npm install -g npm@latest npm publish --access public + + # the alias has no build step (three hand-written re-export files) => prepublishOnly doesn't run + # here, the gate above already covered the code it points at. depends on sql-switch@ which + # the step above just published. + - name: Publish @creative-softworks/sql-switch (scoped alias) + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + working-directory: scoped + run: npm publish --access public diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bb3954..006b61f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,6 @@ Initial pre-release of the universal SQLite/PostgreSQL DAL. crashing, then recovers. - Bidirectional engine swap => migrate data SQLite files <=> PostgreSQL schemas. -[Unreleased]: https://github.com/revxshafi/sql-switch/compare/v0.2.0...HEAD -[0.2.0]: https://github.com/revxshafi/sql-switch/compare/v0.1.0...v0.2.0 -[0.1.0]: https://github.com/revxshafi/sql-switch/releases/tag/v0.1.0 +[Unreleased]: https://github.com/creative-softworks/sql-switch/compare/v0.2.0...HEAD +[0.2.0]: https://github.com/creative-softworks/sql-switch/compare/v0.1.0...v0.2.0 +[0.1.0]: https://github.com/creative-softworks/sql-switch/releases/tag/v0.1.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f5ecdf8..6bff7f6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ Thanks for taking a look. This is a small project, so the workflow is light. ## Getting set up ```bash -git clone https://github.com/revxshafi/sql-switch.git +git clone https://github.com/creative-softworks/sql-switch.git cd sql-switch pnpm install ``` diff --git a/README.md b/README.md index 2fbf4f0..64a8064 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,13 @@ Universal hot-swappable database abstraction layer for Node.js. Run SQLite local npm install sql-switch ``` +Also published under the Creative-Softworks scope if you prefer the branded name — it re-exports +this package unchanged, so pick whichever reads better to you: + +```bash +npm install @creative-softworks/sql-switch +``` + The database drivers are **optional peer dependencies** — install only the one for the engine you run, so a SQLite-only app never pulls in `pg` and its build, and vice versa: diff --git a/package.json b/package.json index 90e74a2..5677ef8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sql-switch", - "version": "0.2.0", + "version": "0.0.0", "description": "Universal hot-swappable DAL — SQLite in dev, PostgreSQL in prod, same fluent API", "type": "module", "packageManager": "pnpm@10.26.1", @@ -49,12 +49,12 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/revxshafi/sql-switch.git" + "url": "git+https://github.com/creative-softworks/sql-switch.git" }, "bugs": { - "url": "https://github.com/revxshafi/sql-switch/issues" + "url": "https://github.com/creative-softworks/sql-switch/issues" }, - "homepage": "https://github.com/revxshafi/sql-switch#readme", + "homepage": "https://github.com/creative-softworks/sql-switch#readme", "publishConfig": { "access": "public", "provenance": true diff --git a/scoped/README.md b/scoped/README.md new file mode 100644 index 0000000..e0d60db --- /dev/null +++ b/scoped/README.md @@ -0,0 +1,18 @@ +# @creative-softworks/sql-switch + +Branded alias of [**sql-switch**](https://www.npmjs.com/package/sql-switch) — a universal, hot-swappable database abstraction layer: SQLite in dev, PostgreSQL in prod, one fluent API. + +This package re-exports `sql-switch` unchanged. It exists so the library can be installed under the Creative-Softworks scope; the code, versions and docs all live in the main package. + +```bash +npm install @creative-softworks/sql-switch +``` + +```ts +// the short unscoped name resolves too (it's pulled in as a dependency) +import { createDAL } from 'sql-switch'; +``` + +Full documentation: https://github.com/creative-softworks/sql-switch#readme + +Everything is identical to `sql-switch` at the same version — see that package for the API, guides and changelog. diff --git a/scoped/index.cjs b/scoped/index.cjs new file mode 100644 index 0000000..fd48d72 --- /dev/null +++ b/scoped/index.cjs @@ -0,0 +1,4 @@ +// see index.js => forward the unscoped `sql-switch` package wholesale (named exports & the +// default `createDAL` alike). CJS entry, so `require('@creative-softworks/sql-switch')` is +// byte for byte what `require('sql-switch')` returns. +module.exports = require('sql-switch'); diff --git a/scoped/index.d.ts b/scoped/index.d.ts new file mode 100644 index 0000000..8139d93 --- /dev/null +++ b/scoped/index.d.ts @@ -0,0 +1,4 @@ +// types for the alias => re-export everything the unscoped package's declarations expose, the +// default included, so editors see the identical surface under either name. +export * from 'sql-switch'; +export { default } from 'sql-switch'; diff --git a/scoped/index.js b/scoped/index.js new file mode 100644 index 0000000..79eb56d --- /dev/null +++ b/scoped/index.js @@ -0,0 +1,5 @@ +// branded alias => the real code lives in the unscoped `sql-switch` package. this file just +// re-exports it, so `@creative-softworks/sql-switch` and `sql-switch` are the exact same API from +// one source of truth (one place bugs get fixed, one version to bump). ESM entry. +export * from 'sql-switch'; +export { default } from 'sql-switch'; diff --git a/scoped/package.json b/scoped/package.json new file mode 100644 index 0000000..5af7419 --- /dev/null +++ b/scoped/package.json @@ -0,0 +1,51 @@ +{ + "name": "@creative-softworks/sql-switch", + "version": "0.0.0", + "description": "Branded alias of sql-switch — a universal hot-swappable DAL (SQLite in dev, PostgreSQL in prod, same fluent API). Re-exports the sql-switch package unchanged.", + "type": "module", + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./index.js", + "require": "./index.cjs" + } + }, + "main": "./index.cjs", + "module": "./index.js", + "types": "./index.d.ts", + "files": [ + "index.js", + "index.cjs", + "index.d.ts", + "README.md" + ], + "engines": { + "node": ">=22.0.0" + }, + "keywords": [ + "database", + "sqlite", + "postgresql", + "drizzle", + "dal", + "hot-swap" + ], + "author": "Rev Albrecht von Nullpointer <160512015+revxshafi@users.noreply.github.com>", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/creative-softworks/sql-switch.git", + "directory": "scoped" + }, + "bugs": { + "url": "https://github.com/creative-softworks/sql-switch/issues" + }, + "homepage": "https://github.com/creative-softworks/sql-switch#readme", + "publishConfig": { + "access": "public", + "provenance": true + }, + "dependencies": { + "sql-switch": "0.0.0" + } +}