Skip to content

Commit

Permalink
chore: simplify documentation generation and build 0.27.1 documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
customcommander committed Jan 16, 2022
1 parent e3af2d1 commit 3a374c4
Show file tree
Hide file tree
Showing 15 changed files with 10,648 additions and 15,111 deletions.
86 changes: 11 additions & 75 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,81 +1,17 @@
GITBOOK = node_modules/.bin/gitbook
JSDOC = node_modules/.bin/jsdoc
LESS = node_modules/.bin/lessc

JSDOC_FILES := $(shell find jsdoc -type f | sort)
LESS_FILES := $(shell find less -name '*.less' | sort)


.PHONY: all
all: \
check-version \
$(VERSION)/tmp/README.md \
$(VERSION)/tmp/package.json \
$(VERSION)/docs/dist/ramda.js \
$(VERSION)/docs/index.html \
$(VERSION)/docs/main.js \
$(VERSION)/index.html \
$(VERSION)/fonts/glyphicons-halflings-regular.eot \
$(VERSION)/fonts/glyphicons-halflings-regular.svg \
$(VERSION)/fonts/glyphicons-halflings-regular.ttf \
$(VERSION)/fonts/glyphicons-halflings-regular.woff \
$(VERSION)/fonts/glyphicons-halflings-regular.woff2 \
$(VERSION)/style.css \
gitbook \
docs/dist/ramda.js \
docs/index.html \
docs/main.js \
index.html \
style.css \

$(VERSION)/tmp/%:
mkdir -p '$(@D)'
curl --silent 'https://raw.githubusercontent.com/ramda/ramda/v$(VERSION)/$(@F)' >'$@'

$(VERSION)/docs/dist/ramda.js:
mkdir -p '$(@D)'
curl --silent 'https://raw.githubusercontent.com/ramda/ramda/v$(VERSION)/dist/ramda.js' >'$@'

$(VERSION)/docs/index.html $(VERSION)/index.html: $(JSDOC_FILES)
VERSION='$(VERSION)' $(JSDOC) \
--destination '$(VERSION)' \
--template '$(<D)' \
'$(VERSION)/docs/dist/ramda.js'

$(VERSION)/fonts/%: node_modules/bootstrap/fonts/%
mkdir -p '$(@D)'
cp '$<' '$@'

$(VERSION)/style.css: $(LESS_FILES)
mkdir -p '$(@D)'
$(LESS) less/ramda.less --autoprefix --clean-css >'$@'

docs/%: $(VERSION)/docs/%
mkdir -p '$(@D)'
cp '$<' '$@'

.PHONY: index.html
index.html: check-version
echo '<!DOCTYPE html><html><head><link rel="canonical" href="http://ramdajs.com/$(VERSION)/index.html" /><script>window.location = "$(VERSION)/index.html" + window.location.hash;</script></head><body></body></html>' >'$@'

%: $(VERSION)/%
cp '$<' '$@'

all: docs/dist/ramda.js docs/index.html repl/index.html style.css index.html

.PHONY: check-version
check-version:
ifeq ($(origin VERSION),undefined)
$(error VERSION not set)
endif
docs/dist/ramda.js: node_modules/ramda/dist/ramda.js
cp -f $< $@

docs/index.html: publish.js docs/index.html.handlebars
npx jsdoc -c .jsdoc.config.json --destination ./$(@D) --template . node_modules/ramda/src

.PHONY: gitbook
gitbook: check-version
$(GITBOOK) build manual './manual'
find './manual' -name '*.html' -print0 \
| xargs -0 perl -p -i -e 's/ data-revision="[^"]*"//g'
index.html: make_index_html.js index.pug layout.pug
node $< >$@

repl/index.html: make_repl_index_html.js repl/index.pug
node $< >$@

.PHONY: setup
setup:
npm install
style.css: $(shell find less -name "*.less")
npx lessc --autoprefix --clean-css ./less/ramda.less >$@
28 changes: 9 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,29 @@
# ramda.github.io

To generate the various files required by the website, run the following
command (using the actual version number in place of `X.Y.Z`):
This repo contains all the prebuilt files used on the site.

```console
$ VERSION=X.Y.Z make
```
## Setup

npm i

## Start local server

This repo contains all the prebuilt files used on the site.
It also contains a static file server (available after `npm i`):

npm run server
npm start

Once this is running, visit [localhost:8080](http://localhost:8080/) to view the docs.
In the event that `:8080` is in use, you can change the port like so:

npm run server -- -p 8081
npm start -- -p 8081

For more details on configuring the server, see [http-server docs][http-server].

[http-server]: https://github.com/indexzero/http-server#available-options


## What to do on a new release
## What to do on a new release?

1. Update [package.json](./package.json) to latest version of `ramda`.

2. Install packages: `npm i`

3. `npm run make_release`


2. Build the documentation. Simply run `make`.
## Development

### Node version
Expand All @@ -48,7 +38,7 @@ If you are using [nvm](https://github.com/creationix/nvm#nvmrc), simply run:

To rebuild the [docs](./docs/index.html) page:

npm run jsdoc
make docs/index.html


### Building styles
Expand All @@ -58,4 +48,4 @@ Styles for the site are written with [Less](http://lesscss.org/), using the

To rebuild the main [style.css](./style.css):

npm run less
make style.css
11 changes: 0 additions & 11 deletions copy_ramda_js.js

This file was deleted.

39 changes: 0 additions & 39 deletions copy_to_version_folder.js

This file was deleted.

Loading

0 comments on commit 3a374c4

Please sign in to comment.