construction: Wow Rollup, you are sure giving me grief
This commit is contained in:
parent
587f0e1ef9
commit
ba2729811d
11 changed files with 1073 additions and 1021 deletions
3
packages/brian/.babelrc
Normal file
3
packages/brian/.babelrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"plugins": ["transform-object-rest-spread"]
|
||||
}
|
|
@ -1,10 +1,7 @@
|
|||
/** Pattern parts */
|
||||
export var config = {
|
||||
parts: [
|
||||
"back",
|
||||
"front",
|
||||
"_sleeve"
|
||||
],
|
||||
export default {
|
||||
name: "brian",
|
||||
parts: ["back", "front", "_sleeve"],
|
||||
measurements: [
|
||||
"bicepsCircumference",
|
||||
"centerBackNeckToWaist",
|
||||
|
@ -19,26 +16,31 @@ export var config = {
|
|||
],
|
||||
options: [
|
||||
// Constants
|
||||
{ "id": "backNeckCutout", "val": 20, "type": "constant"},
|
||||
{ "id": "bicepsEase", "val": 50, "type": "constant"},
|
||||
{ "id": "collarEase", "val": 15, "type": "constant"},
|
||||
{ "id": "frontArmholeExtra", "val": 5, "type": "constant"},
|
||||
{ "id": "shoulderSlopeReduction", "val": 0, "type": "constant"},
|
||||
{ "id": "sleevecapEase", "val": 5, "type": "constant"},
|
||||
{ "id": "collarFactor", "val":4.8, "type": "constant"},
|
||||
{ id: "backNeckCutout", val: 20, type: "constant" },
|
||||
{ id: "bicepsEase", val: 50, type: "constant" },
|
||||
{ id: "collarEase", val: 15, type: "constant" },
|
||||
{ id: "frontArmholeExtra", val: 5, type: "constant" },
|
||||
{ id: "shoulderSlopeReduction", val: 0, type: "constant" },
|
||||
{ id: "sleevecapEase", val: 5, type: "constant" },
|
||||
{ id: "collarFactor", val: 4.8, type: "constant" },
|
||||
|
||||
// Measures
|
||||
{ "id": "bicepsEase", "val": 50, "min": 30, "max": 80 },
|
||||
{ "id": "chestEase", "val": 30, "min": -40, "max": 160 },
|
||||
{ "id": "shoulderEase", "val": 0, "min": -20, "max": 60 },
|
||||
{ "id": "cuffEase", "val": 45, "min": 0, "max": 100 },
|
||||
{ "id": "lengthBonus", "val": 0, "min": -40, "max": 120 },
|
||||
{ "id": "sleeveLengthBonus", "val": 0, "min": -40, "max": 80 },
|
||||
{ id: "bicepsEase", val: 50, min: 30, max: 80 },
|
||||
{ id: "chestEase", val: 30, min: -40, max: 160 },
|
||||
{ id: "shoulderEase", val: 0, min: -20, max: 60 },
|
||||
{ id: "cuffEase", val: 45, min: 0, max: 100 },
|
||||
{ id: "lengthBonus", val: 0, min: -40, max: 120 },
|
||||
{ id: "sleeveLengthBonus", val: 0, min: -40, max: 80 },
|
||||
|
||||
// Percentages
|
||||
{ "id": "acrossBackFactor", "val": 96, "type": "percentage", "min": 93, "max": 99 },
|
||||
{ "id": "armholeDepthFactor", "val": 50, "type": "percentage", "min": 35, "max": 65 },
|
||||
{ "id": "sleevecapHeightFactor", "val": 55, "type": "percentage", "min": 35, "max": 75 }
|
||||
{ id: "acrossBackFactor", val: 96, type: "percentage", min: 93, max: 99 },
|
||||
{ id: "armholeDepthFactor", val: 50, type: "percentage", min: 35, max: 65 },
|
||||
{
|
||||
id: "sleevecapHeightFactor",
|
||||
val: 55,
|
||||
type: "percentage",
|
||||
min: 35,
|
||||
max: 75
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
../freesewing/dist/freesewing.min.js
|
||||
../freesewing/dist/browser.js
|
|
@ -7,15 +7,13 @@
|
|||
<body>
|
||||
<div id="svg"></div>
|
||||
<script type="text/javascript" src="freesewing.js"></script>
|
||||
<script type="text/javascript" src="dist/brian.min.js"></script>
|
||||
<script type="text/javascript" src="theme.js"></script>
|
||||
<script type="text/javascript" src="designer.js"></script>
|
||||
<script type="text/javascript" src="cutonfold.min.js"></script>
|
||||
<script type="text/javascript" src="dist/browser.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/@freesewing/plugin-theme"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/@freesewing/plugin-designer"></script>
|
||||
<script>
|
||||
var pattern = freesewing.patterns.brian
|
||||
.with(freesewing.plugins.theme)
|
||||
.with(freesewing.plugins.designer)
|
||||
.with(freesewing.plugins.cutonfold);
|
||||
.with(freesewing.plugins.designer);
|
||||
|
||||
pattern.settings.measurements = {
|
||||
bicepsCircumference: 335,
|
||||
|
|
1942
packages/brian/package-lock.json
generated
1942
packages/brian/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -24,6 +24,7 @@
|
|||
"clean": "rimraf dist",
|
||||
"pretty": "npx prettier --write \"src/*.js\"",
|
||||
"lint": "eslint --fix \"src/*.js\"",
|
||||
"watch": "rollup -w -c rollup.browser.js",
|
||||
"browserbuild": "rollup -c rollup.browser.js",
|
||||
"nodebuild": "rollup -c rollup.node.js",
|
||||
"build": "npm run clean && npm run browserbuild && npm run nodebuild"
|
||||
|
@ -40,12 +41,15 @@
|
|||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@freesewing-plugins/macro-cutonfold": "0.3.2",
|
||||
"@freesewing/plugin-cutonfold": "^0.5.0",
|
||||
"@freesewing/plugin-logo": "^0.1.2",
|
||||
"@freesewing/plugin-title": "^0.3.2",
|
||||
"freesewing": "^0.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-eslint": "^8.2.6",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||
"eslint": "^5.2.0",
|
||||
"eslint-config-prettier": "^2.9.0",
|
||||
"eslint-plugin-prettier": "^2.6.2",
|
||||
|
|
|
@ -9,7 +9,7 @@ import meta from "./package.json";
|
|||
export default {
|
||||
input: "src/index.js",
|
||||
output: {
|
||||
file: "dist/brian.min.js",
|
||||
file: "dist/browser.js",
|
||||
format: "iife",
|
||||
name: "freesewing.patterns.brian",
|
||||
globals: {
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
import { terser } from "rollup-plugin-terser";
|
||||
import filesize from "rollup-plugin-filesize";
|
||||
import babel from "rollup-plugin-babel";
|
||||
import resolve from "rollup-plugin-node-resolve";
|
||||
import json from "rollup-plugin-json";
|
||||
import resolve from "rollup-plugin-node-resolve";
|
||||
import meta from "./package.json";
|
||||
|
||||
export default {
|
||||
input: "src/index.js",
|
||||
output: {
|
||||
file: "dist/module.js",
|
||||
format: "cjs",
|
||||
banner: `/**\n * ${meta.name} | v${meta.version}\n * ${
|
||||
meta.description
|
||||
}\n * (c) ${new Date().getFullYear()} ${meta.author}\n * @license ${
|
||||
meta.license
|
||||
}\n */`
|
||||
file: "dist/node.js",
|
||||
format: "cjs"
|
||||
},
|
||||
external: ["freesewing"],
|
||||
plugins: [
|
||||
resolve({
|
||||
browser: false
|
||||
|
@ -24,5 +21,14 @@ export default {
|
|||
exclude: "node_modules/**"
|
||||
}),
|
||||
filesize()
|
||||
//terser({
|
||||
// output: {
|
||||
// preamble: `/**\n * ${meta.name} | v${meta.version}\n * ${
|
||||
// meta.description
|
||||
// }\n * (c) ${new Date().getFullYear()} ${meta.author}\n * @license ${
|
||||
// meta.license
|
||||
// }\n */`
|
||||
// }
|
||||
//})
|
||||
]
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as F from "freesewing";
|
|||
import base from "./base";
|
||||
|
||||
var back = {
|
||||
draft: function(part, context) {
|
||||
draft: function(part) {
|
||||
let {
|
||||
measurements,
|
||||
options,
|
||||
|
@ -12,8 +12,8 @@ var back = {
|
|||
macro,
|
||||
final,
|
||||
paperless
|
||||
} = F.utils.shorthand(part, context);
|
||||
base.draft(part, context);
|
||||
} = F.utils.shorthand(part);
|
||||
base.draft(part);
|
||||
|
||||
paths.seam = new F.path()
|
||||
.move(points.cbNeck)
|
||||
|
@ -33,24 +33,33 @@ var back = {
|
|||
|
||||
// Final?
|
||||
|
||||
var decorate = function(part, context) {
|
||||
var decorate = function(part) {
|
||||
macro("cutonfold", {
|
||||
from: points.cbNeck,
|
||||
to: points.cbHips,
|
||||
grainline: true
|
||||
});
|
||||
|
||||
points.title = new F.point(
|
||||
points.armholePitch.x / 2,
|
||||
points.armholePitch.y
|
||||
);
|
||||
macro("title", {
|
||||
at: points.title,
|
||||
nr: 2
|
||||
});
|
||||
};
|
||||
|
||||
if (final) {
|
||||
decorate(part, context);
|
||||
decorate(part);
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
|
||||
var gauge = function(part, context) {};
|
||||
var gauge = function(part) {};
|
||||
|
||||
if (paperless) {
|
||||
gauge(part, context);
|
||||
gauge(part);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import * as F from "freesewing";
|
||||
|
||||
var base = {
|
||||
draft: function(part, context) {
|
||||
draft: function(part) {
|
||||
let { measurements, options, points, paths, snippets } = F.utils.shorthand(
|
||||
part,
|
||||
context
|
||||
part
|
||||
);
|
||||
|
||||
// Center back (cb) vertical axis
|
||||
|
|
|
@ -1,19 +1,24 @@
|
|||
import * as freesewing from "freesewing";
|
||||
import * as cutonfold from "@freesewing-plugins/macro-cutonfold";
|
||||
import { config } from "../config/config";
|
||||
import freesewing from "freesewing";
|
||||
import cutonfold from "@freesewing/plugin-cutonfold";
|
||||
import * as plugintitle from "@freesewing/plugin-title";
|
||||
//import logo from "@freesewing/plugin-logo";
|
||||
import config from "../config/config";
|
||||
import back from "./back";
|
||||
import { version } from "../package.json";
|
||||
console.log("title is ", plugintitle);
|
||||
var pattern = new freesewing.pattern({ version: version, ...config })
|
||||
.with(cutonfold)
|
||||
.with(plugintitle);
|
||||
// .with(logo)
|
||||
//pattern.on("preRenderSvg", function(next) {
|
||||
// this.attributes.add(`freesewing:${name}`, version);
|
||||
// next();
|
||||
//});
|
||||
|
||||
var brian = new freesewing.pattern(config).with(cutonfold);
|
||||
brian.on("preRenderSvg", function(next) {
|
||||
this.attributes.add("freesewing:brian", version);
|
||||
next();
|
||||
});
|
||||
pattern.draft = function() {
|
||||
back.draft(pattern.parts.back);
|
||||
|
||||
brian.draft = function() {
|
||||
back.draft(brian.parts.back, brian.context);
|
||||
|
||||
return brian;
|
||||
return pattern;
|
||||
};
|
||||
|
||||
export default brian;
|
||||
export default pattern;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue