Skip to content
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

add 'npm' and 'npm-update' make targets and lockfile #7246

Merged
merged 6 commits into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ pipeline:
image: webhippie/nodejs:latest
pull: true
commands:
- npm install
- make css
- make js
when:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ coverage.all
/node_modules
/modules/indexer/issues/indexers
routers/repo/authorized_keys
/package-lock.json
/yarn.lock

# Snapcraft
Expand Down
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
package-lock=false
save-exact=true
35 changes: 21 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -366,29 +366,36 @@ release-compress:
fi
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && gxz -k -9 $${file}; done;

.PHONY: js
js:
@if ([ ! -d "$(PWD)/node_modules" ]); then \
echo "node_modules directory is absent, please run 'npm install' first"; \
npm-check:
@hash npm > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
echo "Please install Node.js 8.x or greater with npm"; \
exit 1; \
fi;
@hash npx > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
echo "Please install npm version 5.2+"; \
echo "Please install Node.js 8.x or greater with npm"; \
exit 1; \
fi;

.PHONY: npm
npm:
silverwind marked this conversation as resolved.
Show resolved Hide resolved
silverwind marked this conversation as resolved.
Show resolved Hide resolved
$(MAKE) npm-check
npm install --no-save

.PHONY: npm-update
npm-update:
silverwind marked this conversation as resolved.
Show resolved Hide resolved
$(MAKE) npm-check
npx updates -cu
rm -rf node_modules
npm install --package-lock

.PHONY: js
js:
silverwind marked this conversation as resolved.
Show resolved Hide resolved
$(MAKE) npm
npx eslint public/js

.PHONY: css
css:
silverwind marked this conversation as resolved.
Show resolved Hide resolved
@if ([ ! -d "$(PWD)/node_modules" ]); then \
echo "node_modules directory is absent, please run 'npm install' first"; \
exit 1; \
fi;
@hash npx > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
echo "Please install npm version 5.2+"; \
exit 1; \
fi;

$(MAKE) npm
npx lesshint public/less/
npx lessc --clean-css="--s0 -b" public/less/index.less public/css/index.css
$(foreach file, $(filter-out public/less/themes/_base.less, $(wildcard public/less/themes/*)),npx lessc --clean-css="--s0 -b" public/less/themes/$(notdir $(file)) > public/css/theme-$(notdir $(call strip-suffix,$(file))).css;)
Expand Down
19 changes: 3 additions & 16 deletions docs/content/doc/advanced/hacking-on-gitea.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,7 @@ make vet lint misspell-check

### Updating CSS

To generate the CSS, you will need [Node.js](https://nodejs.org/) 8.0 or greater and the build dependencies:

```bash
npm install
```

At present we use [less](http://lesscss.org/) and [postcss](https://postcss.org) to generate our CSS. Do
**not** edit the files in `public/css` directly, as they are generated from `lessc` from the files in `public/less`.
To generate the CSS, you will need [Node.js](https://nodejs.org/) 8.0 or greater with npm. At present we use [less](http://lesscss.org/) and [postcss](https://postcss.org) to generate our CSS. Do **not** edit the files in `public/css` directly, as they are generated from `lessc` from the files in `public/less`.

Edit files in `public/less`, run the linter, regenerate the CSS and commit all changed files:

Expand All @@ -155,13 +148,7 @@ make css

### Updating JS

To run the JavaScript linter you will need [Node.js](https://nodejs.org/) 8.0 or greater and the build dependencies:

```bash
npm install
```

Edit files in `public/js` and run the linter:
To run the JavaScript linter you will need [Node.js](https://nodejs.org/) 8.0 or greater with npm. Edit files in `public/js` and run the linter:

```bash
make js
Expand Down Expand Up @@ -250,7 +237,7 @@ TAGS="bindata sqlite sqlite_unlock_notify" make generate build test-sqlite
```

will run the integration tests in an sqlite environment. Other database tests
are available but may need adjustment to the local environment.
are available but may need adjustment to the local environment.

Look at
[`integrations/README.md`](https://github.com/go-gitea/gitea/blob/master/integrations/README.md)
Expand Down
Loading