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

New build system: Webpack ✨ 📦 📑 #4902

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bd40f21
RAW commit
achillesrasquinha Dec 12, 2017
8aa1b1f
[WIP] webpack
achillesrasquinha Dec 12, 2017
2207feb
Create index.bundle.js for desk
netchampfaris Dec 13, 2017
5939830
functional async load
achillesrasquinha Dec 18, 2017
bbdc66d
replace rumble with simple cute wiggling (#4628)
pratu16x7 Dec 15, 2017
f02cc9f
foobar
achillesrasquinha Dec 18, 2017
6e95612
updated webpack
achillesrasquinha Dec 19, 2017
53a0a96
Desk loaded
netchampfaris Dec 19, 2017
cf31709
added page webpack bundling
achillesrasquinha Dec 26, 2017
c024cf3
Integrate webpack with bench
netchampfaris Dec 27, 2017
b2ec6cc
Build files from public/js, less-loader
netchampfaris Dec 27, 2017
525f06d
Cleanup webpack config
netchampfaris Jan 8, 2018
b9a42a3
wip
netchampfaris Jan 8, 2018
61ba9fd
wip
netchampfaris Jan 8, 2018
544d22a
Website loaded
netchampfaris Jan 8, 2018
ff42cf3
vendor.bundle.js
netchampfaris Jan 10, 2018
a6f6e66
CSS Working!
netchampfaris Jan 10, 2018
dd95425
List, Form loaded
netchampfaris Jan 11, 2018
845e02d
Merge with develop
netchampfaris Jan 11, 2018
e8e6496
Progress
netchampfaris Jan 23, 2018
926ad1c
Cleanup
achillesrasquinha Jan 23, 2018
4d6fa42
Fixed Code Reviews
achillesrasquinha Jan 23, 2018
47490c5
Merge develop with webpack
achillesrasquinha Jan 23, 2018
e99feae
filter unavailable publicjs
achillesrasquinha Jan 23, 2018
d2835f6
Merge develop to webpack
achillesrasquinha Jan 30, 2018
6a60d96
Reports working
netchampfaris Feb 12, 2018
2994784
Merge with develop
netchampfaris Feb 12, 2018
a7bff51
Separate date and text editor styles, charts in dashboard
netchampfaris Feb 12, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions .babelrc
@@ -0,0 +1,9 @@
{
"sourceMaps": true,
"presets": [
"env"
],
"plugins": [
"transform-object-rest-spread"
]
}
3 changes: 3 additions & 0 deletions .eslintrc
Expand Up @@ -4,6 +4,9 @@
"node": true,
"es6": true
},
"parserOptions": {
"sourceType": "module"
},
"extends": "eslint:recommended",
"rules": {
"indent": [
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Expand Up @@ -14,6 +14,4 @@ node_modules
.kdev4/
*.kdev4


# Not Recommended, but will remove once webpack ready
package-lock.json
npm-debug.log
2 changes: 1 addition & 1 deletion frappe/__init__.py
Expand Up @@ -1462,4 +1462,4 @@ def get_version(doctype, name, limit = None, head = False, raise_err = True):
if raise_err:
raise ValueError('{doctype} has no versions tracked.'.format(
doctype = doctype
))
))
31 changes: 10 additions & 21 deletions frappe/build.py
Expand Up @@ -24,40 +24,29 @@ def setup():
except ImportError: pass
app_paths = [os.path.dirname(pymodule.__file__) for pymodule in pymodules]

def bundle(no_compress, make_copy=False, restore=False, verbose=False):
def bundle(compress=False, make_copy=False, restore=False, verbose=False):
"""concat / minify js files"""
# build js files
setup()

make_asset_dirs(make_copy=make_copy, restore=restore)

# new nodejs build system
command = 'node --use_strict ../apps/frappe/frappe/build.js --build'
if not no_compress:
command += ' --minify'
subprocess.call(command.split(' '))
frappe_app_path = app_paths[0]
command = 'npm run frappe-build{0}'.format('-minify' if compress else '')

# build(no_compress, verbose)
p = subprocess.Popen(command.split(' '), cwd=frappe_app_path)
out, err = p.communicate()

def watch(no_compress):
"""watch and rebuild if necessary"""

# new nodejs file watcher
command = 'node --use_strict ../apps/frappe/frappe/build.js --watch'
subprocess.call(command.split(' '))

# setup()

# import time
# compile_less()
# build(no_compress=True)
setup()

# while True:
# compile_less()
# if files_dirty():
# build(no_compress=True)
frappe_app_path = app_paths[0]

# time.sleep(3)
command = 'npm run frappe-watch'.split(' ')
p = subprocess.Popen(command, cwd=frappe_app_path)
out, err = p.communicate()

def make_asset_dirs(make_copy=False, restore=False):
# don't even think of making assets_path absolute - rm -rf ahead.
Expand Down
8 changes: 4 additions & 4 deletions frappe/commands/utils.py
Expand Up @@ -13,14 +13,14 @@
@click.option('--make-copy', is_flag=True, default=False, help='Copy the files instead of symlinking')
@click.option('--restore', is_flag=True, default=False, help='Copy the files instead of symlinking with force')
@click.option('--verbose', is_flag=True, default=False, help='Verbose')
def build(make_copy=False, restore = False, verbose=False):
@click.option('--minify', is_flag=True, default=False, help='Minify')
def build(make_copy=False, restore = False, verbose=False, minify=False):
"Minify + concatenate JS and CSS files, build translations"
import frappe.build
import frappe
frappe.init('')
# don't minify in developer_mode for faster builds
no_compress = frappe.local.conf.developer_mode or False
frappe.build.bundle(no_compress, make_copy=make_copy, restore = restore, verbose=verbose)
compress = minify or (not frappe.conf.developer_mode) or False
frappe.build.bundle(compress, make_copy=make_copy, restore = restore, verbose=verbose)

@click.command('watch')
def watch():
Expand Down
38 changes: 21 additions & 17 deletions frappe/core/page/desktop/desktop.js
@@ -1,3 +1,4 @@

frappe.provide('frappe.desktop');

frappe.pages['desktop'].on_page_load = function(wrapper) {
Expand All @@ -22,6 +23,7 @@ $.extend(frappe.desktop, {
}

this.render();

this.make_sortable();
},

Expand Down Expand Up @@ -261,24 +263,26 @@ $.extend(frappe.desktop, {
return;
}

new Sortable($("#icon-grid").get(0), {
animation: 150,
onUpdate: function(event) {
var new_order = [];
$("#icon-grid .case-wrapper").each(function(i, e) {
new_order.push($(this).attr("data-name"));
});
if (window.Sortable) {
new Sortable($("#icon-grid").get(0), {
onUpdate: function(event) {
var new_order = [];
$("#icon-grid .case-wrapper").each(function(i, e) {
new_order.push($(this).attr("data-name"));
});

frappe.call({
method: 'frappe.desk.doctype.desktop_icon.desktop_icon.set_order',
args: {
'new_order': new_order,
'user': frappe.session.user
},
quiet: true
});
}
});
}

frappe.call({
method: 'frappe.desk.doctype.desktop_icon.desktop_icon.set_order',
args: {
'new_order': new_order,
'user': frappe.session.user
},
quiet: true
});
}
});
},

set_background: function() {
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion frappe/desk/page/activity/activity.js
@@ -1,6 +1,6 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: See license.txt

import moment from 'moment-timezone';
frappe.provide("frappe.activity");

frappe.pages['activity'].on_page_load = function(wrapper) {
Expand Down