Commit graph

122 commits

Author SHA1 Message Date
Abhinav Raut
22ad66b3bf
fix: remove flush all while build assets, as asset build should never clear entire redis database. (#34874)
Switched to flushdb so frappe on clears the DB assigned to it in config.
2025-11-25 11:51:32 +05:30
Samar Singh
39b14f3a67
feat: configurable esbuild build target (#34398) 2025-10-17 00:55:21 +00:00
Sagar Vora
cb0d06455b chore: use frappe._dev_server instead of local.dev_server 2025-06-17 12:03:08 +05:30
Ankush Menat
b9479e21e1
fix: Clear all cache after rebuilding assets (#29876)
We don't know where this is cached indirectly, this is a rare activity
in production, so dropping all cache isn't such a big deal.
2025-01-21 18:57:10 +05:30
Shariq Ansari
d6386e6e06
Merge pull request #28767 from frappe/remove-billing-pages 2025-01-15 13:21:32 +05:30
Akhil Narang
6c32b79766
fix(build): os.replace -> shutil.move
In some cases, while running in docker, we end up with:

```
[Errno 18] Invalid cross-device link: 'tmp<hash>' -> './assets/frappe'
```

Using `shutil.move` fixes this as it supports different filesystems, `os.replace` doesn't

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-19 16:12:48 +05:30
Bread Genie
bf97db2de9 refactor: remove billing pages and navigate user to Frappe Cloud directly 2024-12-13 13:13:12 +05:30
Akhil Narang
84ef6ec677
refactor: fixup with ruff 0.8.1
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-04 13:18:04 +05:30
Suraj Shetty
225cc5bb4f fix: Print exception if asset linking is failed 2024-12-03 16:36:39 +05:30
Shariq Ansari
61caa8324d fix: post install also install billing dependencies
moved build command from esbuild.js to build.py
2024-11-14 16:08:26 +05:30
Akhil Narang
26ae0f3460
fix: ruff fixes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
18alantom
9ece71bc56 feat: add using-cached flag to bench build
- add using-cache flag to node esbuild call

The flag is to be used by bench get-app if its is
using cache.

Flag causes building of assets to not run and
instead updates assets.json files from built assets.

Linking of assets in the sites folder also occurs.
2024-01-17 13:20:57 +05:30
Hussain Nagaria
c70229cd69 docs: consistency 2023-12-19 12:55:41 +05:30
Hussain Nagaria
caae0bacc9 docs: add missing full stop 2023-12-18 19:09:45 +05:30
Hussain Nagaria
8d2137c265 docs: consistent doc strings 2023-12-18 18:27:39 +05:30
David Arnold
8dabd2bae6
refactor: make the app source accessor explicit
The parent folder of a python module (inside `./site-packages`) can be
`./lib`. Separate code paths that depend on the app source into its own
getter so that patching that function becomes easier in those cases
where the python module is not served from the source checkout.
2023-08-20 01:11:05 +02:00
Ankush Menat
7af8f6a8ff
refactor: replace usage of mktemp (#22093) 2023-08-17 11:03:02 +00:00
barredterra
b553ed98d8 refactor: inline immediately returned variable
Inline a variable to a return in the case when the
variable being declared is immediately returned
2023-08-08 18:09:49 +02:00
Suraj Shetty
fe25fe1db1 feat: A flag (--save-metafiles) to save esbuild metafiles
- Useful for analysing bundle size
2023-06-26 09:14:17 +05:30
Suraj Shetty
5581f960da chore: Update node version requirement in build config 2023-06-26 09:14:17 +05:30
Ankush Menat
4c08689744 perf: defer psutil import 2023-06-24 15:22:01 +05:30
Ankush Menat
8a37d6d278
perf: reduce memory usage of background processes (#21467)
* perf: defer translation.py imports

This indirectly imports babel which isn't really required most of the
time.

* perf: defer gzip import

* perf: move validate_and_sanitize_search_inputs

This causes all sorts of indirect imports and increases memory usage

* perf: defer requests module imports

* perf: defer system settings import

* perf: defer LOG_DOCTYPES import

Causes many indirect imports

* perf: defer update_site_config

* perf: defer notifications import

* perf: remove unused import

* perf: defer safe exec import

* test: memory usage overhead
2023-06-23 12:51:45 +05:30
Ankush Menat
3005e66e45 refactor!: Drop previously deprecated code 2023-06-13 16:00:43 +05:30
gavin
440825a372
refactor: which > find_executable (#18872)
Use shutil from the standard library instead of distutils to find
executables in PATH
2022-11-14 18:15:38 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30
Ankush Menat
d35d7ffbe2 fix: remove bare exception catching
A bare except catches lots of things (like generator iteration end) and should never be used.
2022-06-28 18:05:00 +05:30
Gavin D'souza
b696fa6da5 perf: Pre-compile and re-use regexp pattern
Converted all possible usages of re.* that weren't compiling the regex
separately and re-using it. Separated out the compiled patterns as
global variables. Repetitive patterns could be made DRY-er.

Would be nicer to have all regexes in a single module so that we could
re-use better, keep track of outdated, and keep checks for possible
reDos' etc
2022-06-08 14:07:38 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Gavin D'souza
d72aeca18f chore!: Deprecate frappe.utils.minify
* Remove dead code from build.py
* Whitespaces & imports style fixes
2022-02-11 20:22:56 +05:30
Ankush Menat
121533cf13
refactor: remove chalk dependency 2021-10-20 12:46:05 +05:30
gavin
fbe925b42c
Merge pull request #14238 from resilient-tech/autoreload_on_build
feat: automatically reload web pages whenever JS/CSS assets are rebuilt
2021-10-19 14:13:04 +05:30
Sagar Vora
770bda8cc6 fix: use cint, as os.environ only contains string values 2021-10-19 04:04:00 +05:30
Pruthvi Patel
d99403393a fix: rename auto-reload to live-reload 2021-10-18 17:52:33 +05:30
Ankush Menat
e6bbc698d0
ci: fail CI if asset bundling fails (#14364)
* ci: fail CI if asset bundling fails

* chore: formatting

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
2021-10-08 11:40:31 +05:30
Gavin D'souza
d8020672b0 refactor(minor): Built Assets Management 2021-09-21 16:20:15 +05:30
Sagar Vora
01d69b67c7 feat: automatically reload web pages whenever JS/CSS assets are rebuilt 2021-09-17 12:33:36 +05:30
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
Gavin D'souza
4e7526066f Merge branch 'develop' into drop-py2-code 2021-05-28 10:51:39 +05:30
Faris Ansari
23406d031a fix: Store assets.json directly in assets folder
assets.json stores assets of all apps, so doesn't make sense to put it in frappe folder
2021-05-27 11:50:56 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Gavin D'souza
33ba6494f8 Merge branch 'develop' into deprecation-warnings 2021-05-19 13:18:13 +05:30
Gavin D'souza
8328e03d0d fix: Unstrip better to handle multi line outputs in smaller
terminal sizes
2021-05-19 13:17:29 +05:30
Faris Ansari
f6cd91be58 fix: Show warning for incompatible node version 2021-05-18 16:47:38 +05:30
Faris Ansari
f8ca990a83 Merge remote-tracking branch 'upstream/develop' into esbuild 2021-05-16 11:26:43 +05:30
Gavin D'souza
7930b84b71 Revert "fix(build): Use NamedTemporaryFile from mktemp"
This reverts commit 085290630e.
Breaks via https://github.com/frappe/frappe/pull/13145/checks?check_run_id=2573309928
2021-05-13 12:28:22 +05:30
Gavin D'souza
085290630e fix(build): Use NamedTemporaryFile from mktemp 2021-05-13 11:11:45 +05:30
Gavin D'souza
6581ed886a Revert "fix: Don't re-copy node_modules if public already has it"
This reverts commit 548eb079c8.

Seems to break UI components. Learnt this from Cypress UI tests
ref: https://github.com/frappe/frappe/pull/13145/checks?check_run_id=2567366717
2021-05-12 21:00:18 +05:30
Gavin D'souza
098f1564f3 refactor: bench build
* Deprecate --make-copy and --restore options for build in favour of --hard-link
* Show feedback for linking/copying application assets
2021-05-11 21:15:20 +05:30
Gavin D'souza
548eb079c8 fix: Don't re-copy node_modules if public already has it
public folder already has a symlink to node_modules. So we can just
check if the realpath already exists and ignore copying it again if the
same exists
2021-05-11 20:09:21 +05:30