Skip to content

Commit

Permalink
chore: remove eslint reduction mechanism for build
Browse files Browse the repository at this point in the history
  • Loading branch information
idevat committed Feb 3, 2025
1 parent 488b522 commit 3e4b0fe
Show file tree
Hide file tree
Showing 13 changed files with 11 additions and 11,402 deletions.
12 changes: 0 additions & 12 deletions .bin/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,3 @@ for lockDir in \

fix_lock "$lockDir"/package-lock.json
done

# Deal with reduced packages (for building process).
app=packages/app
package_build="$app"/.bin/package-build

packages_build="$app"/$("$package_build"/fname.sh)
packages_build_lock="$app"/$("$package_build"/fname.sh -l)

"$package_build"/generate.sh "$app"
git add "$packages_build" "$packages_build_lock"

fix_lock "$packages_build_lock"
11 changes: 3 additions & 8 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ app:
build:
if [ "${abs_top_builddir}" != "${abs_top_srcdir}" ]; then \
mkdir -p $(APP_BUILD); \
cp $(APP_SRC)/package-build.json $(APP_BUILD)/package.json; \
cp $(APP_SRC)/package-build-lock.json $(APP_BUILD)/package-lock.json; \
cp $(APP_SRC)/package.json $(APP_BUILD)/package.json; \
cp $(APP_SRC)/package-lock.json $(APP_BUILD)/package-lock.json; \
fi

if [ ! -d $(APP_BUILD)/node_modules ]; then \
Expand Down Expand Up @@ -128,12 +128,11 @@ fmt:
.PHONY: bump-version
bump-version:
@node .bin/bump-version.js $(version)
@packages/app/.bin/package-build/generate.sh packages/app
@git commit -a -m "bump new version ($(version))"
@git tag -a -m "$(version) release" $(version) HEAD

dist-hook:
$(abs_top_srcdir)/packages/app/.bin/package-build/fetch-and-pack.sh \
$(abs_top_srcdir)/packages/app/.bin/fetch-and-pack-node-modules.sh \
$(APP_SRC) \
packages/app \
$(PACKAGE_NAME)-node-modules-$(VERSION).tar.xz
Expand Down Expand Up @@ -167,10 +166,6 @@ clean-local:
rm -f ${abs_top_builddir}/.version; \
fi

generate-package-build:
@packages/app/.bin/package-build/generate.sh packages/app


npm_install:
@.bin/npm_install.sh ./packages

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,14 @@ if [ "$#" -ne 3 ]; then
exit 1
fi

exec="$(dirname "$0")"
package_dir=$(realpath "$1")
app_relative_path="$2"
archive_path=$(realpath "$3")

package="$package_dir"/package.json
package_build="$package_dir"/"$("$exec"/fname.sh)"
package_build_lock="$package_dir"/"$("$exec"/fname.sh -l)"
package_lock="$package_dir"/package-lock.json
npmrc="$package_dir"/.npmrc

if ! "$exec"/check-package.sh "$package_dir" > /dev/null; then
echo It seems that difference between "$package" and "$package_build" is not \
just eslint. Please regenerate "$package_build" by running \
'"make generate-package-build"'
exit 1
fi

if ! "$exec"/check-lock.sh "$package_dir" > /dev/null; then
echo It seems that "$package_build_lock" does not match "$package_build" \
Please regenerate it by running '"make generate-package-build"'
exit 1
fi

temp_dir=$(mktemp -d)
# We need to keep the same relative path to node_modules as from pcs-web-ui root
# directory. So, the subdirs are created, node_modules are fetched inside the
Expand All @@ -40,8 +25,8 @@ temp_app_dir="$temp_dir"/"$app_relative_path"
mkdir -p "$temp_app_dir"
node_modules="$temp_app_dir"/node_modules

cp "$package_build" "$temp_app_dir"/package.json
cp "$package_build_lock" "$temp_app_dir"/package-lock.json
cp "$package" "$temp_app_dir"/package.json
cp "$package_lock" "$temp_app_dir"/package-lock.json
if [ -f "$npmrc" ]; then
cp "$npmrc" "$temp_app_dir"/.npmrc
fi
Expand All @@ -50,7 +35,8 @@ fi
echo Fetching node_modules:
npm ci --prefix="$temp_app_dir"

echo \\nPatching node_modules:
echo
echo Patching node_modules:
files_to_patch="\
babel-loader/lib/cache.js \
"
Expand All @@ -63,7 +49,8 @@ for file in $files_to_patch; do
sed --in-place "$substitution" "$node_modules/$file"
done

echo \\nPacking node_modules to "$archive_path":
echo
echo Packing node_modules to "$archive_path":
tar --create --xz \
--file "$archive_path" \
--directory "$temp_dir" \
Expand Down
26 changes: 0 additions & 26 deletions packages/app/.bin/package-build/check-lock.sh

This file was deleted.

28 changes: 0 additions & 28 deletions packages/app/.bin/package-build/check-package.sh

This file was deleted.

22 changes: 0 additions & 22 deletions packages/app/.bin/package-build/fname.sh

This file was deleted.

18 changes: 0 additions & 18 deletions packages/app/.bin/package-build/generate-hash.sh

This file was deleted.

46 changes: 0 additions & 46 deletions packages/app/.bin/package-build/generate.sh

This file was deleted.

26 changes: 0 additions & 26 deletions packages/app/.bin/package-build/remove-eslint.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/app/.build.hash

This file was deleted.

11 changes: 1 addition & 10 deletions packages/app/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,10 @@ EXTRA_DIST = \
.bin/build/structure.json \
.bin/build/webpack.config.js \
.bin/build/webpack.plugins.js \
.bin/package-build/check-package.sh \
.bin/package-build/check-lock.sh \
.bin/package-build/generate-hash.sh \
.bin/package-build/generate.sh \
.bin/package-build/fetch-and-pack.sh \
.bin/package-build/remove-eslint.js \
.bin/package-build/fname.sh \
.build.hash \
.bin/fetch-and-pack-node-modules.sh \
org.clusterlabs.cockpit_pcs_web_ui.metainfo.xml \
package.json \
package-lock.json \
package-build.json \
package-build-lock.json \
public/index.html \
public/manifestCockpit.json \
public/manifest.json \
Expand Down
Loading

0 comments on commit 3e4b0fe

Please sign in to comment.