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

Implement unit and e2e tests #32

Merged
merged 5 commits into from
Mar 26, 2018
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
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: node_js
node_js:
- "6"
- "8"
cache:
directories:
- /home/travis/build/technopagan/sqip/vendor
before_install:
- npm install -g npm
after_success:
- codecov
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
SQIP - SVG-Based Image Placeholder
====================

[![npm](https://img.shields.io/npm/v/sqip.svg)](https://www.npmjs.com/package/sqip)
[![bitHound Overall Score](https://www.bithound.io/github/technopagan/sqip/badges/score.svg)](https://www.bithound.io/github/technopagan/sqip)
[![bitHound Dependencies](https://www.bithound.io/github/technopagan/sqip/badges/dependencies.svg)](https://www.bithound.io/github/technopagan/sqip/master/dependencies/npm)
[![Build Status](https://travis-ci.org/technopagan/sqip.svg?branch=master)](https://travis-ci.org/technopagan/sqip)
[![codecov](https://codecov.io/gh/technopagan/sqip/branch/master/graph/badge.svg)](https://codecov.io/gh/technopagan/sqip)

## Overview

"SQIP" (pronounced \skwɪb\ like the non-magical folk of magical descent) is a
Expand Down
7,709 changes: 7,013 additions & 696 deletions package-lock.json

Large diffs are not rendered by default.

137 changes: 76 additions & 61 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,63 +1,78 @@
{
"name": "sqip",
"version": "0.3.1",
"description": "A SVG-based LQIP image placeholder generator",
"main": "./src/node.js",
"bin": {
"sqip": "./src/cli.js"
},
"scripts": {
"test": "npm run lint",
"prepare": "npm run build-vendor",
"build-vendor": "node scripts/bundle-vendor.js",
"lint": "eslint src",
"precommit": "npm run test"
},
"files": [
"src",
"vendor"
],
"keywords": [
"lqip",
"svg",
"images",
"placeholder",
"webperf",
"performance",
"ux",
"perceived"
],
"author": "Tobias Baldauf",
"license": "Unlicense",
"engines": {
"node": ">=6.0.0"
},
"dependencies": {
"argv": "0.0.2",
"image-size": "^0.6.1",
"svgo": "^0.7.2",
"xmldom": "^0.1.27"
},
"repository": {
"type": "git",
"url": "https://github.com/technopagan/sqip"
},
"person": {
"name": "Tobias Baldauf",
"email": "[email protected]",
"url": "https://who.tobias.is/"
},
"devDependencies": {
"eslint": "^4.18.2",
"eslint-config-prettier": "^2.9.0",
"eslint-config-prettier-standard": "^1.0.1",
"eslint-config-standard": "^11.0.0",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-standard": "^3.0.1",
"husky": "^0.14.3",
"prettier": "^1.11.1"
}
"name": "sqip",
"version": "0.3.1",
"description": "A SVG-based LQIP image placeholder generator",
"main": "./src/node.js",
"bin": {
"sqip": "./src/cli.js"
},
"scripts": {
"test": "npm run lint && npm run test:unit && npm run test:e2e",
"test:unit": "jest --testPathPattern=test/unit --coverage",
"test:unit:watch": "jest --testPathPattern=test/unit --coverage --watch",
"test:e2e": "jest --testPathPattern=test/e2e",
"test:e2e:watch": "jest --testPathPattern=test/e2e --watch",
"prepare": "npm run build-vendor",
"build-vendor": "node scripts/bundle-vendor.js",
"lint": "eslint src scripts",
"precommit": "npm run lint",
"prepush": "npm run test"
},
"files": [
"src",
"vendor"
],
"keywords": [
"lqip",
"svg",
"images",
"placeholder",
"webperf",
"performance",
"ux",
"perceived"
],
"author": "Tobias Baldauf",
"license": "Unlicense",
"engines": {
"node": ">=6.0.0"
},
"dependencies": {
"argv": "0.0.2",
"image-size": "^0.6.1",
"svgo": "^0.7.2",
"xmldom": "^0.1.27"
},
"repository": {
"type": "git",
"url": "https://github.com/technopagan/sqip"
},
"person": {
"name": "Tobias Baldauf",
"email": "[email protected]",
"url": "https://who.tobias.is/"
},
"devDependencies": {
"cheerio": "^1.0.0-rc.2",
"codecov": "^3.0.0",
"eslint": "^4.19.0",
"eslint-config-prettier": "^2.9.0",
"eslint-config-prettier-standard": "^1.0.1",
"eslint-config-standard": "^11.0.0",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-jest": "^21.15.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-standard": "^3.0.1",
"husky": "^0.14.3",
"jest": "^22.4.2",
"nixt": "^0.5.0",
"prettier": "^1.11.1"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.js"
]
}
}
46 changes: 29 additions & 17 deletions scripts/bundle-vendor.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
const { execSync } = require("child_process");
const { execSync } = require('child_process')
const { existsSync } = require('fs')
const { resolve } = require('path')

const builds = [
{
os: "darwin",
arch: "amd64",
filename: "primitive-darwin-x64"
os: 'darwin',
arch: 'amd64',
filename: 'primitive-darwin-x64'
},
{
os: "linux",
arch: "amd64",
filename: "primitive-linux-x64"
os: 'linux',
arch: 'amd64',
filename: 'primitive-linux-x64'
},
{
os: "windows",
arch: "amd64",
filename: "primitive-win32-x64.exe"
os: 'windows',
arch: 'amd64',
filename: 'primitive-win32-x64.exe'
}
];
]

// Get primitive
execSync(`go get github.com/fogleman/primitive`)

// Build executables
builds.forEach(build => {
const { os, arch, filename } = build;
console.log(`Building primitive executable for ${os} (${arch})`);
const { os, arch, filename } = build
const path = resolve(__dirname, '..', 'vendor', filename)
if (existsSync(path)) {
console.log(`Primitive executable for ${os} (${arch}) already exists`)
return
}
console.log(`Building primitive executable for ${os} (${arch})`)
execSync(
`env GOOS=${os} GOARCH=${arch} go build -o vendor/${filename} github.com/fogleman/primitive`
);
console.log("done");
});
`env GOOS=${os} GOARCH=${arch} go build -o ${path} github.com/fogleman/primitive`
)
console.log('done')
})
Loading