1
0
Fork 0

tada: Initial commit

This commit is contained in:
Joost De Cock 2019-04-01 18:37:54 +02:00
parent 0fabc14c16
commit 85aba22804
10 changed files with 6905 additions and 1 deletions

View file

@ -0,0 +1,13 @@
# editorconfig.org
root = true
[*]
indent_size = 2
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

62
packages/plugin-bust/.gitignore vendored Normal file
View file

@ -0,0 +1,62 @@
dist
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# next.js build output
.next

View file

@ -0,0 +1,4 @@
src
.editorconfig
rollup.browser.js
rollup.node.js

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Joost De Cock
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,2 +1,77 @@
<p align="center">
<a title="Go to freesewing.org" href="https://freesewing.org/"><img src="https://freesewing.org/img/logo/black.svg" align="center" width="150px" alt="Freesewing logo"/></a>
</p>
<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-bust"><img src="https://badgen.net/travis/freesewing/plugin-bust/master" alt="Travis build"></a>
<a href="https://www.npmjs.com/package/@freesewing/plugin-bust"><img src="https://badgen.net/npm/v/@freesewing/plugin-bust" alt="Version"></a>
<a href="https://www.npmjs.com/package/@freesewing/plugin-bust"><img src="https://badgen.net/npm/license/@freesewing/plugin-bust" alt="License"></a>
<a href="https://codecov.io/gh/freesewing/plugin-bust"><img src="https://badgen.net/codecov/c/github/freesewing/plugin-bust/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-bust # plugin-bust
A freesewing plugin that allows a bust adjustment on menswear patterns
A freesewing plugin that helps with bust-adjusting menswear pattern.
> This is a build-time plugin, which means its aimed at pattern designers.
## Usage
The goal of this plugin is to make it easier to adapt extended menswear patterns for breasts.
When adapting a menswear pattern for breasts, you follow the *full-bust-adjustment* approach:
- Draft the pattern with your *high bust* measurement as *chest circumference*
- Add a bust dart to create room for the full bust measurement
This plugin helps to accomplish that by:
- Setting the `fullBust` measurement to the value of the `chestCircumference` measurement
- Setting the `chestCircumference` measurement to the value of the `highBust` measurement
Now you can extend any freesewing menswear pattern, and it will be drafted with the
`chestCircumference` value replaced with the `highBust`.
The original chest circumference (full bust) is now available in the `fullBust` measurement.
> Note: Only when extending menswear patterns
>
> If you are designing a womenswear pattern from scratch, you don't need this.
> You can simply use the measurements of your choice.
>
> This plugin is to be used when you extend a menswear pattern and want to make
> a womenswear version.
## Install
Install this plugin from NPM:
```sh
npm install --save @freesewing/plugin-bust
```
## Usage
To load this plugin, load it when instantiating your instantiated pattern:
```js
import freesewing from 'freesewing'
import plugins from "@freesewing/plugin-bundle";
import bust from '@freesewing/plugin-bust'
const Carlita = new freesewing.Design(config, [
plugins,
bust
]);
```
## Where to get help
Questions? Stuck? The [freesewing chat room on Gitter](https://gitter.im/freesewing/freesewing)
is the best place to ask for help.

6593
packages/plugin-bust/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,79 @@
{
"name": "@freesewing/plugin-bust",
"version": "0.0.1",
"description": "A freesewing plugin that helps with bust-adjusting menswear patterns",
"author": "Joost De Cock <joost@decock.org> (https://github.com/joostdecock)",
"license": "MIT",
"homepage": "https://github.com/freesewing/plugin-bust#readme",
"repository": "github:freesewing/plugin-bust",
"bugs": {
"url": "https://github.com/freesewing/plugin-bust/issues"
},
"keywords": [
"freesewing",
"plugin",
"sewing patterns",
"bust-adjustment"
],
"main": "dist/index.js",
"unpkg": "dist/browser.js",
"module": "dist/index.mjs",
"scripts": {
"patch": "npm version patch -m ':bookmark: v%s' && npm run build",
"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": "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\"",
"browserbuild": "rollup -c rollup.js --file dist/browser.js --format iife --name freesewing.plugins.bust",
"nodebuild": "rollup -c rollup.js --file dist/index.js --format cjs",
"modulebuild": "rollup -c rollup.js --file dist/index.mjs --format es",
"rebuild": "npm run nodebuild && npm run modulebuild",
"build": "npm run clean && npm run browserbuild && npm run nodebuild && npm run modulebuild"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/*.{js,json}": [
"prettier --write",
"git add"
]
},
"devDependencies": {
"@babel/core": "7.4.0",
"@babel/preset-env": "7.4.2",
"@babel/register": "^7.0.0",
"chai": "^4.1.2",
"chai-string": "1.4.0",
"codecov": "^3.1.0",
"eslint": "5.16.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-prettier": "^2.6.2",
"freesewing": "^0.26.1",
"husky": "^0.14.3",
"lint-staged": "^7.2.0",
"mocha": "^5.2.0",
"nyc": "13.3.0",
"prettier": "^1.13.7",
"rimraf": "^2.6.2",
"rollup": "^0.66.2",
"rollup-plugin-babel": "4.3.2",
"rollup-plugin-filesize": "^4.0.1",
"rollup-plugin-json": "^3.0.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-terser": "^1.0.1"
},
"files": [
"dist/*",
"README.md",
"package-lock.json",
"package.json"
]
}

View file

@ -0,0 +1,27 @@
import { terser } from "rollup-plugin-terser";
import babel from "rollup-plugin-babel";
import resolve from "rollup-plugin-node-resolve";
import json from "rollup-plugin-json";
import { version, name, description, author, license } from "./package.json";
export default {
input: "src/index.js",
plugins: [
resolve({
browser: true
}),
json(),
babel({
exclude: "node_modules/**"
}),
terser({
output: {
preamble: `/**\n * ${name} | v${version}\n * ${
description
}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${
license
}\n */`
}
})
]
};

View file

@ -0,0 +1,16 @@
import { name, version } from "../package.json";
export default {
name: name,
version: version,
hooks: {
preDraft: function({ settings }) {
if (svg.attributes.get("freesewing:plugin-bust") === false) {
svg.attributes.set("freesewing:plugin-bust", version);
settings.measurements.bust = settings.measurements.chestCircumference;
settings.measurements.chestCircumference =
settings.measurements.highBust;
}
}
}
};

View file

@ -0,0 +1,14 @@
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", () => {
let pattern = new freesewing.Pattern();
pattern.use(plugin).draft().render();
expect(pattern.svg.attributes.get("freesewing:plugin-buttons")).to.equal(
version
);
});