1
0
Fork 0

chore(titan): Fixed decription so it's configured as a pattern package

This commit is contained in:
Joost De Cock 2020-08-23 17:39:29 +02:00
parent 53a93298ee
commit 86a91d9d5b
10 changed files with 144 additions and 51 deletions

32
.github/workflows/tests.titan.yml vendored Normal file
View file

@ -0,0 +1,32 @@
name: Unit tests - Titan
on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: cd packages/titan && npm install
env:
CI: true
- name: Install peer & test dependencies
run: "cd packages/titan && npm install @freesewing/core@^2.8.1 @freesewing/plugin-bundle@^2.8.1 @freesewing/models@2.8.1 @freesewing/pattern-info@2.8.1 mocha chai"
env:
CI: true
- name: Build pattern
run: cd packages/titan && npm run build
- name: Run pattern unit tests
run: cd packages/titan && npm run testci

View file

@ -59,7 +59,7 @@ sven: 'A FreeSewing pattern for a straightforward sweater'
tamiko: 'A FreeSewing pattern for a zero-waste top' tamiko: 'A FreeSewing pattern for a zero-waste top'
theo: 'A FreeSewing pattern for classic trousers' theo: 'A FreeSewing pattern for classic trousers'
teagan: 'A FreeSewing pattern for a T-shirt' teagan: 'A FreeSewing pattern for a T-shirt'
titan: 'A FreeSewing block for trousers' titan: 'A FreeSewing pattern for a unisex trouser block'
trayvon: 'A FreeSewing pattern for a tie' trayvon: 'A FreeSewing pattern for a tie'
tutorial: "A FreeSewing pattern for a baby bib that's used in our tutorial" tutorial: "A FreeSewing pattern for a baby bib that's used in our tutorial"
utils: 'A collection of utilities shared across freesewing projects' utils: 'A collection of utilities shared across freesewing projects'

View file

@ -46,7 +46,7 @@
This repository is our *monorepo* holding [all our NPM packages](https://www.npmjs.com/search?q=keywords:freesewing). This repository is our *monorepo* holding [all our NPM packages](https://www.npmjs.com/search?q=keywords:freesewing).
This folder holds **@freesewing/titan** This folder holds **@freesewing/titan**
A FreeSewing block for trousers A FreeSewing pattern for a unisex trouser block

View file

@ -27,7 +27,7 @@
</a> </a>
</p> </p>
# trayvon example # titan example
This project was bootstrapped with [Create Freesewing Pattern](https://en.freesewing.dev/create-freesewing-pattern): This project was bootstrapped with [Create Freesewing Pattern](https://en.freesewing.dev/create-freesewing-pattern):
@ -40,16 +40,16 @@ It is **not** part of the pattern's source code.
To run this example, follow these steps: To run this example, follow these steps:
- In the folder above this one, run: `yarn start` (or `npm start`) - In the folder above this one, run: `yarn start` (or `npm start`)
- Then, in new terminal, run the same command in this folder: `yarn start` (or `npm start`) - Then, in new terminal, run the same command in this folder: `yarn start` (or `npm start`)
This will spin up the development environment, similar to [our online demo](https://trayvon.freesewing.dev/). This will spin up the development environment, similar to [our online demo](https://titan.freesewing.dev/).
## About FreeSewing 🤔 ## About FreeSewing 🤔
Where the world of makers and developers collide, that's where you'll find FreeSewing. Where the world of makers and developers collide, that's where you'll find FreeSewing.
Our [core library](https://freesewing.dev/en/freesewing) is a _batteries-included_ toolbox Our [core library](https://freesewing.dev/en/freesewing) is a *batteries-included* toolbox
for parametric design of sewing patterns. It's a modular system (check our list for parametric design of sewing patterns. It's a modular system (check our list
of [plugins](https://freesewing.dev/en/plugins) and getting started is as simple as: of [plugins](https://freesewing.dev/en/plugins) and getting started is as simple as:
@ -76,11 +76,11 @@ should [become a patron](https://freesewing.org/patrons/join).
## Links 👩‍💻 ## Links 👩‍💻
- 💻 Makers website: [freesewing.org](https://freesewing.org) - 💻 Makers website: [freesewing.org](https://freesewing.org)
- 💻 Developers website: [freesewing.dev](https://freesewing.org) - 💻 Developers website: [freesewing.dev](https://freesewing.org)
- 💬 Chat: [gitter.im/freesewing](https://gitter.im/freesewing/freesewing) - 💬 Chat: [gitter.im/freesewing](https://gitter.im/freesewing/freesewing)
- 🐦 Twitter: [@freesewing_org](https://twitter.com/freesewing_org) - 🐦 Twitter: [@freesewing_org](https://twitter.com/freesewing_org)
- 📷 Instagram: [@freesewing_org](https://instagram.com/freesewing_org) - 📷 Instagram: [@freesewing_org](https://instagram.com/freesewing_org)
## License: MIT 🤓 ## License: MIT 🤓
@ -93,3 +93,4 @@ Our [chatroom on Gitter](https://gitter.im) is the best place to ask questions,
share your feedback, or just hang out. share your feedback, or just hang out.
If you want to report a problem, please [create an issue](https://github.com/freesewing/freesewing/issues/new). If you want to report a problem, please [create an issue](https://github.com/freesewing/freesewing/issues/new).

View file

@ -16,15 +16,16 @@
"@freesewing/plugin-i18n": "latest", "@freesewing/plugin-i18n": "latest",
"@freesewing/plugin-svgattr": "latest", "@freesewing/plugin-svgattr": "latest",
"@freesewing/utils": "latest", "@freesewing/utils": "latest",
"@material-ui/core": "^4.4.0", "@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.2.1", "@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^v4.0.0-alpha.25", "@material-ui/lab": "^v4.0.0-alpha.56",
"pattern": "link:..", "pattern": "link:..",
"prismjs": "1.17.1", "prismjs": "1.20.0",
"react": "^16.9", "react": "^16.13",
"react-dom": "^16.9", "react-dom": "^16.13",
"react-scripts": "^3.1.1", "react-scripts": "^3.4.1",
"file-saver": "^2.0.2", "file-saver": "^2.0.2",
"react-markdown": "4.3.1",
"typeface-roboto-condensed": "latest" "typeface-roboto-condensed": "latest"
}, },
"scripts": { "scripts": {
@ -43,6 +44,6 @@
"not op_mini all" "not op_mini all"
], ],
"devDependencies": { "devDependencies": {
"babel-plugin-prismjs": "1.1.1" "babel-plugin-prismjs": "2.0.1"
} }
} }

View file

@ -1,15 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" /> <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000" /> <meta name="theme-color" content="#000000">
<!-- <!--
manifest.json provides metadata used when your web app is added to the manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/ homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
--> -->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> <link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<!-- <!--
Notice the use of %PUBLIC_URL% in the tags above. Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build. It will be replaced with the URL of the `public` folder during the build.

View file

@ -10,15 +10,13 @@ const App = (props) => {
let instance = new Pattern() let instance = new Pattern()
let config = instance.config let config = instance.config
// Adding untranslated strings // You can use this to add transations
/*
let translations = { let translations = {
'measurements.ankleEntry': 'Ankle entry', JSON: 'JSON',
'measurements.backWaist': 'Back waist', someOtherString: 'Some other string that needs translation'
'measurements.crotchDepth': 'Crotch depth',
'measurements.crotchLength': 'Crotch length',
'measurements.frontCrotchLength': 'Front crotch length',
'measurements.frontHip': 'Front hip'
} }
*/
return ( return (
<Workbench <Workbench
@ -26,7 +24,7 @@ const App = (props) => {
Pattern={Pattern} Pattern={Pattern}
config={config} config={config}
userLanguage="en" userLanguage="en"
translations={translations} //translations={translations}
/> />
) )
} }

View file

@ -53,7 +53,7 @@ export function register(config) {
function registerValidSW(swUrl, config) { function registerValidSW(swUrl, config) {
navigator.serviceWorker navigator.serviceWorker
.register(swUrl) .register(swUrl)
.then((registration) => { .then(registration => {
registration.onupdatefound = () => { registration.onupdatefound = () => {
const installingWorker = registration.installing const installingWorker = registration.installing
installingWorker.onstatechange = () => { installingWorker.onstatechange = () => {
@ -84,7 +84,7 @@ function registerValidSW(swUrl, config) {
} }
} }
}) })
.catch((error) => { .catch(error => {
console.error('Error during service worker registration:', error) console.error('Error during service worker registration:', error)
}) })
} }
@ -92,14 +92,14 @@ function registerValidSW(swUrl, config) {
function checkValidServiceWorker(swUrl, config) { function checkValidServiceWorker(swUrl, config) {
// Check if the service worker can be found. If it can't reload the page. // Check if the service worker can be found. If it can't reload the page.
fetch(swUrl) fetch(swUrl)
.then((response) => { .then(response => {
// Ensure service worker exists, and that we really are getting a JS file. // Ensure service worker exists, and that we really are getting a JS file.
if ( if (
response.status === 404 || response.status === 404 ||
response.headers.get('content-type').indexOf('javascript') === -1 response.headers.get('content-type').indexOf('javascript') === -1
) { ) {
// No service worker found. Probably a different app. Reload the page. // No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then((registration) => { navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => { registration.unregister().then(() => {
window.location.reload() window.location.reload()
}) })
@ -116,7 +116,7 @@ function checkValidServiceWorker(swUrl, config) {
export function unregister() { export function unregister() {
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then((registration) => { navigator.serviceWorker.ready.then(registration => {
registration.unregister() registration.unregister()
}) })
} }

View file

@ -1,7 +1,7 @@
{ {
"name": "@freesewing/titan", "name": "@freesewing/titan",
"version": "2.8.1", "version": "2.8.1",
"description": "A FreeSewing block for trousers", "description": "A FreeSewing pattern for a unisex trouser block",
"author": "Joost De Cock <joost@decock.org> (https://github.com/joostdecock)", "author": "Joost De Cock <joost@decock.org> (https://github.com/joostdecock)",
"homepage": "https://freesewing.org/", "homepage": "https://freesewing.org/",
"repository": "github:freesewing/freesewing", "repository": "github:freesewing/freesewing",
@ -16,22 +16,65 @@
"fashion", "fashion",
"made to measure", "made to measure",
"parametric design", "parametric design",
"sewing" "pattern",
"sewing",
"sewing pattern"
], ],
"main": "dist/index.js", "main": "dist/index.js",
"module": "dist/index.mjs", "module": "dist/index.mjs",
"scripts": { "scripts": {
"clean": "rimraf dist", "clean": "rimraf dist",
"build": "rollup -c", "build": "rollup -c",
"test": "echo \"titan: No tests configured. Perhaps you'd like to do this?\" && exit 0", "test": "BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.js --require @babel/register",
"pubtest": "npm publish --registry http://localhost:6662", "pubtest": "npm publish --registry http://localhost:6662",
"pubforce": "npm publish", "pubforce": "npm publish",
"symlink": "mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -", "symlink": "mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -",
"start": "rollup -c -w" "start": "rollup -c -w",
"netlify": "echo \"Not configured yet\"",
"testci": "BABEL_ENV=production ./node_modules/.bin/_mocha tests/*.test.js --require @babel/register"
},
"peerDependencies": {
"@freesewing/core": "^2.8.1",
"@freesewing/plugin-bundle": "^2.8.1"
}, },
"peerDependencies": {},
"dependencies": {}, "dependencies": {},
"devDependencies": {}, "devDependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"babel-eslint": "^10.1.0",
"eslint": "^7.6.0",
"babel-jest": "^26.2.2",
"jest": "26.2.2",
"@freesewing/components": "^2.8.1",
"@freesewing/css-theme": "^2.8.1",
"@freesewing/i18n": "^2.8.1",
"@freesewing/mui-theme": "^2.8.1",
"@freesewing/plugin-bust": "^2.8.1",
"@freesewing/plugin-buttons": "^2.8.1",
"@freesewing/plugin-flip": "^2.8.1",
"@freesewing/utils": "^2.8.1",
"@svgr/rollup": "^2.4.1",
"cross-env": "^7.0.2",
"react-scripts": "^3.4.1",
"webpack": "^4.44.1",
"rollup": "^2.23.0",
"@rollup/plugin-babel": "^5.1.0",
"rollup-plugin-terser": "^6.1.0",
"@rollup/plugin-commonjs": "^14.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^8.4.0",
"rollup-plugin-peer-deps-external": "^2.2.3",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "4.9.1",
"@material-ui/lab": "^v4.0.0-alpha.56",
"react-intl": "^5.4.5",
"prop-types": "^15.7.2",
"mocha": "^8.1.0",
"chai": "^4.2.0",
"chai-string": "^1.5.0",
"@babel/register": "^7.10.5"
},
"files": [ "files": [
"dist/*", "dist/*",
"README.md", "README.md",

View file

@ -1,10 +1,10 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
const expect = require('chai').expect const expect = require("chai").expect;
const models = require('@freesewing/models') const models = require("@freesewing/models")
const patterns = require('@freesewing/pattern-info') const patterns = require("@freesewing/pattern-info")
const Trayvon = require('../dist') const Titan = require('../dist')
// Shared tests // Shared tests
const testPatternConfig = require('../../../tests/patterns/config') const testPatternConfig = require('../../../tests/patterns/config')
@ -12,10 +12,28 @@ const testPatternDrafting = require('../../../tests/patterns/drafting')
const testPatternSampling = require('../../../tests/patterns/sampling') const testPatternSampling = require('../../../tests/patterns/sampling')
// Test config // Test config
testPatternConfig('trayvon', new Trayvon(), expect, models, patterns) testPatternConfig(
'titan',
new Titan(),
expect,
models,
patterns
)
// Test drafting // Test drafting
testPatternDrafting('trayvon', Trayvon, expect, models, patterns) testPatternDrafting(
'titan',
Titan,
expect,
models,
patterns
)
// Test sampling // Test sampling
testPatternSampling('trayvon', Trayvon, expect, models, patterns) testPatternSampling(
'titan',
Titan,
expect,
models,
patterns
)