1
0
Fork 0

Merge branch 'master' of github.com:freesewing/plugin-logo

This commit is contained in:
Joost De Cock 2018-12-08 15:06:30 +01:00
parent 5d5e0381ef
commit f97e37ba69
7 changed files with 5647 additions and 544 deletions

View file

@ -0,0 +1,10 @@
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "entry"
}
]
]
}

View file

@ -0,0 +1,9 @@
language: node_js
node_js:
- "node"
install:
- npm install
- npm run build
script:
- npm run test
- npm run coverage

View file

@ -4,6 +4,15 @@
<h4 align="center"><em>&nbsp;<a title="Go to freesewing.org" href="https://freesewing.org/">freesewing</a></em>
<br><sup>a library for made-to-measure sewing patterns</sup>
</h4>
<p align="center">
<a href="https://travis-ci.org/freesewing/plugin-logo"><img src="https://badgen.net/travis/freesewing/plugin-logo/master" alt="Travis build"></a>
<a href="https://www.npmjs.com/package/@freesewing/plugin-logo"><img src="https://badgen.net/npm/v/@freesewing/plugin-logo" alt="Version"></a>
<a href="https://www.npmjs.com/package/@freesewing/plugin-logo"><img src="https://badgen.net/npm/license/@freesewing/plugin-logo" alt="License"></a>
<a href="https://codecov.io/gh/freesewing/plugin-logo"><img src="https://badgen.net/codecov/c/github/freesewing/plugin-logo/master" alt="Code coverage"></a>
<a href="https://deepscan.io/dashboard#view=project&pid=3267&bid=27574"><img src="https://deepscan.io/api/projects/3267/branches/27574/badge/grade.svg" alt="DeepScan grade"></a>
<a href="https://gitter.im/freesewing/freesewing"><img src="https://badgen.net/badge/chat/on%20Gitter/cyan" alt="Chat on Gitter"></a>
<a href="https://freesewing.org/patrons/join"><img src="https://badgen.net/badge/become/a%20Patron/FF5B77" alt="Become a Patron"></a>
</p>
# plugin-logo
@ -29,27 +38,22 @@ import logo from '@freesewing/plugin-logo'
pattern.with(theme).with(logo);
```
You now have the following snippets available:
You now have the `logo` snippet available:
- logo-xs
- logo-sm
- logo
- logo-lg
- logo-xl
- logo-xxl
You can use them as such:
```sh
snippets.logo = new Snippet('logo-sm', points.logo);
```js
snippets.logo = new Snippet('logo', points.logo);
```
## Example
**Good to know:**
Below is an example of the logo and the different sizes.
As you can see, the logo's anchor point is the chin.
- The logo's anchor point is it's chin
- Like any snippet, you can scale the logo by setting the `data-scale` attribbute on the snippet:
```js
snippets.logo = new Snippet('logo', points.logo)
.attr('data-scale', 2); // Make it twice as big
```
![Example of the logo plugin](https://github.com/freesewing/plugin-logo/raw/master/img/example.png)
## Where to get help

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "@freesewing/plugin-logo",
"version": "0.3.3",
"version": "0.4.0",
"description": "A freesewing plugin to add skully to your patterns",
"author": "Joost De Cock <joost@decock.org> (https://github.com/joostdecock)",
"license": "MIT",
@ -23,7 +23,9 @@
"minor": "npm version minor -m ':bookmark: v%s' && npm run build",
"major": "npm version major -m ':bookmark: v%s' && npm run build",
"precommit": "npm run pretty && lint-staged",
"test": "echo \"Error: no test specified\" && exit 1",
"test": "nyc mocha --require @babel/register tests/*.test.js",
"report": "nyc report --reporter=html mocha --require @babel/register tests/*.test.js",
"coverage": "nyc npm test && nyc report --reporter=text-lcov > coverage.lcov && ./node_modules/.bin/codecov",
"clean": "rimraf dist",
"pretty": "npx prettier --write \"src/*.js\"",
"lint": "eslint --fix \"src/*.js\"",
@ -45,18 +47,24 @@
]
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.6",
"@babel/core": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"@babel/register": "^7.0.0",
"chai": "^4.1.2",
"chai-string": "1.4.0",
"codecov": "^3.1.0",
"eslint": "^5.2.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-prettier": "^2.6.2",
"freesewing": "^0.18.3",
"husky": "^0.14.3",
"lint-staged": "^7.2.0",
"mocha": "^5.2.0",
"nyc": "12.0.2",
"prettier": "^1.13.7",
"rimraf": "^2.6.2",
"rollup": "^0.63.4",
"rollup-plugin-babel": "^3.0.7",
"rollup-plugin-commonjs": "^9.1.3",
"rollup": "^0.66.2",
"rollup-plugin-babel": "^4.0.3",
"rollup-plugin-filesize": "^4.0.1",
"rollup-plugin-json": "^3.0.0",
"rollup-plugin-node-resolve": "^3.3.0",

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,16 @@
import freesewing from "freesewing";
import { version } from "../package.json";
let chai = require("chai");
let expect = chai.expect;
chai.use(require('chai-string'));
let plugin = require("../dist/index.js");
it("Should set the plugin name:version attribute and import style and defs", () => {
let pattern = new freesewing.Pattern().with(plugin);
pattern.render();
expect(pattern.svg.attributes.get("freesewing:plugin-logo")).to.equal(
version
);
expect(pattern.svg.style).to.equal("path.logo{stroke:none;fill:#000;}");
expect(pattern.svg.defs).to.startWith('<g id="logo" transform="translate(-23 -36)"><path class="logo"');
});