Skip to content

Commit b983ea8

Browse files
committed
fix(@schematics/angular): respect skip-install for tailwind schematic
When generating a new application or using the application schematic with the `tailwind` style option, the `skipInstall` option was being ignored. This resulted in dependencies being installed even when `--skip-install` was specified. This change ensures that the `skipInstall` option is correctly passed to and handled by the Tailwind schematic, preventing automatic package installation when requested.
1 parent 269ef26 commit b983ea8

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

packages/schematics/angular/application/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ export default function (options: ApplicationOptions): Rule {
147147
isTailwind
148148
? schematic('tailwind', {
149149
project: options.name,
150+
skipInstall: options.skipInstall,
150151
})
151152
: noop(),
152153
]);

packages/schematics/angular/tailwind/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ import { join } from 'node:path/posix';
2222
import {
2323
DependencyType,
2424
ExistingBehavior,
25+
InstallBehavior,
2526
ProjectDefinition,
2627
addDependency,
2728
updateWorkspace,
2829
} from '../utility';
2930
import { JSONFile } from '../utility/json-file';
3031
import { latestVersions } from '../utility/latest-versions';
3132
import { createProjectSchematic } from '../utility/project';
33+
import { Schema as TailwindOptions } from './schema';
3234

3335
const TAILWIND_DEPENDENCIES = ['tailwindcss', '@tailwindcss/postcss', 'postcss'];
3436
const POSTCSS_CONFIG_FILES = ['.postcssrc.json', 'postcss.config.json'];
@@ -120,14 +122,15 @@ function managePostCssConfiguration(project: ProjectDefinition): Rule {
120122
};
121123
}
122124

123-
export default createProjectSchematic((options, { project }) => {
125+
export default createProjectSchematic<TailwindOptions>((options, { project }) => {
124126
return chain([
125127
addTailwindStyles(options, project),
126128
managePostCssConfiguration(project),
127129
...TAILWIND_DEPENDENCIES.map((name) =>
128130
addDependency(name, latestVersions[name], {
129131
type: DependencyType.Dev,
130132
existing: ExistingBehavior.Skip,
133+
install: options.skipInstall ? InstallBehavior.None : InstallBehavior.Auto,
131134
}),
132135
),
133136
]);

packages/schematics/angular/tailwind/schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
"$default": {
1010
"$source": "projectName"
1111
}
12+
},
13+
"skipInstall": {
14+
"description": "Skip the automatic installation of packages. You will need to manually install the dependencies later.",
15+
"type": "boolean",
16+
"default": false
1217
}
1318
},
1419
"required": ["project"]

0 commit comments

Comments
 (0)