Skip to content

Commit 04f2167

Browse files
committed
Merge branch 'master' into 1.0
2 parents 4050b42 + 1cec7ae commit 04f2167

File tree

94 files changed

+10642
-10173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+10642
-10173
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ elements/*/*.umd.js -diff -merge
22
elements/*/*.umd.js.map -diff -merge
33
themes/*/*.umd.js -diff -merge
44
themes/*/*.umd.js.map -diff -merge
5+
package-lock.json -diff -merge
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Feature Branch: Title
2+
3+
* Appendix doc:
4+
-
5+
* Link(s) to demo pages_ where this element can be viewed:
6+
-
7+
8+
### Ready-for-merge Checklist
9+
10+
- [ ] Expected files: all files in the merge request related to one feature request?
11+
- [ ] Is your branch up-to-date with the master branch?
12+
- [ ] Did automated tests pass?
13+
- [ ] Was it [browser-tested](https://docs.google.com/spreadsheets/d/1luriPYswlGcKdcbKhQfW6kxIgj7tjNjnBVP7yZ4onwA/edit#gid=1660273076)?
14+
- [ ] Was this feature demo'd and the design review task marked as complete?
15+
- [ ] Did it get a LGTM *after the last commit*? (changelog updates are exempt from this rule)
16+
- [ ] Changelog: consider this your postage stamp, it can’t go out without one! Stories should be in alphabetical/numerical order under the tag release.
17+
18+
19+
---
20+
21+
### What's in this branch?
22+
Summarize files edited as part of this MR along with a brief description of what was changed/why.
23+

README.md

Lines changed: 24 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,37 @@
1-
# RHElements
1+
**[Getting Started][start] | [Element Catalog][storybook] | [Creating Components][develop] | [Theming Components][theming]**
22

3-
Welcome to the RHElements project! Let's get started.
3+
![RHElements logo](./brand/logo/png/rhelements-logo-red.png)
44

5-
## Quick-start
6-
7-
*Notice: You will need to use [Node](https://nodejs.org/en/) v.7 or higher. These components are written in [ES6](http://es6-features.org/).*
8-
9-
```
10-
$ git clone [email protected]:RHElements/rhelements.git
11-
$ cd rhelements
12-
$ npm install # this will take a while due to lerna bootstrap
13-
$ npm rebuild node-sass # this may be necessary
14-
$ npm start
15-
```
16-
17-
## Scripts
18-
19-
- `$ npm start`
20-
- Launch a demo server. This should be continuously running as you develop.
21-
- `$ npm run new`
22-
- Create a new component.
23-
- `$ npm test`
24-
- Run tests on ALL RHElements.
25-
- `$ npm run build`
26-
- Run build on ALL RHElements.
27-
- `$ npm run bootstrap`
28-
- Update ALL rhelements' dependencies and interlink them with [lerna bootstrap][lerna-bs].
29-
- `$ npm run storybook`
30-
- Run storybook
31-
- `$ npm run build-storybook`
32-
- Build storybook for deployment
33-
34-
[lerna]: https://github.com/lerna/lerna
35-
[lerna-bs]: https://github.com/lerna/lerna#bootstrap
36-
37-
## Component development
38-
39-
Because this is a monorepo, each component will need to be independently built in order to actively work on and preview the changes. Every component has its own Gulp file and NPM script.
40-
41-
While still running `npm start` in one terminal window (which runs the local server), you will need to open another terminal window, drill into the directory of the component you'd like to work on, and execute the `npm run dev` command. This command will use gulp tasks to watch the files within that component directory and will automatically re-run the build command and refresh the browser when you make changes to the component.
42-
43-
### Example development on a component
44-
45-
```
46-
$ cd /Sites/rhelement
47-
$ npm start
5+
[RHElements][rhe] is a collection of flexible and lightweight [Web Components][wc], and the tools to build them. RHElements are...
486

49-
# SHIFT + CTRL + T to open a new tab in Terminal
7+
- **Lightweight**: small file size, minimal boilerplate, no "framework-like" features.
8+
- **Universal**: write once, use everywhere. RHElements work in React, Vue, Angular, vanilla JS, anywhere HTML elements are used.
509

51-
$ cd elements/rh-card # or any other component
52-
$ npm run dev
53-
```
10+
The result of these two principles is plugging one set of comopnents into a wide variety of applications, bringing UX consistency and developer familiarity to any web project.
5411

55-
Make a change to the 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 component.
12+
A Yeoman generator is included for creating Web Components that meets these goals.
5613

57-
## Test
14+
Let's get started!
5815

59-
To test all RHElements, run `npm test` from the root of the repo. If you only want to test the component you're working on:
60-
61-
```
62-
$ cd elements/rh-card
63-
$ npm test
64-
```
65-
66-
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.
67-
68-
```
69-
$ npm test -- -p
70-
```
71-
72-
Then open the URL that will be printed in the terminal. It looks something like this: `http://localhost:8081/components/@rhelements/rhelements/generated-index.html?cli_browser_id=0`.
73-
74-
## Storybook
75-
76-
We've added [Storybook](https://storybook.js.org/) to RHElements as a way to preview our components as they are being developed. We'll also use Storybook to export a static site that will be the demo site for RHElements.
77-
78-
To run storybook
79-
80-
```
81-
$ npm run storybook
82-
```
83-
84-
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.
85-
86-
To export the storybook static site
16+
## Quick-start
8717

88-
```
89-
$ npm run build-storybook
90-
```
18+
git clone [email protected]:RHElements/rhelements.git
19+
cd rhelements
20+
npm install # this will take a while due to lerna bootstrap
21+
npm start
9122

92-
This places a build of the storybook site in the .storybook_out directory.
23+
The `start` script will launch the demo pages. Demo pages are static showcases of each element, and also serve as scratchpads for experimenting while working on an element.
9324

94-
### Known Issues with Storybook
25+
*Notice: You will need to use [Node](https://nodejs.org/en/) v.7 or higher. Storybook _may_ not work with Node v.10.*
9526

96-
For any component that has a third-party dependency you will need to update the `/.storybook/webpack.config.js` file. You will need to create an alias for your depedency.
27+
---
9728

98-
For example:
29+
**[Getting Started][start] | [Developing Components][develop] | [Theming][theming]**
9930

100-
```
101-
"../../whatwg-fetch/fetch.js": path.join( // this is the third-party dependency in the rhelement
102-
__dirname,
103-
"../node_modules/whatwg-fetch/fetch.js" // this is where it lives in node_modules
104-
)
105-
```
31+
[rhe]: https://github.com/RHElements/rhelements
32+
[wc]: https://developer.mozilla.org/en-US/docs/Web/Web_Components
33+
[home]: https://rhelements.github.io/
34+
[start]: https://rhelements.github.io/getting-started/
35+
[develop]: https://rhelements.github.io/develop/
36+
[theming]: https://rhelements.github.io/theme/
37+
[storybook]: https://rhelements.github.io/rhelements/

elements/all/LICENSE.txt

Lines changed: 0 additions & 19 deletions
This file was deleted.

elements/all/README.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

elements/all/package.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

elements/all/test/index.html

Lines changed: 0 additions & 19 deletions
This file was deleted.

elements/rh-accordion/gulpfile.js

Lines changed: 4 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,5 @@
1-
const fs = require("fs");
2-
const path = require("path");
1+
// rollup.config.js
2+
const gulpFactory = require("../../scripts/gulpfile.factory.js");
3+
const rhelementPackage = require("./package.json");
34

4-
const gulp = require("gulp");
5-
const rename = require("gulp-rename");
6-
const replace = require("gulp-replace");
7-
const stripCssComments = require("strip-css-comments");
8-
const trim = require("trim");
9-
const decomment = require("decomment");
10-
const sass = require("node-sass");
11-
const shell = require("gulp-shell");
12-
13-
gulp.task("compile", () => {
14-
return gulp
15-
.src("./rh-accordion.js")
16-
.pipe(
17-
replace(
18-
/^(import .*?)(['"]\.\.\/(?!\.\.\/).*)(\.js['"];)$/gm,
19-
"$1$2.umd$3"
20-
)
21-
)
22-
.pipe(
23-
rename({
24-
suffix: ".umd"
25-
})
26-
)
27-
.pipe(gulp.dest("./"));
28-
});
29-
30-
gulp.task("merge", () => {
31-
return gulp
32-
.src("./src/rh-accordion.js")
33-
.pipe(
34-
replace(
35-
/extends\s+RHElement\s+{/g,
36-
(classStatement, character, jsFile) => {
37-
// extract the templateUrl and styleUrl with regex. Would prefer to do
38-
// this by require'ing rh-card.js and asking it directly, but without
39-
// node.js support for ES modules, we're stuck with this.
40-
const oneLineFile = jsFile
41-
.slice(character)
42-
.split("\n")
43-
.join(" ");
44-
const [
45-
,
46-
templateUrl
47-
] = /get\s+templateUrl\([^)]*\)\s*{\s*return\s+"([^"]+)"/.exec(
48-
oneLineFile
49-
);
50-
const [
51-
,
52-
styleUrl
53-
] = /get\s+styleUrl\([^)]*\)\s*{\s*return\s+"([^"]+)"/.exec(
54-
oneLineFile
55-
);
56-
57-
let html = fs
58-
.readFileSync(path.join("./src", templateUrl))
59-
.toString()
60-
.trim();
61-
62-
html = decomment(html);
63-
64-
let cssResult = sass.renderSync({
65-
file: path.join("./src", styleUrl)
66-
}).css;
67-
68-
cssResult = stripCssComments(cssResult).trim();
69-
70-
return `${classStatement}
71-
get html() {
72-
return \`
73-
<style>
74-
${cssResult}
75-
</style>
76-
77-
${html}\`;
78-
}
79-
`;
80-
}
81-
)
82-
)
83-
.pipe(gulp.dest("./"));
84-
});
85-
86-
gulp.task("watch", () => {
87-
return gulp.watch("./src/*", gulp.series("build"));
88-
});
89-
90-
gulp.task("bundle", shell.task("../../node_modules/.bin/rollup -c"));
91-
92-
gulp.task("build", gulp.series("merge", "compile", "bundle"));
93-
94-
gulp.task("default", gulp.series("build"));
95-
96-
gulp.task("dev", gulp.series("build", "watch"));
5+
gulpFactory(rhelementPackage.rhelement);

elements/rh-accordion/package-lock.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

elements/rh-accordion/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"scripts": {
1818
"build": "../../node_modules/.bin/gulp && ../../node_modules/.bin/prettier --ignore-path ../../.prettierignore --write '**/*.{js,json}'",
1919
"dev": "../../node_modules/.bin/gulp dev",
20-
"test": "../../node_modules/.bin/wct --configFile ../../wct.conf.json node_modules/@rhelements/rh-accordion/test/"
20+
"test": "../../node_modules/.bin/wct --configFile ../../wct.conf.json elements/rh-accordion/test/"
2121
},
2222
"author": {
2323
"name": "Kyle Buchanan"

0 commit comments

Comments
 (0)