1
0
Fork 0

Save after loading freesewing and pattern

This commit is contained in:
Joost De Cock 2019-04-12 19:36:32 +02:00
parent a91ecd1b3a
commit d73cd3512c
61 changed files with 6493 additions and 334 deletions

View file

@ -0,0 +1,9 @@
{
"presets": [
["@babel/preset-env", {
"modules": false
}],
"@babel/preset-react"
],
"plugins": ["@babel/plugin-proposal-class-properties"]
}

View file

@ -0,0 +1,23 @@
{
"parser": "babel-eslint",
"extends": [
"standard",
"standard-react"
],
"env": {
"es6": true
},
"plugins": [
"react"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
// don't force es6 functions to include space before paren
"space-before-function-paren": 0,
// allow specifying true explicitly for boolean props
"react/jsx-boolean-value": 0
}
}

View file

@ -1,19 +1,11 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.
# IDE Stuff
/.idea
/.vscode
# dependencies
node_modules
# testing
/coverage
# builds
build
dist
.rpt2_cache
# misc
.DS_Store

View file

@ -12,7 +12,7 @@ npm install --save {{name}}
## Usage
```tsx
```jsx
import React, { Component } from 'react'
import MyComponent from '{{name}}'

View file

@ -0,0 +1,199 @@
import { version } from "../package.json";
// Configuration file syntax documentation:
// -> https://beta.freesewing.org/en/docs/developer/config
export default {
name: "{{name}}",
version,
//
// measurements
//
// An array with the names of
// the measurements required for your design
measurements: [
//"chestCircumference",
//"naturalWaist",
],
//
// dependencies
//
// An object where the key must be a part name, the value can be:
// -> a part name
// -> an array of part names
//
// This will be used to determine the order in which parts are drafted
dependencies: {
//front: "back"
//side: ["front", "back"]
},
//
// inject
//
// An object where both key and value must be a a part name.
// The value part will be injected in the key part.
//
// By injected we mean rather than starting out with a fresh part,
// the key part will get the points, paths, and snippets of the value part.
inject: {
//front: "back"
},
//
// hide
//
// An array that lists pattern parts that should be hidden
// by default. Hidden means that they will be drafted,
// but not rendered. Typically used for a base part on
// which other parts are built.
//
hide: [],
//
// parts
//
// An array that lists your (additional) pattern parts.
// The name must be the key the pattern.parts object.
//
// This does not need to be an exhaustive list of all parts
// in your pattern. If parts are included in the dependencies,
// inject, or hide configuration, theres no need to include
// them here, as we already know of their existence.
//
parts: [],
//
// options
//
// Options come in 6 varities:
//
// -> Constants : A value that cant be changed
// -> Percentages : A value in percent, with minimum and maximum values
// -> Millimeters : A value in millimeter, with minimum and maximum values
// -> Degrees : A value in degrees, with minimum and maximum values
// -> Counters : An integer value, with minimum and maximum values
// -> Lists : A list of options with a default
//
// Under the hood, millimeters, degrees, and counters are handled
// the same way. We use different types because it easier to
// understand the nature of a given option.
//
options: {
//
// Constants
//
// If your option is a scalar value (like a string or a number),
// it will be treated as a constant.
//
// Rather than define constants in your code, its good practice
// to set them in your configuration file. This way, people who
// extend your pattern can change them if they would like to.
//
//foo: 4,
//
// Percentages
//
// Percentage options are the bread and butter of freesewing.
// Almost all your options will probably be percentages.
// They make sure that your pattern will scale regardless of size.
//
// Your percentage option should be an object with these properties:
//
// -> pct : The percentage
// -> min : The minimum thats allowed
// -> max : The maximum thats allowed
//
// Percentage options will be divided by 100 when loaded
//
// You specify percentages in your config file.
// For example, 50 means 50%. When your configuration is loaded,
// those percentages will by divided by 100.
// So a percentage of 50 in your config file will be 0.5 when
// you read out that option in your pattern.
//
//chestEase: {
// pct: 8,
// min: -4,
// max: 20
//},
//
// Millimeters
//
// While we recommend using percentages where possible, sometimes
// that doesnt make sense. For those cases, you can use millimeters.
//
// Your millimeter option should be an object with these properties:
//
// -> mm : The default value in millimeter
// -> min : The minimul thats allowed
// -> max : The maximum thats allowed
//
//elasticWidth: {
// mm: 35,
// min: 5,
// max: 80
//},
//
// Degrees
//
// For angles, use degrees.
//
// Your degree option should be an object with these properties:
//
// -> deg : The default value in degrees
// -> min : The minimul thats allowed
// -> max : The maximum thats allowed
//
//collarAngle: {
// deg: 85,
// min: 60,
// max: 130
//},
//
// Counters
//
// For a given number of things, use counters. Counters are
// for integers only. Things like number of buttons and so on.
//
// Your counter option should be an object with these properties:
//
// -> count : The default integer value
// -> min : The minimal integer value thats allowed
// -> max : The maximum integer value thats allowed
//
//butttons: {
// count: 7,
// min: 4,
// max: 12
//},
//
// Lists
//
// Use a list option when you want to offer an array of choices.
//
// Your list option should be an object with these properties:
//
// -> dflt : The default for this option
// -> list : An array of available values options
//
//cuffStyle: {
// dflt: "angledBarrelCuff",
// list: [
// "roundedBarrelCuff",
// "angledBarrelCuff",
// "straightBarrelCuff",
// "roundedFrenchCuff",
// "angledFrenchCuff",
// "straightFrenchCuff"
// ]
//}
}
};

View file

@ -7,6 +7,7 @@
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-scripts": "2.0.4",
"freesewing": "^0.30.6",
"{{name}}": "{{#if yarn}}link:..{{else}}file:..{{/if}}"
},
"scripts": {

View file

@ -1,11 +1,14 @@
import React, { Component } from 'react';
import freesewing from "freesewing";
import './App.css';
import ExampleComponent from '{{name}}';
class App extends Component {
render() {
return <ExampleComponent text='Modern React component module' />;
console.log(freesewing);
console.log({ExampleComponent});
return (<p>hi there</p>)
}
}

View file

@ -0,0 +1,80 @@
{
"name": "{{name}}",
"version": "0.0.1",
"description": "{{description}}",
"author": "{{author}}",
"license": "{{license}}",
"repository": "{{repo}}",
"main": "dist/index.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"engines": {
"node": ">=8",
"npm": ">=5"
},
"scripts": {
"test": "cross-env CI=1 react-scripts test --env=jsdom",
"test:watch": "react-scripts test --env=jsdom",
"build": "rollup -c",
"start": "rollup -c -w",
"prepare": "{{manager}} run build",
"predeploy": "cd example && {{manager}} install && {{manager}} run build",
"deploy": "gh-pages -d example/build"
},
"peerDependencies": {
"prop-types": "^15.5.4",
"react": "^15.0.0 || ^16.0.0",
"react-dom": "^15.0.0 || ^16.0.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-external-helpers": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-do-expressions": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-bind": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-proposal-pipeline-operator": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@svgr/rollup": "^2.4.1",
"babel-eslint": "^10.0.1",
"cross-env": "^5.1.4",
"eslint": "^5.0.1",
"eslint-config-standard": "^11.0.0",
"eslint-config-standard-react": "^6.0.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.0.0",
"eslint-plugin-react": "^7.10.0",
"eslint-plugin-standard": "^3.1.0",
"gh-pages": "^1.2.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-scripts": "^1.1.4",
"rollup": "^0.64.1",
"rollup-plugin-babel": "^4.0.1",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-babel-minify": "^7.0.0",
"rollup-plugin-json": "^3.1.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-peer-deps-external": "^2.2.0",
"rollup-plugin-postcss": "^1.6.2",
"rollup-plugin-url": "^1.4.0",
"@freesewing/plugin-bundle": "0.8.0",
"freesewing": "0.30.6"
},
"files": [
"dist"
]
}

View file

@ -1,27 +1,27 @@
import typescript from 'rollup-plugin-typescript2'
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import external from 'rollup-plugin-peer-deps-external'
// import postcss from 'rollup-plugin-postcss-modules'
import postcss from 'rollup-plugin-postcss'
import json from "rollup-plugin-json";
import resolve from 'rollup-plugin-node-resolve'
import url from 'rollup-plugin-url'
import svgr from '@svgr/rollup'
import minify from "rollup-plugin-babel-minify";
import { name, version, description, author, license } from "./package.json";
import pkg from './package.json'
export default {
input: 'src/index.tsx',
input: 'src/index.js',
output: [
{
file: pkg.main,
format: 'cjs',
exports: 'named',
sourcemap: true
},
{
file: pkg.module,
format: 'es',
exports: 'named',
sourcemap: true
}
],
@ -32,11 +32,12 @@ export default {
}),
url({ exclude: ['**/*.svg'] }),
svgr(),
resolve(),
typescript({
rollupCommonJSResolveHack: true,
clean: true
babel({
exclude: 'node_modules/**',
plugins: [ '@babel/external-helpers' ]
}),
resolve({ browser: true }),
json(),
commonjs()
]
}

View file

@ -0,0 +1,5 @@
{
"env": {
"jest": true
}
}

View file

@ -0,0 +1,22 @@
export default function(part) {
let { Point, Path, points, paths, complete, paperless } = part.shorthand();
points.start = new Point(0, 0);
points.end = new Point(75, 0);
paths.demo = new Path()
.move(points.start)
.line(points.end)
.attr("data-text", "thisIsTheFrontPart")
.attr("data-text-class", "center");
// Complete?
if (complete) {
}
// Paperless?
if (paperless) {
}
return part;
}

View file

@ -0,0 +1,69 @@
/*
* This file was created by create-freesewing-pattern
* -> https://github.com/freesewing/create-freesewing-pattern
*
* Freesewing documentation:
* -> https://beta.freesewing.org/en/docs/developer
*
* Freesewing help & advice:
* -> https://gitter.im/freesewing/freesewing
*/
import freesewing from "freesewing";
import config from "../config";
/*
* Our most popular plugins are part of the plugin bundle
* which is already installed and imported.
* If you need additional plugins, you should install and
* import them.
*
* A list of all plugins is available at:
* -> https://beta.freesewing.org/en/docs/developer/plugins
*/
import plugins from "@freesewing/plugin-bundle";
// import buttons from "@freesewing/plugin-buttons";
/*
* If you want to extend an existing pattern, you should
* install it as a dev-dependency, and then import it.
*
* A list of all patterns is available at:
* -> https://beta.freesewing.org/en/patterns
*/
//import Brian from "@freesewing/brian";
/*
* It's a best practice to put each pattern part in its own file:
* -> https://beta.freesewing.org/en/docs/developer/do
*/
import draftBox from "./box";
/* Create new design*/
const {{name}} = new freesewing.Design(config, [
plugins,
//buttons
]);
/*
* If you want to extend an existing pattern, you should
* attach those draft methods you need to the design prototype
* as such:
*/
//{{name}}.prototype.draftBrianBase = function(part) {
// return new Brian(this.settings).draftBase(part);
//};
//{{name}}.prototype.draftBrianBack = function(part) {
// return new Brian(this.settings).draftBack(part);
//};
//{{name}}.prototype.draftBrianFront = function(part) {
// return new Brian(this.settings).draftFront(part);
//};
/*
* Attach the draft methods of your own parts to the
* design prototype as such:
*/
{{name}}.prototype.draftBox = draftBox;
// Export your design
export default {{name}};

View file

@ -1,54 +0,0 @@
{
"name": "{{name}}",
"version": "1.0.0",
"description": "{{description}}",
"author": "{{author}}",
"license": "{{license}}",
"repository": "{{repo}}",
"main": "dist/index.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"engines": {
"node": ">=8",
"npm": ">=5"
},
"scripts": {
"test": "cross-env CI=1 react-scripts test --env=jsdom",
"test:watch": "react-scripts test --env=jsdom",
"build": "rollup -c",
"start": "rollup -c -w",
"prepare": "{{manager}} run build",
"predeploy": "cd example && {{manager}} install && {{manager}} run build",
"deploy": "gh-pages -d example/build"
},
"dependencies": {},
"peerDependencies": {
"react": "^15.0.0 || ^16.0.0",
"react-dom": "^15.0.0 || ^16.0.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/runtime": "^7.0.0",
"@svgr/rollup": "^2.4.1",
"@types/jest": "^23.1.5",
"@types/react": "^16.8.0",
"@types/react-dom": "^16.8.0",
"cross-env": "^5.1.4",
"gh-pages": "^1.2.0",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-scripts": "^2.1.0",
"rollup": "^0.62.0",
"rollup-plugin-babel": "^4.0.1",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-peer-deps-external": "^2.2.0",
"rollup-plugin-postcss": "^1.6.2",
"rollup-plugin-typescript2": "^0.17.0",
"rollup-plugin-url": "^1.4.0",
"typescript": "^3.3.0"
},
"files": [
"dist"
]
}

View file

@ -1,23 +0,0 @@
/**
* @class ExampleComponent
*/
import React, { Component } from 'react'
import styles from './styles.css'
export type Props = { text: string }
export default class ExampleComponent extends Component<Props> {
render() {
const {
text
} = this.props
return (
<div className={styles.test}>
Example Component: {text}
</div>
)
}
}

View file

@ -1,8 +0,0 @@
/* add css styles here (optional) */
.test {
display: inline-block;
margin: 2em auto;
border: 2px solid #000;
font-size: 2em;
}

View file

@ -1,7 +0,0 @@
import ExampleComponent from './'
describe('ExampleComponent', () => {
it('is truthy', () => {
expect(ExampleComponent).toBeTruthy()
})
})

View file

@ -1,17 +0,0 @@
/**
* Default CSS definition for typescript,
* will be overridden with file-specific definitions by rollup
*/
declare module '*.css' {
const content: { [className: string]: string };
export default content;
}
interface SvgrComponent extends React.StatelessComponent<React.SVGAttributes<SVGElement>> {}
declare module '*.svg' {
const svgUrl: string;
const svgComponent: SvgrComponent;
export default svgUrl;
export { svgComponent as ReactComponent }
}

View file

@ -1,24 +0,0 @@
{
"compilerOptions": {
"outDir": "build",
"module": "esnext",
"target": "es5",
"lib": ["es6", "dom", "es2016", "es2017"],
"sourceMap": true,
"allowJs": false,
"jsx": "react",
"declaration": true,
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true
},
"include": ["src"],
"exclude": ["node_modules", "build", "dist", "example", "rollup.config.js"]
}

View file

@ -1,6 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs"
}
}