Skip to content
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(tools): Add more commands to package.json #1908

Merged
merged 1 commit into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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