Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup - improve loading time #302

Merged
merged 25 commits into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto

# don't diff machine generated files
dist/ -diff
package-lock.json -diff
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
- name: Install APM dependencies
run: |
apm ci # uses locked module. use `apm install` for non-locked
- name: Build
run: npm run build
- name: Run tests 👩🏾‍💻
run: npm run test

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
npm-debug.log
node_modules
dist
20 changes: 20 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
let presets = [
["@babel/preset-env", {
targets: {
"electron": 5
}
}]
];

let plugins = [];

if (process.env.BABEL_ENV === "development") {
plugins.push("@babel/plugin-transform-modules-commonjs");
}

module.exports = {
presets: presets,
plugins: plugins,
exclude: "node_modules/**",
sourceMaps: "inline"
};
7 changes: 7 additions & 0 deletions iconsets/rollup-iconsets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file is the entry file for css rollup
aminya marked this conversation as resolved.
Show resolved Hide resolved
import "./ionicons/ionicons.css";
import "./font-awesome/font-awesome.css";
import "./foundation/foundation-icons.css";
import "./icomoon/icomoon.css";
import "./devicon/devicon.css";
import "./mdi/materialdesignicons.css";
9 changes: 3 additions & 6 deletions lib/items/tool-bar-button-view.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {CompositeDisposable} = require('atom');
const { ToolBarItem } = require('./tool-bar-item');
import {CompositeDisposable} from 'atom';
import { ToolBarItem } from './tool-bar-item';

/**
* A button class with many options
Expand All @@ -12,9 +12,8 @@ const { ToolBarItem } = require('./tool-bar-item');
* @property {boolean} enabled
* @property {CompositeDisposable} subscriptions
*/
class ToolBarButtonView extends ToolBarItem {
export class ToolBarButtonView extends ToolBarItem {
/**
*
* @param {ButtonOptions} options
* @param {string} group
*/
Expand Down Expand Up @@ -238,5 +237,3 @@ function getTooltipPlacement () {
const toolbarPosition = atom.config.get('tool-bar.position');
return tooltipPlacement[toolbarPosition] || null;
}

module.exports.ToolBarButtonView = ToolBarButtonView;
4 changes: 1 addition & 3 deletions lib/items/tool-bar-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @property {number} priority
* @property {string} group
*/
class ToolBarItem {
export class ToolBarItem {
/**
* @param {ItemOptions} options
* @param {string} group
Expand All @@ -24,5 +24,3 @@ class ToolBarItem {
this.element = null;
}
}

module.exports.ToolBarItem = ToolBarItem;
6 changes: 2 additions & 4 deletions lib/items/tool-bar-spacer-view.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { ToolBarItem } = require('./tool-bar-item');
import { ToolBarItem } from './tool-bar-item';

class ToolBarSpacerView extends ToolBarItem {
export class ToolBarSpacerView extends ToolBarItem {
constructor (options, group) {
// first calling the super (ToolBarItem) constructor
super({
Expand All @@ -15,5 +15,3 @@ class ToolBarSpacerView extends ToolBarItem {
this.element.classList.add(...classNames);
}
}

module.exports.ToolBarSpacerView = ToolBarSpacerView;
4 changes: 2 additions & 2 deletions lib/raf-debounce.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function rafDebounce (fn) {
export function rafDebounce (fn) {
let args, context, requestID;

function later () {
Expand All @@ -22,4 +22,4 @@ module.exports = function rafDebounce (fn) {
};

return debounced;
};
}
11 changes: 5 additions & 6 deletions lib/tool-bar-manager.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
const { ToolBarItem } = require('./items/tool-bar-item');
const { ToolBarButtonView } = require('./items/tool-bar-button-view');
const { ToolBarSpacerView } = require('./items/tool-bar-spacer-view');
import { ToolBarItem } from './items/tool-bar-item';
import { ToolBarButtonView } from './items/tool-bar-button-view';
import { ToolBarSpacerView } from './items/tool-bar-spacer-view';

/**
*
* @property {string} group
* @property {ToolBarView} toolBarView
* @property {TouchBarManager} touchBarManager
*/
class ToolBarManager {
export class ToolBarManager {
/**
*
* @param {string} group
* @param {ToolBarView} toolBarView
* @param {TouchBarManager} touchBarManager
Expand Down Expand Up @@ -73,6 +72,6 @@ class ToolBarManager {
onDidDestroy (callback) {
this.toolBarView.emitter.on('did-destroy', callback);
}
};
}

module.exports.ToolBarManager = ToolBarManager;
8 changes: 4 additions & 4 deletions lib/tool-bar-view.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const {CompositeDisposable, Emitter} = require('atom');
const rafDebounce = require('./raf-debounce');
import {CompositeDisposable, Emitter} from 'atom';
import {rafDebounce} from './raf-debounce';

module.exports = class ToolBarView {
export class ToolBarView {
constructor () {
this.element = document.createElement('div');
this.element.classList.add('tool-bar');
Expand Down Expand Up @@ -212,4 +212,4 @@ module.exports = class ToolBarView {
toggle () {
atom.config.set('tool-bar.visible', !atom.config.get('tool-bar.visible'));
}
};
}
6 changes: 3 additions & 3 deletions lib/tool-bar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { ToolBarManager } = require('./tool-bar-manager');
const ToolBarView = require('./tool-bar-view');
const TouchBarManager = require('./touch-bar-manager');
import {ToolBarManager} from './tool-bar-manager';
import {ToolBarView} from './tool-bar-view';
import {TouchBarManager} from './touch-bar-manager';

let toolBarView = null;
let touchBarManager = null;
Expand Down
7 changes: 4 additions & 3 deletions lib/touch-bar-manager.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const {TouchBar, nativeImage} = require('electron').remote;
import {remote} from 'electron';
const {TouchBar, nativeImage} = remote;
ericcornelissen marked this conversation as resolved.
Show resolved Hide resolved
const {TouchBarButton} = TouchBar;

module.exports = class TouchBarManager {
export class TouchBarManager {
constructor () {
this.buttons = [];
}
Expand Down Expand Up @@ -86,4 +87,4 @@ module.exports = class TouchBarManager {
atom.getCurrentWindow().setTouchBar(touchBar);
this._updateDebounce = null;
}
};
}
Loading