From af4185b126187c7cebe1af023793d2c9d6d7ecd2 Mon Sep 17 00:00:00 2001 From: Enoch Riese Date: Tue, 29 Nov 2022 16:10:19 -0600 Subject: [PATCH] inherited designs all use base templates --- packages/new-design/lib/cli.mjs | 13 +- packages/new-design/lib/utils.mjs | 83 +++++++-- packages/new-design/templates/from-bella.mjs | 2 + .../from-bella/design/src/front.mjs.mustache | 169 ------------------ .../from-bella/design/src/index.mjs.mustache | 30 ---- .../from-bella/package.json.mustache | 98 ---------- packages/new-design/templates/from-bent.mjs | 2 + .../from-bent/design/src/back.mjs.mustache | 169 ------------------ .../from-bent/design/src/front.mjs.mustache | 169 ------------------ .../from-bent/design/src/index.mjs.mustache | 32 ---- .../design/src/topsleeve.mjs.mustache | 169 ------------------ .../design/src/undersleeve.mjs.mustache | 169 ------------------ .../templates/from-bent/package.json.mustache | 100 ----------- .../new-design/templates/from-breanna.mjs | 2 + .../from-breanna/design/src/back.mjs.mustache | 169 ------------------ .../design/src/front.mjs.mustache | 169 ------------------ .../design/src/index.mjs.mustache | 31 ---- .../design/src/sleeve.mjs.mustache | 169 ------------------ packages/new-design/templates/from-brian.mjs | 2 + .../from-brian/design/src/back.mjs.mustache | 169 ------------------ .../from-brian/design/src/front.mjs.mustache | 169 ------------------ .../from-brian/design/src/index.mjs.mustache | 31 ---- .../from-brian/design/src/sleeve.mjs.mustache | 169 ------------------ .../from-brian/package.json.mustache | 98 ---------- packages/new-design/templates/from-titan.mjs | 2 + .../from-titan/design/src/back.mjs.mustache | 155 ---------------- .../from-titan/design/src/front.mjs.mustache | 155 ---------------- .../from-titan/package.json.mustache | 99 ---------- .../design/src => shared}/index.mjs.mustache | 9 +- .../inherited-part.mjs.mustache} | 26 +-- .../package.json.mustache | 8 +- 31 files changed, 108 insertions(+), 2729 deletions(-) create mode 100644 packages/new-design/templates/from-bella.mjs delete mode 100644 packages/new-design/templates/from-bella/design/src/front.mjs.mustache delete mode 100644 packages/new-design/templates/from-bella/design/src/index.mjs.mustache delete mode 100644 packages/new-design/templates/from-bella/package.json.mustache create mode 100644 packages/new-design/templates/from-bent.mjs delete mode 100644 packages/new-design/templates/from-bent/design/src/back.mjs.mustache delete mode 100644 packages/new-design/templates/from-bent/design/src/front.mjs.mustache delete mode 100644 packages/new-design/templates/from-bent/design/src/index.mjs.mustache delete mode 100644 packages/new-design/templates/from-bent/design/src/topsleeve.mjs.mustache delete mode 100644 packages/new-design/templates/from-bent/design/src/undersleeve.mjs.mustache delete mode 100644 packages/new-design/templates/from-bent/package.json.mustache create mode 100644 packages/new-design/templates/from-breanna.mjs delete mode 100644 packages/new-design/templates/from-breanna/design/src/back.mjs.mustache delete mode 100644 packages/new-design/templates/from-breanna/design/src/front.mjs.mustache delete mode 100644 packages/new-design/templates/from-breanna/design/src/index.mjs.mustache delete mode 100644 packages/new-design/templates/from-breanna/design/src/sleeve.mjs.mustache create mode 100644 packages/new-design/templates/from-brian.mjs delete mode 100644 packages/new-design/templates/from-brian/design/src/back.mjs.mustache delete mode 100644 packages/new-design/templates/from-brian/design/src/front.mjs.mustache delete mode 100644 packages/new-design/templates/from-brian/design/src/index.mjs.mustache delete mode 100644 packages/new-design/templates/from-brian/design/src/sleeve.mjs.mustache delete mode 100644 packages/new-design/templates/from-brian/package.json.mustache create mode 100644 packages/new-design/templates/from-titan.mjs delete mode 100644 packages/new-design/templates/from-titan/design/src/back.mjs.mustache delete mode 100644 packages/new-design/templates/from-titan/design/src/front.mjs.mustache delete mode 100644 packages/new-design/templates/from-titan/package.json.mustache rename packages/new-design/templates/{from-titan/design/src => shared}/index.mjs.mustache (82%) rename packages/new-design/templates/{from-bella/design/src/back.mjs.mustache => shared/inherited-part.mjs.mustache} (85%) rename packages/new-design/templates/{from-breanna => shared}/package.json.mustache (97%) diff --git a/packages/new-design/lib/cli.mjs b/packages/new-design/lib/cli.mjs index 1920e09c4a4..9ebee123575 100644 --- a/packages/new-design/lib/cli.mjs +++ b/packages/new-design/lib/cli.mjs @@ -1,15 +1,9 @@ -import { banner } from './banner.mjs' -import { - checkNodeVersion, - getChoices, - createEnvironment, -} from './utils.mjs' - +// import { banner } from './banner.mjs' +import { checkNodeVersion, getChoices, createEnvironment } from './utils.mjs' export const cli = async () => { - // Make it pretty - console.log(banner+"\n") + // console.log(banner+"\n") // Make sure we have a valid NodeJS version checkNodeVersion() @@ -20,4 +14,3 @@ export const cli = async () => { // Create environment from template createEnvironment(choices) } - diff --git a/packages/new-design/lib/utils.mjs b/packages/new-design/lib/utils.mjs index bb2caf372e2..6a1d116659b 100644 --- a/packages/new-design/lib/utils.mjs +++ b/packages/new-design/lib/utils.mjs @@ -123,11 +123,17 @@ const ensureDir = async (file, suppress = false) => { } } +const writeTemplateFile = async (to, template, args) => { + if (!dirs[to]) await ensureDir(to) + + return writeFile(to, mustache.render(template, args)) +} // Helper method to copy template files const copyTemplate = async (config, choices) => { // Copy files in parallel rather than using await const promises = [] + // const templateConfig // Copy shared files for (const from of config.files.shared) { // FIXME: Explain the -7 @@ -136,16 +142,60 @@ const copyTemplate = async (config, choices) => { promises.push(copyFile(from, to)) } - // Template files - for (const from of config.files.template) { - let to = join(config.dest, from.slice(config.source.template.length - 7)) - if (to.slice(-9) === '.mustache') to = to.slice(0, -9) - if (!dirs[to]) await ensureDir(to) - // Template out file - const src = await readFile(from, 'utf-8') - promises.push(writeFile(to, mustache.render(src, { name: choices.name, tag: config.tag }))) + // Template the package.json + const packageJsonTemplate = await readFile(config.files.templates['package.json'], 'utf-8') + const packageJsonTo = join(config.dest, 'package.json') + promises.push( + writeTemplateFile(packageJsonTo, packageJsonTemplate, { + name: choices.name, + tag: config.tag, + dependencies: config.templateData.dependencies, + }) + ) + + const designSrcDir = join(config.dest, 'design/src') + + // Template the index file + const indexTemplate = await readFile(config.files.templates['index'], 'utf-8') + const indexTo = join(designSrcDir, 'index.mjs') + promises.push( + writeTemplateFile(indexTo, indexTemplate, { + name: choices.name, + parts: config.templateData.parts, + }) + ) + + // Template the parts + if (choices.template !== 'scratch') { + const partTemplate = await readFile(config.files.templates['inherited-part'], 'utf-8') + const baseConfig = { + baseName: choices.template, + baseNameUpcase: choices.template[0].toUpperCase() + choices.template.slice(1), + name: choices.name, + } + + config.templateData.parts.forEach(async (p) => { + const to = join(designSrcDir, `${p}.mjs`) + promises.push( + writeTemplateFile(to, partTemplate, { + part: p, + partUpcase: p[0].toUpperCase() + p.slice(1), + ...baseConfig, + }) + ) + }) } + // // Template files + // for (const from of config.files.template) { + // let to = join(config.dest, from.slice(config.source.template.length - 7)) + // if (to.slice(-9) === '.mustache') to = to.slice(0, -9) + // if (!dirs[to]) await ensureDir(to) + // // Template out file + // const src = await readFile(from, 'utf-8') + // promises.push(writeFile(to, mustache.render(src, { name: choices.name, tag: config.tag }))) + // } + await Promise.all(promises) return @@ -256,7 +306,8 @@ export const createEnvironment = async (choices) => { ;(config.cwd = cwd), (config.source = { root: cwd, - template: cwd + `/../templates/from-${choices.template}`, + templateData: cwd + `/../templates/from-${choices.template}.mjs`, + templates: join(cwd, `/../templates/shared`), shared: cwd + `/../shared`, }) config.dest = join(process.cwd(), choices.name) @@ -264,12 +315,22 @@ export const createEnvironment = async (choices) => { // Create target directory await mkdir(config.dest, { recursive: true }) + const templateFiles = await rdir(config.source.templates) + const templates = {} + templateFiles.forEach( + (f) => + (templates[f.replace(`${config.source.templates}/`, '').replace(/(\.mjs)*\.mustache/, '')] = + f) + ) + // Find files config.files = { - template: await rdir(config.source.template), + templates, shared: await rdir(config.source.shared), } + config.templateData = await import(config.source.templateData) + // Output a linebreak console.log() @@ -285,7 +346,7 @@ export const createEnvironment = async (choices) => { ), }) } catch (err) { - /* no feedback here */ + console.log(err) } // Install dependencies diff --git a/packages/new-design/templates/from-bella.mjs b/packages/new-design/templates/from-bella.mjs new file mode 100644 index 00000000000..02f36d6571c --- /dev/null +++ b/packages/new-design/templates/from-bella.mjs @@ -0,0 +1,2 @@ +export const parts = ['back', 'frontSideDart'] +export const dependencies = ['@freesewing/bella'] diff --git a/packages/new-design/templates/from-bella/design/src/front.mjs.mustache b/packages/new-design/templates/from-bella/design/src/front.mjs.mustache deleted file mode 100644 index 56aeceab6b3..00000000000 --- a/packages/new-design/templates/from-bella/design/src/front.mjs.mustache +++ /dev/null @@ -1,169 +0,0 @@ -import { frontSideDart as bellaFront } from '@freesewing/bella' - -function draftFront({ - // Uncomment below to destructure what you need - /* - * Content constructors - */ - //Path, // A Path constructor to create new paths - //Point, // A Point constructor to create new points - //Snippet, // A Snippet constructor to create new snippets - /* - * Content constainers - */ - //paths, // Add a Path to your part by adding it to this object - //points, // Add a Points to your part by adding it to this object - //snippets, // Add a Snippet to your part by adding it to this object - /* - * Access to settings - */ - //absoluteOptions, // Access to settings.absoluteOptions - //complete, // Access to settings.complete - //measurements, // Access to settings.measurements - //options, // Access to settings.options - //paperless, // Access to settings.paperless - //sa, // Access to settings.sa - //scale, // Access to settings.scale - /* - * Access to utilities - */ - //getId, //See the getId documentation - //hide, //See the hide documentation - //log, //See the logging documentation - //macro, //See the macros documentation - //setHidden, //See the setHidden documentation - //store, //See the store documentation - //unhide, //See the unhide documentation - //units, //See the units documentation - //utils, //See the utils documentation - /* - * Return value - */ - part, // Your draft method must return this -}) { - - // Work your magic here - - return part -} - -export const front = { - /* - * name: Holds the name of this part. - * - * We STRONGLY recommend naming your parts in the format of - * design.part to avoid naming conflicts when people re-use - * parts across designs. - */ - name: '{{ name }}.front', - /* - * draft: Holds the draft method for this part - * - * This should be a function that drafts and returns the part - * - * Documentation: https://freesewing.dev/reference/api/part/draft - */ - draft: draftFront, - after: [ - /* - * after: Holds a list of parts that should be drafted prior to this part. - * - * You'll need to import these parts, just as with the from key above. - * - * If you don't have any parts to draft prior to this part, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - ], - /* - * from: Holds the part you want to extend. - * - * Since you opted to extend bella, and this is the front part, - * we're extending bella's frontSideDart part here. - * It was imported at the top of this file from @freesewing/bella - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - from: bellaFront, - /* - * hide: Set this to true to hide a part. - * - * We've set this to false here to clarify its use. - * I you don't want to hide this part, - * you can remove the hide key entirely. - */ - hide: false, - /* - * hideDependecies: Set this to true to hide a part's dependencies. - * - * We've set this to true here since you're extending Bella's front part. - * I you don't want to hide this part's dependencies, - * you can remove the hideDependencies key entirely. - */ - hideDependencies: true, - /* - * hideAll: Set this to true to hide both the part and its dependencies. - * - * This is a combination of the hide and hideDependencies keys in case - * you want to both hide this part and its dependencies. - * We've included it here with a value of false to its use. - * I you don't want to hide this a part and its dependencies, - * you can remove the hideAll key entirely. - */ - hideAll: false, - options: { - /* - * options: Holds (the configuration of) options for this part - * - * Declare options used in this part here. - * You only need to add additional options. - * All options coming from Bella's front part are already loaded. - * - * If you don't have any options to add, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/options - */ - }, - measurements: [ - /* - * measurements: Holds a list of measurements required by this part. - * - * Declare measurements required by this part here. - * You only need to add additional measurements. - * All measurements coming from Bella's front part are already loaded. - * - * If you don't have any required measurements to add, - * you can remove this measurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - optionalMeasurements: [ - /* - * optionalMeasurements: Holds a list of measurements optional in this part. - * - * Declare measurements that are optional for this part here. - * - * If you don't have any optional measurements to add, - * you can remove this optionalMeasurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - plugins: [ - /* - * plugins: Holds a list of plugins this part relies on. - * - * Add all the plugins here that you need in this part. - * You only need to add additional plugins. - * All plugins coming from Bella's front part are already loaded. - * - * If you don't have any plugins to add, - * you can remove this plugins key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/plugins - */ - ] -} diff --git a/packages/new-design/templates/from-bella/design/src/index.mjs.mustache b/packages/new-design/templates/from-bella/design/src/index.mjs.mustache deleted file mode 100644 index e628e6e7c1a..00000000000 --- a/packages/new-design/templates/from-bella/design/src/index.mjs.mustache +++ /dev/null @@ -1,30 +0,0 @@ -// Import Design constructor -import { Design } from '@freesewing/core' -// Import parts -import { back } from './back' -import { front } from './front' - -// Create the new design -const Pattern = new Design({ - data: { - /* - * If you like, you can add any data you want to your design. - * We'll add the name here as an example. - * - * If you don't use this, - * you can remove this data key enterely. - */ - name: "{{ name }}", - }, - // A list of parts is all that is required. - parts: [ back, front ], -}) - -/* - * Named exports - * - * We export the design itself as well as each part individually. - * This allows us to re-use these parts in other designs. - */ -export { back, front, Pattern } - diff --git a/packages/new-design/templates/from-bella/package.json.mustache b/packages/new-design/templates/from-bella/package.json.mustache deleted file mode 100644 index 26db33a01a5..00000000000 --- a/packages/new-design/templates/from-bella/package.json.mustache +++ /dev/null @@ -1,98 +0,0 @@ -{ - "name": "@freesewing/{{name}}", - "version": "0.0.1", - "description": "A new FreeSewing design", - "author": "Joost De Cock (https://github.com/joostdecock)", - "homepage": "https://freesewing.org/", - "repository": "github:freesewing/freesewing", - "license": "MIT", - "bugs": { - "url": "https://github.com/freesewing/freesewing/issues" - }, - "funding": { - "type": "individual", - "url": "https://freesewing.org/patrons/join" - }, - "keywords": [ - "freesewing", - "design", - "diy", - "fashion", - "parametric design", - "sewing", - "sewing pattern" - ], - "main": "dist/index.js", - "module": "dist/index.mjs", - "scripts": { - "dev": "next dev -p 8000", - "build": "node build.js", - "clean": "rimraf dist", - "mbuild": "NO_MINIFY=1 node build.js", - "test": "BABEL_ENV=production npx mocha tests/*.test.mjs --require @babel/register", - "vbuild": "VERBOSE=1 node build.js" - }, - "dependencies": { - "@freesewing/core": "{{ tag }}", - "@freesewing/bella": "{{ tag }}", - "@freesewing/plugin-bundle": "{{ tag }}" - }, - "devDependencies": { - "@freesewing/plugin-svgattr": "{{ tag }}", - "@freesewing/plugin-theme": "{{ tag }}", - "@freesewing/plugin-i18n": "{{ tag }}", - "@freesewing/models": "{{ tag }}", - "@headlessui/react": "^1.6.5", - "js-yaml": "^4.1.0", - "file-saver": "^2.0.5", - "axios": "^0.27.2", - "react": "^17.0.2", - "react-dom": "^17.0.2", - "react-sizeme": "^3.0.2", - "react-zoom-pan-pinch": "^2.1.3", - "react-markdown": "^8.0.3", - "roughjs": "^4.5.2", - "@tailwindcss/typography": "^0.5.2", - "d3-dispatch": "^3.0.1", - "d3-drag": "^3.0.0", - "d3-selection": "^3.0.0", - "daisyui": "^2.0.6", - "lodash.get": "^4.4.2", - "lodash.orderby": "^4.6.0", - "lodash.set": "^4.3.2", - "lodash.unset": "^4.5.2", - "lodash.clonedeep": "^4.5.0", - "next": "^12.3.2", - "next-i18next": "^11.0.0", - "react-copy-to-clipboard": "^5.0.4", - "react-hotkeys-hook": "^3.4.4", - "react-swipeable": "^6.2.0", - "react-timeago": "^6.2.1", - "mocha": "^9.1.1", - "chai": "^4.2.0", - "autoprefixer": "^10.4.0", - "eslint-config-next": "12.1.6", - "highlight.js": "^11.5.1", - "js-yaml": "^4.1.0", - "pdfkit": "^0.13.0", - "svg-to-pdfkit": "^0.1.8", - "postcss": "^8.4.14", - "postcss-for": "^2.1.1", - "tailwindcss": "^3.1.3", - "tailwindcss-open-variant": "^1.0.0", - "web-worker": "^1.2.0" - }, - "files": [ - "dist/*", - "README.md", - "package.json" - ], - "publishConfig": { - "access": "public", - "tag": "next" - }, - "engines": { - "node": ">=14.0.0", - "npm": ">=6" - } -} diff --git a/packages/new-design/templates/from-bent.mjs b/packages/new-design/templates/from-bent.mjs new file mode 100644 index 00000000000..9a3f40d1d36 --- /dev/null +++ b/packages/new-design/templates/from-bent.mjs @@ -0,0 +1,2 @@ +export const parts = ['back', 'front', 'topSleeve', 'underSleeve'] +export const dependencies = ['@freesewing/bent', '@freesewing/brian', '@freesewing/plugin-bust'] diff --git a/packages/new-design/templates/from-bent/design/src/back.mjs.mustache b/packages/new-design/templates/from-bent/design/src/back.mjs.mustache deleted file mode 100644 index dd58e1df305..00000000000 --- a/packages/new-design/templates/from-bent/design/src/back.mjs.mustache +++ /dev/null @@ -1,169 +0,0 @@ -import { back as bentBack } from '@freesewing/bent' - -function draftBack({ - // Uncomment below to destructure what you need - /* - * Content constructors - */ - //Path, // A Path constructor to create new paths - //Point, // A Point constructor to create new points - //Snippet, // A Snippet constructor to create new snippets - /* - * Content constainers - */ - //paths, // Add a Path to your part by adding it to this object - //points, // Add a Points to your part by adding it to this object - //snippets, // Add a Snippet to your part by adding it to this object - /* - * Access to settings - */ - //absoluteOptions, // Access to settings.absoluteOptions - //complete, // Access to settings.complete - //measurements, // Access to settings.measurements - //options, // Access to settings.options - //paperless, // Access to settings.paperless - //sa, // Access to settings.sa - //scale, // Access to settings.scale - /* - * Access to utilities - */ - //getId, //See the getId documentation - //hide, //See the hide documentation - //log, //See the logging documentation - //macro, //See the macros documentation - //setHidden, //See the setHidden documentation - //store, //See the store documentation - //unhide, //See the unhide documentation - //units, //See the units documentation - //utils, //See the utils documentation - /* - * Return value - */ - part, // Your draft method must return this -}) { - - // Work your magic here - - return part -} - -export const back = { - /* - * name: Holds the name of this part. - * - * We STRONGLY recommend naming your parts in the format of - * design.part to avoid naming conflicts when people re-use - * parts across designs. - */ - name: '{{ name }}.back', - /* - * draft: Holds the draft method for this part - * - * This should be a function that drafts and returns the part - * - * Documentation: https://freesewing.dev/reference/api/part/draft - */ - draft: draftBack, - after: [ - /* - * after: Holds a list of parts that should be drafted prior to this part. - * - * You'll need to import these parts, just as with the from key above. - * - * If you don't have any parts to draft prior to this part, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - ], - /* - * from: Holds the part you want to extend. - * - * Since you opted to extend Bent, and this is the back part, - * we're extending Bent's back part here. - * It was imported at the top of this file from @freesewing/bent - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - from: bentBack, - /* - * hide: Set this to true to hide a part. - * - * We've set this to false here to clarify its use. - * I you don't want to hide this part, - * you can remove the hide key entirely. - */ - hide: false, - /* - * hideDependecies: Set this to true to hide a part's dependencies. - * - * We've set this to true here since you're extending Bent's back part. - * I you don't want to hide this part's dependencies, - * you can remove the hideDependencies key entirely. - */ - hideDependencies: true, - /* - * hideAll: Set this to true to hide both the part and its dependencies. - * - * This is a combination of the hide and hideDependencies keys in case - * you want to both hide this part and its dependencies. - * We've included it here with a value of false to its use. - * I you don't want to hide this a part and its dependencies, - * you can remove the hideAll key entirely. - */ - hideAll: false, - options: { - /* - * options: Holds (the configuration of) options for this part - * - * Declare options used in this part here. - * You only need to add additional options. - * All options coming from Bent's back part are already loaded. - * - * If you don't have any options to add, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/options - */ - }, - measurements: [ - /* - * measurements: Holds a list of measurements required by this part. - * - * Declare measurements required by this part here. - * You only need to add additional measurements. - * All measurements coming from Bent's back part are already loaded. - * - * If you don't have any required measurements to add, - * you can remove this measurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - optionalMeasurements: [ - /* - * optionalMeasurements: Holds a list of measurements optional in this part. - * - * Declare measurements that are optional for this part here. - * - * If you don't have any optional measurements to add, - * you can remove this optionalMeasurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - plugins: [ - /* - * plugins: Holds a list of plugins this part relies on. - * - * Add all the plugins here that you need in this part. - * You only need to add additional plugins. - * All plugins coming from Bent's back part are already loaded. - * - * If you don't have any plugins to add, - * you can remove this plugins key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/plugins - */ - ] -} diff --git a/packages/new-design/templates/from-bent/design/src/front.mjs.mustache b/packages/new-design/templates/from-bent/design/src/front.mjs.mustache deleted file mode 100644 index 843b98e1958..00000000000 --- a/packages/new-design/templates/from-bent/design/src/front.mjs.mustache +++ /dev/null @@ -1,169 +0,0 @@ -import { front as bentFront } from '@freesewing/bent' - -function draftFront({ - // Uncomment below to destructure what you need - /* - * Content constructors - */ - //Path, // A Path constructor to create new paths - //Point, // A Point constructor to create new points - //Snippet, // A Snippet constructor to create new snippets - /* - * Content constainers - */ - //paths, // Add a Path to your part by adding it to this object - //points, // Add a Points to your part by adding it to this object - //snippets, // Add a Snippet to your part by adding it to this object - /* - * Access to settings - */ - //absoluteOptions, // Access to settings.absoluteOptions - //complete, // Access to settings.complete - //measurements, // Access to settings.measurements - //options, // Access to settings.options - //paperless, // Access to settings.paperless - //sa, // Access to settings.sa - //scale, // Access to settings.scale - /* - * Access to utilities - */ - //getId, //See the getId documentation - //hide, //See the hide documentation - //log, //See the logging documentation - //macro, //See the macros documentation - //setHidden, //See the setHidden documentation - //store, //See the store documentation - //unhide, //See the unhide documentation - //units, //See the units documentation - //utils, //See the utils documentation - /* - * Return value - */ - part, // Your draft method must return this -}) { - - // Work your magic here - - return part -} - -export const front = { - /* - * name: Holds the name of this part. - * - * We STRONGLY recommend naming your parts in the format of - * design.part to avoid naming conflicts when people re-use - * parts across designs. - */ - name: '{{ name }}.front', - /* - * draft: Holds the draft method for this part - * - * This should be a function that drafts and returns the part - * - * Documentation: https://freesewing.dev/reference/api/part/draft - */ - draft: draftFront, - after: [ - /* - * after: Holds a list of parts that should be drafted prior to this part. - * - * You'll need to import these parts, just as with the from key above. - * - * If you don't have any parts to draft prior to this part, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - ], - /* - * from: Holds the part you want to extend. - * - * Since you opted to extend Bent, and this is the front part, - * we're extending Bent's front part here. - * It was imported at the top of this file from @freesewing/bent - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - from: bentFront, - /* - * hide: Set this to true to hide a part. - * - * We've set this to false here to clarify its use. - * I you don't want to hide this part, - * you can remove the hide key entirely. - */ - hide: false, - /* - * hideDependecies: Set this to true to hide a part's dependencies. - * - * We've set this to true here since you're extending Bent's front part. - * I you don't want to hide this part's dependencies, - * you can remove the hideDependencies key entirely. - */ - hideDependencies: true, - /* - * hideAll: Set this to true to hide both the part and its dependencies. - * - * This is a combination of the hide and hideDependencies keys in case - * you want to both hide this part and its dependencies. - * We've included it here with a value of false to its use. - * I you don't want to hide this a part and its dependencies, - * you can remove the hideAll key entirely. - */ - hideAll: false, - options: { - /* - * options: Holds (the configuration of) options for this part - * - * Declare options used in this part here. - * You only need to add additional options. - * All options coming from Bent's front part are already loaded. - * - * If you don't have any options to add, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/options - */ - }, - measurements: [ - /* - * measurements: Holds a list of measurements required by this part. - * - * Declare measurements required by this part here. - * You only need to add additional measurements. - * All measurements coming from Bent's front part are already loaded. - * - * If you don't have any required measurements to add, - * you can remove this measurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - optionalMeasurements: [ - /* - * optionalMeasurements: Holds a list of measurements optional in this part. - * - * Declare measurements that are optional for this part here. - * - * If you don't have any optional measurements to add, - * you can remove this optionalMeasurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - plugins: [ - /* - * plugins: Holds a list of plugins this part relies on. - * - * Add all the plugins here that you need in this part. - * You only need to add additional plugins. - * All plugins coming from Bent's front part are already loaded. - * - * If you don't have any plugins to add, - * you can remove this plugins key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/plugins - */ - ] -} diff --git a/packages/new-design/templates/from-bent/design/src/index.mjs.mustache b/packages/new-design/templates/from-bent/design/src/index.mjs.mustache deleted file mode 100644 index 59a30ada17f..00000000000 --- a/packages/new-design/templates/from-bent/design/src/index.mjs.mustache +++ /dev/null @@ -1,32 +0,0 @@ -// Import Design constructor -import { Design } from '@freesewing/core' -// Import parts -import { back } from './back.mjs' -import { front } from './front.mjs' -import { topSleeve } from './topsleeve.mjs' -import { underSleeve } from './undersleeve.mjs' - -// Create the new design -const Pattern = new Design({ - data: { - /* - * If you like, you can add any data you want to your design. - * We'll add the name here as an example. - * - * If you don't use this, - * you can remove this data key enterely. - */ - name: "{{ name }}", - }, - // A list of parts is all that is required. - parts: [ back, front, topSleeve, underSleeve ], -}) - -/* - * Named exports - * - * We export the design itself as well as each part individually. - * This allows us to re-use these parts in other designs. - */ -export { back, front, topSleeve, underSleeve, Pattern } - diff --git a/packages/new-design/templates/from-bent/design/src/topsleeve.mjs.mustache b/packages/new-design/templates/from-bent/design/src/topsleeve.mjs.mustache deleted file mode 100644 index c3b716ac7ab..00000000000 --- a/packages/new-design/templates/from-bent/design/src/topsleeve.mjs.mustache +++ /dev/null @@ -1,169 +0,0 @@ -import { topSleeve as bentTopSleeve } from '@freesewing/bent' - -function draftTopSleeve({ - // Uncomment below to destructure what you need - /* - * Content constructors - */ - //Path, // A Path constructor to create new paths - //Point, // A Point constructor to create new points - //Snippet, // A Snippet constructor to create new snippets - /* - * Content constainers - */ - //paths, // Add a Path to your part by adding it to this object - //points, // Add a Points to your part by adding it to this object - //snippets, // Add a Snippet to your part by adding it to this object - /* - * Access to settings - */ - //absoluteOptions, // Access to settings.absoluteOptions - //complete, // Access to settings.complete - //measurements, // Access to settings.measurements - //options, // Access to settings.options - //paperless, // Access to settings.paperless - //sa, // Access to settings.sa - //scale, // Access to settings.scale - /* - * Access to utilities - */ - //getId, //See the getId documentation - //hide, //See the hide documentation - //log, //See the logging documentation - //macro, //See the macros documentation - //setHidden, //See the setHidden documentation - //store, //See the store documentation - //unhide, //See the unhide documentation - //units, //See the units documentation - //utils, //See the utils documentation - /* - * Return value - */ - part, // Your draft method must return this -}) { - - // Work your magic here - - return part -} - -export const topSleeve = { - /* - * name: Holds the name of this part. - * - * We STRONGLY recommend naming your parts in the format of - * design.part to avoid naming conflicts when people re-use - * parts across designs. - */ - name: '{{ name }}.topSleeve', - /* - * draft: Holds the draft method for this part - * - * This should be a function that drafts and returns the part - * - * Documentation: https://freesewing.dev/reference/api/part/draft - */ - draft: draftTopSleeve, - after: [ - /* - * after: Holds a list of parts that should be drafted prior to this part. - * - * You'll need to import these parts, just as with the from key above. - * - * If you don't have any parts to draft prior to this part, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - ], - /* - * from: Holds the part you want to extend. - * - * Since you opted to extend Bent, and this is the topSleeve part, - * we're extending Bent's topSleeve part here. - * It was imported at the top of this file from @freesewing/bent - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - from: bentTopSleeve, - /* - * hide: Set this to true to hide a part. - * - * We've set this to false here to clarify its use. - * I you don't want to hide this part, - * you can remove the hide key entirely. - */ - hide: false, - /* - * hideDependecies: Set this to true to hide a part's dependencies. - * - * We've set this to true here since you're extending Bent's topSleeve part. - * I you don't want to hide this part's dependencies, - * you can remove the hideDependencies key entirely. - */ - hideDependencies: true, - /* - * hideAll: Set this to true to hide both the part and its dependencies. - * - * This is a combination of the hide and hideDependencies keys in case - * you want to both hide this part and its dependencies. - * We've included it here with a value of false to its use. - * I you don't want to hide this a part and its dependencies, - * you can remove the hideAll key entirely. - */ - hideAll: false, - options: { - /* - * options: Holds (the configuration of) options for this part - * - * Declare options used in this part here. - * You only need to add additional options. - * All options coming from Bent's topSleeve part are already loaded. - * - * If you don't have any options to add, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/options - */ - }, - measurements: [ - /* - * measurements: Holds a list of measurements required by this part. - * - * Declare measurements required by this part here. - * You only need to add additional measurements. - * All measurements coming from Bent's topSleeve part are already loaded. - * - * If you don't have any required measurements to add, - * you can remove this measurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - optionalMeasurements: [ - /* - * optionalMeasurements: Holds a list of measurements optional in this part. - * - * Declare measurements that are optional for this part here. - * - * If you don't have any optional measurements to add, - * you can remove this optionalMeasurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - plugins: [ - /* - * plugins: Holds a list of plugins this part relies on. - * - * Add all the plugins here that you need in this part. - * You only need to add additional plugins. - * All plugins coming from Bent's topSleeve part are already loaded. - * - * If you don't have any plugins to add, - * you can remove this plugins key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/plugins - */ - ] -} diff --git a/packages/new-design/templates/from-bent/design/src/undersleeve.mjs.mustache b/packages/new-design/templates/from-bent/design/src/undersleeve.mjs.mustache deleted file mode 100644 index 760f9023cfc..00000000000 --- a/packages/new-design/templates/from-bent/design/src/undersleeve.mjs.mustache +++ /dev/null @@ -1,169 +0,0 @@ -import { underSleeve as bentUnderSleeve } from '@freesewing/bent' - -function draftUnderSleeve({ - // Uncomment below to destructure what you need - /* - * Content constructors - */ - //Path, // A Path constructor to create new paths - //Point, // A Point constructor to create new points - //Snippet, // A Snippet constructor to create new snippets - /* - * Content constainers - */ - //paths, // Add a Path to your part by adding it to this object - //points, // Add a Points to your part by adding it to this object - //snippets, // Add a Snippet to your part by adding it to this object - /* - * Access to settings - */ - //absoluteOptions, // Access to settings.absoluteOptions - //complete, // Access to settings.complete - //measurements, // Access to settings.measurements - //options, // Access to settings.options - //paperless, // Access to settings.paperless - //sa, // Access to settings.sa - //scale, // Access to settings.scale - /* - * Access to utilities - */ - //getId, //See the getId documentation - //hide, //See the hide documentation - //log, //See the logging documentation - //macro, //See the macros documentation - //setHidden, //See the setHidden documentation - //store, //See the store documentation - //unhide, //See the unhide documentation - //units, //See the units documentation - //utils, //See the utils documentation - /* - * Return value - */ - part, // Your draft method must return this -}) { - - // Work your magic here - - return part -} - -export const underSleeve = { - /* - * name: Holds the name of this part. - * - * We STRONGLY recommend naming your parts in the format of - * design.part to avoid naming conflicts when people re-use - * parts across designs. - */ - name: '{{ name }}.underSleeve', - /* - * draft: Holds the draft method for this part - * - * This should be a function that drafts and returns the part - * - * Documentation: https://freesewing.dev/reference/api/part/draft - */ - draft: draftUnderSleeve, - after: [ - /* - * after: Holds a list of parts that should be drafted prior to this part. - * - * You'll need to import these parts, just as with the from key above. - * - * If you don't have any parts to draft prior to this part, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - ], - /* - * from: Holds the part you want to extend. - * - * Since you opted to extend Bent, and this is the underSleeve part, - * we're extending Bent's underSleeve part here. - * It was imported at the top of this file from @freesewing/bent - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - from: bentUnderSleeve, - /* - * hide: Set this to true to hide a part. - * - * We've set this to false here to clarify its use. - * I you don't want to hide this part, - * you can remove the hide key entirely. - */ - hide: false, - /* - * hideDependecies: Set this to true to hide a part's dependencies. - * - * We've set this to true here since you're extending Bent's underSleeve part. - * I you don't want to hide this part's dependencies, - * you can remove the hideDependencies key entirely. - */ - hideDependencies: true, - /* - * hideAll: Set this to true to hide both the part and its dependencies. - * - * This is a combination of the hide and hideDependencies keys in case - * you want to both hide this part and its dependencies. - * We've included it here with a value of false to its use. - * I you don't want to hide this a part and its dependencies, - * you can remove the hideAll key entirely. - */ - hideAll: false, - options: { - /* - * options: Holds (the configuration of) options for this part - * - * Declare options used in this part here. - * You only need to add additional options. - * All options coming from Bent's underSleeve part are already loaded. - * - * If you don't have any options to add, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/options - */ - }, - measurements: [ - /* - * measurements: Holds a list of measurements required by this part. - * - * Declare measurements required by this part here. - * You only need to add additional measurements. - * All measurements coming from Bent's underSleeve part are already loaded. - * - * If you don't have any required measurements to add, - * you can remove this measurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - optionalMeasurements: [ - /* - * optionalMeasurements: Holds a list of measurements optional in this part. - * - * Declare measurements that are optional for this part here. - * - * If you don't have any optional measurements to add, - * you can remove this optionalMeasurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - plugins: [ - /* - * plugins: Holds a list of plugins this part relies on. - * - * Add all the plugins here that you need in this part. - * You only need to add additional plugins. - * All plugins coming from Bent's underSleeve part are already loaded. - * - * If you don't have any plugins to add, - * you can remove this plugins key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/plugins - */ - ] -} diff --git a/packages/new-design/templates/from-bent/package.json.mustache b/packages/new-design/templates/from-bent/package.json.mustache deleted file mode 100644 index 40473cc5633..00000000000 --- a/packages/new-design/templates/from-bent/package.json.mustache +++ /dev/null @@ -1,100 +0,0 @@ -{ - "name": "@freesewing/{{name}}", - "version": "0.0.1", - "description": "A new FreeSewing design", - "author": "Joost De Cock (https://github.com/joostdecock)", - "homepage": "https://freesewing.org/", - "repository": "github:freesewing/freesewing", - "license": "MIT", - "bugs": { - "url": "https://github.com/freesewing/freesewing/issues" - }, - "funding": { - "type": "individual", - "url": "https://freesewing.org/patrons/join" - }, - "keywords": [ - "freesewing", - "design", - "diy", - "fashion", - "parametric design", - "sewing", - "sewing pattern" - ], - "main": "dist/index.js", - "module": "dist/index.mjs", - "scripts": { - "dev": "next dev -p 8000", - "build": "node build.js", - "clean": "rimraf dist", - "mbuild": "NO_MINIFY=1 node build.js", - "test": "BABEL_ENV=production npx mocha tests/*.test.mjs --require @babel/register", - "vbuild": "VERBOSE=1 node build.js" - }, - "dependencies": { - "@freesewing/core": "{{ tag }}", - "@freesewing/bent": "{{ tag }}", - "@freesewing/brian": "{{ tag }}", - "@freesewing/plugin-bundle": "{{ tag }}", - "@freesewing/plugin-bust": "{{ tag }}" - }, - "devDependencies": { - "@freesewing/plugin-svgattr": "{{ tag }}", - "@freesewing/plugin-theme": "{{ tag }}", - "@freesewing/plugin-i18n": "{{ tag }}", - "@freesewing/models": "{{ tag }}", - "@headlessui/react": "^1.6.5", - "js-yaml": "^4.1.0", - "file-saver": "^2.0.5", - "axios": "^0.27.2", - "pdfkit": "^0.13.0", - "svg-to-pdfkit": "^0.1.8", - "react": "^17.0.2", - "react-dom": "^17.0.2", - "react-sizeme": "^3.0.2", - "react-zoom-pan-pinch": "^2.1.3", - "react-markdown": "^8.0.3", - "roughjs": "^4.5.2", - "@tailwindcss/typography": "^0.5.2", - "d3-dispatch": "^3.0.1", - "d3-drag": "^3.0.0", - "d3-selection": "^3.0.0", - "daisyui": "^2.0.6", - "lodash.get": "^4.4.2", - "lodash.orderby": "^4.6.0", - "lodash.set": "^4.3.2", - "lodash.unset": "^4.5.2", - "lodash.clonedeep": "^4.5.0", - "next": "^12.3.2", - "next-i18next": "^11.0.0", - "react-copy-to-clipboard": "^5.0.4", - "react-hotkeys-hook": "^3.4.4", - "react-swipeable": "^6.2.0", - "react-timeago": "^6.2.1", - "mocha": "^9.1.1", - "chai": "^4.2.0", - "autoprefixer": "^10.4.0", - "eslint-config-next": "12.1.6", - "highlight.js": "^11.5.1", - "js-yaml": "^4.1.0", - "postcss": "^8.4.14", - "postcss-for": "^2.1.1", - "tailwindcss": "^3.1.3", - "tailwindcss-open-variant": "^1.0.0", - "web-worker": "^1.2.0" - }, - "files": [ - "dist/*", - "README.md", - "package.json" - ], - "publishConfig": { - "access": "public", - "tag": "next" - }, - "engines": { - "node": ">=14.0.0", - "npm": ">=6" - } -} diff --git a/packages/new-design/templates/from-breanna.mjs b/packages/new-design/templates/from-breanna.mjs new file mode 100644 index 00000000000..42d7f685fcc --- /dev/null +++ b/packages/new-design/templates/from-breanna.mjs @@ -0,0 +1,2 @@ +export const parts = ['back', 'front', 'sleeve'] +export const dependencies = ['@freesewing/breanna'] diff --git a/packages/new-design/templates/from-breanna/design/src/back.mjs.mustache b/packages/new-design/templates/from-breanna/design/src/back.mjs.mustache deleted file mode 100644 index 7e5f985a75b..00000000000 --- a/packages/new-design/templates/from-breanna/design/src/back.mjs.mustache +++ /dev/null @@ -1,169 +0,0 @@ -import { back as breannaBack } from '@freesewing/breanna' - -function draftBack({ - // Uncomment below to destructure what you need - /* - * Content constructors - */ - //Path, // A Path constructor to create new paths - //Point, // A Point constructor to create new points - //Snippet, // A Snippet constructor to create new snippets - /* - * Content constainers - */ - //paths, // Add a Path to your part by adding it to this object - //points, // Add a Points to your part by adding it to this object - //snippets, // Add a Snippet to your part by adding it to this object - /* - * Access to settings - */ - //absoluteOptions, // Access to settings.absoluteOptions - //complete, // Access to settings.complete - //measurements, // Access to settings.measurements - //options, // Access to settings.options - //paperless, // Access to settings.paperless - //sa, // Access to settings.sa - //scale, // Access to settings.scale - /* - * Access to utilities - */ - //getId, //See the getId documentation - //hide, //See the hide documentation - //log, //See the logging documentation - //macro, //See the macros documentation - //setHidden, //See the setHidden documentation - //store, //See the store documentation - //unhide, //See the unhide documentation - //units, //See the units documentation - //utils, //See the utils documentation - /* - * Return value - */ - part, // Your draft method must return this -}) { - - // Work your magic here - - return part -} - -export const back = { - /* - * name: Holds the name of this part. - * - * We STRONGLY recommend naming your parts in the format of - * design.part to avoid naming conflicts when people re-use - * parts across designs. - */ - name: '{{ name }}.back', - /* - * draft: Holds the draft method for this part - * - * This should be a function that drafts and returns the part - * - * Documentation: https://freesewing.dev/reference/api/part/draft - */ - draft: draftBack, - after: [ - /* - * after: Holds a list of parts that should be drafted prior to this part. - * - * You'll need to import these parts, just as with the from key above. - * - * If you don't have any parts to draft prior to this part, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - ], - /* - * from: Holds the part you want to extend. - * - * Since you opted to extend Breanna, and this is the back part, - * we're extending Breanna's back part here. - * It was imported at the top of this file from @freesewing/breanna - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - from: breannaBack, - /* - * hide: Set this to true to hide a part. - * - * We've set this to false here to clarify its use. - * I you don't want to hide this part, - * you can remove the hide key entirely. - */ - hide: false, - /* - * hideDependecies: Set this to true to hide a part's dependencies. - * - * We've set this to true here since you're extending Breanna's back part. - * I you don't want to hide this part's dependencies, - * you can remove the hideDependencies key entirely. - */ - hideDependencies: true, - /* - * hideAll: Set this to true to hide both the part and its dependencies. - * - * This is a combination of the hide and hideDependencies keys in case - * you want to both hide this part and its dependencies. - * We've included it here with a value of false to its use. - * I you don't want to hide this a part and its dependencies, - * you can remove the hideAll key entirely. - */ - hideAll: false, - options: { - /* - * options: Holds (the configuration of) options for this part - * - * Declare options used in this part here. - * You only need to add additional options. - * All options coming from Breanna's back part are already loaded. - * - * If you don't have any options to add, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/options - */ - }, - measurements: [ - /* - * measurements: Holds a list of measurements required by this part. - * - * Declare measurements required by this part here. - * You only need to add additional measurements. - * All measurements coming from Breanna's back part are already loaded. - * - * If you don't have any required measurements to add, - * you can remove this measurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - optionalMeasurements: [ - /* - * optionalMeasurements: Holds a list of measurements optional in this part. - * - * Declare measurements that are optional for this part here. - * - * If you don't have any optional measurements to add, - * you can remove this optionalMeasurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - plugins: [ - /* - * plugins: Holds a list of plugins this part relies on. - * - * Add all the plugins here that you need in this part. - * You only need to add additional plugins. - * All plugins coming from Breanna's back part are already loaded. - * - * If you don't have any plugins to add, - * you can remove this plugins key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/plugins - */ - ] -} diff --git a/packages/new-design/templates/from-breanna/design/src/front.mjs.mustache b/packages/new-design/templates/from-breanna/design/src/front.mjs.mustache deleted file mode 100644 index df66358ee01..00000000000 --- a/packages/new-design/templates/from-breanna/design/src/front.mjs.mustache +++ /dev/null @@ -1,169 +0,0 @@ -import { front as breannaFront } from '@freesewing/breanna' - -function draftFront({ - // Uncomment below to destructure what you need - /* - * Content constructors - */ - //Path, // A Path constructor to create new paths - //Point, // A Point constructor to create new points - //Snippet, // A Snippet constructor to create new snippets - /* - * Content constainers - */ - //paths, // Add a Path to your part by adding it to this object - //points, // Add a Points to your part by adding it to this object - //snippets, // Add a Snippet to your part by adding it to this object - /* - * Access to settings - */ - //absoluteOptions, // Access to settings.absoluteOptions - //complete, // Access to settings.complete - //measurements, // Access to settings.measurements - //options, // Access to settings.options - //paperless, // Access to settings.paperless - //sa, // Access to settings.sa - //scale, // Access to settings.scale - /* - * Access to utilities - */ - //getId, //See the getId documentation - //hide, //See the hide documentation - //log, //See the logging documentation - //macro, //See the macros documentation - //setHidden, //See the setHidden documentation - //store, //See the store documentation - //unhide, //See the unhide documentation - //units, //See the units documentation - //utils, //See the utils documentation - /* - * Return value - */ - part, // Your draft method must return this -}) { - - // Work your magic here - - return part -} - -export const front = { - /* - * name: Holds the name of this part. - * - * We STRONGLY recommend naming your parts in the format of - * design.part to avoid naming conflicts when people re-use - * parts across designs. - */ - name: '{{ name }}.front', - /* - * draft: Holds the draft method for this part - * - * This should be a function that drafts and returns the part - * - * Documentation: https://freesewing.dev/reference/api/part/draft - */ - draft: draftFront, - after: [ - /* - * after: Holds a list of parts that should be drafted prior to this part. - * - * You'll need to import these parts, just as with the from key above. - * - * If you don't have any parts to draft prior to this part, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - ], - /* - * from: Holds the part you want to extend. - * - * Since you opted to extend Breanna, and this is the front part, - * we're extending Breanna's front part here. - * It was imported at the top of this file from @freesewing/breanna - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - from: breannaFront, - /* - * hide: Set this to true to hide a part. - * - * We've set this to false here to clarify its use. - * I you don't want to hide this part, - * you can remove the hide key entirely. - */ - hide: false, - /* - * hideDependecies: Set this to true to hide a part's dependencies. - * - * We've set this to true here since you're extending Breanna's front part. - * I you don't want to hide this part's dependencies, - * you can remove the hideDependencies key entirely. - */ - hideDependencies: true, - /* - * hideAll: Set this to true to hide both the part and its dependencies. - * - * This is a combination of the hide and hideDependencies keys in case - * you want to both hide this part and its dependencies. - * We've included it here with a value of false to its use. - * I you don't want to hide this a part and its dependencies, - * you can remove the hideAll key entirely. - */ - hideAll: false, - options: { - /* - * options: Holds (the configuration of) options for this part - * - * Declare options used in this part here. - * You only need to add additional options. - * All options coming from Breanna's front part are already loaded. - * - * If you don't have any options to add, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/options - */ - }, - measurements: [ - /* - * measurements: Holds a list of measurements required by this part. - * - * Declare measurements required by this part here. - * You only need to add additional measurements. - * All measurements coming from Breanna's front part are already loaded. - * - * If you don't have any required measurements to add, - * you can remove this measurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - optionalMeasurements: [ - /* - * optionalMeasurements: Holds a list of measurements optional in this part. - * - * Declare measurements that are optional for this part here. - * - * If you don't have any optional measurements to add, - * you can remove this optionalMeasurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - plugins: [ - /* - * plugins: Holds a list of plugins this part relies on. - * - * Add all the plugins here that you need in this part. - * You only need to add additional plugins. - * All plugins coming from Breanna's front part are already loaded. - * - * If you don't have any plugins to add, - * you can remove this plugins key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/plugins - */ - ] -} diff --git a/packages/new-design/templates/from-breanna/design/src/index.mjs.mustache b/packages/new-design/templates/from-breanna/design/src/index.mjs.mustache deleted file mode 100644 index 076a0a0a6d0..00000000000 --- a/packages/new-design/templates/from-breanna/design/src/index.mjs.mustache +++ /dev/null @@ -1,31 +0,0 @@ -// Import Design constructor -import { Design } from '@freesewing/core' -// Import parts -import { back } from './back' -import { front } from './front' -import { sleeve } from './sleeve' - -// Create the new design -const Pattern = new Design({ - data: { - /* - * If you like, you can add any data you want to your design. - * We'll add the name here as an example. - * - * If you don't use this, - * you can remove this data key enterely. - */ - name: "{{ name }}", - }, - // A list of parts is all that is required. - parts: [ back, front, sleeve ], -}) - -/* - * Named exports - * - * We export the design itself as well as each part individually. - * This allows us to re-use these parts in other designs. - */ -export { back, front, sleeve, Pattern } - diff --git a/packages/new-design/templates/from-breanna/design/src/sleeve.mjs.mustache b/packages/new-design/templates/from-breanna/design/src/sleeve.mjs.mustache deleted file mode 100644 index ce151affdcf..00000000000 --- a/packages/new-design/templates/from-breanna/design/src/sleeve.mjs.mustache +++ /dev/null @@ -1,169 +0,0 @@ -import { sleeve as breannaSleeve } from '@freesewing/breanna' - -function draftSleeve({ - // Uncomment below to destructure what you need - /* - * Content constructors - */ - //Path, // A Path constructor to create new paths - //Point, // A Point constructor to create new points - //Snippet, // A Snippet constructor to create new snippets - /* - * Content constainers - */ - //paths, // Add a Path to your part by adding it to this object - //points, // Add a Points to your part by adding it to this object - //snippets, // Add a Snippet to your part by adding it to this object - /* - * Access to settings - */ - //absoluteOptions, // Access to settings.absoluteOptions - //complete, // Access to settings.complete - //measurements, // Access to settings.measurements - //options, // Access to settings.options - //paperless, // Access to settings.paperless - //sa, // Access to settings.sa - //scale, // Access to settings.scale - /* - * Access to utilities - */ - //getId, //See the getId documentation - //hide, //See the hide documentation - //log, //See the logging documentation - //macro, //See the macros documentation - //setHidden, //See the setHidden documentation - //store, //See the store documentation - //unhide, //See the unhide documentation - //units, //See the units documentation - //utils, //See the utils documentation - /* - * Return value - */ - part, // Your draft method must return this -}) { - - // Work your magic here - - return part -} - -export const sleeve = { - /* - * name: Holds the name of this part. - * - * We STRONGLY recommend naming your parts in the format of - * design.part to avoid naming conflicts when people re-use - * parts across designs. - */ - name: '{{ name }}.sleeve', - /* - * draft: Holds the draft method for this part - * - * This should be a function that drafts and returns the part - * - * Documentation: https://freesewing.dev/reference/api/part/draft - */ - draft: draftSleeve, - after: [ - /* - * after: Holds a list of parts that should be drafted prior to this part. - * - * You'll need to import these parts, just as with the from key above. - * - * If you don't have any parts to draft prior to this part, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - ], - /* - * from: Holds the part you want to extend. - * - * Since you opted to extend Breanna, and this is the sleeve part, - * we're extending Breanna's sleeve part here. - * It was imported at the top of this file from @freesewing/breanna - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - from: breannaSleeve, - /* - * hide: Set this to true to hide a part. - * - * We've set this to false here to clarify its use. - * I you don't want to hide this part, - * you can remove the hide key entirely. - */ - hide: false, - /* - * hideDependecies: Set this to true to hide a part's dependencies. - * - * We've set this to true here since you're extending Breanna's sleeve part. - * I you don't want to hide this part's dependencies, - * you can remove the hideDependencies key entirely. - */ - hideDependencies: true, - /* - * hideAll: Set this to true to hide both the part and its dependencies. - * - * This is a combination of the hide and hideDependencies keys in case - * you want to both hide this part and its dependencies. - * We've included it here with a value of false to its use. - * I you don't want to hide this a part and its dependencies, - * you can remove the hideAll key entirely. - */ - hideAll: false, - options: { - /* - * options: Holds (the configuration of) options for this part - * - * Declare options used in this part here. - * You only need to add additional options. - * All options coming from Breanna's sleeve part are already loaded. - * - * If you don't have any options to add, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/options - */ - }, - measurements: [ - /* - * measurements: Holds a list of measurements required by this part. - * - * Declare measurements required by this part here. - * You only need to add additional measurements. - * All measurements coming from Breanna's sleeve part are already loaded. - * - * If you don't have any required measurements to add, - * you can remove this measurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - optionalMeasurements: [ - /* - * optionalMeasurements: Holds a list of measurements optional in this part. - * - * Declare measurements that are optional for this part here. - * - * If you don't have any optional measurements to add, - * you can remove this optionalMeasurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - plugins: [ - /* - * plugins: Holds a list of plugins this part relies on. - * - * Add all the plugins here that you need in this part. - * You only need to add additional plugins. - * All plugins coming from Breanna's sleeve part are already loaded. - * - * If you don't have any plugins to add, - * you can remove this plugins key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/plugins - */ - ] -} diff --git a/packages/new-design/templates/from-brian.mjs b/packages/new-design/templates/from-brian.mjs new file mode 100644 index 00000000000..455c3e74c4d --- /dev/null +++ b/packages/new-design/templates/from-brian.mjs @@ -0,0 +1,2 @@ +export const parts = ['back', 'front', 'sleeve'] +export const dependencies = ['@freesewing/brian', '@freesewing/plugin-bust'] diff --git a/packages/new-design/templates/from-brian/design/src/back.mjs.mustache b/packages/new-design/templates/from-brian/design/src/back.mjs.mustache deleted file mode 100644 index 0d60a815435..00000000000 --- a/packages/new-design/templates/from-brian/design/src/back.mjs.mustache +++ /dev/null @@ -1,169 +0,0 @@ -import { back as brianBack } from '@freesewing/brian' - -function draftBack({ - // Uncomment below to destructure what you need - /* - * Content constructors - */ - //Path, // A Path constructor to create new paths - //Point, // A Point constructor to create new points - //Snippet, // A Snippet constructor to create new snippets - /* - * Content constainers - */ - //paths, // Add a Path to your part by adding it to this object - //points, // Add a Points to your part by adding it to this object - //snippets, // Add a Snippet to your part by adding it to this object - /* - * Access to settings - */ - //absoluteOptions, // Access to settings.absoluteOptions - //complete, // Access to settings.complete - //measurements, // Access to settings.measurements - //options, // Access to settings.options - //paperless, // Access to settings.paperless - //sa, // Access to settings.sa - //scale, // Access to settings.scale - /* - * Access to utilities - */ - //getId, //See the getId documentation - //hide, //See the hide documentation - //log, //See the logging documentation - //macro, //See the macros documentation - //setHidden, //See the setHidden documentation - //store, //See the store documentation - //unhide, //See the unhide documentation - //units, //See the units documentation - //utils, //See the utils documentation - /* - * Return value - */ - part, // Your draft method must return this -}) { - - // Work your magic here - - return part -} - -export const back = { - /* - * name: Holds the name of this part. - * - * We STRONGLY recommend naming your parts in the format of - * design.part to avoid naming conflicts when people re-use - * parts across designs. - */ - name: '{{ name }}.back', - /* - * draft: Holds the draft method for this part - * - * This should be a function that drafts and returns the part - * - * Documentation: https://freesewing.dev/reference/api/part/draft - */ - draft: draftBack, - after: [ - /* - * after: Holds a list of parts that should be drafted prior to this part. - * - * You'll need to import these parts, just as with the from key above. - * - * If you don't have any parts to draft prior to this part, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - ], - /* - * from: Holds the part you want to extend. - * - * Since you opted to extend brian, and this is the back part, - * we're extending brian's back part here. - * It was imported at the top of this file from @freesewing/brian - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - from: brianBack, - /* - * hide: Set this to true to hide a part. - * - * We've set this to false here to clarify its use. - * I you don't want to hide this part, - * you can remove the hide key entirely. - */ - hide: false, - /* - * hideDependecies: Set this to true to hide a part's dependencies. - * - * We've set this to true here since you're extending Brian's back part. - * I you don't want to hide this part's dependencies, - * you can remove the hideDependencies key entirely. - */ - hideDependencies: true, - /* - * hideAll: Set this to true to hide both the part and its dependencies. - * - * This is a combination of the hide and hideDependencies keys in case - * you want to both hide this part and its dependencies. - * We've included it here with a value of false to its use. - * I you don't want to hide this a part and its dependencies, - * you can remove the hideAll key entirely. - */ - hideAll: false, - options: { - /* - * options: Holds (the configuration of) options for this part - * - * Declare options used in this part here. - * You only need to add additional options. - * All options coming from Brian's back part are already loaded. - * - * If you don't have any options to add, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/options - */ - }, - measurements: [ - /* - * measurements: Holds a list of measurements required by this part. - * - * Declare measurements required by this part here. - * You only need to add additional measurements. - * All measurements coming from Brian's back part are already loaded. - * - * If you don't have any required measurements to add, - * you can remove this measurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - optionalMeasurements: [ - /* - * optionalMeasurements: Holds a list of measurements optional in this part. - * - * Declare measurements that are optional for this part here. - * - * If you don't have any optional measurements to add, - * you can remove this optionalMeasurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - plugins: [ - /* - * plugins: Holds a list of plugins this part relies on. - * - * Add all the plugins here that you need in this part. - * You only need to add additional plugins. - * All plugins coming from Brian's back part are already loaded. - * - * If you don't have any plugins to add, - * you can remove this plugins key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/plugins - */ - ] -} diff --git a/packages/new-design/templates/from-brian/design/src/front.mjs.mustache b/packages/new-design/templates/from-brian/design/src/front.mjs.mustache deleted file mode 100644 index b9627b54311..00000000000 --- a/packages/new-design/templates/from-brian/design/src/front.mjs.mustache +++ /dev/null @@ -1,169 +0,0 @@ -import { front as brianFront } from '@freesewing/brian' - -function draftFront({ - // Uncomment below to destructure what you need - /* - * Content constructors - */ - //Path, // A Path constructor to create new paths - //Point, // A Point constructor to create new points - //Snippet, // A Snippet constructor to create new snippets - /* - * Content constainers - */ - //paths, // Add a Path to your part by adding it to this object - //points, // Add a Points to your part by adding it to this object - //snippets, // Add a Snippet to your part by adding it to this object - /* - * Access to settings - */ - //absoluteOptions, // Access to settings.absoluteOptions - //complete, // Access to settings.complete - //measurements, // Access to settings.measurements - //options, // Access to settings.options - //paperless, // Access to settings.paperless - //sa, // Access to settings.sa - //scale, // Access to settings.scale - /* - * Access to utilities - */ - //getId, //See the getId documentation - //hide, //See the hide documentation - //log, //See the logging documentation - //macro, //See the macros documentation - //setHidden, //See the setHidden documentation - //store, //See the store documentation - //unhide, //See the unhide documentation - //units, //See the units documentation - //utils, //See the utils documentation - /* - * Return value - */ - part, // Your draft method must return this -}) { - - // Work your magic here - - return part -} - -export const front = { - /* - * name: Holds the name of this part. - * - * We STRONGLY recommend naming your parts in the format of - * design.part to avoid naming conflicts when people re-use - * parts across designs. - */ - name: '{{ name }}.front', - /* - * draft: Holds the draft method for this part - * - * This should be a function that drafts and returns the part - * - * Documentation: https://freesewing.dev/reference/api/part/draft - */ - draft: draftFront, - after: [ - /* - * after: Holds a list of parts that should be drafted prior to this part. - * - * You'll need to import these parts, just as with the from key above. - * - * If you don't have any parts to draft prior to this part, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - ], - /* - * from: Holds the part you want to extend. - * - * Since you opted to extend Brian, and this is the front part, - * we're extending Brian's front part here. - * It was imported at the top of this file from @freesewing/brian - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - from: brianFront, - /* - * hide: Set this to true to hide a part. - * - * We've set this to false here to clarify its use. - * I you don't want to hide this part, - * you can remove the hide key entirely. - */ - hide: false, - /* - * hideDependecies: Set this to true to hide a part's dependencies. - * - * We've set this to true here since you're extending Brian's front part. - * I you don't want to hide this part's dependencies, - * you can remove the hideDependencies key entirely. - */ - hideDependencies: true, - /* - * hideAll: Set this to true to hide both the part and its dependencies. - * - * This is a combination of the hide and hideDependencies keys in case - * you want to both hide this part and its dependencies. - * We've included it here with a value of false to its use. - * I you don't want to hide this a part and its dependencies, - * you can remove the hideAll key entirely. - */ - hideAll: false, - options: { - /* - * options: Holds (the configuration of) options for this part - * - * Declare options used in this part here. - * You only need to add additional options. - * All options coming from Brian's front part are already loaded. - * - * If you don't have any options to add, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/options - */ - }, - measurements: [ - /* - * measurements: Holds a list of measurements required by this part. - * - * Declare measurements required by this part here. - * You only need to add additional measurements. - * All measurements coming from Brian's front part are already loaded. - * - * If you don't have any required measurements to add, - * you can remove this measurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - optionalMeasurements: [ - /* - * optionalMeasurements: Holds a list of measurements optional in this part. - * - * Declare measurements that are optional for this part here. - * - * If you don't have any optional measurements to add, - * you can remove this optionalMeasurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - plugins: [ - /* - * plugins: Holds a list of plugins this part relies on. - * - * Add all the plugins here that you need in this part. - * You only need to add additional plugins. - * All plugins coming from Brian's front part are already loaded. - * - * If you don't have any plugins to add, - * you can remove this plugins key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/plugins - */ - ] -} diff --git a/packages/new-design/templates/from-brian/design/src/index.mjs.mustache b/packages/new-design/templates/from-brian/design/src/index.mjs.mustache deleted file mode 100644 index 076a0a0a6d0..00000000000 --- a/packages/new-design/templates/from-brian/design/src/index.mjs.mustache +++ /dev/null @@ -1,31 +0,0 @@ -// Import Design constructor -import { Design } from '@freesewing/core' -// Import parts -import { back } from './back' -import { front } from './front' -import { sleeve } from './sleeve' - -// Create the new design -const Pattern = new Design({ - data: { - /* - * If you like, you can add any data you want to your design. - * We'll add the name here as an example. - * - * If you don't use this, - * you can remove this data key enterely. - */ - name: "{{ name }}", - }, - // A list of parts is all that is required. - parts: [ back, front, sleeve ], -}) - -/* - * Named exports - * - * We export the design itself as well as each part individually. - * This allows us to re-use these parts in other designs. - */ -export { back, front, sleeve, Pattern } - diff --git a/packages/new-design/templates/from-brian/design/src/sleeve.mjs.mustache b/packages/new-design/templates/from-brian/design/src/sleeve.mjs.mustache deleted file mode 100644 index 56492aa691b..00000000000 --- a/packages/new-design/templates/from-brian/design/src/sleeve.mjs.mustache +++ /dev/null @@ -1,169 +0,0 @@ -import { sleeve as brianSleeve } from '@freesewing/brian' - -function draftSleeve({ - // Uncomment below to destructure what you need - /* - * Content constructors - */ - //Path, // A Path constructor to create new paths - //Point, // A Point constructor to create new points - //Snippet, // A Snippet constructor to create new snippets - /* - * Content constainers - */ - //paths, // Add a Path to your part by adding it to this object - //points, // Add a Points to your part by adding it to this object - //snippets, // Add a Snippet to your part by adding it to this object - /* - * Access to settings - */ - //absoluteOptions, // Access to settings.absoluteOptions - //complete, // Access to settings.complete - //measurements, // Access to settings.measurements - //options, // Access to settings.options - //paperless, // Access to settings.paperless - //sa, // Access to settings.sa - //scale, // Access to settings.scale - /* - * Access to utilities - */ - //getId, //See the getId documentation - //hide, //See the hide documentation - //log, //See the logging documentation - //macro, //See the macros documentation - //setHidden, //See the setHidden documentation - //store, //See the store documentation - //unhide, //See the unhide documentation - //units, //See the units documentation - //utils, //See the utils documentation - /* - * Return value - */ - part, // Your draft method must return this -}) { - - // Work your magic here - - return part -} - -export const sleeve = { - /* - * name: Holds the name of this part. - * - * We STRONGLY recommend naming your parts in the format of - * design.part to avoid naming conflicts when people re-use - * parts across designs. - */ - name: '{{ name }}.sleeve', - /* - * draft: Holds the draft method for this part - * - * This should be a function that drafts and returns the part - * - * Documentation: https://freesewing.dev/reference/api/part/draft - */ - draft: draftSleeve, - after: [ - /* - * after: Holds a list of parts that should be drafted prior to this part. - * - * You'll need to import these parts, just as with the from key above. - * - * If you don't have any parts to draft prior to this part, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - ], - /* - * from: Holds the part you want to extend. - * - * Since you opted to extend brian, and this is the sleeve part, - * we're extending brian's sleeve part here. - * It was imported at the top of this file from @freesewing/brian - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - from: brianSleeve, - /* - * hide: Set this to true to hide a part. - * - * We've set this to false here to clarify its use. - * I you don't want to hide this part, - * you can remove the hide key entirely. - */ - hide: false, - /* - * hideDependecies: Set this to true to hide a part's dependencies. - * - * We've set this to true here since you're extending Brian's sleeve part. - * I you don't want to hide this part's dependencies, - * you can remove the hideDependencies key entirely. - */ - hideDependencies: true, - /* - * hideAll: Set this to true to hide both the part and its dependencies. - * - * This is a combination of the hide and hideDependencies keys in case - * you want to both hide this part and its dependencies. - * We've included it here with a value of false to its use. - * I you don't want to hide this a part and its dependencies, - * you can remove the hideAll key entirely. - */ - hideAll: false, - options: { - /* - * options: Holds (the configuration of) options for this part - * - * Declare options used in this part here. - * You only need to add additional options. - * All options coming from Brian's sleeve part are already loaded. - * - * If you don't have any options to add, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/options - */ - }, - measurements: [ - /* - * measurements: Holds a list of measurements required by this part. - * - * Declare measurements required by this part here. - * You only need to add additional measurements. - * All measurements coming from Brian's sleeve part are already loaded. - * - * If you don't have any required measurements to add, - * you can remove this measurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - optionalMeasurements: [ - /* - * optionalMeasurements: Holds a list of measurements optional in this part. - * - * Declare measurements that are optional for this part here. - * - * If you don't have any optional measurements to add, - * you can remove this optionalMeasurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - plugins: [ - /* - * plugins: Holds a list of plugins this part relies on. - * - * Add all the plugins here that you need in this part. - * You only need to add additional plugins. - * All plugins coming from Brian's sleeve part are already loaded. - * - * If you don't have any plugins to add, - * you can remove this plugins key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/plugins - */ - ] -} diff --git a/packages/new-design/templates/from-brian/package.json.mustache b/packages/new-design/templates/from-brian/package.json.mustache deleted file mode 100644 index 638cf1e93d4..00000000000 --- a/packages/new-design/templates/from-brian/package.json.mustache +++ /dev/null @@ -1,98 +0,0 @@ -{ - "name": "@freesewing/{{name}}", - "version": "0.0.1", - "description": "A new FreeSewing design", - "author": "Joost De Cock (https://github.com/joostdecock)", - "homepage": "https://freesewing.org/", - "repository": "github:freesewing/freesewing", - "license": "MIT", - "bugs": { - "url": "https://github.com/freesewing/freesewing/issues" - }, - "funding": { - "type": "individual", - "url": "https://freesewing.org/patrons/join" - }, - "keywords": [ - "freesewing", - "design", - "diy", - "fashion", - "parametric design", - "sewing", - "sewing pattern" - ], - "main": "dist/index.js", - "module": "dist/index.mjs", - "scripts": { - "dev": "next dev -p 8000", - "build": "node build.js", - "clean": "rimraf dist", - "mbuild": "NO_MINIFY=1 node build.js", - "test": "BABEL_ENV=production npx mocha tests/*.test.mjs --require @babel/register", - "vbuild": "VERBOSE=1 node build.js" - }, - "dependencies": { - "@freesewing/core": "{{ tag }}", - "@freesewing/brian": "{{ tag }}", - "@freesewing/plugin-bundle": "{{ tag }}", - "@freesewing/plugin-bust": "{{ tag }}" - }, - "devDependencies": { - "@freesewing/plugin-svgattr": "{{ tag }}", - "@freesewing/plugin-theme": "{{ tag }}", - "@freesewing/plugin-i18n": "{{ tag }}", - "@freesewing/models": "{{ tag }}", - "@headlessui/react": "^1.6.5", - "js-yaml": "^4.1.0", - "file-saver": "^2.0.5", - "axios": "^0.27.2", - "react": "^17.0.2", - "react-dom": "^17.0.2", - "react-sizeme": "^3.0.2", - "react-zoom-pan-pinch": "^2.1.3", - "react-markdown": "^8.0.3", - "@tailwindcss/typography": "^0.5.2", - "d3-dispatch": "^3.0.1", - "d3-drag": "^3.0.0", - "d3-selection": "^3.0.0", - "daisyui": "^2.0.6", - "lodash.get": "^4.4.2", - "lodash.orderby": "^4.6.0", - "lodash.set": "^4.3.2", - "lodash.unset": "^4.5.2", - "lodash.clonedeep": "^4.5.0", - "next": "^12.3.2", - "next-i18next": "^11.0.0", - "react-copy-to-clipboard": "^5.0.4", - "react-hotkeys-hook": "^3.4.4", - "react-swipeable": "^6.2.0", - "react-timeago": "^6.2.1", - "mocha": "^9.1.1", - "chai": "^4.2.0", - "autoprefixer": "^10.4.0", - "eslint-config-next": "12.1.6", - "highlight.js": "^11.5.1", - "js-yaml": "^4.1.0", - "pdfkit": "^0.13.0", - "svg-to-pdfkit": "^0.1.8", - "postcss-for": "^2.1.1", - "postcss": "^8.4.14", - "tailwindcss": "^3.1.3", - "tailwindcss-open-variant": "^1.0.0", - "web-worker": "^1.2.0" - }, - "files": [ - "dist/*", - "README.md", - "package.json" - ], - "publishConfig": { - "access": "public", - "tag": "next" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=6" - } -} diff --git a/packages/new-design/templates/from-titan.mjs b/packages/new-design/templates/from-titan.mjs new file mode 100644 index 00000000000..ebe83e7c2c2 --- /dev/null +++ b/packages/new-design/templates/from-titan.mjs @@ -0,0 +1,2 @@ +export const parts = ['back', 'front'] +export const dependencies = ['@freesewing/titan', '@freesewing/snapseries'] diff --git a/packages/new-design/templates/from-titan/design/src/back.mjs.mustache b/packages/new-design/templates/from-titan/design/src/back.mjs.mustache deleted file mode 100644 index 5e399e6b312..00000000000 --- a/packages/new-design/templates/from-titan/design/src/back.mjs.mustache +++ /dev/null @@ -1,155 +0,0 @@ -import { back as titanBack } from '@freesewing/titan' - -function draftBack({ - // Uncomment below to destructure what you need - /* - * Content constructors - */ - //Path, // A Path constructor to create new paths - //Point, // A Point constructor to create new points - //Snippet, // A Snippet constructor to create new snippets - /* - * Content constainers - */ - //paths, // Add a Path to your part by adding it to this object - //points, // Add a Points to your part by adding it to this object - //snippets, // Add a Snippet to your part by adding it to this object - /* - * Access to settings - */ - //absoluteOptions, // Access to settings.absoluteOptions - //complete, // Access to settings.complete - //measurements, // Access to settings.measurements - //options, // Access to settings.options - //paperless, // Access to settings.paperless - //sa, // Access to settings.sa - //scale, // Access to settings.scale - /* - * Access to utilities - */ - //getId, //See the getId documentation - //hide, //See the hide documentation - //log, //See the logging documentation - //macro, //See the macros documentation - //setHidden, //See the setHidden documentation - //store, //See the store documentation - //unhide, //See the unhide documentation - //units, //See the units documentation - //utils, //See the utils documentation - /* - * Return value - */ - part, // Your draft method must return this -}) { - - // Work your magic here - - return part -} - -export const back = { - /* - * name: Holds the name of this part. - * - * We STRONGLY recommend naming your parts in the format of - * design.part to avoid naming conflicts when people re-use - * parts across designs. - */ - name: '{{ name }}.back', - /* - * draft: Holds the draft method for this part - * - * This should be a function that drafts and returns the part - * - * Documentation: https://freesewing.dev/reference/api/part/draft - */ - draft: draftBack, - after: [ - /* - * after: Holds a list of parts that should be drafted prior to this part. - * - * You'll need to import these parts, just as with the from key above. - * - * If you don't have any parts to draft prior to this part, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - ], - /* - * from: Holds the part you want to extend. - * - * Since you opted to extend Titan, and this is the back part, - * we're extending Titan's back part here. - * It was imported at the top of this file from @freesewing/titan - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - from: titanBack, - /* - * hide: Set this to true to hide a part. - * - * We've set this to false here to clarify its use. - * I you don't want to hide this part, - * you can remove the hide key entirely. - */ - hide: false, - /* - * hideDependecies: Set this to true to hide a part's dependencies. - * - * We've set this to true here since you're extending Titan's back part. - * I you don't want to hide this part's dependencies, - * you can remove the hideDependencies key entirely. - */ - hideDependencies: true, - /* - * hideAll: Set this to true to hide both the part and its dependencies. - * - * This is a combination of the hide and hideDependencies keys in case - * you want to both hide this part and its dependencies. - * We've included it here with a value of false to its use. - * I you don't want to hide this a part and its dependencies, - * you can remove the hideAll key entirely. - */ - hideAll: false, - options: { - /* - * options: Holds (the configuration of) options for this part - * - * Declare options used in this part here. - * You only need to add additional options. - * All options coming from Titan's back part are already loaded. - * - * If you don't have any options to add, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/options - */ - }, - measurements: [ - /* - * measurements: Holds a list of measurements required by this part. - * - * Declare measurements required by this part here. - * You only need to add additional measurements. - * All measurements coming from Titan's back part are already loaded. - * - * If you don't have any required measurements to add, - * you can remove this measurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - optionalMeasurements: [ - /* - * optionalMeasurements: Holds a list of measurements optional in this part. - * - * Declare measurements that are optional for this part here. - * - * If you don't have any optional measurements to add, - * you can remove this optionalMeasurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], -} diff --git a/packages/new-design/templates/from-titan/design/src/front.mjs.mustache b/packages/new-design/templates/from-titan/design/src/front.mjs.mustache deleted file mode 100644 index ef06d4117dc..00000000000 --- a/packages/new-design/templates/from-titan/design/src/front.mjs.mustache +++ /dev/null @@ -1,155 +0,0 @@ -import { front as titanFront } from '@freesewing/titan' - -function draftFront({ - // Uncomment below to destructure what you need - /* - * Content constructors - */ - //Path, // A Path constructor to create new paths - //Point, // A Point constructor to create new points - //Snippet, // A Snippet constructor to create new snippets - /* - * Content constainers - */ - //paths, // Add a Path to your part by adding it to this object - //points, // Add a Points to your part by adding it to this object - //snippets, // Add a Snippet to your part by adding it to this object - /* - * Access to settings - */ - //absoluteOptions, // Access to settings.absoluteOptions - //complete, // Access to settings.complete - //measurements, // Access to settings.measurements - //options, // Access to settings.options - //paperless, // Access to settings.paperless - //sa, // Access to settings.sa - //scale, // Access to settings.scale - /* - * Access to utilities - */ - //getId, //See the getId documentation - //hide, //See the hide documentation - //log, //See the logging documentation - //macro, //See the macros documentation - //setHidden, //See the setHidden documentation - //store, //See the store documentation - //unhide, //See the unhide documentation - //units, //See the units documentation - //utils, //See the utils documentation - /* - * Return value - */ - part, // Your draft method must return this -}) { - - // Work your magic here - - return part -} - -export const front = { - /* - * name: Holds the name of this part. - * - * We STRONGLY recommend naming your parts in the format of - * design.part to avoid naming conflicts when people re-use - * parts across designs. - */ - name: '{{ name }}.front', - /* - * draft: Holds the draft method for this part - * - * This should be a function that drafts and returns the part - * - * Documentation: https://freesewing.dev/reference/api/part/draft - */ - draft: draftFront, - after: [ - /* - * after: Holds a list of parts that should be drafted prior to this part. - * - * You'll need to import these parts, just as with the from key above. - * - * If you don't have any parts to draft prior to this part, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - ], - /* - * from: Holds the part you want to extend. - * - * Since you opted to extend titan, and this is the front part, - * we're extending titan's front part here. - * It was imported at the top of this file from @freesewing/titan - * - * Documentation: https://freesewing.dev/reference/api/part/config/dependencies - */ - from: titanFront, - /* - * hide: Set this to true to hide a part. - * - * We've set this to false here to clarify its use. - * I you don't want to hide this part, - * you can remove the hide key entirely. - */ - hide: false, - /* - * hideDependecies: Set this to true to hide a part's dependencies. - * - * We've set this to true here since you're extending Titan's front part. - * I you don't want to hide this part's dependencies, - * you can remove the hideDependencies key entirely. - */ - hideDependencies: true, - /* - * hideAll: Set this to true to hide both the part and its dependencies. - * - * This is a combination of the hide and hideDependencies keys in case - * you want to both hide this part and its dependencies. - * We've included it here with a value of false to its use. - * I you don't want to hide this a part and its dependencies, - * you can remove the hideAll key entirely. - */ - hideAll: false, - options: { - /* - * options: Holds (the configuration of) options for this part - * - * Declare options used in this part here. - * You only need to add additional options. - * All options coming from Titan's front part are already loaded. - * - * If you don't have any options to add, - * you can remove this options key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/options - */ - }, - measurements: [ - /* - * measurements: Holds a list of measurements required by this part. - * - * Declare measurements required by this part here. - * You only need to add additional measurements. - * All measurements coming from Titan's front part are already loaded. - * - * If you don't have any required measurements to add, - * you can remove this measurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], - optionalMeasurements: [ - /* - * optionalMeasurements: Holds a list of measurements optional in this part. - * - * Declare measurements that are optional for this part here. - * - * If you don't have any optional measurements to add, - * you can remove this optionalMeasurements key entirely. - * - * Documentation: https://freesewing.dev/reference/api/part/config/measurements - */ - ], -} diff --git a/packages/new-design/templates/from-titan/package.json.mustache b/packages/new-design/templates/from-titan/package.json.mustache deleted file mode 100644 index 120ab433610..00000000000 --- a/packages/new-design/templates/from-titan/package.json.mustache +++ /dev/null @@ -1,99 +0,0 @@ -{ - "name": "@freesewing/{{name}}", - "version": "0.0.1", - "description": "A new FreeSewing design", - "author": "Joost De Cock (https://github.com/joostdecock)", - "homepage": "https://freesewing.org/", - "repository": "github:freesewing/freesewing", - "license": "MIT", - "bugs": { - "url": "https://github.com/freesewing/freesewing/issues" - }, - "funding": { - "type": "individual", - "url": "https://freesewing.org/patrons/join" - }, - "keywords": [ - "freesewing", - "design", - "diy", - "fashion", - "parametric design", - "sewing", - "sewing pattern" - ], - "main": "dist/index.js", - "module": "dist/index.mjs", - "scripts": { - "dev": "next dev -p 8000", - "build": "node build.js", - "clean": "rimraf dist", - "mbuild": "NO_MINIFY=1 node build.js", - "test": "BABEL_ENV=production npx mocha tests/*.test.mjs --require @babel/register", - "vbuild": "VERBOSE=1 node build.js" - }, - "dependencies": { - "@freesewing/core": "{{ tag }}", - "@freesewing/titan": "{{ tag }}", - "@freesewing/snapseries": "{{ tag }}", - "@freesewing/plugin-bundle": "{{ tag }}" - }, - "devDependencies": { - "@freesewing/plugin-svgattr": "{{ tag }}", - "@freesewing/plugin-theme": "{{ tag }}", - "@freesewing/plugin-i18n": "{{ tag }}", - "@freesewing/models": "{{ tag }}", - "@headlessui/react": "^1.6.5", - "js-yaml": "^4.1.0", - "file-saver": "^2.0.5", - "axios": "^0.27.2", - "react": "^17.0.2", - "svg-to-pdfkit": "^0.1.8", - "react-dom": "^17.0.2", - "pdfkit": "^0.13.0", - "react-sizeme": "^3.0.2", - "react-zoom-pan-pinch": "^2.1.3", - "react-markdown": "^8.0.3", - "roughjs": "^4.5.2", - "@tailwindcss/typography": "^0.5.2", - "d3-dispatch": "^3.0.1", - "d3-drag": "^3.0.0", - "d3-selection": "^3.0.0", - "daisyui": "^2.0.6", - "lodash.get": "^4.4.2", - "lodash.orderby": "^4.6.0", - "lodash.set": "^4.3.2", - "lodash.unset": "^4.5.2", - "lodash.clonedeep": "^4.5.0", - "next": "^12.3.2", - "next-i18next": "^11.0.0", - "react-copy-to-clipboard": "^5.0.4", - "react-hotkeys-hook": "^3.4.4", - "react-swipeable": "^6.2.0", - "react-timeago": "^6.2.1", - "mocha": "^9.1.1", - "chai": "^4.2.0", - "autoprefixer": "^10.4.0", - "eslint-config-next": "12.1.6", - "highlight.js": "^11.5.1", - "js-yaml": "^4.1.0", - "postcss": "^8.4.14", - "postcss-for": "^2.1.1", - "tailwindcss": "^3.1.3", - "tailwindcss-open-variant": "^1.0.0", - "web-worker": "^1.2.0" - }, - "files": [ - "dist/*", - "README.md", - "package.json" - ], - "publishConfig": { - "access": "public", - "tag": "next" - }, - "engines": { - "node": ">=14.0.0", - "npm": ">=6" - } -} diff --git a/packages/new-design/templates/from-titan/design/src/index.mjs.mustache b/packages/new-design/templates/shared/index.mjs.mustache similarity index 82% rename from packages/new-design/templates/from-titan/design/src/index.mjs.mustache rename to packages/new-design/templates/shared/index.mjs.mustache index e628e6e7c1a..cd431bd9efe 100644 --- a/packages/new-design/templates/from-titan/design/src/index.mjs.mustache +++ b/packages/new-design/templates/shared/index.mjs.mustache @@ -1,8 +1,9 @@ // Import Design constructor import { Design } from '@freesewing/core' // Import parts -import { back } from './back' -import { front } from './front' +{{#parts}} +import { {{.}} } from './{{.}}.mjs' +{{/parts}} // Create the new design const Pattern = new Design({ @@ -17,7 +18,7 @@ const Pattern = new Design({ name: "{{ name }}", }, // A list of parts is all that is required. - parts: [ back, front ], + parts: [ {{parts}} ], }) /* @@ -26,5 +27,5 @@ const Pattern = new Design({ * We export the design itself as well as each part individually. * This allows us to re-use these parts in other designs. */ -export { back, front, Pattern } +export { {{#parts}}{{.}}, {{/parts}}Pattern } diff --git a/packages/new-design/templates/from-bella/design/src/back.mjs.mustache b/packages/new-design/templates/shared/inherited-part.mjs.mustache similarity index 85% rename from packages/new-design/templates/from-bella/design/src/back.mjs.mustache rename to packages/new-design/templates/shared/inherited-part.mjs.mustache index 2cf19be91c0..4d3ca4ed113 100644 --- a/packages/new-design/templates/from-bella/design/src/back.mjs.mustache +++ b/packages/new-design/templates/shared/inherited-part.mjs.mustache @@ -1,6 +1,6 @@ -import { back as bellaBack } from '@freesewing/bella' +import { {{part}} as {{baseName}}{{partUpcase}} } from '@freesewing/{{baseName}}' -function draftBack({ +function draft{{partUpcase}} ({ // Uncomment below to destructure what you need /* * Content constructors @@ -47,7 +47,7 @@ function draftBack({ return part } -export const back = { +export const {{part}} = { /* * name: Holds the name of this part. * @@ -55,7 +55,7 @@ export const back = { * design.part to avoid naming conflicts when people re-use * parts across designs. */ - name: '{{ name }}.back', + name: '{{ name }}.{{part}}', /* * draft: Holds the draft method for this part * @@ -63,7 +63,7 @@ export const back = { * * Documentation: https://freesewing.dev/reference/api/part/draft */ - draft: draftBack, + draft: draft{{partUpcase}}, after: [ /* * after: Holds a list of parts that should be drafted prior to this part. @@ -79,13 +79,13 @@ export const back = { /* * from: Holds the part you want to extend. * - * Since you opted to extend Bella, and this is the back part, - * we're extending Bella's back part here. - * It was imported at the top of this file from @freesewing/Bella + * Since you opted to extend {{baseNameUpcase}}, and this is the {{part}} part, + * we're extending {{baseNameUpcase}}'s {{part}} part here. + * It was imported at the top of this file from @freesewing/{{baseNameUpcase}} * * Documentation: https://freesewing.dev/reference/api/part/config/dependencies */ - from: bellaBack, + from: {{baseName}}{{partUpcase}}, /* * hide: Set this to true to hide a part. * @@ -97,7 +97,7 @@ export const back = { /* * hideDependecies: Set this to true to hide a part's dependencies. * - * We've set this to true here since you're extending Bella's back part. + * We've set this to true here since you're extending {{baseNameUpcase}}'s {{part}} part. * I you don't want to hide this part's dependencies, * you can remove the hideDependencies key entirely. */ @@ -118,7 +118,7 @@ export const back = { * * Declare options used in this part here. * You only need to add additional options. - * All options coming from Bella's back part are already loaded. + * All options coming from {{baseNameUpcase}}'s {{part}} part are already loaded. * * If you don't have any options to add, * you can remove this options key entirely. @@ -132,7 +132,7 @@ export const back = { * * Declare measurements required by this part here. * You only need to add additional measurements. - * All measurements coming from Bella's back part are already loaded. + * All measurements coming from {{baseNameUpcase}}'s {{part}} part are already loaded. * * If you don't have any required measurements to add, * you can remove this measurements key entirely. @@ -158,7 +158,7 @@ export const back = { * * Add all the plugins here that you need in this part. * You only need to add additional plugins. - * All plugins coming from Bella's back part are already loaded. + * All plugins coming from {{baseNameUpcase}}'s {{part}} part are already loaded. * * If you don't have any plugins to add, * you can remove this plugins key entirely. diff --git a/packages/new-design/templates/from-breanna/package.json.mustache b/packages/new-design/templates/shared/package.json.mustache similarity index 97% rename from packages/new-design/templates/from-breanna/package.json.mustache rename to packages/new-design/templates/shared/package.json.mustache index f8435503eb6..e1cbe380584 100644 --- a/packages/new-design/templates/from-breanna/package.json.mustache +++ b/packages/new-design/templates/shared/package.json.mustache @@ -34,7 +34,9 @@ }, "dependencies": { "@freesewing/core": "{{ tag }}", - "@freesewing/breanna": "{{ tag }}", + {{#dependencies}} + "{{{.}}}": "{{tag}}", + {{/dependencies}} "@freesewing/plugin-bundle": "{{ tag }}" }, "devDependencies": { @@ -46,8 +48,6 @@ "js-yaml": "^4.1.0", "file-saver": "^2.0.5", "axios": "^0.27.2", - "pdfkit": "^0.13.0", - "svg-to-pdfkit": "^0.1.8", "react": "^17.0.2", "react-dom": "^17.0.2", "react-sizeme": "^3.0.2", @@ -66,6 +66,7 @@ "lodash.clonedeep": "^4.5.0", "next": "^12.3.2", "next-i18next": "^11.0.0", + "pdfkit": "^0.13.0", "react-copy-to-clipboard": "^5.0.4", "react-hotkeys-hook": "^3.4.4", "react-swipeable": "^6.2.0", @@ -78,6 +79,7 @@ "js-yaml": "^4.1.0", "postcss": "^8.4.14", "postcss-for": "^2.1.1", + "svg-to-pdfkit": "^0.1.8", "tailwindcss": "^3.1.3", "tailwindcss-open-variant": "^1.0.0", "web-worker": "^1.2.0"