Skip to content

sm new project: Styles/app.css uses monorepo-relative paths that don't resolve for downstream consumers #152

@antosubash

Description

@antosubash

Summary

sm new project (CLI v0.0.36) scaffolds src/<Project>.Host/Styles/app.css with paths that assume the project lives inside the SimpleModule monorepo:

@import "tailwindcss";
@import "../../../packages/SimpleModule.Theme.Default/theme.css";
@source "../../../packages/SimpleModule.UI/";
@source "../../../packages/SimpleModule.Client/";
@source "../../../../modules/**/Views/**/*.tsx";
@source "../../../../modules/**/Pages/**/*.tsx";

For a downstream consumer (someone running sm new project Foo outside the SimpleModule git checkout), these paths don't exist. The equivalents are in node_modules/@simplemodule/theme-default/, node_modules/@simplemodule/ui/, and node_modules/@simplemodule/client/ — i.e. consumed via the published npm packages.

Tailwind then errors with:

EXEC : error : Can't resolve '../../../packages/SimpleModule.Theme.Default/theme.css' in '.../Styles'

The @source glob for modules is also off by one level — it's ../../../../modules/** (four ups) but the host lives at src/<Project>.Host/Styles/, so the modules directory at src/modules/ is only three ups (../../modules/**).

Repro

sm new project Repro                # outside the SimpleModule monorepo
cd Repro
# (after #150 + #151 worked around)
dotnet build
# → Tailwind can't resolve packages/SimpleModule.Theme.Default/theme.css

Expected

The default Styles/app.css resolves on a clean install. Either:

  1. Detect "inside monorepo" vs "outside" at scaffold time (the CLI already does this — see SolutionContext.Discover() in NewProjectCommand.cs) and emit different paths accordingly.
  2. Always use npm-package paths in the scaffold, since the monorepo also has the npm packages installed under node_modules/@simplemodule/* (via npm workspaces).

Option 2 is simpler and works for both audiences.

Suggested replacement

@import "tailwindcss";
@import "../../../node_modules/@simplemodule/theme-default/theme.css";
@source "../../../node_modules/@simplemodule/ui/";
@source "../../../node_modules/@simplemodule/client/";
@source "../../modules/**/Views/**/*.tsx";
@source "../../modules/**/Pages/**/*.tsx";

(I verified this builds clean against the published 0.0.36 npm packages.)

Environment

  • sm --version: 0.0.36
  • dotnet --version: 10.0.201
  • Project scaffolded outside the SimpleModule monorepo

Related

#149, #150, #151 — all gaps that surface on a clean sm new project outside the monorepo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions