1
0
Fork 0

chore: Updates to docs for new dev env

This commit is contained in:
Joost De Cock 2022-07-02 22:52:31 +02:00
parent 474188a05e
commit 8cd70bc451
37 changed files with 500 additions and 350 deletions

View file

@ -15,7 +15,7 @@ So let's add it as a required measurement.
## Add required measurements
Open the config file at `config/index.js` and update the `measurements` array with the name of our required measurement:
Open the config file at `design/config.js` and update the `measurements` array with the name of our required measurement:
```js
measurements: ["head"],
@ -38,7 +38,7 @@ This change will also get picked up by the development environment, and you'll n
Since it's just one measurement, let's simply enter a value by hand.
For example `38` as 38cm is a realistic head circumference measurement for a baby.
Enter `38` in the box, and click on **Draft your pattern** in the top navigation bar to get back to your draft,
which for now still looks like this:
Enter `38` in the box, and click on **Draft Design** in the sidebar under the **View** heading.
This brings you back to our work in progress:
<Example pattern="tutorial" part="step1">Nothing has changed, yet</Example>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 229 KiB

Before After
Before After

View file

@ -20,7 +20,7 @@ flexible and let the user decide. All you have to do is add options to your patt
The first option we're going to add controls the ratio between the neck opening
and the head circumference. Let's call it `neckRatio`.
Open the config file at `config/index.js` and add this to the options:
Open the config file at `design/config.js` and add this to the options:
```js
options: {
@ -66,7 +66,7 @@ between their minimum and maximum values. At that time, you can still tweak thes
</Note>
Before you close the `config/index.js` file, make sure to update the `optionGroups` entry as follows:
Before you close the `design/config.js` file, make sure to update the `optionGroups` entry as follows:
```js
optionGroups: {

View file

@ -11,7 +11,7 @@ The rest of your bib should stay as it is, so let's start by making a list of po
to rotate:
```js
let rotateThese = [
const rotateThese = [
"edgeTopLeftCp",
"edgeTop",
"tipRight",
@ -34,7 +34,7 @@ Now you can rotate them. How far? Until the strap no longer overlaps:
```js
while (points.tipRightBottomStart.x > -1) {
for (let p of rotateThese) points[p] = points[p].rotate(1, points.edgeLeft)
for (const p of rotateThese) points[p] = points[p].rotate(1, points.edgeLeft)
}
```

View file

@ -7,7 +7,7 @@ When we started out, we said a good part boilerplate looks like this:
```js
export default function(part) {
let { Point, points, Path, paths, complete, sa, paperless } = part.shorthand()
const { Point, points, Path, paths, complete, sa, paperless } = part.shorthand()
// Design pattern here
// Complete?
@ -42,7 +42,7 @@ To access the setting, we merely have to tell `part.shorthand()` that we'd like
While we're at it, also add `snippets` and `Snippet`, like this:
```js
let {
const {
Point,
points,
Path,

View file

@ -6,7 +6,7 @@ order: 280
Congratulations, you have created your first pattern. And while it's arguably rather simple,
you have learned a bunch of things along the way. Let's list some of the things you've learned:
- You learned how to [setup your development environment](/tutorials/pattern-design/create-freesewing-pattern) with `npx create-freesewing-pattern`
- You learned how to [setup your development environment](/tutorials/pattern-design/new-design) with `npx @freesewing/new-design`
- You learned how to [add parts](/tutorials/pattern-design/your-first-part), [measurements](/tutorials/pattern-design/adding-measurements), and [options](/tutorials/pattern-design/adding-options) to your pattern's configuration file
- You learned what [a good boilerplate is to start with a new part](/tutorials/pattern-design/part-structure)
- You learned [how to add points and draw paths](/tutorials/pattern-design/constructing-the-neck-opening)
@ -19,7 +19,7 @@ you have learned a bunch of things along the way. Let's list some of the things
- You learned [how to offset a path](/tutorials/pattern-design/completing-your-pattern#seam-allowance) to create seam allowance, or in our case, mark the bias tape line
- You learned how to create a [paperless pattern](/tutorials/pattern-design/paperless-bib) by adding dimensions
You can find the complete code of the tutorial pattern [here on GitHub](https://github.com/freesewing/freesewing/blob/develop/packages/tutorial/src/bib.js).
You can find the complete code of the tutorial pattern [here on GitHub](https://github.com/freesewing/freesewing/blob/develop/designs/tutorial/src/bib.js).
## More reading material
@ -34,8 +34,6 @@ Now that you have learned how to create a pattern, why don't you make one?
Think about what it is you would like to create, and just do it. If you get stuck at any moment,
or need some help or advice, you can [join our chat room](https://discord.freesewing.org/) and we'll help you out.
If you need some ideas or want to help on a pattern design take a look [at these open projects](https://github.com/freesewing/freesewing/discussions?discussions_q=label%3A%22%3Ashirt%3A+pattern+design%22+label%3A%22%3A%2B1%3A+good+first+issue%22) for patterns which are currently being worked on and are good patterns for a first time contributor to have a go at!
<Note>
###### Tell us how we can improve this tutorial

View file

@ -14,7 +14,7 @@ to our measurements and options to do so. For this, you first update the shortha
to indicate you also want access to `measurements` and `options`:
```js
let {
const {
Point,
points,
Path,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

View file

@ -1,64 +0,0 @@
---
title: Setting up the development environment
order: 100
---
<Note>
###### Already did the Getting started tutorial?
If you already set up the FreeSewing development environment and created a pattern, you can use that pattern and skip these steps. You can move on to [Your first part](/tutorials/pattern-design/your-first-part/).
</Note>
Open a terminal and enter the following command:
```bash
npx create-freesewing-pattern
```
This will load a few dependencies, and then ask you the following questions:
- **Language**: Use the arrow keys to select the language of your choice
- **Pattern name**: Enter `tutorial`
- **description**: Enter `The FreeSewing tutorial`
- **Pattern type**: Use the arrow key to select `Pattern`
- **Department**: Use the arrow keys to select `Accessories`
- **Author**: Enter your GitHub username
- **GitHub repository**: This will be prefilled for you, so just hit Enter
- **Package manager**: Use the arrow to choose. Pick `npm` if you're not sure.
After you've answered these questions, the default template will be copied, after which all dependencies will be installed.
<Note>
This will take a few minutes because we're loading some software for your development environment.
</Note>
When it's ready, enter the directory that was just created for our `tutorial` pattern and navigate to the `example` subfolder. There, start the development environment:
```bash
cd tutorial/example
npm start
```
Or if you chose to use Yarn as package manager:
```bash
cd tutorial/example
yarn start
```
If all goes well, your browser will open and show the following landing page:
![The FreeSewing development environment](./cfp.png)
<Note>
###### Need help?
If you run into any issues, join [our chatroom](https://discord.freesewing.org/) and
we'll figure it out together.
</Note>

View file

@ -16,7 +16,7 @@ Before we can use it, we have to update our `part.shorthand()` call to indicate
also like to make use of macros. Simply add `macro` at the end:
```js
let {
const {
Point,
points,
Path,

View file

@ -51,4 +51,4 @@ node -v
If you get the node version number, you're all set.
You can find the complete code of the tutorial pattern for the final result to help make sure you're following the steps correctly [here on GitHub](https://github.com/freesewing/freesewing/blob/develop/packages/tutorial/src/bib.js).
You can find the complete code of the tutorial pattern for the final result to help make sure you're following the steps correctly [here on GitHub](https://github.com/freesewing/freesewing/blob/develop/designs/tutorial/src/bib.js).

View file

@ -0,0 +1,53 @@
---
title: Setting up the development environment
order: 100
---
Open a terminal and enter the following command:
```bash
npx @freesewing/new-design
```
You'll be asked some questions, use these answers:
- **What template would you like to use?**: Pick the default `From scratch`
- **What name would you like the design to have**: Enter `bib`
- **What package manager do you use?**: Pick `npm` unless you are certain you have `yarn` installed
After you've answered these questions, files will be copied, dependencies installed, and components downloaded.
<Note>
This will take a few minutes because we're loading some software for your development environment.
</Note>
When it's ready, enter the `bib` directory that was just created and run `npm run dev`:
```bash
cd bib
npm run dev
```
Or if you chose to use Yarn as package manager:
```bash
cd bib
yarn start
```
Now open your browser at http://localhost:8000
If all goes well, you should see this landing page:
![The FreeSewing development environment](./nd.png)
<Note>
###### Need help?
If you run into any issues, join [our chatroom](https://discord.freesewing.org/) and
we'll figure it out together.
</Note>

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 KiB

View file

@ -9,7 +9,7 @@ We can get that value of the setting from the `part.shorthand()` method.
It will be the last shorthand we will put to use:
```js
let {
const {
Point,
points,
Path,

View file

@ -4,11 +4,11 @@ order: 150
---
Let's get rid of the example box first.
Open `src/bib.js` and make sure it looks like this:
Open `design/src/bib.js` and make sure it looks like this:
```js
export default function(part) {
let { Point, points, Path, paths, complete, sa, paperless } = part.shorthand()
const { Point, points, Path, paths, complete, sa, paperless } = part.shorthand()
// Design pattern here
// Complete?

View file

@ -18,10 +18,16 @@ for different measurements and options to see how well it adapts.
</Tip>
If testing your pattern sounds like a lot of work, you're in luck. FreeSewing can do it
for you. Click the **Test your pattern** button in the top navigation bar of your
development environment, and you'll see a number of choices on the right:
for you. Click the **Test Design** link in the sidebar under the **View** title.
- Test pattern options
<Fixme>
The new development environment does not yet support all tests.
Update these docs when that's completed
</Fixme>
You have a number of ways to test your pattern:
- Test design options
- Test measurements
- Test models

View file

@ -9,7 +9,7 @@ Most patterns will have multiple parts. A sleeve, a back part, the collar, and s
Our pattern is very simple, and only has one part: the bib.
The pattern that's been created for us also just has one part to get you started.
It's called **box** and it draws a box. If you click on the **Draft your pattern**
It's called **box** and it draws a box. If you click on the **To your design**
button in your browser, you'll get to see it:
![The default pattern with its box part](./step1.png)
@ -18,11 +18,11 @@ Since we only need one part, we'll rename this _box_ part, and call it _bib_.
## Rename the box part to bib
First, update the configuration file in `config/index.js`.
First, update the configuration file in `design/config.js`.
Update the **parts** array with `bib`, rather than `box`:
```js
parts: ["bib"],
parts: ['bib'],
```
<Note>
@ -33,9 +33,9 @@ This will (temporarily) cause en error to appear in your development environment
</Note>
When that's done, rename the `src/box.js` file into `src/bib.js`.
When that's done, rename the `design/src/box.js` file into `design/src/bib.js`.
Then, in the `src/index.js` file, change the import accordingly:
Then, in the `design/src/index.js` file, change the import accordingly:
```js
// Change this line
@ -45,14 +45,14 @@ Then, in the `src/index.js` file, change the import accordingly:
import draftBib from "./bib"
```
Finally, still in the `src/index.js` file, update the draftmethod:
Finally, still in the `design/src/index.js` file, update the draft method:
```js
// Change this line
//Pattern.prototype.draftBox = draftBox
//Design.prototype.draftBox = draftBox
// Into this
Pattern.prototype.draftBib = draftBib
Design.prototype.draftBib = draftBib
```
<Tip>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 277 KiB

Before After
Before After