Browse Source

Makefile now calls npm scripts. Added bin/website-deploy script. Removed some npm scripts.

Harry Hedger 9 years ago
parent
commit
4412428205
3 changed files with 46 additions and 45 deletions
  1. 15 41
      Makefile
  2. 27 0
      bin/website-deploy
  3. 4 4
      package.json

+ 15 - 41
Makefile

@@ -3,48 +3,22 @@ ghpages_repo   := "transloadit/uppy"
 ghpages_branch := "gh-pages"
 ghpages_url    := "git@github.com:$(ghpages_repo).git"
 
-.PHONY: website-install
-website-install:
-	@echo "--> Installing dependencies.."
-	@cd website && npm install
+.PHONY: web-install
+web-install:
+	npm run website:install
 
-.PHONY: website-build
-website-build: website-install
-	@echo "--> Building site.."
-	@cd website && node update.js
-	@cd website && ./node_modules/.bin/hexo generate
+.PHONY: web-build
+web-build:
+	npm run website:build
 
-.PHONY: website-preview
-website-preview: website-build
-	@echo "--> Running preview.."
-	@cd website && ./node_modules/.bin/hexo server --debug
+.PHONY: web-preview
+web-preview:
+	npm run website:preview
 
-.PHONY: website-deploy
-website-deploy: website-build
-	@echo "--> Deploying to GitHub pages.."
-	@mkdir -p /tmp/deploy-$(ghpages_repo)
+.PHONY: web-deploy
+web-deploy:
+	npm run website:deploy
 
-	# Custom steps
-	@rsync \
-    --archive \
-    --delete \
-    --exclude=.git* \
-    --exclude=node_modules \
-    --exclude=lib \
-    --itemize-changes \
-    --checksum \
-    --no-times \
-    --no-group \
-    --no-motd \
-    --no-owner \
-	./website/public/ /tmp/deploy-$(ghpages_repo)
-
-	@echo 'This branch is just a deploy target. Do not edit. You changes will be lost.' > /tmp/deploy-$(ghpages_repo)/README.md
-
-	@cd /tmp/deploy-$(ghpages_repo) \
-	  && git init && git checkout -B $(ghpages_branch) && git add --all . \
-	  && git commit -nm "Update $(ghpages_repo) website by $${USER}" \
-	  && (git remote add origin $(ghpages_url)|| true)  \
-	  && git push origin $(ghpages_branch):refs/heads/$(ghpages_branch) --force
-
-	@rm -rf /tmp/deploy-$(ghpages_repo)
+.PHONY: watch
+watch:
+	npm run watch:examples

+ 27 - 0
bin/website-deploy

@@ -0,0 +1,27 @@
+  echo "--> Deploying to GitHub pages.."
+  mkdir -p /tmp/deploy-$(ghpages_repo)
+
+  # Custom steps
+  rsync \
+    --archive \
+    --delete \
+    --exclude=.git* \
+    --exclude=node_modules \
+    --exclude=lib \
+    --itemize-changes \
+    --checksum \
+    --no-times \
+    --no-group \
+    --no-motd \
+    --no-owner \
+  ./website/public/ /tmp/deploy-$(ghpages_repo)
+
+  echo 'This branch is just a deploy target. Do not edit. You changes will be lost.' > /tmp/deploy-$(ghpages_repo)/README.md
+
+  cd /tmp/deploy-$(ghpages_repo) \
+    && git init && git checkout -B $(ghpages_branch) && git add --all . \
+    && git commit -nm "Update $(ghpages_repo) website by $${USER}" \
+    && (git remote add origin $(ghpages_url)|| true)  \
+    && git push origin $(ghpages_branch):refs/heads/$(ghpages_branch) --force
+
+  rm -rf /tmp/deploy-$(ghpages_repo)

+ 4 - 4
package.json

@@ -9,17 +9,17 @@
     "build:lib": "babel src -d lib --stage 0",
     "build:umd": "./bin/build-umd",
     "build:umd:min": "./bin/build-umd",
-    "build:examples": "website/src/examples/buildAll node_modules/.bin/browserify",
     "clean": "rm -rf lib && rm -rf dist",
     "lint": "eslint src/**/*.js",
-    "dev": "npm run watch & npm run server",
     "server": "browser-sync start --config .browsersync.js",
     "test": "bin/test",
     "test:phantom": "zuul test/spec/upload.js --phantom",
-    "watch": "npm run watch:css & npm run watch:js",
     "watch:css": "nodemon -e src/scss -x \"npm run build:css\"",
     "watch:examples": "cd website && node watch.js",
-    "watch:js": "nodemon --watch src -e js --ignore src/scss -x \"npm run build:lib\""
+    "watch:js": "nodemon --watch src -e js --ignore src/scss -x \"npm run build:lib\"",
+    "website:build": "echo \"--> Building site..\" && cd website && node update.js && ./node_modules/.bin/hexo generate",
+    "website:install": "echo \"--> Installing dependencies\" && cd website && npm install",
+    "website:preview": "npm run website:build && cd website && ./node_modules/.bin/hexo server --debug"
   },
   "repository": {
     "type": "git",