@fleetbase/ember-core 0.0.7 → 0.0.8

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.
@@ -0,0 +1,9 @@
1
+ export function initialize() {
2
+ const socketClusterClientScript = document.createElement('script');
3
+ socketClusterClientScript.src = '/assets/socketcluster-client.min.js';
4
+ document.body.appendChild(socketClusterClientScript);
5
+ }
6
+
7
+ export default {
8
+ initialize,
9
+ };
@@ -0,0 +1 @@
1
+ export { default, initialize } from '@fleetbase/ember-core/initializers/load-socketcluster-client';
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
+ const Funnel = require('broccoli-funnel');
3
+ const MergeTrees = require('broccoli-merge-trees');
2
4
  const path = require('path');
3
- const resolve = require('resolve');
4
5
 
5
6
  module.exports = {
6
7
  name: require('./package').name,
@@ -20,13 +21,20 @@ module.exports = {
20
21
  useSessionSetupMethod: true,
21
22
  };
22
23
  }
24
+ },
25
+
26
+ treeForPublic: function () {
27
+ const publicTree = this._super.treeForPublic.apply(this, arguments);
28
+ const trees = [];
23
29
 
24
- // import socketcluster for use in all fleetbase engines
25
- // this will become globally available as socketClusterClient
26
- let socketClusterMainPath = resolve.sync('socketcluster-client', { basedir: app.project.root });
27
- let socketClusterDir = path.dirname(socketClusterMainPath);
28
- let socketClusterMinPath = path.join(socketClusterDir, 'socketcluster-client.min.js');
30
+ trees.push(
31
+ new Funnel(path.dirname(require.resolve('socketcluster-client')), {
32
+ files: ['socketcluster-client.min.js'],
33
+ destDir: '/assets',
34
+ })
35
+ );
29
36
 
30
- app.import(socketClusterMinPath);
37
+ // Merge the addon tree with the existing tree
38
+ return publicTree ? new MergeTrees([publicTree, ...trees], { overwrite: true }) : new MergeTrees([...trees], { overwrite: true });
31
39
  },
32
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetbase/ember-core",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "Provides all the core services, decorators and utilities for building a Fleetbase extension for the Console.",
5
5
  "keywords": [
6
6
  "fleetbase-extension",
@@ -58,6 +58,8 @@
58
58
  "@glimmer/tracking": "^1.1.2",
59
59
  "babel-eslint": "^10.1.0",
60
60
  "broccoli-asset-rev": "^3.0.0",
61
+ "broccoli-funnel": "^3.0.8",
62
+ "broccoli-merge-trees": "^4.2.0",
61
63
  "broccoli-persistent-filter": "^3.1.3",
62
64
  "ember-cli": "~4.6.0",
63
65
  "ember-cli-dependency-checker": "^3.3.1",