Skip to content

Phase 0.3: @_linked/cli rename + setup-publish + build-workspace refactor#17

Merged
flyon merged 96 commits intomainfrom
next
Apr 23, 2026
Merged

Phase 0.3: @_linked/cli rename + setup-publish + build-workspace refactor#17
flyon merged 96 commits intomainfrom
next

Conversation

@flyon
Copy link
Copy Markdown
Contributor

@flyon flyon commented Apr 23, 2026

Summary

Accumulated Phase 0.3 changes ready to ship as @_linked/cli 1.3.0:

  • Package rename: lincd-cli → @_linked/cli; repo transferred semantu/lincd-cli → linked-cm/cli
  • Binary rename: lincd → linked (with lnk shortcut); lincd retained as deprecated alias with stderr warning
  • New commands: build-workspace, build-package, yarn (safeYarn), setup-publish
  • build-workspace now invokes each package's own yarn build (not the internal pipeline)
  • Import checker: warn-only (was fatal)
  • App/package templates modernized
  • linkedPackage/linkedApp flags replace lincd/lincdApp (transition period reads both)

See .changeset/phase-0-3-rename-and-publish-workflow.md for the full changelog entry.

Publishing effect

On merge, the changesets workflow will open a Release PR bumping to 1.3.0 (minor). Merging that Release PR publishes @_linked/cli@1.3.0 to npm.

Test plan

  • CI runs pass
  • After merge: Release PR auto-opens with version bump + CHANGELOG update
  • After Release PR merge: @_linked/cli@1.3.0 on npm

René Verheij and others added 30 commits March 11, 2024 11:08
cleaning up defaults around env variables and run scripts.
lincd-cli should only contain things that everyone using lincd is interested in, not semantu specific preferences
TODO: update enable capacitor script to merge env variables and run scripts from templates
* main:
  latest release
  changed defaults to reflect new setup with public folder and with LinkedFileStore
  do not upload to CDN when building for phone App
  - upgrade version lincd-cli 1.1.0 - enable ASSET_PATH from env to fixed assets for apps
  cherrypick from fix env variables next branch
  deployed 1.1
  update lincd version
  - add accessUrl when build with postcss-url in css for development - remove SOURCE_PATH output webpack config
  fixed import storage config for webpack build
  remove @types/postcss-url
  setup postcss-url to handle url in css
  - changes the assets from /static to /public - changes the webpack output to support public/bundles and CDN
  make upload build to storage skip in dev env
  - changes the build process that it outputs in web/assets - update web folder into the CDN when buildApp
  fixed tsconfig for webpack config app

# Conflicts:
#	defaults/app-static/src/index-static.tsx
#	defaults/app-with-backend/package.json
#	defaults/app-with-backend/scripts/storage-config.js
#	defaults/app-with-backend/src/index.tsx
#	defaults/package/package.json
lincd CLI is now itself a dual package
we use tsx instead of @babel/register
all require statements became import statements
grunt is still broken
lincd CLI is itself now a dual package.
…this: `node --import ./node_modules/lincd-cli/lib/esm/loaders/register.js app.js`

adjusted default package setup, not using registerPackageModule anymore
added types to default package setup
updated default ontology import
default dual package setup
updated config-webpack-app as its now used by LincdServer for SSR & hot module reloading in development mode, as well as `yarn build` to build production bundles.
updated defaults
updated build command, latest glob version, added missing node-hook dependency
better warning messages for runPackage
build command now uses internal functions (buildPackage) instead of exec
extended addLineToIndex function for adding types.d.ts to new package
added getScriptDir() which functions like __dirname but works on both ESM & CJS
continued upgradePackages command (and commented all out). this is good to review for turning into update documentation
added compileOnly function
improved functionality to copy files into lib folder by doing it more manually
removing old files during build process (manually taken from main branch updates)
* 'next' of github.com:Semantu/lincd-cli:
  only 1 place now where CSS scoped names are generated. updated config-webpack-app as its now used by LincdServer for SSR & hot module reloading in development mode, as well as `yarn build` to build production bundles.
  added custom css loader for node.js, currently needs to be used like this: `node --import ./node_modules/lincd-cli/lib/esm/loaders/register.js app.js` adjusted default package setup, not using registerPackageModule anymore added types to default package setup updated default ontology import default dual package setup

# Conflicts:
#	src/cli-methods.ts
skip upload to storage when S3_BUCKET_ENDPOINT is not set in environment
extended dual modujle type support
updated tailwind to v4 and improved support:
* No more endless watch cycles being triggered.
* Lazy imported bundles are also included in tailwinds css generation
* We turn off tailwind preflight, but then recreate it almost entirely. But without destructive/strict selectors that ended up overwriting styles from CSS modules
* imported as first postcss plugin so that styles & theme variables from tailwind come first in the bundle.

SCSS - removed entirely. we rely on postcss for things like nesting.

CSS modules
- are now only applied to css files with .module.css names
- imrpoved css loader for css modules inside node.js

improved option to see which files changed and triggered a rebuild (to be cleaned up a bit)

config-webpack will likely be outdated, if its used to bundle a lincd package (we dont really do that at the moment)
…d sources and importing that as content in a separate tailwind.config.js file inside the app
…er or attach to the current running instance and then calls a provider method. Currently only works for generic providers, not shape providers.

 made `yarn lincd p [pkg]` work with spawn for better output
log build errors during build-updated if a package failed to build
René Verheij and others added 28 commits December 2, 2025 16:29
- Add interactive prompts to create-app command for app name, prefix, and domain
- Fix hydration target in index.tsx to properly target #root div
- Improve setup-workspace command
- Update default app template with improved variable naming (app_name, app_prefix, app_domain)
- Enhance CSS asset URL handling in webpack configuration for web and native paths
- Refactor public path handling to support Capacitor builds
- Add CSS-only loader registration for TypeScript and CSS integration
- Add extension aliasing in webpack configuration
- Update default CSS mode to 'tailwind' in webpack configuration
- Improve CSS chunk handling to prevent FOUC issues with lazy-loaded pages
- Add webpack-manifest-plugin support
- Add custom preflight CSS
- Support type inference for config files with defineConfig
- Fix process that runs forever
… in VS code shows green / red based on actual success / failure to auto build packages
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These were not imported in source (all commented out). Their presence
caused getLINCDDependencies() to discover unmigrated packages at
runtime, triggering "Multiple versions of LINCD" errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- package.json: name lincd-cli -> @_linked/cli, version 1.2.11
- bin entries: linked (primary), lnk (shortcut), lincd + lincd-cli (deprecated alias that prints warning to stderr)
- remove grunt bin entry and grunt-related deps (grunt, grunt-cli, grunt-concurrent, grunt-contrib-*, grunt-ts, grunt-webpack, @lodder/grunt-postcss, load-grunt-tasks)
- delete expose-grunt.cjs and src/config-grunt.cts (unused)
- remove dead getGruntConfig helper from utils.ts
- repository URL updated to linked-cm/cli
- defaults/package: drop Gruntfile, switch to rimraf + tsc + tsconfig-to-dual-package pattern (matches @_linked/core)
- defaults/package/package.json: flag lincd:true -> linkedPackage:true; keywords lincd -> linked; deps lincd-cli -> @_linked/cli; lincd -> @_linked/core
- src/cli-methods.ts: getLincdPackages + getEnvironmentInfo accept either linkedPackage or lincd (transition period)
- src/config-webpack-app.ts: loadAppConfig reads linkedApp before falling back to lincdApp
- build-workspace: builds all linked packages in the workspace in dep order. Wraps existing buildAll (or buildUpdated with -u). Reads from workspaces field, respects linkedPackage flag.
- build-package <filepath>: editor-hook variant. Walks up from a file path, finds nearest package.json, runs 'linked build' in that package's directory. Skips non-linked packages cleanly.
- yarn: safeYarn port from semantu-cli. Preserves nested yarn.lock files (mrgit-aware) while running yarn at root. Falls back to plain yarn when mrgit.json is absent.
- export buildPackageByPath and safeYarn from package root for reuse by semantu-cli
…edApp flag

- package.json: lincdApp -> linkedApp flag; dep lincd -> @_linked/core, devdep lincd-cli -> @_linked/cli; keywords lincd -> linked
- package.json scripts: lincd -> linked in start, build, server:prod; new 'setup' script that cp mrgit-template -> mrgit.json, runs mrgit sync, yarn install
- gitignore.template: add mrgit.json (generated locally, not committed)
- theme.css: tailwind config path lincd-cli -> @_linked/cli
- readme.md: document optional yarn setup flow for local @_linked package development
- mrgit-template.json: new empty default, users can add @_linked/* packages to clone locally
- package.json: declare @_linked/cli itself as a linkedPackage so build-workspace can include it
- commands/build-package.ts: shell out via 'yarn exec linked build' instead of 'yarn linked build'. Inner packages don't have a 'linked' script in package.json; yarn exec invokes the binary directly.
CHANGELOG follows Keep-a-Changelog format. Entry documents rename, new commands,
deprecation of lincd bin, template modernization, and migration notes.

App template: mrgit is now a devDep (previously assumed global). Setup script runs
yarn install before yarn mrgit sync so the local mrgit is available, then yarn install
again after sync to pick up any packages mrgit cloned into packages/.
Set LINKED_YARN_DRY_RUN=1 to log the assembled yarn command and received args
instead of executing. Useful for validating arg forwarding in new environments
or debugging safeYarn regressions.

Tested arg forwarding with: 'install', 'add -D foo', 'install --mode update-lockfile',
no-args, and 'workspaces foreach -A run build'. All pass through verbatim.
…al packages

Template now uses the CLI-driven build (yarn linked build) instead of pure tsc.
Brings checker + copy + dual-package steps for free via the standard CLI build
path. Matches the pattern used by all 14 @_linked/* foundational packages.

Removed rimraf from template devDeps (no longer used; linked build handles it).
…encies' field

Object.keys(pack.dependencies) crashed when a foundational package had no
'dependencies' key (only devDependencies). Guard with || {}.
Previously buildAll called the internal buildPackage() pipeline directly, which
hardcoded tsc + tsconfig-to-dual-package. That broke for packages with different
build setups (@_linked/core uses npx tsc direct + custom dual-package.js; pure-CSS
packages have no tsc at all). Now each package owns its build pipeline.

Also:
- checkImports: guard against missing src/ folder (pure-CSS packages)
- checkImports: return warnings as string (warning) instead of throwing (fatal);
  the strict ESM extension check was aborting builds despite lib/ being fresh
- compilePackageESM/CJS: skip if no tsconfig-*.json present
- Dual package step: skip if tsconfig files missing
- tsconfig-to-dual-package: invoke via npx so binary is found regardless of
  where it's installed (root vs per-package node_modules)
- cli-methods.ts: migrate lingering lincd-server imports to @_linked/server
Sets up a single-branch changesets publish workflow in the current package repo.
Copies GitHub Actions workflows + changesets config, patches package.json
(publishConfig + changesets devDeps), generates package-lock.json via an
isolated tmpdir (avoids yarn-workspace root polluting).

With --configure-github: checks gh CLI is installed + authenticated, then
calls gh api to set branch protection on main (strict + Build & Test required).
Prints friendly next-steps if gh is absent or protection call fails.

--scope core (default) uses NPM_AUTH_TOKEN secret; --scope community uses
NPM_AUTH_TOKEN_CM (for future community-tier packages).

Template files in defaults/setup-publish/ with {{NPM_SECRET_NAME}} and
{{REPO_SLUG}} substitutions.
First publish via CI will be triggered when the next->main PR is merged.
Includes current accumulated changes: build-workspace refactor, npx tsc fixes,
tsconfig-to-dual-package via npx, setup-publish command itself.
- --dual-branch: copy core's main+dev workflow pattern (with @next prereleases
  on dev), adapted to use NPM_AUTH_TOKEN instead of OIDC.
- ensureLockfile: always regenerate (package.json was just patched with
  changesets devDeps; pre-existing lockfile is stale). Uses isolated tmpdir
  with dedicated cache to avoid conflicts with yarn workspace parent.
- patchPackageJson: strip publishConfig.provenance when applying (OIDC-only
  feature; conflicts with NPM_AUTH_TOKEN flow).
- .gitignore: relax src-compiled gitignore to only .d.ts and .js.map; .js is
  sometimes legitimate (e.g. test helpers like jest-environment-jsdom-with-fetch.js).
…re legit sources

src/plugins/colors.d.ts is a hand-written type declaration referenced via
/// <reference path="colors.d.ts" /> in declaration-plugin.ts + externalise-modules.ts.
It was clobbered by the defensive gitignore rule, breaking CI ('file not found' on tsc).

Also de-dupe the gitignore (had duplicate node_modules/lib entries).
Keep src/**/*.js.map gitignored (those are strictly tsc sourcemap output).
@flyon flyon merged commit 3cd3c4d into main Apr 23, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants