Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Command Line Interface

WinJS provides many built-in CLI commands for starting and building projects, as well as some development assistance commands such as generators.

To get a list of available commands, you can run the help command in your project directory:

bash
win help

You should see output similar to the following:

bash
Usage: win <command> [options]Commands:    build     build app for production    config    win config cli    cache     manage win cache    dev       dev server for development    help      show commands help    info      print debugging information about your environment    lint      lint source code using eslint and stylelint    setup     setup project    see       generate possessing by SEE platform    ftp       FTP uploads local files to the target server    deadcode  check dead code    version   show win version    v         show win version    plugin    inspect win plugins    verify-commit verify the commit message, which is usually used with husky.    preview   locally preview production build    zip       compress the package to zip package    run       run the script commands, support for ts and zx    generate  generate code snippets quickly    g         generate code snippets quicklyRun `win help<command>` for more information of specific commands.Visit https://winjs-dev.github.io/winjs-docs/ to learn more about WinJS.

For easy reference, the following commands are sorted alphabetically.

build

Builds the project for production deployment.

bash
$ win build

config

Quickly view and modify configurations through the command line.

To view configurations, uselist orget.

bash
$ win config list - [key:polyfill] false - [key:externals] { esbuild: true }$ win config get mfsu - [key:externals] { esbuild: true }

To modify configurations, useset orremove.

bash
$ win config set polyfill falseset config:polyfill on /private/tmp/sorrycc-wsYpty/.winrc.ts$ win config remove polyfillremove config:polyfill on /private/tmp/sorrycc-wsYpty/.winrc.ts

cache

WinJS usesnode_modules/.cache as the cache directory. Sometimes you need to manually clear the cache, for example, when you've modified files innode_modules and want to verify the results, or when mf errors can be resolved by clearing the cache. You can execute this command to clear the cache.

bash
$ win cache clean

It also supports outputting the cache directory tree and size, displaying cache folder information.--depth indicates the optional number of layers, with a default value of 1 layer, where the cache layer is level 0.

Execute the following command:

bash
win cache ls [--depth]
bash
info  - [wincache] dir info└─ [40.71MB] node_modules/.cache   ├─ [16.52MB] bundler-webpack-eager   ├─ [166KB] logger   ├─ [4.50MB] mfsu   └─ [19.53MB] mfsu-deps

deadcode

Used to find unreferenced files in the src directory and output the results to a file in the root directory.

bash
$ win deadcode- Preparing...- begin check deadCode- write file /examples/win-run/DeadCodeList-{timeStamp}.txt- check dead code end, please be careful if you want to remove them

dev

Starts the local development server for project development and debugging.

bash
$ win dev        ╔═════════════════════════════════════════════════════╗ App listening at:  >   Local: https://127.0.0.1:8001ready -  > Network: https://192.168.1.1:8001 Now you can open browser with the above addresses👆        ╚═════════════════════════════════════════════════════╝event - compiled successfully in 1051 ms (416modules)

ftp

Uploads local files to the target server through FTP tools. Usually set inscripts.ftp of package.json.

By default, it reads the ftpOptions property from the.winrc.ts configuration. For specific configuration details, refer toconfiguring ftpOptions.

bash
{  "scripts": { "ftp": "win ftp" }}

generate

Used for incremental file generation or enabling features. The command line alias isg.

When run without any parameters, it provides an interactive generator selection.

bash
$ win g# 或$ win generate? Pick generator type › - Use arrow-keys. Return to submit.   Create Pages -- Create a win page by page name    Enable Tailwind CSS -- Setup Tailwind CSS configuration    Enable Uno CSS -- Setup Uno CSS configuration    Generate Component -- Generate component boilerplate code    Generate mock -- Generate mock boilerplate code    Enable E2E Testing with Cypress -- Setup Cypress Configuration    Generator api -- Generate api route boilerplate code    Generate Precommit -- Generate precommit boilerplate code    Generate huipro -- Generate subsystem build tool for hui 1.0 pro

You can also specify parameters.

bash
# Generate route files$ win g page index --typescript --less

help

Shows help information.

bash
$ win helpUsage: win <command> [options]Commands:    build     build app for production    config    win config cli    dev       dev server for development    help      show commands help    setup     setup project    see       generate possessing by SEE platform    version   show win version    plugin    inspect win plugins    generate  generate code snippets quicklyRun `win help<command>` for more information of specific commands.Visit https://winjs-dev.github.io/winjs-docs/ to learn more about WinJS.

You can also specify a command to view detailed help for a specific command.

bash
$ win help buildUsage: win build [options]build app for production.Details:    win build    # build without compression    COMPRESS=none win build    # clean and build    win build --clean

info

Prints debugging information about your environment.

$ win infoUsage: win info System:    OS: macOS 11.4    CPU: (8) arm64 Apple M1  Binaries:    Node: 18.16.0 - ~/Library/Caches/fnm_multishells/13409_1689559164099/bin/node    npm: 9.6.7 - ~/Library/Caches/fnm_multishells/13409_1689559164099/bin/npm  Browsers:    Chrome: 114.0.5735.198    Edge: Not Found    Safari: 14.1.1  npmPackages:    vue: Not Found    vue-router: Not Found    win: workspace:* => 0.0.13  npmGlobalPackages:    win: Not Found

lint

Used to check and fix code compliance with rules.

bash
$ win lintUsage: win lint  # automatically fix, where possible  win lint --fix  # disable reporting on warnings  win lint --quiet  # generate a report  win lint --report  # scan the directory  win lint --include src

mfsu

Thewin mfsu command can view MFSU dependency information, rebuild MFSU dependencies, and clear MFSU dependencies.

Get MFSU command help

bash
$ win mfsu

Get MFSU dependency list

bash
$ win mfsu lswarning@0.0.3regenerator-runtime/runtime.js@0.13.11react/jsx-dev-runtime@18.1.0react-intl@3.12.1react-error-overlay/lib/index.js@6.0.9react@18.1.0qiankun@2.8.4lodash/noop@4.17.21lodash/mergeWith@4.17.21lodash/concat@4.17.21...

Rebuild MFSU dependencies

bash
$ win mfsu buildinfo  - Preparing...info  - MFSU eager strategy enabledwarn  - Invalidate webpack cache since mfsu cache is missinginfo  - [MFSU] buildDeps since cacheDependency has changed...info  - [plugin:@winner-fed/preset-win/dist/commands/mfsu/mfsu] [MFSU][eager] build success

Clear MFSU dependencies

bash
$ # Delete dependency information list$ win mfsu remove$ # Delete dependency information list and build artifacts$ win mfsu remove --all

plugin

Plugin-related operations. Currently only supports thelist subcommand.

List all plugins.

bash
$ win plugin list- @winner-fed/core/dist/service/servicePlugin- @winner-fed/preset-win (frompreset)- @winner-fed/preset-win/dist/registerMethods (frompreset)- @winner-fed/preset-win/dist/features/appData/appData (frompreset)- @winner-fed/preset-win/dist/features/check/check (frompreset)- @winner-fed/preset-win/dist/features/configPlugins/configPlugins (frompreset)- virtual: config-styles- virtual: config-scripts- virtual: config-routes- virtual: config-plugins...

preview

Thewin preview command starts a local static web server, serving the dist folder athttp://127.0.0.1:4172 to preview build artifacts. It supports proxy, mock, and other settings.

You can configure the service port using the--port parameter.

bash
$ win preview --port 9527

Now thepreview command will run the server athttp://127.0.0.1:9527.

Use the--host parameter to specify the hostname for the service.

The following user configurations will also take effect duringpreview:

Note that thedist directory will change according to theoutputPath configuration.

run

Thewin run command allows you to run TypeScript and ESM files just like running JavaScript with node. You can combine it withzx for better script command usage.

bash
$ win run ./script.ts

setup

Initializes the project and performs operations such as generating temporary files. Usually set inscripts.postinstall of package.json.

bash
{  "scripts": { "postinstall": "win setup" }}

see

Generates SEE platform artifacts from built static resources. Usually set inscripts.see of package.json.

Note

This command only packages existing static resources in the build output directory and does not perform source code compilation.

By default, it reads the seeOptions property from the.winrc.ts configuration. For specific configuration details, refer toconfiguring seeOptions.

bash
{  "scripts": { "see": "win see" }}

verify-commit

Verifies commit message information, usually used in combination withhusky.

For example, configure in.husky/commit-msg as follows:

bash
#!/bin/sh. "$(dirname "$0")/_/husky.sh"npx --no-install win verify-commit $1

version

View thewin version, equivalent towin -v.

bash
$ win version0.0.3

zip

Compresses the specified directory into a zip package. Usually set inscripts.zip of package.json.

By default, it reads the zipOptions property from the.winrc.ts configuration. For specific configuration details, refer toconfiguring zipOptions.

bash
{  "scripts": { "zip": "win zip" }}
bash
$ win zipinfo - Win v0.0.4Building examplesample-v1001687759573867.zip...info - Zip successfully! At /Users/liwenbo/Desktop/xxx/winjs/examples/sample/dist-zip/examplesample-v1001687759573867.zip

[8]ページ先頭

©2009-2025 Movatter.jp