1
0
Fork 0

feat(new-design): Added template specific for tutorial

This commit is contained in:
Joost De Cock 2022-10-09 21:32:43 +02:00
parent 857695445e
commit b9a46e9763
4 changed files with 155 additions and 11 deletions

View file

@ -58,6 +58,7 @@ export const getChoices = async () => {
name: 'template', name: 'template',
message: 'What template would you like to use? 📑', message: 'What template would you like to use? 📑',
choices: [ choices: [
{ title: 'Tutorial', value: 'tutorial', description: 'Setup the pattern design tutorial' },
{ title: 'From Scratch', value: 'scratch', description: 'Create a design from scratch' }, { title: 'From Scratch', value: 'scratch', description: 'Create a design from scratch' },
{ {
title: 'Extend Brian', title: 'Extend Brian',
@ -88,17 +89,20 @@ export const getChoices = async () => {
initial: 0, initial: 0,
}) })
const { name } = await prompts({ const { name } =
type: 'text', template === 'tutorial'
name: 'name', ? { name: 'tutorial' }
message: 'What name would you like the design to have? 🏷️ ([a-z] only)', : await prompts({
validate: validateDesignName, type: 'text',
}) name: 'name',
message: 'What name would you like the design to have? 🏷️ ([a-z] only)',
validate: validateDesignName,
})
const { manager } = await prompts({ const { manager } = await prompts({
type: 'select', type: 'select',
name: 'manager', name: 'manager',
message: 'Last but not least, what package manager do you use? 📦', message: 'What package manager should we use? 📦',
choices: [ choices: [
{ title: 'yarn', value: 'yarn', description: 'Yarn - Nice if you have it' }, { title: 'yarn', value: 'yarn', description: 'Yarn - Nice if you have it' },
{ title: 'npm', value: 'npm', description: 'NPM - Comes with NodeJS' }, { title: 'npm', value: 'npm', description: 'NPM - Comes with NodeJS' },
@ -193,7 +197,7 @@ const initGitRepo = async (config, choices) => {
} }
// Tips // Tips
const showTips = (config, choices) => const showTips = (config, choices) => {
console.log(` console.log(`
All done 🤓 Your new design ${chalk.yellow.bold( All done 🤓 Your new design ${chalk.yellow.bold(
choices.name choices.name
@ -211,7 +215,29 @@ const showTips = (config, choices) =>
3) Now open your browser and navigate to ${chalk.green('http://localhost:8000/')} 3) Now open your browser and navigate to ${chalk.green('http://localhost:8000/')}
${chalk.bold.yellow('🤔 More info & help')} ${chalk.bold.yellow('🤔 More info & help')}
${chalk.gray('≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡')} ${chalk.gray('≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡')}`)
if (choices.template === 'tutorial')
console.log(`
Our pattern design tutorial is available at: ${chalk.green(
'https://freesewing.dev/tutorials/pattern-design'
)}
It will walk your through the process step by step.
If you get stuck, reach out to our community on Discord: ${chalk.green(
'https://discord.freesewing.dev/'
)}
The ${chalk.bold('development-help')} channel is a good place to ask questions
Don't be shy to reach out. If something is not clear, that's on us, not on you.
So your feedback really helps us improve our tutorial/documentation.
Thanks for giving FreeSewing a shot. We hope you'll 💜 it.
Have fun 🤓
`)
else
console.log(`
FreeSewing's documentation for developers is available at: ${chalk.green( FreeSewing's documentation for developers is available at: ${chalk.green(
'https://freesewing.dev/' 'https://freesewing.dev/'
@ -220,9 +246,9 @@ const showTips = (config, choices) =>
Our community is on Discord: ${chalk.green('https://discord.freesewing.dev/')} Our community is on Discord: ${chalk.green('https://discord.freesewing.dev/')}
The ${chalk.bold('development-help')} channel is a good place to ask for help if you get stuck The ${chalk.bold('development-help')} channel is a good place to ask for help if you get stuck
Happy hacking 🤓 Happy hacking 🤓
`) `)
}
// Creates the environment based on the user's choices // Creates the environment based on the user's choices
export const createEnvironment = async (choices) => { export const createEnvironment = async (choices) => {

View file

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

View file

@ -0,0 +1,12 @@
import { Design } from '@freesewing/core'
import { bib } from './bib.mjs'
const Pattern = new Design({
data: {
version: "0.0.1",
name: "Tutorial",
},
parts: [ bib ],
})
export { bib, Pattern }

View file

@ -0,0 +1,97 @@
{
"name": "@freesewing/{{name}}",
"version": "0.0.1",
"description": "A new FreeSewing design",
"author": "Joost De Cock <joost@joost.at> (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": "node --experimental-json-modules ./node_modules/.bin/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/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": "latest",
"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",
"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",
"svg-to-pdfkit": "^0.1.8",
"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"
}
}