1
0
Fork 0

style(new-design): Export $$Name$$ instead of Pattern

This commit is contained in:
Nikhil Chelliah 2022-10-14 17:40:11 -04:00
parent 49e4496e4b
commit f8b156d066
11 changed files with 76 additions and 26 deletions

View file

@ -9,6 +9,7 @@ import { oraPromise } from 'ora'
import { execa } from 'execa'
import axios from 'axios'
import { fileURLToPath } from 'url'
import { capitalize } from '@freesewing/core'
// Current working directory
let filename
@ -286,6 +287,7 @@ export const createEnvironment = async (choices) => {
// Copy/Template files
try {
const templateVars = {
Name: capitalize(choices.name),
name: choices.name,
tag: config.tag,
}

View file

@ -28,6 +28,7 @@
},
"peerDependencies": {},
"dependencies": {
"@freesewing/core": "^3.0.0-alpha.2",
"axios": "^1.1.2",
"chalk": "^5.0.1",
"execa": "^6.1.0",

View file

@ -1,4 +1,10 @@
import { Pattern } from 'design/src/index.mjs'
//{{!
// Change the Mustache delimiter from double curly braces to double dollar signs.
// Dollar signs are allowed in EcmaScript identifier names,
// which is helpful when running unrendered Mustache templates through eslint.
//}}{{=$$ $$=}}
import { $$Name$$ } from 'design/src/index.mjs'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import Page from 'site/components/wrappers/page.js'
@ -11,7 +17,7 @@ const WorkbenchPage = (props) => {
return (
<Page app={app}>
<WorkbenchWrapper {...{ app, design: Pattern, layout: Layout }} />
<WorkbenchWrapper {...{ app, design: $$Name$$, layout: Layout }} />
</Page>
)
}

View file

@ -1,3 +1,9 @@
//{{!
// Change the Mustache delimiter from double curly braces to double dollar signs.
// Dollar signs are allowed in EcmaScript identifier names,
// which is helpful when running unrendered Mustache templates through eslint.
//}}{{=$$ $$=}}
// Import Design constructor
import { Design } from '@freesewing/core'
// Import parts
@ -5,7 +11,7 @@ import { back } from './back'
import { front } from './front'
// Create the new design
const Pattern = new Design({
const $$Name$$ = new Design({
data: {
/*
* If you like, you can add any data you want to your design.
@ -14,7 +20,7 @@ const Pattern = new Design({
* If you don't use this,
* you can remove this data key enterely.
*/
name: "{{ name }}",
name: "$$ name $$",
},
// A list of parts is all that is required.
parts: [ back, front ],
@ -26,5 +32,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 { back, front, $$Name$$ }

View file

@ -1,3 +1,9 @@
//{{!
// Change the Mustache delimiter from double curly braces to double dollar signs.
// Dollar signs are allowed in EcmaScript identifier names,
// which is helpful when running unrendered Mustache templates through eslint.
//}}{{=$$ $$=}}
// Import Design constructor
import { Design } from '@freesewing/core'
// Import parts
@ -7,7 +13,7 @@ import { topSleeve } from './topsleeve.mjs'
import { underSleeve } from './undersleeve.mjs'
// Create the new design
const Pattern = new Design({
const $$Name$$ = new Design({
data: {
/*
* If you like, you can add any data you want to your design.
@ -16,7 +22,7 @@ const Pattern = new Design({
* If you don't use this,
* you can remove this data key enterely.
*/
name: "{{ name }}",
name: "$$ name $$",
},
// A list of parts is all that is required.
parts: [ back, front, topSleeve, underSleeve ],
@ -28,5 +34,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, topSleeve, underSleeve, Pattern }
export { back, front, topSleeve, underSleeve, $$Name$$ }

View file

@ -1,3 +1,9 @@
//{{!
// Change the Mustache delimiter from double curly braces to double dollar signs.
// Dollar signs are allowed in EcmaScript identifier names,
// which is helpful when running unrendered Mustache templates through eslint.
//}}{{=$$ $$=}}
// Import Design constructor
import { Design } from '@freesewing/core'
// Import parts
@ -6,7 +12,7 @@ import { front } from './front'
import { sleeve } from './sleeve'
// Create the new design
const Pattern = new Design({
const $$Name$$ = new Design({
data: {
/*
* If you like, you can add any data you want to your design.
@ -15,7 +21,7 @@ const Pattern = new Design({
* If you don't use this,
* you can remove this data key enterely.
*/
name: "{{ name }}",
name: "$$ name $$",
},
// A list of parts is all that is required.
parts: [ back, front, sleeve ],
@ -27,5 +33,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, sleeve, Pattern }
export { back, front, sleeve, $$Name$$ }

View file

@ -1,3 +1,9 @@
//{{!
// Change the Mustache delimiter from double curly braces to double dollar signs.
// Dollar signs are allowed in EcmaScript identifier names,
// which is helpful when running unrendered Mustache templates through eslint.
//}}{{=$$ $$=}}
// Import Design constructor
import { Design } from '@freesewing/core'
// Import parts
@ -6,7 +12,7 @@ import { front } from './front'
import { sleeve } from './sleeve'
// Create the new design
const Pattern = new Design({
const $$Name$$ = new Design({
data: {
/*
* If you like, you can add any data you want to your design.
@ -15,7 +21,7 @@ const Pattern = new Design({
* If you don't use this,
* you can remove this data key enterely.
*/
name: "{{ name }}",
name: "$$ name $$",
},
// A list of parts is all that is required.
parts: [ back, front, sleeve ],
@ -27,5 +33,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, sleeve, Pattern }
export { back, front, sleeve, $$Name$$ }

View file

@ -1,10 +1,16 @@
//{{!
// Change the Mustache delimiter from double curly braces to double dollar signs.
// Dollar signs are allowed in EcmaScript identifier names,
// which is helpful when running unrendered Mustache templates through eslint.
//}}{{=$$ $$=}}
// Import Design constructor
import { Design } from '@freesewing/core'
// Import parts
import { box } from './box.mjs'
// Create the new design
const Pattern = new Design({
const $$Name$$ = new Design({
data: {
/*
* If you like, you can add any data you want to your design.
@ -13,7 +19,7 @@ const Pattern = new Design({
* If you don't use this,
* you can remove this data key enterely.
*/
name: "{{ name }}",
name: "$$ name $$",
},
// A list of parts is all that is required.
parts: [ box ],
@ -25,5 +31,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 { box, Pattern }
export { box, $$Name$$ }

View file

@ -1,3 +1,9 @@
//{{!
// Change the Mustache delimiter from double curly braces to double dollar signs.
// Dollar signs are allowed in EcmaScript identifier names,
// which is helpful when running unrendered Mustache templates through eslint.
//}}{{=$$ $$=}}
// Import Design constructor
import { Design } from '@freesewing/core'
// Import parts
@ -5,7 +11,7 @@ import { back } from './back'
import { front } from './front'
// Create the new design
const Pattern = new Design({
const $$Name$$ = new Design({
data: {
/*
* If you like, you can add any data you want to your design.
@ -14,7 +20,7 @@ const Pattern = new Design({
* If you don't use this,
* you can remove this data key enterely.
*/
name: "{{ name }}",
name: "$$ name $$",
},
// A list of parts is all that is required.
parts: [ back, front ],
@ -26,5 +32,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 { back, front, $$Name$$ }

View file

@ -1,9 +1,8 @@
function draftBib({ part }) {
return part
}
export const bib = {
name: 'tutorial.bib',
name: '{{ name }}.bib',
draft: draftBib,
}

View file

@ -1,12 +1,18 @@
//{{!
// Change the Mustache delimiter from double curly braces to double dollar signs.
// Dollar signs are allowed in EcmaScript identifier names,
// which is helpful when running unrendered Mustache templates through eslint.
//}}{{=$$ $$=}}
import { Design } from '@freesewing/core'
import { bib } from './bib.mjs'
const Pattern = new Design({
const $$Name$$ = new Design({
data: {
version: "0.0.1",
name: "Tutorial",
version: '0.0.1',
name: '$$ name $$',
},
parts: [ bib ],
})
export { bib, Pattern }
export { bib, $$Name$$ }