Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
schilder2000
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schilder
schilder2000
Commits
c79f47a6
Commit
c79f47a6
authored
8 months ago
by
Thomas Schneider
Browse files
Options
Downloads
Patches
Plain Diff
build: Build webpack as part of sdist
parent
8d74ca9f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pdm_build.py
+22
-7
22 additions, 7 deletions
pdm_build.py
pyproject.toml
+1
-2
1 addition, 2 deletions
pyproject.toml
with
23 additions
and
9 deletions
pdm_build.py
+
22
−
7
View file @
c79f47a6
from
__future__
import
annotations
import
json
from
pathlib
import
Path
from
typing
import
TYPE_CHECKING
from
pynpm
import
NPMPackage
if
TYPE_CHECKING
:
from
pdm.backend.hooks.base
import
Context
def
pdm_build_update_files
(
context
:
Context
,
files
:
dict
[
str
,
Path
])
->
None
:
pkg_root
=
Path
(
"
schilder2000
"
)
manifest_path
=
pkg_root
/
"
static
"
/
"
manifest.json
"
with
(
context
.
root
/
manifest_path
).
open
()
as
fp
:
def
pdm_build_initialize
(
context
:
Context
)
->
None
:
if
not
context
.
target
==
"
sdist
"
:
return
context
.
config
.
build_config
.
includes
.
append
(
"
schilder2000/static/manifest.json
"
)
if
"
without-npm
"
not
in
context
.
config_settings
:
# Assume built webpack is already present otherwise
context
.
ensure_build_dir
()
pkg
=
NPMPackage
(
context
.
root
,
commands
=
[
"
clean-install
"
,
"
run-script
"
])
pkg
.
clean_install
()
pkg
.
run_script
(
"
build
"
,
"
--
"
,
"
--output-path
"
,
context
.
build_dir
/
"
schilder2000
"
/
"
static
"
,
)
manifest_path
=
context
.
build_dir
/
"
schilder2000
"
/
"
static
"
/
"
manifest.json
"
else
:
manifest_path
=
context
.
root
/
"
schilder2000
"
/
"
static
"
/
"
manifest.json
"
with
manifest_path
.
open
()
as
fp
:
manifest
:
dict
[
str
,
str
|
dict
]
=
json
.
load
(
fp
)
for
k
,
v
in
manifest
.
items
():
if
k
==
"
entrypoints
"
or
not
isinstance
(
v
,
str
):
continue
v
=
v
.
removeprefix
(
"
/
"
)
files
[
str
(
pkg_root
/
v
)]
=
context
.
root
/
pkg_root
/
v
context
.
config
.
build_config
.
includes
.
append
(
"
schilder2000
"
+
v
)
This diff is collapsed.
Click to expand it.
pyproject.toml
+
1
−
2
View file @
c79f47a6
...
...
@@ -50,10 +50,9 @@ serve = "flask -A schilder2000 run --debug"
includes
=
[
"schilder2000/**/*.py"
,
"schilder2000/templates"
,
"schilder2000/static/manifest.json"
,
# Referenced files in manifest.json included via pdm_build.py
]
[build-system]
requires
=
[
"pdm-backend"
]
requires
=
[
"pdm-backend"
,
"pynpm"
]
build-backend
=
"pdm.backend"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment