Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
testing speed up
Browse files Browse the repository at this point in the history
  • Loading branch information
btopro committed Nov 13, 2021
1 parent f1d2d49 commit b3d1fc7
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 82 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ curl -fsSL https://raw.githubusercontent.com/elmsln/WCFactory/master/wcfactoryme
Make sure you have a version of node v14.16.1 and above.
Verify that you have yarn enabled — if not [install yarn](https://yarnpkg.com/lang/en/docs/install/) and ensure it is [globally available via PATH](https://yarnpkg.com/lang/en/docs/cli/global/). If using Linux, make sure you add `--prefix /usr/local` at the end of each of these calls
```bash
$ yarn global add symlink-dir
$ yarn global add @wcfactory/cli
$ yarn global add polymer-cli
$ yarn global add lerna
$ yarn global add web-component-analyzer
$ yarn global add http-server
yarn global add symlink-dir
yarn global add @wcfactory/cli
yarn global add polymer-cli
yarn global add lerna
yarn global add web-component-analyzer
yarn global add http-server
```

## Windows
Expand All @@ -34,23 +34,23 @@ $ yarn global add http-server
Make sure a path entry to yarn global binaries is present or `wcf` will fail. Yarn global binaries can be found in `C:\Users\<username>\AppData\Local\Yarn\bin`
To properly configure git endlines for Windows, run this configuration
```bash
$ git config --global core.autocrlf true
git config --global core.autocrlf true
```

## Usage (company)
A company helps you manage multiple factories and the products they produce so you'll need to create one before you do anything else. **The company MUST be created in a directory above your user directory** in some manner. example: `/home/dana/Documents/git/company` or any directory above `/home/dana`.
```bash
# create a new company, a series of factories linked by the owner
$ mkdir my-company-name && cd my-company-name && wcf start
mkdir my-company-name && cd my-company-name && wcf start
# create a new factory after you've made the company
wcf factory
# add a new element to the factory-name that you produced in the previous step
wcf element
```
Answer the prompts for your new element and you're off and running. To work on your new element called `new-name` perform the following:
```bash
$ cd {factoryName}/elements/new-name
$ yarn start
cd {factoryName}/elements/new-name
yarn start
```
This will open the folder to the `elements/new-name/src` folder, start watching it for changes which will be compiled automatically (and documented), and open a mini-server (via `polymer serve`) which will allow you to edit the src directory files, compile them together and make them available for the localhost window for viewing.

Expand Down
8 changes: 4 additions & 4 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ A factory that churns out web components, library agnostic with a unified develo
Make sure you have a version of node >=6.0 and above.
Verify that you have yarn enabled — if not [install yarn globally](https://yarnpkg.com/lang/en/docs/install/).
```bash
$ yarn global add @wcfactory/cli
yarn global add @wcfactory/cli
```
## Usage (company)
A company helps you manage multiple factories and the products they produce so you'll need to create one before you do anything else. **The company MUST be created in a directory above your user directory** in some manner. example: `/home/dana/Documents/git/company` or any directory above `/home/dana`.
```bash
# create a new company, a series of factories linked by the owner
$ mkdir my-company-name && cd my-company-name && wcf start
mkdir my-company-name && cd my-company-name && wcf start
# create a new factory after you've made the company
wcf factory
# add a new element to the factory-name that you produced in the previous step
wcf element
```
Answer the prompts for your new element and your off and running. To work on your new element called `new-name` perform the following:
```bash
$ cd {factoryName}/elements/new-name
$ yarn start
cd {factoryName}/elements/new-name
yarn start
```
This will open the folder to the `elements/new-name/src` folder, start watching it for changes which will be compiled automatically (and documented), and open a mini-server (via `polymer serve`) which will allow you to edit the src directory files, compile them together and make them available for the localhost window for viewing.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ import '<%= orgNpm %>/<%= elementName %>/<%= elementName %>.js';
## Develop / Demo
Run `yarn start` will start a local development server, open your default browser to display it, open your finder to the correct window and start watching the `/src` directory for changes and automatically rebuilding the element and documentation site for the demo.
```bash
$ yarn start
yarn start
```

## Test

```bash
$ yarn run test
yarn run test
```

## Build
Builds ensure that wcfactory can correctly compile your web component project to
work on the maximum number of browsers possible.
```bash
$ yarn run build
yarn run build
```

## Contributing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@
"module": "<%= elementName %>.js",
"umd": "<%= elementName %>.umd.js",
"scripts": {
"test": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs",
"test:watch": "web-test-runner \"test/**/*.test.js\" --node-resolve --watch --config=../../web-test-runner.config.mjs",
"test:browsers": "web-test-runner \"test/**/*.test.js\" --node-resolve --playwright --browsers chromium firefox webkit --config=../../web-test-runner.config.mjs",
"test": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --playwright --browsers chromium firefox",
"test:watch": "web-test-runner \"test/**/*.test.js\" --node-resolve --watch --config=../../web-test-runner.config.mjs --playwright --browsers chromium firefox",
<%- libraryScripts %>
},
"author": {
Expand Down
51 changes: 29 additions & 22 deletions packages/generator-wcfactory/generators/factory/templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,38 @@ Welcome to the <%= humanName %> project!
### Install

```bash
$ git clone <%= gitRepo %>
$ cd <%= name %>
$ yarn install
$ yarn start
git clone <%= gitRepo %>
cd <%= name %>
yarn global add @wcfactory/cli
yarn global add polymer-cli
yarn global add @web/test-runner
yarn global add @web/test-runner-commands
yarn global add @web/test-runner-puppeteer
yarn global add @web/test-runner-playwright
yarn global add lerna
yarn global add web-component-analyzer
yarn install
```

## Scripts

- `$ yarn start`
- `yarn start`
- Launch a demo server. This should be continuously running as you develop.
- `$ wcf element`
- `wcf element`
- Create a new component.
- `$ yarn run rebuild-wcfcache`
- `yarn run rebuild-wcfcache`
- Rebuild caches as to what web component libraries can be used
- `$ yarn test`
- `yarn test`
- Run tests on ALL <%= name %>.
- `$ yarn run build`
- `yarn run build`
- Run build on ALL <%= name %>.
- `$ yarn run storybook`
- `yarn run storybook`
- Run storybook
- `$ yarn run build-storybook`
- `yarn run build-storybook`
- Build storybook for deployment
- `$ lerna publish`
- `lerna publish`
- Publish ALL <%= name %>' elements to npmjs.com
- `$ lerna run build --no-bail`
- `lerna run build --no-bail`
- Run `build` command in all projects in the repo, don't bail if there's an issue

## Web Component development
Expand All @@ -52,13 +59,13 @@ Run `wcf element` to make a new element. Go to the new element following the dir
### Example development on a web component

```bash
$ cd /Sites/<%= name %>
$ yarn start
cd /Sites/<%= name %>
yarn start

# SHIFT + CTRL + T to open a new tab in Terminal

$ cd elements your-card # or any other web component
$ yarn run dev
cd elements your-card # or any other web component
yarn run dev
```

Make a change to the web component and save. The gulpfile will handle transpiling the element down to ES5 and will bring in the HTML and Sass into the template in the web component.
Expand All @@ -68,14 +75,14 @@ Make a change to the web component and save. The gulpfile will handle transpilin
To test all <%= name %>, run `yarn test` from the root of the repo. If you only want to test the web component you're working on:

```bash
$ cd elements/your-card
$ yarn test
cd elements/your-card
yarn test
```

Also, if your tests are failing and you want access to a live browser to investigate why, the following flag will keep the browser open.

```bash
$ yarn test -- -p
yarn test -- -p
```

Then open the URL that will be printed in the terminal. It looks something like this: `http://localhost:8081/components/@<%= orgNpm %>/<%= name %>/generated-index.html?cli_browser_id=0`.
Expand All @@ -87,15 +94,15 @@ We've added [Storybook](https://storybook.js.org/) to <%= name %> as a way to pr
To run storybook

```bash
$ yarn run storybook
yarn run storybook
```

This will start a web server on port 9001. Navigate in your browser to `http://localhost:9001` to see Storybook in action. Storybook will watch for file changes and reload the browser automatically for you. This is a little slow at the moment, but we'll look into speeding this up.

To export the storybook static site

```bash
$ yarn run build-storybook
yarn run build-storybook
```

This places a build of the storybook site in the .storybook_out directory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@
"whatwg-fetch": "3.6.1",
"yo": "3.1.1"
},
"peerDependencies": {
"@web/test-runner": "0.12.19",
"@web/test-runner-commands": "0.4.2",
"@web/test-runner-playwright": "0.8.4",
"@web/test-runner-puppeteer": "0.9.3"
},
"dependencies": {
"lit": "^2.0.2",
"@lit/reactive-element": "^1.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
"concurrently": "5.3.0",
"polymer-build": "3.1.4",
"wct-browser-legacy": "1.0.2",
"@open-wc/testing": "2.5.32",
"@web/test-runner": "0.12.19",
"@web/test-runner-commands": "0.4.2",
"@web/test-runner-playwright": "0.8.4",
"@web/test-runner-puppeteer": "0.9.3"
"@open-wc/testing": "2.5.32"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
"concurrently": "5.3.0",
"polymer-build": "3.1.4",
"wct-browser-legacy": "1.0.2",
"@open-wc/testing": "2.5.32",
"@web/test-runner": "0.12.19",
"@web/test-runner-commands": "0.4.2",
"@web/test-runner-playwright": "0.8.4",
"@web/test-runner-puppeteer": "0.9.3"
"@open-wc/testing": "2.5.32"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
"@web/dev-server": "0.1.28",
"wct-browser-legacy": "1.0.2",
"web-animations-js": "2.3.2",
"@open-wc/testing": "2.5.32",
"@web/test-runner": "0.12.19",
"@web/test-runner-commands": "0.4.2",
"@web/test-runner-playwright": "0.8.4",
"@web/test-runner-puppeteer": "0.9.3"
"@open-wc/testing": "2.5.32"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
"concurrently": "5.3.0",
"polymer-build": "3.1.4",
"wct-browser-legacy": "1.0.2",
"@open-wc/testing": "2.5.32",
"@web/test-runner": "0.12.19",
"@web/test-runner-commands": "0.4.2",
"@web/test-runner-playwright": "0.8.4",
"@web/test-runner-puppeteer": "0.9.3"
"@open-wc/testing": "2.5.32"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
"concurrently": "5.3.0",
"polymer-build": "3.1.4",
"wct-browser-legacy": "1.0.2",
"@open-wc/testing": "2.5.32",
"@web/test-runner": "0.12.19",
"@web/test-runner-commands": "0.4.2",
"@web/test-runner-playwright": "0.8.4",
"@web/test-runner-puppeteer": "0.9.3"
"@open-wc/testing": "2.5.32"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
"concurrently": "5.3.0",
"polymer-build": "3.1.4",
"wct-browser-legacy": "1.0.2",
"@open-wc/testing": "2.5.32",
"@web/test-runner": "0.12.19",
"@web/test-runner-commands": "0.4.2",
"@web/test-runner-playwright": "0.8.4",
"@web/test-runner-puppeteer": "0.9.3"
"@open-wc/testing": "2.5.32"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
"@web/dev-server": "0.1.28",
"wct-browser-legacy": "1.0.2",
"web-animations-js": "2.3.2",
"@open-wc/testing": "2.5.32",
"@web/test-runner": "0.12.19",
"@web/test-runner-commands": "0.4.2",
"@web/test-runner-playwright": "0.8.4",
"@web/test-runner-puppeteer": "0.9.3"
"@open-wc/testing": "2.5.32"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
"concurrently": "5.3.0",
"polymer-build": "3.1.4",
"wct-browser-legacy": "1.0.2",
"@open-wc/testing": "2.5.32",
"@web/test-runner": "0.12.19",
"@web/test-runner-commands": "0.4.2",
"@web/test-runner-playwright": "0.8.4",
"@web/test-runner-puppeteer": "0.9.3"
"@open-wc/testing": "2.5.32"
}
}

0 comments on commit b3d1fc7

Please sign in to comment.