Skip to content
Snippets Groups Projects
Commit 732de91b authored by Benoit Alessandroni's avatar Benoit Alessandroni
Browse files

Merge branch 'master' into dpo/switch-to-skypack

parents 32f9cf21 deb3b255
No related branches found
No related tags found
1 merge request!238Dpo/switch to skypack
Pipeline #9230 passed with stages
in 4 minutes and 14 seconds
Showing
with 13037 additions and 11127 deletions
{
}
**/node_modules
config.json
.DS_Store
*.iml
*.swp
dist
.npm
# Test cache
cache
cypress/screenshots
cypress/videos
cache
.npm
.DS_Store
# Built files
.cache
dist
# Config specific files
config.json
config.*.json
!config.sample.json
# PWA Generated file
src/manifest.webmanifest
\ No newline at end of file
......@@ -38,7 +38,7 @@ build:
test:e2e:
stage: test
image: cypress/included:4.5.0
image: cypress/included:5.6.0
services:
- name: ${CI_REGISTRY_IMAGE}/server:0.1
before_script:
......@@ -150,7 +150,7 @@ stg2:
publish:
stage: release
script:
- npm install -g semantic-release@v17 @semantic-release/gitlab
- npm install -g semantic-release@v17 @semantic-release/gitlab@v6.0.5
- semantic-release
only:
- master
......@@ -930,5 +930,41 @@ montpellier:
only:
- master
when: manual
tags:
- deploy
acn:
stage: deployment
environment:
name: acn
url: https://acn.hubl.world
before_script:
- npm ci --cache .npm --prefer-offline --only=production
script:
- echo "$APP_CONFIG_ACN" > config.json
- echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key
- npm run build
- scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* acn@astral.startinblox.com:~/client/dist/
only:
- master
when: manual
tags:
- deploy
woma:
stage: deployment
environment:
name: woma
url: https://woma.hubl.world
before_script:
- npm ci --cache .npm --prefer-offline --only=production
script:
- echo "$APP_CONFIG_WOMA" > config.json
- echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key
- npm run build
- scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* woma@astral.startinblox.com:~/client/dist/
only:
- master
when: manual
tags:
- deploy
\ No newline at end of file
{
"includePaths": ["node_modules"],
}
\ No newline at end of file
# Hubl
<h1 align="center">
<br>
<a href="http://hubl.world"><img src="https://cdn.startinblox.com/logos/hubl-logo.png" alt="Hubl" width="200"></a>
<br>
</h1>
Hubl is the magic tool that allows the Freelance Network to thrive in a decentralized way.
<h4 align="center">A magic tool that allows the Freelance Network to thrive in a decentralized way, built on top of <a href="https://startinblox.com/" target="_blank">Startin'blox</a>.</h4>
<hr>
<p align="center">
<a href="https://git.startinblox.com/management/product-owners-sync/issues/"><img alt="create a feature request" src="https://img.shields.io/badge/%2B-feature%20request-blue" /></a>
<a href="https://git.startinblox.com/applications/hubl/issues/"><img alt="create an issue" src="https://img.shields.io/badge/%2B-issue-orange" /></a>
<a href="https://git.startinblox.com/applications/hubl/commits/master"><img alt="pipeline status" src="https://git.startinblox.com/applications/hubl/badges/master/pipeline.svg" /></a>
</p>
## Getting Started
......@@ -43,13 +55,6 @@ npm install
Then create a `config.json` based on your needs, see Mandatory and Optional Modules on this page. For convienence a `config.sample.json` exists in the source.
Federated Hubl needs to use `config.sample.federated.json` example.
You can quickly update your API URI from the samples:
```
$ sed 's/http:\/\/localhost:8000/https:\/\/api.your-server.startinblox.com/' config.sample.json > config.json
```
Then build your new Hubl:
```bash
......@@ -66,6 +71,22 @@ Serve, watch files & rebuild on change with this command:
npm run watch
```
### Multiple config.json
You can have as many `config.*.json` as you need.
Watch on a custom config file:
```bash
CONFIG_PATH='config.customName.json' npm run watch
```
Build with a custom config file:
```bash
CONFIG_PATH='config.customName.json' npm run build
```
## Mandatory modules
By default, a Hubl includes only individual chat modules.
......@@ -76,14 +97,19 @@ On `config.json`:
```json
{
"xmpp": "https://jabber.happy-dev.fr/http-bind/",
"xmppWebsocket": "wss://jabber.happy-dev.fr/xmpp-websocket",
"clientName": "My local Hubl",
"clientLogo": "/images/logo.webp",
"authority": "http://localhost:8000/",
"endpoints": {
"skills": "http://server.url/skills/",
"users": "http://server.url/users/",
"uploads": "http://server.url/upload/"
"get": {
"skills": "http://server.url/skills/",
"users": "http://server.url/users/"
},
"post": {
"users": "http://server.url/users/",
"uploads": "http://server.url/upload/"
}
}
}
```
......@@ -92,11 +118,11 @@ Where:
* `clientName` is the name of your Hubl
* `clientLogo` is an URL to an image file
* `xmpp` is your [Prosody](https://prosody.im/) with [appropriate modules](https://git.startinblox.com/infra/prosody-modules/) configured on.
* `xmppWebsocket` is your [Prosody](https://prosody.im/) with [appropriate modules](https://git.startinblox.com/infra/prosody-modules/) configured on.
* `authority` is the OpenID Provider. Usually, if you use `djangoldp-account` it's the same as your djangoldp server.
* `endpoints.users` is the API endpoints for Users on your djangoldp server. (djangoldp-account)
* `endpoints.skills` is the API endpoints for Skills on your djangoldp server. (djangoldp-skill)
* `endpoints.uploads` is the API endpoints for Uploads on your djangoldp server. (djangoldp-upload)
* `endpoints.*.users` is the API endpoints for Users on your djangoldp server. (djangoldp-account)
* `endpoints.*.skills` is the API endpoints for Skills on your djangoldp server. (djangoldp-skill)
* `endpoints.*.uploads` is the API endpoints for Uploads on your djangoldp server. (djangoldp-upload)
### Communities
......@@ -113,9 +139,7 @@ Don't forget to set some users as admin from the Django Admin if you want to all
On `config.json`:
```json
"clientName": "Hubl",
"clientFavicon": "/images/favicon.webp",
"clientLogo": "/images/logo.webp",
"clientLogoHeight": "32px",
"clientCSS": "/path/to/custom.css",
"authorityName": "djangoldp-server-name"
......@@ -123,9 +147,7 @@ On `config.json`:
Where:
* `clientName` is the name of your Hubl.
* `clientFavicon` is an URL to a distant favicon
* `clientLogo` is an URL to a distant logo for your client
* `clientLogoHeight` allow a quick fix to manage different height logos
* `clientCSS` is an URL to a distant CSS that'll be the last one loaded by the Hubl
* `authorityName` is a visual name of your OpenID Provider
......@@ -156,7 +178,12 @@ On `config.json`:
```json
"endpoints": {
"circle": "http://server.url/circles/"
"get": {
"circle": "http://server.url/circles/"
},
"post": {
"circle": "http://server.url/circles/"
},
}
```
......@@ -170,62 +197,63 @@ On `config.json`:
```json
"endpoints": {
"dashboard": "http://server.url/dashboard/"
"get": {
"dashboard": "http://server.url/dashboard/"
}
}
```
A [sample fixture](https://git.startinblox.com/djangoldp-packages/djangoldp-dashboard/blob/master/djangoldp_dashboard/fixtures/sample.json) can be loaded with `./manage.py loaddata path/to/djangoldp_dashboard/fixtures/sample.json`.
A [sample fixture](https://git.startinblox.com/djangoldp-packages/djangoldp-dashboard/blob/master/djangoldp_dashboard/fixtures/sample.json) can be loaded with `./manage.py loaddata sample`.
### Project
### Job Offers
Project are a private group chat including Customer and Business Provider management. To activate them, you need:
Job Offers includes a job board with conversation. To activate them, you need:
On Server: `djangoldp_project` packages
On Server: `djangoldp_joboffer`, `djangoldp_skill`, `djangoldp_upload`, `djangoldp_conversation` packages
On `config.json`:
```json
"endpoints": {
"projects": "http://server.url/projects/",
"customers": "http://server.url/customers/",
"businessproviders": "http://server.url/businessproviders/",
"skills": "http://server.url/skills/"
"get": {
"joboffers": "http://server.url/job-offers/"
}
}
```
### Users Directory
### Project
Directory includes a listing of each users of your app and editable individual profile. To activate them, you need:
Project are a private group chat including Customer and Business Provider management. To activate them, you need:
On Server: `djangoldp_skill`, `djangoldp_upload` packages
On Server: `djangoldp_project` packages
On `config.json`:
```json
"publicDirectory": true,
"endpoints": {
"groups": "http://server.url/groups/",
"skills": "http://server.url/skills/",
"uploads": "http://server.url/upload/"
"get": {
"projects": "http://server.url/projects/"
},
"post": {
"projects": "http://server.url/projects/"
}
}
```
### Job Offers
### Users Directory
Job Offers includes a job board with conversation. To activate them, you need:
Directory includes a listing of each users of your app and editable individual profile. To activate them, you need:
On Server: `djangoldp_joboffer`, `djangoldp_skill`, `djangoldp_upload`, `djangoldp_conversation` packages
On Server: `djangoldp_skill`, `djangoldp_upload` packages
On `config.json`:
```json
"endpoints": {
"joboffers": "http://server.url/job-offers/",
"skills": "http://server.url/skills/",
"uploads": "http://server.url/upload/"
}
"publicDirectory": true
```
## Optional community modules
### Events
The events module includes a listing of upcoming events and the capability to create new ones.
......@@ -238,9 +266,14 @@ On `config.json`:
```json
"endpoints": {
"events":"http://server.url/events/",
"typeevents":"http://server.url/typeevents/",
"uploads": "http://server.url/upload/"
"get": {
"events":"http://server.url/events/",
"typeevents":"http://server.url/typeevents/"
},
"post": {
"events":"http://server.url/events/",
"typeevents":"http://server.url/typeevents/"
}
}
```
......@@ -256,10 +289,16 @@ On `config.json`:
```json
"endpoints": {
"resources":"http://server.url/resources/",
"resourceskeywords":"http://server.url/keywords/",
"resourcestypes":"http://server.url/types/",
"uploads": "http://server.url/upload/"
"get": {
"resources":"http://server.url/resources/",
"resourceskeywords":"http://server.url/keywords/",
"resourcestypes":"http://server.url/types/"
},
"post": {
"resources":"http://server.url/resources/",
"resourceskeywords":"http://server.url/keywords/",
"resourcestypes":"http://server.url/types/"
}
}
```
......@@ -273,7 +312,12 @@ On `config.json`:
```json
"endpoints": {
"polls":"http://server.url/polls/"
"get": {
"polls":"http://server.url/polls/"
},
"post": {
"polls":"http://server.url/polls/"
}
}
```
......@@ -305,6 +349,12 @@ docker push registry.startinblox.com/applications/hubl/server:0.1
Note: within a Kubernetes pod all services are bound to `localhost`.
## Troubleshooting
### Circles or Projects are missing the @user list
Did you properly created subscriptions on your DjangoLDP's server? You can quickly create them with `./manage.py create_subscriptions`
## Built With
* [Sib-Core](https://git.startinblox.com/framework/sib-core/) - An awesome new framework!
* [Sib-Core](https://git.startinblox.com/framework/sib-core/) - A SOLID-Compliant framework
# Documentation
## Define your own colors
We use css variables to apply colors in the application.
The file can be found in src/styles/etc/
Example of use:
```css
:root {
--color-primary: #FFD759;
--color-secondary: #FFB700;
--color-complementary: #3C3F57;
--color-complementary-darken: #27293A;
}
```
Users can find example files at the root of the application. Use
- client.sample.happy-dev.css : for a more advanced example of customization.
- client.sample.css : to set five basic colors and let the default setup apply the colors.
:root {
--color-primary: #FFB700;
--color-secondary: #3C3F57;
--color-complementary: #6259E5;
--color-complementary-darken: #36383B;
--color-white: #FFFFFF;
--color-black-h: 216;
--color-black-s: 4%;
--color-black-l: 22%;
--color-main-background: var(--color-grey-13);
--color-main-text: #7A7F85;
--color-highlight-primary: var(--color-primary);
--color-user-panel: var(--color-black);
--color-bell: var(--color-secondary);
--color-avatar-background: #E4E8ED;
--color-title: #36383B;
--color-h1: var(--color-title);
--color-h2: var(--color-title);
/* Depreciated */
--color-tag-group-text: #9BA0A7;
--color-tag-group-border: var(--color-primary);
--color-label-dark: var(--color-grey-6);
/* Header's elements */
--color-header-background: var(--color-white);
--color-bell: var(--color-complementary-darken);
--color-notification-counter-number: black;
--color-notification-summary: #7A7F85;
--solid-notifications-theme: var(--color-primary);
--color-notification-item-border: #E4E8ED;
--color-notification-scrollbar-background: #EDF1FA;
--color-notification-scrollbar-track: #BDC2D7;
--color-user-panel-header-text: var(--color-complementary-darken);
--color-user-panel-header-background: var(--color-white);
--color-user-panel-header-text-open: var(--color-white);
--color-user-panel-header-background-open: var(--color-secondary);
--color-user-panel-list-background: var(--color-white);
--color-user-panel-list-text-hover: var(--color-complementary);
--color-user-panel-list-border: #E4E8ED;
/* Left menu */
--color-menu-highlight-primary: #FFD759;
--color-menu-background: var(--color-secondary);
--color-menu-text: var(--color-white);
--color-menu-text-active: var(--color-secondary);
--color-menu-background-active: var(--color-menu-highlight-primary);
--color-menu-badge-background: var(--color-menu-highlight-primary);
--color-menu-badge-text-active: var(--color-menu-highlight-primary);
--color-menu-badge-background-active: var(--color-secondary);
--color-menu-icon-background-active: var(--color-secondary);
/* Right menu */
--color-right-menu-background: #DAE2F3;
--color-right-menu-text: var(--color-secondary);
--color-right-menu-link-border: #BDC2D7;
--color-right-menu-active-text: var(--color-primary);
--color-right-menu-active-background: var(--color-secondary);
--color-right-menu-active-icon: var(--color-primary);
/* Scrollbar */
--color-scrollbar-right-background: var(--color-white);
--color-scrollbar-right-track: var(--color-grey-6);
--color-scrollbar-left-background: var(--color-secondary);
--color-scrollbar-left-track: var(--color-grey-11);
/* Tags */
--color-tag-admin-text: var(--color-complementary);
--color-tag-admin-border: var(--color-complementary);
/* Form elements */
--color-button-white: var(--color-white);
--color-button-primary: var(--color-primary);
--color-button-secondary: var(--color-complementary);
--color-button-complementary: var(--color-secondary);
--color-input-background: #EDF1FA;
--color-input-text: var(--color-secondary);
--color-input-icon: var(--color-complementary);
--color-input-active: var(--color-complementary);
--color-fieldset: var(--color-title);
--color-fieldset-border: #DAE2F3;
--color-button-modal: var(--color-title);
--color-select-list: var(--color-secondary);
--color-select-add-button: var(--color-button-secondary);
--color-select-add-button-background: var(--color-button-white);
--color-label-light: var(--color-grey-6);
/* Skill */
--color-skill-background: var(--color-primary);
--color-skill-text: var(--color-white);
/* Icon */
--color-icon: var(--color-primary);
/* Table */
--color-table-header-background: #BDC2D7;
--color-table-header-text: var(--color-white);
--color-table-border: #BDC2D7;
/* User thumb */
--color-user-thumb-name: #7A7F85;
--color-backlink: var(--color-secondary);
--color-content-header: #DAE2F3;
/* Chat */
--color-chat-white: var(--color-white);
--color-chat-primary: var(--color-primary);
--color-chat-complementary: var(--color-complementary);
--color-chat-secondary: var(--color-secondary);
--color-chat-complementary-darken: var(--color-complementary-darken);
--color-chat-grey-1: var(--color-grey-4);
--color-chat-grey-2: var(--color-grey-6);
--color-chat-grey-3: var(--color-grey-10);
/* Directory */
--color-directory-grey-4: #7A7F85 !important;
--color-directory-grey-5: #F0F3F6 !important;
--color-directory-avatar-background: #E4E8ED !important;
--color-directory-back-link: #36383B !important;
--color-directory-border: #DAE2F3 !important;
--color-directory-content-header-border: #DAE2F3 !important;
--color-directory-h1: var(--color-complementary-darken);
--color-directory-list-icon: var(--color-primary);
--color-directory-text: var(--color-directory-grey-4);
--color-directory-send-border: var(--color-complementary) !important;
--color-directory-list-icon: var(--color-primary) !important;
--color-directory-counter-background: var(--color-directory-grey-5) !important;
--color-directory-counter-border: #9BA0A7 !important;
--color-directory-counter-text: #4A4A4A !important;
--color-directory-paginate: #36383B !important;
--color-directory-paginate-disabled: #9BA0A7 !important;
--color-directory-form-input: #EDF1FA !important;
--color-directory-form-input-text: var(--color-directory-grey-4) !important;
--color-directory-form-input-active: var(--color-complementary) !important;
--color-directory-form-select-icon: var(--color-complementary) !important;
}
/* Text color for the beta label */
#header>div.header-left>span.beta-tag {
color: var(--color-complementary);
}
/* Button to edit a channel or a project (in project-profile) */
#project solid-link[next="project-edit"],
#circle solid-link[next="circle-edit"] {
background: var(--color-complementary);
border: 1px solid var(--color-complementary);
}
#project solid-link[next="project-edit"]:hover,
#circle solid-link[next="circle-edit"]:hover {
background: var(--color-white);
border: 1px solid var(--color-complementary);
color: var(--color-complementary);
}
/* Button to delete a channel */
/* box-button is depreciated */
#circle-profile>div>div.desktop-button__end>solid-ac-checker>solid-delete,
#circle-profile>div>div.box-button>solid-ac-checker>solid-delete {
background: var(--color-white);
border: 1px solid var(--color-complementary);
color: var(--color-complementary);
}
#circle-profile>div>div.desktop-button__end>solid-ac-checker>solid-delete>button,
#circle-profile>div>div.box-button>solid-ac-checker>solid-delete>button {
color: var(--color-complementary);
}
#circle-profile>div>div.desktop-button__end>solid-ac-checker>solid-delete:hover,
#circle-profile>div>div.box-button>solid-ac-checker>solid-delete:hover {
background: var(--color-complementary);
border: 1px solid var(--color-complementary);
color: var(--color-white);
}
#circle-profile>div>div.desktop-button__end>solid-ac-checker>solid-delete:hover>button,
#circle-profile>div>div.box-button>solid-ac-checker>solid-delete:hover>button {
color: var(--color-white);
}
/* Button with a pen to edit a user */
#admin-users-list>div>div.table>solid-display>div>solid-display>div>solid-action-hd-custom>solid-ac-checker>solid-link {
background: var(--color-complementary);
border: 1px solid var(--color-complementary);
color: var(--color-white);
}
#admin-users-list>div>div.table>solid-display>div>solid-display>div>solid-action-hd-custom>solid-ac-checker>solid-link:hover {
background: var(--color-white);
border: 1px solid var(--color-complementary);
color: var(--color-complementary);
}
/* Button to join a channel */
#admin-circle-list>div>div.table>solid-display:nth-child(5)>div>solid-display>div>admin-circle-join-button>solid-form {
background: var(--color-complementary);
border: 1px solid var(--color-complementary);
color: var(--color-white);
}
#admin-circle-list>div>div.table>solid-display:nth-child(5)>div>solid-display>div>admin-circle-join-button>solid-form:hover {
background: var(--color-white);
border: 1px solid var(--color-complementary);
color: var(--color-complementary);
}
#admin-circle-list>div>div.table>solid-display:nth-child(5)>div>solid-display>div>admin-circle-join-button>solid-form:hover input {
color: var(--color-complementary);
}
/* Directory - my profile*/
/* Colors for buttons to send a message to a member and to update or remove your profile picture */
#member-profile>div.profile-card>div.user-profile>div>solid-display>div>solid-action.button.button-primary.bordered,
button#solid-picture-browse.button.button-primary,
button#solid-picture-remove.button.button-primary {
border: 1px solid var(--color-directory-complementary) !important;
}
#member-profile solid-action.button.button-primary>solid-link,
button#solid-picture-browse.button.button-primary,
button#solid-picture-remove.button.button-primary {
color: var(--color-directory-complementary) !important;
}
#member-profile>div.profile-card>div.user-profile>div>solid-display>div>solid-action.button.button-primary.bordered>solid-link::before {
background-color: var(--color-directory-complementary) !important;
}
/* Hover */
#member-profile solid-action.button.button-primary:hover,
#member-profile solid-action.button.button-primary:hover>solid-link,
button#solid-picture-browse.button.button-primary:hover,
button#solid-picture-remove.button.button-primary:hover {
color: var(--color-directory-white) !important;
background-color: var(--color-directory-complementary) !important;
}
#member-profile>div.profile-card>div.user-profile>div>solid-display>div>solid-action.button.button-primary.bordered:hover>solid-link::before {
background-color: var(--color-directory-white) !important;
}
#members-list .send-display solid-link::before {
background-color: var(--color-directory-complementary)!important;
}
/* Dashboard */
.dashboard-card>div>div>p {
color: var(--color-complementary) !important;
}
.dashboard-card .svg-color-secondary {
fill: var(--color-complementary) !important;
}
.dashboard-card i {
border-color: var(--color-primary) !important;
color: var(--color-complementary) !important;
}
.dashboard-card sib-link, .dashboard-card solid-link {
border-color: var(--color-complementary) !important;
color: var(--color-complementary) !important;
}
.dashboard-card sib-link:hover, .dashboard-card solid-link:hover {
background-color: var(--color-complementary) !important;
color: #fff !important;
}
{
"xmpp": "https://jabber.happy-dev.fr/http-bind/",
"authority": "http://localhost:8000/",
"clientName": "Hubl",
"clientLogo": "https://cdn.startinblox.com/logos/hubl-logo.png",
"endpoints": {
"get": {
"skills": "http://localhost:8000/skills/",
"users": "http://localhost:8000/users/",
"groups": "http://localhost:8000/groups/"
},
"post": {
"skills": "http://localhost:8000/skills/",
"users": "http://localhost:8000/users/",
"groups": "http://localhost:8000/groups/"
}
}
}
{
"xmpp": "https://jabber.happy-dev.fr/http-bind/",
"xmppWebsocket": "wss://jabber.happy-dev.fr/xmpp-websocket",
"clientName": "My local Hubl",
"clientLogo": "/images/logo.webp",
"authority": "http://localhost:8000/",
"authorityName": "djangoldp-server-name",
"clientName": "Hubl",
"clientLogo": "https://cdn.startinblox.com/logos/hubl-logo.png",
"endpoints": {
"groups": "http://localhost:8000/groups/",
"skills": "http://localhost:8000/skills/",
"users": "http://localhost:8000/users/"
"get": {
"skills": "http://localhost:8000/skills/",
"users": "http://localhost:8000/users/"
},
"post": {
"users": "http://localhost:8000/users/",
"upload": "http://localhost:8000/upload/"
}
}
}
}
\ No newline at end of file
{
"xmpp": "https://jabber.happy-dev.fr/http-bind/",
"authority": "$SERVER",
"authorityName": "djangoldp-server-name",
"publicDirectory": true,
"endpoints": {
"get": {
"circles": "$SERVER/circles/",
"dashboards": "$SERVER/dashboards/",
"groups": "$SERVER/groups/",
"users": "$SERVER/users/",
"skills": "$SERVER/skills/",
"uploads": "$SERVER/upload/"
},
"post": {
"circles": "$SERVER/circles/",
"dashboards": "$SERVER/dashboards/",
"groups": "$SERVER/groups/",
"users": "$SERVER/users/",
"skills": "$SERVER/skills/",
"uploads": "$SERVER/upload/"
}
}
}
const HTMLAsset = require('parcel-bundler/lib/assets/HTMLAsset')
function shouldIgnore (file) {
// Ignore img(src="${...}") on pug & keep the components folder pristine
return /\${.+}/.test(file) || /components/.test(file) || /\/lib\/solid-/.test(file);
}
class SkipStartinbloxWidgetAsset extends HTMLAsset {
addDependency (name, opts) {
if (!shouldIgnore(opts.resolved)) {
return super.addDependency(name, opts)
}
}
processSingleDependency (p, opts) {
if (shouldIgnore(p)) return p
else return super.processSingleDependency(p, opts)
}
}
module.exports = SkipStartinbloxWidgetAsset
\ No newline at end of file
File moved
File moved
File moved
File moved
File moved
'use strict';
const fs = require('fs');
const fse = require('fs-extra');
const Bundler = require('parcel-bundler');
const options = {
outDir: './dist',
outFile: 'index.html',
publicUrl: '/',
watch: process.env.NODE_ENV !== 'production',
cache: process.env.NODE_ENV !== 'production',
cacheDir: '.cache',
contentHash: false,
minify: process.env.NODE_ENV === 'production',
scopeHoist: false,
target: 'browser',
bundleNodeModules: false,
https: true,
logLevel: 3,
hmr: false,
hmrPort: 1235,
sourceMaps: true,
hmrHostname: '',
detailedReport: false,
autoInstall: true
};
(async function() {
let configPath = process.env.CONFIG_PATH || 'config.json';
if(!fs.existsSync(configPath)) throw `[Error] (Mandatory) Missing ${configPath} file`;
console.log(`Using ${configPath} config file`);
let config = JSON.parse(fs.readFileSync(configPath));
if(!config.clientName) throw `[Error] (Mandatory) Missing clientName on ${configPath}`;
if(!config.clientLogo) throw `[Error] (Mandatory) Missing clientLogo on ${configPath}`;
let manifest = {
"lang": "fr",
"dir": "ltr",
"name": config.clientName,
"description": `Hubl of ${config.clientName}`,
"short_name": config.clientName,
"icons": [{
"src": config.clientLogo,
"purpose": "any"
}, {
"src": "/images/hubl-icon-192.png",
"sizes": "192x192",
"type": "image/png"
}, {
"src": "/images/hubl-icon-512.png",
"sizes": "512x512",
"type": "image/png"
}],
"start_url": ".",
"display": "standalone",
"orientation": "portrait",
"background_color": "#fff",
'theme_color': "white"
}
await fse.writeJSON('./src/manifest.webmanifest', manifest)
console.log(`Created manifest for ${config.clientName}`);
await fse.copy("./src/locales", "./dist/locales")
console.log(`Copied locales to dist folder`);
await fse.copy("./src/components", "./dist/components")
console.log(`Copied components to dist folder`);
const bundler = new Bundler('./src/index.pug', options);
bundler.addAssetType('html', require.resolve('./assets.js'));
if(process.env.NODE_ENV !== 'production') {
await bundler.serve();
} else {
await bundler.bundle();
}
})();
\ No newline at end of file
'use strict';
import fs from 'fs';
if(!fs.existsSync("config.json")) throw "[Error] (Mandatory) Missing config.json file";
let config = JSON.parse(fs.readFileSync('config.json'));
if(!config.clientName) throw "[Error] (Mandatory) Missing clientName on config.json";
if(!config.clientLogo) throw "[Error] (Mandatory) Missing clientLogo on config.json";
let manifest = {
"lang": "fr",
"dir": "ltr",
"name": config.clientName,
"description": `Hubl of ${config.clientName}`,
"short_name": config.clientName,
"icons": [{
"src": config.clientLogo,
"purpose": "any"
}, {
"src": "/images/hubl-icon-192.png",
"sizes": "192x192",
"type": "image/png"
}, {
"src": "/images/hubl-icon-512.png",
"sizes": "512x512",
"type": "image/png"
}],
"start_url": ".",
"display": "standalone",
"orientation": "portrait",
"background_color": "#fff",
'theme_color': "white"
}
fs.existsSync("dist") || fs.mkdirSync("dist");
fs.writeFileSync('dist/manifest.webmanifest', JSON.stringify(manifest, null, 2));
console.log(`Created manifest for ${config.clientName}`);
\ No newline at end of file
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment