-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: scripts section #20
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,54 @@ | ||||||||||||||||||||||||||||||
--- | ||||||||||||||||||||||||||||||
title: Scripts | ||||||||||||||||||||||||||||||
--- | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
<head> | ||||||||||||||||||||||||||||||
<title>Stencil-Cli Introduction</title> | ||||||||||||||||||||||||||||||
</head> | ||||||||||||||||||||||||||||||
<p> | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
## Stencil CLI and Scripts | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
This section provides additional background on how to use npm scripts to manage the build and execution process of a Stencil application. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
A Stencil application is a **standard** TypeScript application that needs to be compiled to JavaScript before it can be executed. There are various ways to accomplish the compilation step, and developers/teams are free to choose a way that works best for them. With that in mind, Stencil provides a set of tools out-of-the-box that seek to do the following: | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
This goal is accomplished through a combination of a locally installed TypeScript compiler and `package.json` scripts. We describe how these technologies work together below. This should help you understand what's happening at each step of the build/execute process, and how to customize that behavior if necessary. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
### Linking | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
To link a local package, use the following npm command: | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||||||||
$ npm link | ||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
This is useful when you are developing multiple packages locally and want to test them together. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
### Build | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
You can build your Stencil application using the following npm command: | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
#### **Note : make sure to keep dependencies in-check and update the required packages** | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||||||||
$ npm run build | ||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
This command will compile the TypeScript code to JavaScript, ensuring that the application is ready to be executed. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
### Execution | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
To start your Stencil application, use the following npm command: | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||||||||
$ npm run start | ||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
This command will execute the compiled application. | ||||||||||||||||||||||||||||||
Comment on lines
+42
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Standardize command documentation. For consistency, avoid using the dollar sign before commands unless you are showing output. This adheres to Markdownlint suggestions and improves readability. - $ npm run start
+ npm run start Committable suggestion
Suggested change
ToolsMarkdownlint
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
#### Package Scripts | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
Running the above commands at the OS command level ensures that the build and execute processes are managed as project dependencies in `package.json`. This way, all members of your organization can be assured of running the same version of the commands. By following this **recommended** usage, you can fully customize the behavior of these scripts via their options and/or customize the `tsc` compiler options files (e.g., `tsconfig.json`) as needed. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
For most developers/teams, it is recommended to utilize the package scripts for building and executing their Nest projects.</p> | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a newline at the end of the file. Files should end with a single newline character to comply with POSIX standards and facilitate proper processing by Unix/Linux utilities. + \n Committable suggestion
Suggested change
ToolsMarkdownlint
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarify npm link usage.
The section on linking local packages is clear. Consider adding an example to demonstrate how
npm link
can be used in a practical scenario, which will enhance understanding for new developers.Tools
Markdownlint