Skip to content

Commit cb1591c

Browse files
authored
Merge pull request #37 from eapearson/master
Added notification support (but not used!)
2 parents 2ae776d + 75b84b6 commit cb1591c

File tree

271 files changed

+39383
-148
lines changed

Some content is hidden

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

271 files changed

+39383
-148
lines changed

build/Gruntfile.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ module.exports = function (grunt) {
55
grunt.initConfig({
66
pkg: grunt.file.readJSON('package.json'),
77
copy: {
8-
'pure-uuid': {
9-
expand: true,
10-
flatten: true,
11-
src: 'node_modules/pure-uuid/uuid.js',
12-
dest: '../src/plugin/iframe_root/modules/vendor/pure-uuid'
13-
}
8+
// 'pure-uuid': {
9+
// expand: true,
10+
// flatten: true,
11+
// src: 'node_modules/pure-uuid/uuid.js',
12+
// dest: '../src/plugin/iframe_root/modules/vendor/pure-uuid'
13+
// }
1414
},
1515
clean: {
1616
options: {

build/README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ yarn install
1313
yarn install-bower
1414
yarn install-npm
1515
yarn remove-source-maps
16+
yarn install-dist
1617
```
1718

18-
> Only use yarn clean if you want to clean out the stuff installed in vendor, as well as the node and bower packages installed in build.
19+
> Only use yarn clean if you want to clean out the stuff installed in vendor, as well as the node and bower packages installed in build.
20+
21+
## Preparing for a new release
22+
23+
This plugin provides itself in the `dist` directory. In order to ensure that the dist directory is up-to-date with the source, run `yarn install-dist`.
24+
25+
You can iterate on the raw source locally with `kbase-ui` by removing the dist directory temporarily, and supplying the plugin via the `plugins` option to kbase-ui's `make dev-start` task. kbase-ui will detect the absence of a dist directory and use the src directory instead.

build/bower.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,21 @@
4646
"requirejs": "2.3.6",
4747
"require-css": "0.1.10",
4848
"kbase-common-js": "2.18.1",
49-
"kbase-common-es6": "0.10.23",
49+
"kbase-common-es6": "0.11.1",
5050
"js-yaml": "3.13.1",
5151
"requirejs-text": "2.0.16",
5252
"requirejs-yaml": "eapearson/requirejs-yaml#1.0.5",
5353
"kbase-service-clients-js": "3.3.6",
5454
"nunjucks": "3.1.2",
55+
"pure-uuid": "1.5.8",
5556
"spark-md5": "3.0.0",
5657
"font-awesome": "4.7.0",
5758
"datatables-bootstrap3-plugin": "eapearson/datatables-bootstrap3-plugin#1.0.1",
5859
"datatables": "1.10.19"
5960
},
61+
"resolutions": {
62+
"kbase-common-es6": "0.11.1",
63+
"pure-uuid": "1.5.8"
64+
},
6065
"license": "SEE LICENSE IN ../LICENSE"
6166
}

build/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"clean": "grunt clean",
55
"install-bower": "bower-installer",
66
"install-npm": "grunt copy",
7-
"remove-source-maps": "node scripts/remove-source-maps.js"
7+
"remove-source-maps": "node scripts/remove-source-maps.js",
8+
"install-dist": "node scripts/install-dist.js"
89
},
910
"author": "KBase Developers",
1011
"license": "SEE LICENSE IN LICENSE",
@@ -21,6 +22,6 @@
2122
"grunt-contrib-copy": "1.0.0",
2223
"js-yaml": "3.13.1",
2324
"numeral": "2.0.6",
24-
"pure-uuid": "1.5.7"
25+
"terser": "4.4.3"
2526
}
2627
}

build/scripts/install-dist.js

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
const bluebird = require('bluebird');
2+
const glob = bluebird.promisify(require('glob').Glob);
3+
const fs = bluebird.promisifyAll(require('fs-extra'));
4+
const Terser = require('terser');
5+
const path = require('path');
6+
7+
async function copyFiles(rootDir) {
8+
const root = rootDir.split('/');
9+
const source = root.concat(['src', 'plugin']).join('/');
10+
const dest = root.concat(['dist', 'plugin']).join('/');
11+
try {
12+
await fs.removeAsync(dest);
13+
} catch (ex) {
14+
console.warn('WARNING removing dest', ex.message);
15+
}
16+
await fs.ensureDirAsync(dest);
17+
await fs.copyAsync(source, dest);
18+
}
19+
20+
async function minify(rootDir) {
21+
const root = rootDir.split('/');
22+
23+
// remove mapping from css files.
24+
const matches = await glob(
25+
root
26+
.concat(['dist', 'plugin', 'iframe_root', '**', '*.js'])
27+
.join('/'),
28+
{
29+
nodir: true
30+
}
31+
);
32+
console.log(`minifying ${matches.length} files...`);
33+
34+
return Promise.all(
35+
matches.map(async (match) => {
36+
// console.log(`minifying ${match}...`);
37+
const contents = await fs.readFileAsync(match, 'utf8');
38+
const result = Terser.minify(contents, {
39+
output: {
40+
beautify: false,
41+
max_line_len: 80,
42+
quote_style: 0
43+
},
44+
compress: {
45+
// required in uglify-es 3.3.10 in order to work
46+
// around a bug in the inline implementation.
47+
// it should be fixed in an upcoming release.
48+
inline: 1
49+
},
50+
safari10: true
51+
});
52+
if (result.error) {
53+
console.error('Error minifying file: ' + match, result);
54+
throw new Error('Error minifying file ' + match) + ':' + result.error;
55+
} else if (result.code.length === 0) {
56+
console.warn('Skipping empty file: ' + match);
57+
} else {
58+
return fs.writeFileAsync(match, result.code);
59+
}
60+
})
61+
);
62+
}
63+
64+
async function main() {
65+
const cwd = process.cwd().split('/');
66+
cwd.push('..');
67+
const projectPath = path.normalize(cwd.join('/'));
68+
console.log(`Project path: ${projectPath}`);
69+
console.log('Copying files to dist...');
70+
await copyFiles(projectPath);
71+
console.log('Minifying dist...');
72+
await minify(projectPath);
73+
console.log('done');
74+
}
75+
76+
77+
78+
main();

build/yarn.lock

+40-13
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ async@~1.5.2:
9696
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
9797
integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=
9898

99-
atob@^2.1.1:
99+
atob@^2.1.2:
100100
version "2.1.2"
101101
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
102102
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
@@ -167,6 +167,11 @@ braces@^2.3.1:
167167
split-string "^3.0.2"
168168
to-regex "^3.0.1"
169169

170+
buffer-from@^1.0.0:
171+
version "1.1.1"
172+
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
173+
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==
174+
170175
cache-base@^1.0.1:
171176
version "1.0.1"
172177
resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2"
@@ -280,6 +285,11 @@ colors@~1.1.2:
280285
resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63"
281286
integrity sha1-FopHAXVran9RoSzgyXv6KMCE7WM=
282287

288+
commander@^2.20.0:
289+
version "2.20.3"
290+
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
291+
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
292+
283293
component-emitter@^1.2.1:
284294
version "1.3.0"
285295
resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0"
@@ -1339,11 +1349,6 @@ posix-character-classes@^0.1.0:
13391349
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
13401350
integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=
13411351

1342-
1343-
version "1.5.7"
1344-
resolved "https://registry.yarnpkg.com/pure-uuid/-/pure-uuid-1.5.7.tgz#c089845d85e3b33a070bf4dc8cce30906880e9bd"
1345-
integrity sha512-g8kcLZcJi1ePpuNxrnI6a4re2ze89FPnV6dXaDuW4K9+n+SzvolhR2uoZhHJvz1Ilba0U8hvb1clxTLN49EvuQ==
1346-
13471352
read-pkg-up@^1.0.1:
13481353
version "1.0.1"
13491354
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02"
@@ -1415,9 +1420,9 @@ resolve-url@^0.2.1:
14151420
integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=
14161421

14171422
resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0:
1418-
version "1.13.1"
1419-
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.13.1.tgz#be0aa4c06acd53083505abb35f4d66932ab35d16"
1420-
integrity sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w==
1423+
version "1.14.1"
1424+
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.14.1.tgz#9e018c540fcf0c427d678b9931cbf45e984bcaff"
1425+
integrity sha512-fn5Wobh4cxbLzuHaE+nphztHy43/b++4M6SsGFC2gB8uYwf0C8LcarfCz1un7UTW8OFQg9iNjZ4xpcFVGebDPg==
14211426
dependencies:
14221427
path-parse "^1.0.6"
14231428

@@ -1508,16 +1513,24 @@ snapdragon@^0.8.1:
15081513
use "^3.1.0"
15091514

15101515
source-map-resolve@^0.5.0:
1511-
version "0.5.2"
1512-
resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259"
1513-
integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==
1516+
version "0.5.3"
1517+
resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a"
1518+
integrity sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==
15141519
dependencies:
1515-
atob "^2.1.1"
1520+
atob "^2.1.2"
15161521
decode-uri-component "^0.2.0"
15171522
resolve-url "^0.2.1"
15181523
source-map-url "^0.4.0"
15191524
urix "^0.1.0"
15201525

1526+
source-map-support@~0.5.12:
1527+
version "0.5.16"
1528+
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042"
1529+
integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==
1530+
dependencies:
1531+
buffer-from "^1.0.0"
1532+
source-map "^0.6.0"
1533+
15211534
source-map-url@^0.4.0:
15221535
version "0.4.0"
15231536
resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"
@@ -1528,6 +1541,11 @@ source-map@^0.5.6:
15281541
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
15291542
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
15301543

1544+
source-map@^0.6.0, source-map@~0.6.1:
1545+
version "0.6.1"
1546+
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
1547+
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
1548+
15311549
spdx-correct@^3.0.0:
15321550
version "3.1.0"
15331551
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4"
@@ -1619,6 +1637,15 @@ supports-color@^7.1.0:
16191637
dependencies:
16201638
has-flag "^4.0.0"
16211639

1640+
1641+
version "4.4.3"
1642+
resolved "https://registry.yarnpkg.com/terser/-/terser-4.4.3.tgz#401abc52b88869cf904412503b1eb7da093ae2f0"
1643+
integrity sha512-0ikKraVtRDKGzHrzkCv5rUNDzqlhmhowOBqC0XqUHFpW+vJ45+20/IFBcebwKfiS2Z9fJin6Eo+F1zLZsxi8RA==
1644+
dependencies:
1645+
commander "^2.20.0"
1646+
source-map "~0.6.1"
1647+
source-map-support "~0.5.12"
1648+
16221649
to-object-path@^0.3.0:
16231650
version "0.3.0"
16241651
resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af"

dist/plugin/config.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
## YAML Template.
2+
---
3+
package:
4+
author: Erik Pearson
5+
name: dashboard
6+
description: The dashboard panel and associated widgets
7+
date: August 6, 2015
8+
version: 0.0.1
9+
source:
10+
## sources are relative to build/plugins/PACKAGE/source/javascript
11+
## NB: need to quote file names, otherwise
12+
modules:
13+
styles:
14+
# - file: styles.css
15+
install:
16+
widgets:
17+
- module: ./panel
18+
id: kb_plugin_dashboard
19+
type: es6
20+
# -
21+
# module: ./dashboardPanel
22+
# id: dashboardPanel
23+
# type: factory
24+
# -
25+
# module: ./widgets/CollaboratorsWidget
26+
# id: dashboardCollaborators
27+
# type: object
28+
# -
29+
# module: ./widgets/MetricsWidget
30+
# id: dashboardMetrics
31+
# type: object
32+
# -
33+
# module: ./widgets/NarrativesWidget
34+
# id: dashboardNarratives
35+
# type: object
36+
# -
37+
# module: ./widgets/PublicNarrativesWidget
38+
# id: dashboardPublicNarratives
39+
# type: object
40+
# -
41+
# module: ./widgets/NarratorialsWidget
42+
# id: dashboardNarratorials
43+
# type: object
44+
# -
45+
# module: ./widgets/SharedNarrativesWidget
46+
# id: dashboardSharedNarratives
47+
# type: object
48+
routes:
49+
- path: ["dashboard"]
50+
widget: kb_plugin_dashboard
51+
authorization: true
52+
menu:
53+
- name: dashboard
54+
definition:
55+
path: ["dashboard"]
56+
label: Dashboard
57+
icon: dashboard

dist/plugin/iframe_root/.bowerrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "modules/bower_components"
3+
}

dist/plugin/iframe_root/bower.json

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "kbase-ui-plugin-dashboard",
3+
"description": "A primary view (panel) for the KBase UI to provide a user with a summary of their Narratives, relationships, and status",
4+
"keywords": ["kbase", "widget"],
5+
"author": ["[email protected]"],
6+
"moduleType": "kbase-ui-plugin",
7+
"main": "src/plugin/config.yml",
8+
"ignore": [".gitignore"],
9+
"repository": {
10+
"type": "git",
11+
"url": "git://github.com/kbase/kbase-ui-plugin-dashboard"
12+
},
13+
"dependencies": {
14+
"bluebird": "3.5.3",
15+
"bootstrap": "3.4.1",
16+
"nunjucks": "^3.0.0",
17+
"jquery": "^2.1.0",
18+
"kbase-service-clients-js": "^3.3.5",
19+
"requirejs": "2.3.6",
20+
"require-css": "0.1.10",
21+
"kbase-common-js": "2.18.1",
22+
"kbase-common-es6": "0.10.14",
23+
"kbase-ui-widget": "1.3.0",
24+
"js-yaml": "3.12.1",
25+
"requirejs-text": "2.0.15",
26+
"requirejs-yaml": "eapearson/requirejs-yaml#1.0.5",
27+
"pure-uuid": "eapearson/pure-uuid#1.1.1",
28+
"kbase-service-clients-js": "3.3.5",
29+
"nunjucks": "3.1.2",
30+
"spark-md5": "3.0.0",
31+
"font-awesome": "4.7.0",
32+
"datatables-bootstrap3-plugin": "eapearson/datatables-bootstrap3-plugin#1.0.1",
33+
"datatables": "1.10.19"
34+
},
35+
"devDependencies": {},
36+
"license": "SEE LICENSE IN LICENSE.md"
37+
}

0 commit comments

Comments
 (0)