Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: version 11.0.0 #2813

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
1c64eef
feat(schematics): list schematics from extended collections
xdissent May 25, 2023
868e4f0
Update lib/schematics/custom.collection.ts
xdissent May 26, 2023
a063bbd
Update lib/schematics/custom.collection.ts
xdissent May 26, 2023
28157f8
package json changes
thisFunction Aug 30, 2024
c010d97
add new action changes
thisFunction Aug 30, 2024
100a17a
change lib questions file
thisFunction Aug 30, 2024
c461e6d
messages file changes
thisFunction Aug 30, 2024
abccd76
lib utils changes
thisFunction Aug 30, 2024
3bfffa4
test changes
thisFunction Aug 30, 2024
322412b
clean up console.logs
thisFunction Aug 30, 2024
56cc055
refactor(build): properly asyncify compiler run methods
iliazeus Sep 28, 2023
84d4d4a
feat: several apps for nest build
iliazeus Sep 28, 2023
57c09cb
feat: add nest build --all flag
iliazeus Sep 28, 2023
b3fedf6
feat: log project names if building multiple
iliazeus Sep 28, 2023
aef1368
fix: consistently allow undefined as an app name for build command
iliazeus Jan 11, 2024
4b0a4b0
fix(deps): update dependency chokidar to v4
renovate[bot] Sep 22, 2024
1e34706
feat: drop uncommon variants of nest cli config file name
micalevisk Oct 27, 2024
af80b59
fix(deps): update dependency glob to v11
renovate[bot] Nov 6, 2024
21291f2
feat: add flag to disable shell mode for `nest start --watch`
quallrum Feb 21, 2024
4ef5cfb
fix(deps): update angular-cli monorepo to v19
renovate[bot] Nov 21, 2024
57fb5e0
Merge pull request #2788 from nestjs/renovate/glob-11.x
kamilmysliwiec Nov 22, 2024
ec78e77
Merge pull request #2769 from micalevisk/feat-issue-2765
kamilmysliwiec Nov 22, 2024
d88cd0f
Merge pull request #2734 from nestjs/renovate/chokidar-4.x
kamilmysliwiec Nov 22, 2024
76ca1ea
chore: resolve conflicts
kamilmysliwiec Nov 22, 2024
70e9183
Merge branch 'thisFunction-chore/upgrade-inquirer-package' into next
kamilmysliwiec Nov 22, 2024
2796752
Merge branch 'next' into renovate/major-angular-cli-monorepo
kamilmysliwiec Nov 22, 2024
8d6c26a
Merge pull request #2608 from nestjs/renovate/major-angular-cli-monorepo
kamilmysliwiec Nov 22, 2024
d4746a1
chore: minor improvements, resolve conflicts
kamilmysliwiec Nov 22, 2024
1e69046
Merge branch 'iliazeus-feature/2026/build-all' into next
kamilmysliwiec Nov 22, 2024
ceb1dca
Merge branch 'feat/list-extended-schematics' of https://github.com/xd…
kamilmysliwiec Nov 22, 2024
05eb311
chore: minor variable name update
kamilmysliwiec Nov 22, 2024
2a69119
Merge branch 'xdissent-feat/list-extended-schematics' into next
kamilmysliwiec Nov 22, 2024
fb27c53
Merge branch 'feat/no-shell-option' of https://github.com/quallrum/ne…
kamilmysliwiec Nov 22, 2024
8dd3d64
chore: use shell flag instead of noshell
kamilmysliwiec Nov 22, 2024
22f1f44
Merge branch 'quallrum-feat/no-shell-option' into next
kamilmysliwiec Nov 22, 2024
bdde28e
fix(deps): update angular-cli monorepo to v19
renovate[bot] Nov 22, 2024
b1adae3
Merge branch 'next' into renovate/major-angular-cli-monorepo
kamilmysliwiec Nov 22, 2024
e8a4345
Merge pull request #2811 from nestjs/renovate/major-angular-cli-monorepo
kamilmysliwiec Nov 22, 2024
17eb5c7
chore: sync package lock, update ci install cmd
kamilmysliwiec Nov 22, 2024
2e3bfa6
chore: update minimum node engine
kamilmysliwiec Nov 22, 2024
b39cb7f
fix: fix build action
kamilmysliwiec Nov 22, 2024
601a108
fix: build when --all not set, start --watch fix
kamilmysliwiec Nov 22, 2024
0ab89d6
chore: add negate --shell flag
kamilmysliwiec Nov 22, 2024
3d0313f
chore: update package.json
kamilmysliwiec Nov 22, 2024
4725b93
chore: update messages, emoji
kamilmysliwiec Nov 22, 2024
54950a2
fix: inquirer misuse, upgrade leftovers, fixes
kamilmysliwiec Nov 22, 2024
bca0b82
chore: install schematics published under next tag
kamilmysliwiec Nov 25, 2024
aeb0622
feat: add support for --env-file flag
kamilmysliwiec Nov 25, 2024
b38af54
Merge pull request #2818 from nestjs/feat/env-file-flag
kamilmysliwiec Nov 25, 2024
101081a
refactor: replace chalk with smaller and faster ansis
webdiscus Dec 17, 2024
5a97e1b
Merge pull request #2845 from webdiscus/switch-to-ansis
kamilmysliwiec Jan 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ aliases:
- &install-deps
run:
name: Install dependencies
command: npm ci --ignore-scripts
command: npm ci --ignore-scripts --legacy-peer-deps
- &build-packages
run:
name: Build
Expand All @@ -31,7 +31,7 @@ jobs:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Install dependencies
command: npm ci --ignore-scripts
command: npm ci --ignore-scripts --legacy-peer-deps
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
Expand Down
14 changes: 7 additions & 7 deletions actions/add.action.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as chalk from 'chalk';
import { red } from 'ansis';
import { Input } from '../commands';
import { getValueOrDefault } from '../lib/compiler/helpers/get-value-or-default';
import {
Expand Down Expand Up @@ -40,7 +40,7 @@ export class AddAction extends AbstractAction {
await this.addLibrary(collectionName, options, extraFlags);
} else {
console.error(
chalk.red(
red(
MESSAGES.LIBRARY_INSTALLATION_FAILED_BAD_PACKAGE(libraryName),
),
);
Expand Down Expand Up @@ -86,11 +86,11 @@ export class AddAction extends AbstractAction {
defaultLabel,
);

const answers = await askForProjectName(
const selectedProject = (await askForProjectName(
MESSAGES.LIBRARY_PROJECT_SELECTION_QUESTION,
projects,
);
const project = answers.appName.replace(defaultLabel, '');
)) as string;
const project = selectedProject.replace(defaultLabel, '');
if (project !== configuration.sourceRoot) {
sourceRoot = configurationProjects[project].sourceRoot;
}
Expand All @@ -109,7 +109,7 @@ export class AddAction extends AbstractAction {
installResult = await manager.addProduction([collectionName], tagName);
} catch (error) {
if (error && error.message) {
console.error(chalk.red(error.message));
console.error(red(error.message));
}
}
return installResult;
Expand Down Expand Up @@ -140,7 +140,7 @@ export class AddAction extends AbstractAction {
);
} catch (error) {
if (error && error.message) {
console.error(chalk.red(error.message));
console.error(red(error.message));
return Promise.reject();
}
}
Expand Down
173 changes: 100 additions & 73 deletions actions/build.action.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as chalk from 'chalk';
import { red } from 'ansis';
import { join } from 'path';
import * as ts from 'typescript';
import { Input } from '../commands';
Expand Down Expand Up @@ -60,7 +60,7 @@ export class BuildAction extends AbstractAction {
if (err instanceof Error) {
console.log(`\n${ERROR_PREFIX} ${err.message}\n`);
} else {
console.error(`\n${chalk.red(err)}\n`);
console.error(`\n${red(err)}\n`);
}
process.exit(1);
}
Expand All @@ -78,87 +78,110 @@ export class BuildAction extends AbstractAction {
(option) => option.name === 'config',
)!.value as string;
const configuration = await this.loader.load(configFileName);
const appName = commandInputs.find((input) => input.name === 'app')!
.value as string;
const buildAll = commandOptions.find((opt) => opt.name === 'all')?.value;

const pathToTsconfig = getTscConfigPath(
configuration,
commandOptions,
appName,
);
const { options: tsOptions } =
this.tsConfigProvider.getByConfigFilename(pathToTsconfig);
const outDir = tsOptions.outDir || defaultOutDir;
let appNames: (string | undefined)[];
if (buildAll) {
// If the "all" flag is set, we need to build all projects in a monorepo.
appNames = [];

const isWebpackEnabled = getValueOrDefault<boolean>(
configuration,
'compilerOptions.webpack',
appName,
'webpack',
commandOptions,
);
const builder = isWebpackEnabled
? { type: 'webpack' }
: getBuilder(configuration, commandOptions, appName);
if (configuration.projects) {
appNames.push(...Object.keys(configuration.projects));
}
} else {
appNames = commandInputs
.filter((input) => input.name === 'app')
.map((input) => input.value) as string[];
}

await deleteOutDirIfEnabled(configuration, appName, outDir);
this.assetsManager.copyAssets(
configuration,
appName,
outDir,
watchAssetsMode,
);
if (appNames.length === 0) {
// If there are no projects, use "undefined" to build the default project.
appNames.push(undefined);
}

const typeCheck = getValueOrDefault<boolean>(
configuration,
'compilerOptions.typeCheck',
appName,
'typeCheck',
commandOptions,
);
if (typeCheck && builder.type !== 'swc') {
console.warn(
INFO_PREFIX +
` "typeCheck" will not have any effect when "builder" is not "swc".`,
for (const appName of appNames) {
const pathToTsconfig = getTscConfigPath(
configuration,
commandOptions,
appName,
);
}
const { options: tsOptions } =
this.tsConfigProvider.getByConfigFilename(pathToTsconfig);
const outDir = tsOptions.outDir || defaultOutDir;

switch (builder.type) {
case 'tsc':
return this.runTsc(
watchMode,
commandOptions,
configuration,
pathToTsconfig,
appName,
onSuccess,
);
case 'webpack':
return this.runWebpack(
configuration,
appName,
commandOptions,
pathToTsconfig,
isDebugEnabled,
watchMode,
onSuccess,
);
case 'swc':
return this.runSwc(
configuration,
appName,
pathToTsconfig,
watchMode,
commandOptions,
tsOptions,
onSuccess,
const isWebpackEnabled = getValueOrDefault<boolean>(
configuration,
'compilerOptions.webpack',
appName,
'webpack',
commandOptions,
);
const builder = isWebpackEnabled
? { type: 'webpack' }
: getBuilder(configuration, commandOptions, appName);

await deleteOutDirIfEnabled(configuration, appName, outDir);
this.assetsManager.copyAssets(
configuration,
appName,
outDir,
watchAssetsMode,
);

const typeCheck = getValueOrDefault<boolean>(
configuration,
'compilerOptions.typeCheck',
appName,
'typeCheck',
commandOptions,
);
if (typeCheck && builder.type !== 'swc') {
console.warn(
INFO_PREFIX +
` "typeCheck" will not have any effect when "builder" is not "swc".`,
);
}

switch (builder.type) {
case 'tsc':
await this.runTsc(
watchMode,
commandOptions,
configuration,
pathToTsconfig,
appName,
onSuccess,
);
break;
case 'webpack':
await this.runWebpack(
configuration,
appName,
commandOptions,
pathToTsconfig,
isDebugEnabled,
watchMode,
onSuccess,
);
break;
case 'swc':
await this.runSwc(
configuration,
appName,
pathToTsconfig,
watchMode,
commandOptions,
tsOptions,
onSuccess,
);
break;
}
}
}

private async runSwc(
configuration: Required<Configuration>,
appName: string,
appName: string | undefined,
pathToTsconfig: string,
watchMode: boolean,
options: Input[],
Expand All @@ -167,6 +190,7 @@ export class BuildAction extends AbstractAction {
) {
const { SwcCompiler } = await import('../lib/compiler/swc/swc-compiler');
const swc = new SwcCompiler(this.pluginsLoader);

await swc.run(
configuration,
pathToTsconfig,
Expand All @@ -189,7 +213,7 @@ export class BuildAction extends AbstractAction {

private async runWebpack(
configuration: Required<Configuration>,
appName: string,
appName: string | undefined,
commandOptions: Input[],
pathToTsconfig: string,
debug: boolean,
Expand All @@ -209,6 +233,7 @@ export class BuildAction extends AbstractAction {
webpackPath,
defaultWebpackConfigFilename,
);

return webpackCompiler.run(
configuration,
pathToTsconfig,
Expand All @@ -229,7 +254,7 @@ export class BuildAction extends AbstractAction {
options: Input[],
configuration: Required<Configuration>,
pathToTsconfig: string,
appName: string,
appName: string | undefined,
onSuccess: (() => void) | undefined,
) {
if (watchMode) {
Expand All @@ -243,6 +268,7 @@ export class BuildAction extends AbstractAction {
(option) =>
option.name === 'preserveWatchOutput' && option.value === true,
)?.value as boolean | undefined;

watchCompiler.run(
configuration,
pathToTsconfig,
Expand All @@ -257,6 +283,7 @@ export class BuildAction extends AbstractAction {
this.tsConfigProvider,
this.tsLoader,
);

compiler.run(
configuration,
pathToTsconfig,
Expand Down
17 changes: 8 additions & 9 deletions actions/generate.action.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as chalk from 'chalk';
import { red } from 'ansis';
import * as path from 'path';
import { Answers } from 'inquirer';
import { Input } from '../commands';
import { getValueOrDefault } from '../lib/compiler/helpers/get-value-or-default';
import {
Expand Down Expand Up @@ -94,28 +93,28 @@ const generateFiles = async (inputs: Input[]) => {
defaultLabel,
);

const answers: Answers = await askForProjectName(
const selectedProjectName = (await askForProjectName(
MESSAGES.PROJECT_SELECTION_QUESTION,
projects,
);
)) as string;

const project: string = answers.appName.replace(defaultLabel, '');
const project: string = selectedProjectName.replace(defaultLabel, '');
if (project !== configuration.sourceRoot) {
sourceRoot = configurationProjects[project].sourceRoot;
}

if (answers.appName !== defaultProjectName) {
if (selectedProjectName !== defaultProjectName) {
// Only overwrite if the appName is not the default- as it has already been loaded above
generateSpec = shouldGenerateSpec(
configuration,
schematic,
answers.appName,
selectedProjectName,
specValue,
specOptions.passedAsInput,
);
generateFlat = shouldGenerateFlat(
configuration,
answers.appNames,
selectedProjectName,
flatValue,
);
generateSpecFileSuffix = getSpecFileSuffix(
Expand Down Expand Up @@ -144,7 +143,7 @@ const generateFiles = async (inputs: Input[]) => {
await collection.execute(schematicInput.value as string, schematicOptions);
} catch (error) {
if (error && error.message) {
console.error(chalk.red(error.message));
console.error(red(error.message));
}
}
};
Expand Down
Loading