As part of #52341-core there’s some work being done to standardise the build configuration for WordPress releases, but one of the changes is likely to cause breakage with the develop.svn -> core.svn sync.
Currently package.json JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML. contains (for example) { engines: { node: "1.2.3" } }
however the field should ideally contain >=1.2.3
.
Due to the way that the nodeVersion
switching code works though, I believe it’ll fail to find node ">=1.2.3"
and then fail to find node ">=1*"
not taking into account the version qualifiers.
See https://github.com/WordPress/wordpress-develop/pull/897/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R9-R12
While not an ideal way to parse the field, altering nodeVersion() {}
in develop-core-svn-sync-config.sh
like so should make this more reliable and work well enough until this can be replaced.
nodeVersion() {
# Old branches don't have a node version defined
if [ "$1" = 'null' ]; then
NODE_VER=0.10.5
else
NODE_VER=$1
fi
+
+ # Remove any non-numeric characters and version qualifiers (>=1.2.3)
+ NODE_VER=$( echo "$NODE_VER" | grep -oE '[0-9.]+' | head -n1 )
+
echo Switching nodejs to $NODE_VER
This has been tested by copying it to a new file, and running with the following output:
$ cat test.sh && echo ----- && ./test.sh
#!/bin/sh
nodeVersion() {
# Old branches don't have a node version defined
if [ "$1" = 'null' ]; then
NODE_VER=0.10.5
else
NODE_VER=$1
fi
NODE_VER=$( echo "$NODE_VER" | grep -oE '[0-9.]+' | head -n1 )
echo $NODE_VER
}
nodeVersion "1.2.3"
nodeVersion ">=0.1.2"
nodeVersion ">=1.2.3 <2.0.0"
-----
1.2.3
0.1.2
1.2.3
After it’s standardised, I believe the build team intends to look at self-containing the build process so it’s less tied to the system it’s being built on.
cc @desrosj
#svn #build #prio1
#52341-core