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

npm package #1185

Closed
ghost opened this issue May 23, 2016 · 7 comments
Closed

npm package #1185

ghost opened this issue May 23, 2016 · 7 comments

Comments

@ghost
Copy link

ghost commented May 23, 2016

The npm package has wrong Makefile configuration:

Old configuration:

VERSION=8.7

default: build
    @cp -f build/highlight.* .
    @cp -f highlight/src/styles/* styles
    @du -hs highlight.*

build: highlight
    @cd highlight && git fetch && git checkout $(VERSION)
    @cd highlight && npm install
    @mkdir -p build
    @cd highlight && node tools/build.js && cp build/highlight.pack.js ../build/highlight.pack.min.js
    @cd highlight && node tools/build.js -n && cp build/highlight.pack.js ../build/highlight.pack.js

highlight:
    @git clone git://github.com/isagalaev/highlight.js.git $@

clean:
    @rm -rf build

.PHONY: default

The new one:

default: build
    @cp -f build/highlight.* .
    @cp -r highlight.js/src/styles .
    @du -hs highlight.js/*

build:
ifneq ($(wildcard highlight.js/.),)
    @cd highlight.js
else
    @git clone --depth=1 git://github.com/isagalaev/highlight.js.git
    @cd highlight.js && npm install
endif

    @mkdir -p build
    @cd highlight.js && node tools/build.js && cp build/highlight.pack.js ../build/highlight.pack.min.js
    @cd highlight.js && node tools/build.js -n && cp build/highlight.pack.js ../build/highlight.pack.js

clean:
    @rm -rf build

.PHONY: default build clean

If you want you can add cdn and browser builds.

@derhuerst
Copy link

derhuerst commented May 23, 2016

Is the Makefile even necessary in the npm package? AFAIK @isagalaev said in #1169 (comment) that the published npm module just acts as a distribution package.

@ghost
Copy link
Author

ghost commented May 23, 2016

The Makefile provides to the user a way to download and build the latest highlightjs (not the releases) without leaving the terminal once the library is installed. The building is not so flexible as building it manually though.

npm install highlightjs
cd node_modules/highlightjs/
make

@derhuerst
Copy link

The npm package should contain the pre-built (default) distribution files. Anything custom should be done via Git & build. In an effort to make npm packages as lightweight as possible, it is common not to bundle the build files & scripts.

@ghost
Copy link
Author

ghost commented May 23, 2016

This Makefile came with the npm package, all I did was to modify it and post it here.

-rw-r--r-- 1 frost frost     65 Aug  5  2015 .npmignore
-rw-r--r-- 1 frost frost   1498 Aug  5  2015 LICENSE
-rw-r--r-- 1 frost frost    543 Aug  5  2015 Makefile <--------
-rw-r--r-- 1 frost frost    320 Aug  5  2015 README.md
-rw-r--r-- 1 frost frost    204 Aug  5  2015 bower.json
-rw-r--r-- 1 frost frost    212 Aug  5  2015 component.json
-rw-r--r-- 1 frost frost    669 Aug  5  2015 composer.json
-rw-r--r-- 1 frost frost 595102 Aug  5  2015 highlight.pack.js
-rw-r--r-- 1 frost frost 401788 Aug  5  2015 highlight.pack.min.js
-rw-r--r-- 1 frost frost   1367 May 23 17:27 package.json
drwxr-xr-x 2 frost frost   1400 May 23 17:27 styles

@derhuerst
Copy link

Sure. I'd suggest to remove it entirely and jsut distribute fully working pre-built version of highlight.js.

@isagalaev
Copy link
Member

Guys, we don't have a Makefile in our package. @wifiextender you're using some third-party bundle of highlight.js, I guess this one.

@ghost
Copy link
Author

ghost commented May 24, 2016

It's bit confusing as I saw your avatar right below the npm package Collaborators, didn't knew that highlightjs is not uploaded by you, and highlight**.**js is your package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants