Skip to content

Fix cache/path issue with npm 7 #7

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

Merged
merged 1 commit into from
Apr 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,16 @@ coverage.all

# Frontend
.npmrc
/node_modules
.npm-cache
node_modules
/yarn.lock
/public/js
/public/serviceworker.js
/public/css
/public/fonts
/public/img/webpack
/web_src/fomantic/node_modules
/web_src/fomantic/package-lock.json
/web_src/fomantic/semantic.json
/web_src/fomantic/build/*
!/web_src/fomantic/build/semantic.js
Expand All @@ -98,7 +100,6 @@ coverage.all
!/web_src/fomantic/build/themes/default/assets/fonts/outline-icons.woff2
/VERSION
/.air
/.npm-cache

# Snapcraft
snap/.snapcraft/
Expand Down
21 changes: 8 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -668,31 +668,26 @@ docs:
.npmrc:
echo "audit=false fund=false package-lock=true save-exact=true " | tr " " "\n" > $@

$(FOMANTIC_WORK_DIR)/.npmrc:
echo "optional=false package-lock=false " | tr " " "\n" > $@

node_modules: package-lock.json .npmrc $(FOMANTIC_WORK_DIR)/.npmrc
node_modules: package-lock.json .npmrc
npm install --no-save
@touch node_modules

.PHONY: npm-cache
npm-cache: .npm-cache $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui

.npm-cache: package-lock.json .npmrc $(FOMANTIC_WORK_DIR)/.npmrc
.npm-cache: package-lock.json .npmrc
rm -rf .npm-cache
$(eval ESBUILD_VERSION := $(shell node -p "require('./package-lock.json').dependencies.esbuild.version"))
$(eval ESBUILD_PLATFORMS := darwin-64 $(foreach arch,arm arm64 32 64,linux-${arch}) $(foreach arch,32 64,windows-${arch}))
npm config --userconfig=.npmrc set cache=.npm-cache
npm config --userconfig=.npmrc rm cache; echo cache=.npm-cache >> .npmrc
rm -rf node_modules && npm install --no-save
npm config --userconfig=$(FOMANTIC_WORK_DIR)/.npmrc set cache=../../.npm-cache
echo $(ESBUILD_PLATFORMS) | xargs printf "esbuild-%s@$(ESBUILD_VERSION)\n" | xargs -n 1 -P 4 npm cache add
rm -rf $(FOMANTIC_WORK_DIR)/node_modules
rm -rf $(FOMANTIC_WORK_DIR)/node_modules $(FOMANTIC_WORK_DIR)/package-lock.json
@touch .npm-cache

.PHONY: npm-uncache
npm-uncache:
rm -rf .npm-cache
npm config --userconfig=$(FOMANTIC_WORK_DIR)/.npmrc rm cache
npm config --userconfig=.npmrc rm cache

.PHONY: npm-update
Expand All @@ -706,17 +701,17 @@ npm-update: node-check | node_modules
fomantic: $(FOMANTIC_DEST)

$(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui:
ln -sf ../../semantic.json $(FOMANTIC_WORK_DIR)
cd $(FOMANTIC_WORK_DIR); \
cp "$$OLDPWD/semantic.json" ./; \
rm -rf node_modules && mkdir node_modules && \
npm install fomantic-ui; \
npm install --no-optional --cache="$$OLDPWD/.npm-cache"; \
rm -f semantic.json
@touch $(FOMANTIC_WORK_DIR)/node_modules

$(FOMANTIC_DEST): $(FOMANTIC_CONFIGS) $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui
ln -sf ../../semantic.json $(FOMANTIC_WORK_DIR)
rm -rf $(FOMANTIC_WORK_DIR)/build
cd $(FOMANTIC_WORK_DIR); \
rm -rf build; \
cp "$$OLDPWD/semantic.json" ./; \
cp -f theme.config.less node_modules/fomantic-ui/src/theme.config; \
cp -rf _site node_modules/fomantic-ui/src/; \
npx gulp -f node_modules/fomantic-ui/gulpfile.js build; \
Expand Down
5 changes: 5 additions & 0 deletions web_src/fomantic/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"fomantic-ui": "^2.8.7"
}
}