@biggive/components 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/package.json +53 -0
- package/readme.md +122 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@biggive/components",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Big Give Components",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"es2015": "dist/esm/index.mjs",
|
|
8
|
+
"es2017": "dist/esm/index.mjs",
|
|
9
|
+
"types": "dist/types/index.d.ts",
|
|
10
|
+
"collection": "dist/collection/collection-manifest.json",
|
|
11
|
+
"collection:main": "dist/collection/index.js",
|
|
12
|
+
"unpkg": "dist/biggive/biggive.esm.js",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/thebiggive/components.git"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist/",
|
|
19
|
+
"loader/"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "stencil build --docs",
|
|
23
|
+
"start": "stencil build --dev --watch --serve --port 3939",
|
|
24
|
+
"lint": "eslint src/**/*{.ts,.tsx}",
|
|
25
|
+
"lint:fix": "eslint --fix src/**/*{.ts,.tsx}",
|
|
26
|
+
"test": "stencil test --spec --e2e --port 3939",
|
|
27
|
+
"test.watch": "stencil test --spec --e2e --watchAll --port 3939",
|
|
28
|
+
"generate": "stencil generate",
|
|
29
|
+
"prepare": "husky install",
|
|
30
|
+
"pre-commit": "lint-staged"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@fortawesome/fontawesome-svg-core": "^6.1.2",
|
|
34
|
+
"@fortawesome/free-brands-svg-icons": "^6.1.2",
|
|
35
|
+
"@fortawesome/free-solid-svg-icons": "^6.1.2",
|
|
36
|
+
"@fortawesome/pro-duotone-svg-icons": "^6.1.2",
|
|
37
|
+
"@fortawesome/pro-solid-svg-icons": "^6.1.2",
|
|
38
|
+
"@stencil/core": "^2.13.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@stencil/eslint-plugin": "^0.4.0",
|
|
42
|
+
"@types/jest": "^27.0.3",
|
|
43
|
+
"eslint-config-prettier": "^8.5.0",
|
|
44
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
45
|
+
"husky": "^8.0.0",
|
|
46
|
+
"jest": "^27.4.5",
|
|
47
|
+
"jest-cli": "^27.4.5",
|
|
48
|
+
"lint-staged": "^13.0.3",
|
|
49
|
+
"prettier": "2.7.1",
|
|
50
|
+
"puppeteer": "^15.4.0"
|
|
51
|
+
},
|
|
52
|
+
"license": "MIT"
|
|
53
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Big Give StencilJS Web Component Proof of Concept
|
|
4
|
+
|
|
5
|
+
The project is based on a sample project from https://stenciljs.com/docs/getting-started
|
|
6
|
+
|
|
7
|
+
## Setup and Build
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Get latest version of codebase from github
|
|
11
|
+
```bash
|
|
12
|
+
git clone https://github.com/thebiggive/components.git
|
|
13
|
+
cd components
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Install StencilJS dependencies as defined in package.json
|
|
17
|
+
|
|
18
|
+
Set `FONTAWESOME_NPM_AUTH_TOKEN` in your environment so pro packages can be installed, and:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install
|
|
22
|
+
npm start
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Follow Stencil + repository conventions
|
|
26
|
+
|
|
27
|
+
CI runs lint checks, but there are tools to help you follow the expected code style so you don't have
|
|
28
|
+
to fix it later.
|
|
29
|
+
|
|
30
|
+
In Visual Studio Code, you might find [this ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
31
|
+
and [this Prettier one](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
32
|
+
helpful.
|
|
33
|
+
|
|
34
|
+
We use both tools to ensure both consistent code style and adherence to Stencil recommended practice.
|
|
35
|
+
|
|
36
|
+
Husky should also set you up a pre-commit hook that fixes anything it can automatically, and complains
|
|
37
|
+
about anything else. If you don't appear to have this and had already installed packages before this
|
|
38
|
+
feature was set up, run `npm install` again.
|
|
39
|
+
|
|
40
|
+
### Make any required changes to the sample web components
|
|
41
|
+
|
|
42
|
+
The web components are configured in /src/components
|
|
43
|
+
|
|
44
|
+
The /src/index.html file can be used as a test area for displaying the web components in a static HTML page.
|
|
45
|
+
|
|
46
|
+
### Run the StencilJS build command to package your changes
|
|
47
|
+
```bash
|
|
48
|
+
npm run build
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Outputs
|
|
53
|
+
|
|
54
|
+
### dist directory - https://stenciljs.com/docs/distribution
|
|
55
|
+
This directory contains the distribtion files
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### www directory - https://stenciljs.com/docs/www
|
|
59
|
+
This directory contains a static version of the web components which can be used for testing and inclusion in simple web apps. Due to CORS restrictions, the index.html file needs to be run from a webserver (not as a local file).
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
## Publish to NPM
|
|
65
|
+
|
|
66
|
+
### Connect to NPM
|
|
67
|
+
```bash
|
|
68
|
+
npm add_user
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Publish
|
|
72
|
+
|
|
73
|
+
Continuous Integration will automatically publish `main` to NPM, but you can also do it manually if necessary.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npm publish --access=public
|
|
77
|
+
```
|
|
78
|
+
The name of the NPM package and version number can be updated in the root package.json file. It's currently set to (@biggive/components, 0.0.1)
|
|
79
|
+
|
|
80
|
+
More information about publishing and distribution is available at https://stenciljs.com/docs/distribution
|
|
81
|
+
|
|
82
|
+
## Include components in web app
|
|
83
|
+
|
|
84
|
+
### Include the following script tag in the HTML head
|
|
85
|
+
```
|
|
86
|
+
<script type='module' src='https://unpkg.com/@biggive/components@0.0.1/dist/biggive/biggive.esm.js'></script>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Include the markup for the sample web component
|
|
90
|
+
```
|
|
91
|
+
<demo-campaign-cards></demo-campaign-cards>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Styled Component
|
|
97
|
+
The first styled components are available
|
|
98
|
+
- biggive-grid
|
|
99
|
+
- biggive-campaign-card
|
|
100
|
+
|
|
101
|
+
These can be added to an HTML page with the following code:
|
|
102
|
+
```
|
|
103
|
+
<biggive-grid>
|
|
104
|
+
|
|
105
|
+
<biggive-campaign-card
|
|
106
|
+
banner="/assets/img/banner.png"
|
|
107
|
+
days-remaining={50}
|
|
108
|
+
target={50000}
|
|
109
|
+
organisation-name="Ardent Theatre Company"
|
|
110
|
+
campaign-type="Match Funded"
|
|
111
|
+
campaign-title="Strike! A play by Tracy Ryan"
|
|
112
|
+
categories="Arts/Culture/Heritage|Environment/Conservation|Health/Wellbeing"
|
|
113
|
+
beneficiaries="General Public/Humankind"
|
|
114
|
+
match-funds-remaining={17424}
|
|
115
|
+
total-funds-raised={15424}
|
|
116
|
+
call-to-action-url="#"
|
|
117
|
+
call-to-action-label="Donate"
|
|
118
|
+
/>
|
|
119
|
+
|
|
120
|
+
</biggive-grid>
|
|
121
|
+
```
|
|
122
|
+
|