Skip to content

Latest commit

 

History

History
111 lines (79 loc) · 3.44 KB

File metadata and controls

111 lines (79 loc) · 3.44 KB

@_linked/cli

Command-line tools for the @_linked/* packages and apps.

Install

npm install --save-dev @_linked/cli
# or
yarn add -D @_linked/cli

Binaries

Three executables ship in this package:

  • linked — primary command
  • lnk — short alias for linked
  • lincd — deprecated alias; prints a warning and forwards to linked. Will be removed in a future major release.

Commands

Run linked --help for the full list. The commonly used ones:

App scaffolding

linked create-app <name>          # scaffold a new app (interactive)
linked create-package <name>      # scaffold a new linkedPackage
linked create-shape <name>        # add a shape file to the current package
linked create-component <name>    # add a React component file

Building

linked build                      # build the current package (tsc + checks)
linked build-app                  # build frontend + backend for the current app
linked build-workspace            # build all linked packages in the workspace in dependency order
linked build-updated              # incremental: only packages that changed since last build
linked build-package <file>       # walk up from a file path to find its package and rebuild

Publishing / release

linked setup-publish              # install a changesets-based publish workflow in the current repo
linked setup-publish --dual-branch          # use main + dev with @next prereleases
linked setup-publish --configure-github     # also set branch protection via gh CLI
linked setup-publish --scope community      # use NPM_AUTH_TOKEN_CM instead of NPM_AUTH_TOKEN

setup-publish writes:

  • .github/workflows/ci.yml, publish.yml, changeset-check.yml
  • .changeset/config.json + README.md
  • .gitignore entries
  • publishConfig: {access: public} + @changesets/cli devDeps in package.json
  • package-lock.json (via isolated tmpdir)

Dev workflow

linked start                      # run the dev server (app)
linked dev                        # file-watch rebuild (package)
linked yarn <args>                # safe-yarn: run yarn at root while preserving nested yarn.lock files

Registry / dev utilities

linked publish                    # publish the current package (for non-CI flows)
linked register                   # register the package to the linked registry
linked status                     # show which packages need build/publish
linked depcheck                   # check for missing/unused deps

Package flags

The CLI recognizes two flags in package.json:

{
  "linkedPackage": true,     // marks a reusable library; build-workspace builds it
  "linkedApp": true          // marks a deployable app; build-workspace skips it
}

The legacy lincd: true and lincdApp: true flags are still read for the transition period.

Development

cd packages/cli
yarn build

Dual ESM + CJS build via tsconfig-to-dual-package. Sources in src/, output in lib/esm/ and lib/cjs/.

Templates

Templates live in defaults/:

  • defaults/app-with-backend/ — used by linked create-app
  • defaults/app-static/ — minimal static app
  • defaults/package/ — used by linked create-package
  • defaults/setup-publish/ — workflow + changeset files written by linked setup-publish (single-branch default; dual-branch/ subdirectory for the --dual-branch variant)

Repository

linked-cm/cli on GitHub. License: MPL-2.0.