Skip to content

Commit

Permalink
feat: UI overhaul featuring Vuetify.js (#48) (Fix #47)
Browse files Browse the repository at this point in the history
* New and improved collapsible tree
* Fuzzy search for components
* Hot reload tree, render, and source
  • Loading branch information
mvsde committed Jul 3, 2019
1 parent 6d76790 commit a5ea3fc
Show file tree
Hide file tree
Showing 83 changed files with 1,792 additions and 1,338 deletions.
11 changes: 2 additions & 9 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
{
"root": true,
"extends": [
"@pangolin/eslint-config",
"plugin:ava/recommended"
],
"plugins": [
"ava"
],
"env": {
"browser": true
}
"@pangolin/eslint-config"
]
}
10 changes: 8 additions & 2 deletions .github/main.workflow
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
workflow "Lint and test on push" {
workflow "Test on push" {
on = "push"
resolves = ["Lint CSS", "Lint JavaScript", "Unit testing"]
resolves = ["Lint CSS", "Lint JavaScript", "Unit testing", "Build UI"]
}

action "Install" {
Expand All @@ -25,3 +25,9 @@ action "Unit testing" {
needs = ["Lint JavaScript", "Lint CSS"]
args = "run test:unit"
}

action "Build UI" {
uses = "actions/npm@master"
needs = ["Unit testing"]
args = "run build:ui"
}
4 changes: 2 additions & 2 deletions lib/commands/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ module.exports = async function (options) {
})

if (shouldReload) {
// Broadcast 'window-reload via WebSocket
// Broadcast reload message via WebSocket
webSocketServer.clients.forEach(client => {
if (client.readyState === WebSocket.OPEN) {
client.send('window-reload')
client.send('reload')
}
})
}
Expand Down
22 changes: 9 additions & 13 deletions lib/config/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const path = require('path')
const webpack = require('webpack')
const WebpackBar = require('webpackbar')

const ComponentsIndexPlugin = require('../nunjucks/components-index-plugin')
const generateFileLoaderOptions = require('../utils/generate-file-loader-options')
const PangolinPlugin = require('../webpack/pangolin-plugin.js')
const store = require('../store')

/**
Expand Down Expand Up @@ -138,20 +138,16 @@ module.exports = (context, options = {}) => {
config.entry('main')
.add('./src/main.scss')

// HTML

config.module
.rule('html')
.test(/\.njk$/)
.use('nunjucks-loader')
.loader(require.resolve('../nunjucks/loader'))

// Plugins

if (process.env.PANGOLIN_ENV !== 'build') {
config.module
.rule('pangolin')
.test(/\.njk$/)
.use('pangolin-loader')
.loader(require.resolve('../webpack/pangolin-loader.js'))

config
.plugin('pangolin-components-index')
.use(ComponentsIndexPlugin)
.plugin('pangolin-plugin')
.use(PangolinPlugin)
}
}

Expand Down
56 changes: 0 additions & 56 deletions lib/nunjucks/components-index-plugin.js

This file was deleted.

File renamed without changes.
File renamed without changes.
129 changes: 0 additions & 129 deletions lib/nunjucks/loader.js

This file was deleted.

17 changes: 17 additions & 0 deletions lib/utils/escape-html.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Escape HTML
* @see {@link https://stackoverflow.com/a/4835406/9208523}
* @param {String} html Raw HTML
* @returns {String} Escaped HTML
*/
module.exports = function (html) {
const replacements = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#039;'
}

return html.replace(/[&<>"']/g, match => replacements[match])
}
15 changes: 15 additions & 0 deletions lib/utils/generate-index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const fs = require('fs-extra')
const store = require('../store.js')

const template = fs.readFileSync('../../ui/index.html').toString()

/**
* Generate index html
* @returns {String} Index HTML
*/
module.exports = function () {
return template
.replace(/{{ project }}/g, store.state.config.project.name)
.replace(/{{ base }}/g, store.state.config.project.base)
.replace(/{{ socketPath }}/g, store.state.config.devServer.webSocketPath)
}
7 changes: 6 additions & 1 deletion lib/utils/get-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ module.exports = (context) => {
},
nunjucks: {},
project: {
id: require(`${context}/package.json`).name,
name: 'Pangolin',
base: '/'
base: '/',
branding: {
colorTheme: '#ff721f',
favicon: 'favicon.ico'
}
},
fileNameHash: true
}
Expand Down
Loading

0 comments on commit a5ea3fc

Please sign in to comment.