Skip to content

Commit b0551b3

Browse files
authored
feat(tools): Add more commands to package.json (#1908)
1 parent 4a84258 commit b0551b3

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

docs/dev/Creating UI5 Web Components Packages.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ Task | Purpose
108108
clean | Deletes the `dist/` directory with the build output
109109
build | Production build to the `dist/` directory
110110
lint | Run a static code scan with `eslint`
111-
start | Build the project for development and run the dev server
112-
test | Run the test specs from the `test/specs/` directory
111+
start | Build the project for development, run the dev server and watch for changes
112+
watch | Watch for changes only
113+
serve | Run the dev server only
114+
test | Run the dev server and execute the specs from the `test/specs/` directory
113115
create-ui5-element | Create an empty web component with the given name
114116

115117
### Files in the main directory

packages/fiori/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"clean": "wc-dev clean",
1515
"lint": "wc-dev lint",
1616
"start": "wc-dev start",
17+
"watch": "wc-dev watch",
18+
"serve": "wc-dev serve",
1719
"build": "wc-dev build",
1820
"test": "wc-dev test",
1921
"create-ui5-element": "wc-create-ui5-element",

packages/main/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"clean": "wc-dev clean",
1515
"lint": "wc-dev lint",
1616
"start": "wc-dev start",
17+
"watch": "wc-dev watch",
18+
"serve": "wc-dev serve",
1719
"build": "wc-dev build",
1820
"test": "wc-dev test",
1921
"create-ui5-element": "wc-create-ui5-element",

packages/tools/bin/dev.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@
33
const child_process = require("child_process");
44

55
let command = process.argv[2];
6+
const argument = process.argv[3];
67

7-
// Support for running the test task with a spec parameter
8-
if (command === "test") {
9-
const spec = process.argv[3];
10-
if (spec) {
11-
command = `test.spec --spec ${spec}`;
8+
if (command === "watch") {
9+
if (["src", "test", "bundles", "styles", "templates", "samples"].includes(argument)) {
10+
command = `watch.${argument}`;
11+
}
12+
} else if (command === "test") {
13+
if (argument === "--no-server") { // yarn test --no-server
14+
command = `test.run`;
15+
} else if (argument) { // yarn test test/specs/Button.spec.js
16+
command = `test.spec --spec ${argument}`;
1217
}
1318
}
1419

packages/tools/lib/init-package/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ const updatePackageFile = () => {
9494
"clean": "wc-dev clean",
9595
"lint": "wc-dev lint",
9696
"start": "wc-dev start",
97+
"watch": "wc-dev watch",
98+
"serve": "wc-dev serve",
9799
"build": "wc-dev build",
98100
"test": "wc-dev test",
99101
"create-ui5-element": "wc-create-ui5-element",

0 commit comments

Comments
 (0)