Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@nestjs/cli
Advanced tools
[![Nest Logo](http://kamilmysliwiec.com/public/nest-logo.png)](http://kamilmysliwiec.com/)
The @nestjs/cli package is a command-line interface tool for NestJS, a framework for building efficient, reliable and scalable server-side applications. This CLI tool helps developers to initialize, develop, and maintain their NestJS applications with ease by providing a set of commands to generate, run, and manage various parts of the application.
Project Initialization
This command creates a new NestJS project with all the necessary configuration and dependencies to get started.
nest new project-name
Generate Resources
Generates a new controller named 'users' within the project. The CLI supports generating various resources like modules, services, and guards.
nest generate controller users
Run Development Server
Starts the application in watch mode. Any changes in the source code will automatically restart the server, facilitating a smooth development process.
nest start --watch
Build Project
Compiles the application into JavaScript, preparing it for production deployment.
nest build
Similar to @nestjs/cli, express-generator is a CLI tool for Express.js, another Node.js framework. It helps in scaffolding new Express applications quickly but lacks the comprehensive set of features for managing the entire lifecycle of the application as @nestjs/cli does.
Although angular-cli is for Angular, a front-end framework, it shares a similar purpose with @nestjs/cli in terms of initializing projects, generating components, and managing build tasks. Both provide a robust set of tools to streamline development within their respective ecosystems.
create-react-app is a CLI tool for setting up new React applications. It abstracts away the build configuration into a single command, similar to how @nestjs/cli simplifies the setup and development of NestJS applications. However, it's focused on front-end React projects.
WARNING: The CLI is still a work in progress and is not ready for practical use. The repository is created to allow for insight and contributions.
$ git clone https://github.com/nestjs/nest-cli.git <project>
$ cd <project>
$ npm install
$ npm link
###npm (not registered)
While the CLI does not require a nestconfig.json file to work, default values can be overrided by implementing one. Currently, a nestconfig.json file is only the following:
{
"language": "ts | es (default: ts)"
}
Examples :
$ nest new my-app
$ nest new my-app myapp/
$ nest new my-app --repo https://github.com/ThomRick/nest-typescript-starter
Creates a new Nest application by cloning https://github.com/ThomRick/nest-typescript-starter
Git repository.g
)Example :
$ nest generate module path/to/<name>
$ nest g module path/to/<name>
Creates a templated module file :src/path/to/<name>/<name>.module.ts
@Module({})
export class NameModule {}
Examples :
$ nest generate controller path/to/<name>
$ nest g controller path/to/<name>
Creates a templated controller files :src/path/to/<name>/<name>.controller.ts
@Controller()
export class NameController {
public constructor() {}
}
src/path/to/<name>/<name>.controller.spec.ts
import {NameController} from './name.controller';
import {expect} from 'chai';
describe('NameController', () => {
const controller: NameController;
beforeEach(() => {
Test.createTestingModule({
controllers: [
NameController
]
});
controller = Test.get(NameController);
});
it('should exists', () => {
expect(controller).to.exist;
});
}
Examples :
$ nest generate component path/to/<name>
$ nest g component path/to/<name>
Creates a templated component files :src/path/to/<name>/<name>.service.ts
@Component()
export class NameService {
constructor() {}
}
src/path/to/<name>/<name>.service.spec.ts
import {NameService} from './name.service';
import {expect} from 'chai';
describe('NameService', () => {
const service: NameService;
beforeEach(() => {
Test.createTestingModule({
components: [
NameService
]
});
service = Test.get(NameService);
});
it('should exists', () => {
expect(service).to.exist;
});
}
FAQs
Nest - modern, fast, powerful node.js web framework (@cli)
The npm package @nestjs/cli receives a total of 1,871,532 weekly downloads. As such, @nestjs/cli popularity was classified as popular.
We found that @nestjs/cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.