Skip to content

Commit

Permalink
feat(tools): Add more commands to package.json (#1908)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladitasev committed Jul 6, 2020
1 parent 4a84258 commit b0551b3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
6 changes: 4 additions & 2 deletions docs/dev/Creating UI5 Web Components Packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ Task | Purpose
clean | Deletes the `dist/` directory with the build output
build | Production build to the `dist/` directory
lint | Run a static code scan with `eslint`
start | Build the project for development and run the dev server
test | Run the test specs from the `test/specs/` directory
start | Build the project for development, run the dev server and watch for changes
watch | Watch for changes only
serve | Run the dev server only
test | Run the dev server and execute the specs from the `test/specs/` directory
create-ui5-element | Create an empty web component with the given name

### Files in the main directory
Expand Down
2 changes: 2 additions & 0 deletions packages/fiori/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"clean": "wc-dev clean",
"lint": "wc-dev lint",
"start": "wc-dev start",
"watch": "wc-dev watch",
"serve": "wc-dev serve",
"build": "wc-dev build",
"test": "wc-dev test",
"create-ui5-element": "wc-create-ui5-element",
Expand Down
2 changes: 2 additions & 0 deletions packages/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"clean": "wc-dev clean",
"lint": "wc-dev lint",
"start": "wc-dev start",
"watch": "wc-dev watch",
"serve": "wc-dev serve",
"build": "wc-dev build",
"test": "wc-dev test",
"create-ui5-element": "wc-create-ui5-element",
Expand Down
15 changes: 10 additions & 5 deletions packages/tools/bin/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
const child_process = require("child_process");

let command = process.argv[2];
const argument = process.argv[3];

// Support for running the test task with a spec parameter
if (command === "test") {
const spec = process.argv[3];
if (spec) {
command = `test.spec --spec ${spec}`;
if (command === "watch") {
if (["src", "test", "bundles", "styles", "templates", "samples"].includes(argument)) {
command = `watch.${argument}`;
}
} else if (command === "test") {
if (argument === "--no-server") { // yarn test --no-server
command = `test.run`;
} else if (argument) { // yarn test test/specs/Button.spec.js
command = `test.spec --spec ${argument}`;
}
}

Expand Down
2 changes: 2 additions & 0 deletions packages/tools/lib/init-package/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ const updatePackageFile = () => {
"clean": "wc-dev clean",
"lint": "wc-dev lint",
"start": "wc-dev start",
"watch": "wc-dev watch",
"serve": "wc-dev serve",
"build": "wc-dev build",
"test": "wc-dev test",
"create-ui5-element": "wc-create-ui5-element",
Expand Down

0 comments on commit b0551b3

Please sign in to comment.