1
0
Fork 0

chore(brian): Switch to new conditional bust plugin export

This commit is contained in:
Joost De Cock 2022-08-28 14:52:18 +02:00
parent 610302ac21
commit e11571f1e1
3 changed files with 13 additions and 20 deletions

View file

@ -38,7 +38,7 @@
"vbuild": "VERBOSE=1 node --experimental-json-modules build.mjs", "vbuild": "VERBOSE=1 node --experimental-json-modules build.mjs",
"lab": "cd ../../sites/lab && yarn start", "lab": "cd ../../sites/lab && yarn start",
"tips": "node ../../scripts/help.mjs", "tips": "node ../../scripts/help.mjs",
"prettier": "npx prettier --write 'src/*.js'", "prettier": "npx prettier --write 'src/*.mjs' 'tests/*.mjs'",
"testci": "npx mocha tests/*.test.mjs --reporter ../../tests/reporters/terse.js", "testci": "npx mocha tests/*.test.mjs --reporter ../../tests/reporters/terse.js",
"cibuild_step3": "node --experimental-json-modules build.mjs" "cibuild_step3": "node --experimental-json-modules build.mjs"
}, },

View file

@ -1,31 +1,25 @@
// FreeSewing core library // FreeSewing Design constructor
import freesewing from '@freesewing/core' import { Design } from '@freesewing/core'
// FreeSewing Plugins // FreeSewing Plugins
import pluginBundle from '@freesewing/plugin-bundle' import { pluginBundle } from '@freesewing/plugin-bundle'
import bustPlugin from '@freesewing/plugin-bust' import { withCondition as bustPlugin } from '@freesewing/plugin-bust'
// Design parts // Design parts
import { back } from './back.mjs' import { back } from './back.mjs'
import { front } from './front.mjs' import { front } from './front.mjs'
import { sleeve } from './sleeve.mjs' import { sleeve } from './sleeve.mjs'
// Get name & version from package.json // Get name & version from package.json
import { name, version } from '../package.json' assert { type: 'json' } import { name, version } from '../package.json'
// Re-export skeleton parts so peope can re-use them // Re-export skeleton parts so peope can re-use them
import { base } from './base.mjs' import { base } from './base.mjs'
import { sleevecap } from './sleevecap.mjs' import { sleevecap } from './sleevecap.mjs'
// Setup our new design // Setup our new design
const Brian = new freesewing.Design({ const Brian = new Design({
name, name,
version, version,
parts: [ back, front, sleeve ], parts: [ back, front, sleeve ],
plugins: pluginBundle, plugins: pluginBundle,
conditionalPlugins: { conditionalPlugins: bustPlugin
plugin: bustPlugin,
condition: (settings=false) =>
settings?.options?.draftForHighBust &&
settings?.measurements?.highBust
? true : false
}
}) })
// Named exports // Named exports

View file

@ -1,5 +1,4 @@
// This file is auto-generated. // This file is auto-generated | Any changes you make will be overwritten.
// Changes you make will be overwritten.
import { Brian } from './dist/index.mjs' import { Brian } from './dist/index.mjs'
// Shared tests // Shared tests
@ -10,8 +9,8 @@ import { testPatternSampling } from '../../../tests/designs/sampling.mjs'
// Test config // Test config
testPatternConfig(Brian) testPatternConfig(Brian)
// Test drafting // Test drafting - Change the second parameter to `true` to log errors
//testPatternDrafting("brian", Pattern) testPatternDrafting(Brian, false)
// Test sampling // Test sampling - Change the second parameter to `true` to log errors
//testPatternSampling( "brian", Pattern) testPatternSampling(Brian, false)