diff --git a/.github/workflows/tests.cornelius.yml b/.github/workflows/tests.cornelius.yml new file mode 100644 index 00000000000..3adcfb913fb --- /dev/null +++ b/.github/workflows/tests.cornelius.yml @@ -0,0 +1,32 @@ +name: Unit tests - Cornelius + +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/cornelius && npm install + env: + CI: true + - name: Install peer & test dependencies + run: "cd packages/cornelius && npm install @freesewing/core@^2.13.2 @freesewing/plugin-bundle@^2.13.2 @freesewing/models@2.13.2 @freesewing/pattern-info@2.13.2 mocha chai" + env: + CI: true + - name: Build pattern + run: cd packages/cornelius && npm run build + - name: Run pattern unit tests + run: cd packages/cornelius && npm run testci diff --git a/config/descriptions.yaml b/config/descriptions.yaml index 85f773cea26..2c3dbdbc818 100644 --- a/config/descriptions.yaml +++ b/config/descriptions.yaml @@ -11,6 +11,7 @@ carlton: 'A FreeSewing pattern for Sherlock Holmes cosplay; Or just a nice long cathrin: 'A FreeSewing pattern for a underbust corset / waist trainer' components: 'A collection of React components for FreeSewing web UIs' core: 'A library for creating made-to-measure sewing patterns' +cornelius: 'A FreeSewing pattern for cycling breeches, based on the Keystone drafting system' create-freesewing-pattern: 'Initializer package for FreeSewing patterns: npm init FreeSewing-pattern' css-theme: 'A CSS theme for FreeSewing web UIs' diana: 'A FreeSewing pattern for a top with a draped neck' diff --git a/config/templates/package.dflt.json b/config/templates/package.dflt.json index 60750e1eb3f..23733dbc6cc 100644 --- a/config/templates/package.dflt.json +++ b/config/templates/package.dflt.json @@ -22,7 +22,7 @@ "files": ["dist/*", "README.md", "package.json"], "publishConfig": { "access": "public", - "tag": "latest" + "tag": "next" }, "engines": { "node": ">=12.0.0", diff --git a/packages/cornelius/CHANGELOG.md b/packages/cornelius/CHANGELOG.md index b9fe1b40761..d932785bfdb 100644 --- a/packages/cornelius/CHANGELOG.md +++ b/packages/cornelius/CHANGELOG.md @@ -1,5 +1,9 @@ # Change log for: @freesewing/cornelius -## 2.11.3 (2021-02-02) + +This is the **initial release**, and the start of this change log. + +> Prior to version 2, FreeSewing was not a JavaScript project. +> As such, that history is out of scope for this change log. diff --git a/packages/cornelius/README.md b/packages/cornelius/README.md new file mode 100644 index 00000000000..a82db08ebe4 --- /dev/null +++ b/packages/cornelius/README.md @@ -0,0 +1,118 @@ +![FreeSewing](https://static.freesewing.org/banner.png) +

@freesewing/cornelius on NPM + License: MIT + Code quality on DeepScan + Open issues tagged pkg:cornelius + Project board +

Follow @freesewing_org on Twitter + Chat with us on Discord + Become a FreeSewing Patron + Follow @freesewing_org on Twitter +

+ +# @freesewing/cornelius + +A FreeSewing pattern for cycling breeches, based on the Keystone drafting system + + + +## What am I looking at? 🤔 + +This repository is our *monorepo* +holding [all our NPM packages](https://freesewing.dev/reference/packages/). + +This folder holds: @freesewing/cornelius + +## About FreeSewing 💀 + +Where the world of makers and developers collide, that's where you'll find FreeSewing. + +If you're a maker, checkout [freesewing.org](https://freesewing.org/) where you can generate +our sewing patterns adapted to your measurements. + +If you're a developer, our documentation is on [freesewing.dev](https://freesewing.dev/). +Our [core library](https://freesewing.dev/reference/api/) is a *batteries-included* toolbox +for parametric design of sewing patterns. But we also provide a range +of [plugins](https://freesewing.dev/reference/plugins/) that further extend the +functionality of the platform. + +If you have NodeJS installed, you can try it right now by running: + +```bash +npx create-freesewing-pattern +``` + +Or, consult our getting started guides +for [Linux](https://freesewing.dev/tutorials/getting-started-linux/), +[MacOS](https://freesewing.dev/tutorials/getting-started-mac/), +or [Windows](https://freesewing.dev/tutorials/getting-started-windows/). + +We also have a [pattern design tutorial](https://freesewing.dev/tutorials/pattern-design/) that +walks you through your first parametric design, +and [a friendly community](https://freesewing.org/community/where/) with +people who can help you when you get stuck. + +## Support FreeSewing: Become a patron 🥰 + +FreeSewing is an open source project run by a community, +and financially supported by our patrons. + +If you feel what we do is worthwhile, and you can spend a few coind without +hardship, then you should [join us and become a patron](https://freesewing.org/community/join). + +## Links 👩‍💻 + + - 💻 Makers website: [freesewing.org](https://freesewing.org) + - 💻 Developers website: [freesewing.dev](https://freesewing.dev) + - 💬 Chat: On Discord via [chat.freesewing.org](https://chat.freesewing.org/) + - ✅ Todo list/Kanban board: On Github via [todo.freesewing.org](https://todo.freesewing.org/) + - 🐦 Twitter: [@freesewing_org](https://twitter.com/freesewing_org) + - 📷 Instagram: [@freesewing_org](https://instagram.com/freesewing_org) + +## License: MIT 🤓 + +© [Joost De Cock](https://github.com/joostdecock). +See [the license file](https://github.com/freesewing/freesewing/blob/develop/LICENSE) for details. + +## Where to get help 🤯 + +Our [chatrooms on Discord](https://chat.freesewing.org/) are the best place to ask questions, +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). diff --git a/packages/cornelius/example/.babelrc b/packages/cornelius/example/.babelrc new file mode 100644 index 00000000000..a6551f4342d --- /dev/null +++ b/packages/cornelius/example/.babelrc @@ -0,0 +1,13 @@ +{ + "plugins": [ + [ + "prismjs", + { + "languages": ["javascript", "css", "markup"], + "plugins": ["line-numbers"], + "theme": "twilight", + "css": true + } + ] + ] +} diff --git a/packages/cornelius/example/README.md b/packages/cornelius/example/README.md new file mode 100644 index 00000000000..a4fb9a8b960 --- /dev/null +++ b/packages/cornelius/example/README.md @@ -0,0 +1,96 @@ +

+Freesewing logo +
+FreeSewing v2 +

+

A JavaScript library for made-to-measure sewing patterns

+

Follow @freesewing_org on Twitter + Chat with us on Gitter + Become a FreeSewing Patron + Follow @freesewing_org on Twitter + +

+ +# cornelius example + +This project was bootstrapped with [Create Freesewing Pattern](https://en.freesewing.dev/create-freesewing-pattern): + +```js +npm init freesewing-pattern +``` + +This example folder is part of the local development environment. +It is **not** part of the pattern's source code. + +To run this example, follow these steps: + + - 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`) + +This will spin up the development environment, similar to [our online demo](https://cornelius.freesewing.dev/). + +## About 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 +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: + +```bash +npm init freesewing-pattern +``` + +The [getting started] section on [freesewing.dev](https://freesewing.dev/) is a good +entrypoint to our documentation, but you'll find a lot more there, including +our [API documentation](https://freesewing.dev/en/freesewing/api), +as well as [examples](https://freesewing.dev/en/freesewing/examples), +and [best practices](https://freesewing.dev/en/do). + +If you're a maker, checkout [freesewing.org](https://freesewing/) where you can generate +our sewing patterns adapted to your measurements. + +## Support FreeSewing: Become a patron 🥰 + +FreeSewing is an open source project run by a community, +and financially supported by our patrons. + +If you feel what we do is worthwhile, you too +should [become a patron](https://freesewing.org/patrons/join). + +## Links 👩‍💻 + + - 💻 Makers website: [freesewing.org](https://freesewing.org) + - 💻 Developers website: [freesewing.dev](https://freesewing.org) + - 💬 Chat: [gitter.im/freesewing](https://gitter.im/freesewing/freesewing) + - 🐦 Twitter: [@freesewing_org](https://twitter.com/freesewing_org) + - 📷 Instagram: [@freesewing_org](https://instagram.com/freesewing_org) + +## License: MIT 🤓 + +© [Joost De Cock](https://github.com/joostdecock). +See [the license file](https://github.com/freesewing/freesewing/blob/develop/LICENSE) for details. + +## Where to get help 🤯 + +Our [chatroom on Gitter](https://gitter.im) is the best place to ask questions, +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). + diff --git a/packages/cornelius/example/netlify.toml b/packages/cornelius/example/netlify.toml new file mode 100644 index 00000000000..3cab43964b4 --- /dev/null +++ b/packages/cornelius/example/netlify.toml @@ -0,0 +1,9 @@ +[build] + base = "packages/cornelius/example" + publish = "build" + command = "npm run build" + +[[redirects]] + from = "/*" + to = "/index.html" + status = 200 diff --git a/packages/cornelius/example/package.json b/packages/cornelius/example/package.json new file mode 100644 index 00000000000..20bf744d3f8 --- /dev/null +++ b/packages/cornelius/example/package.json @@ -0,0 +1,51 @@ +{ + "name": "cornelius", + "homepage": "https://cornelius.freesewing.dev/", + "version": "", + "private": true, + "dependencies": { + "@fontsource/permanent-marker": "^4.1.0", + "@fontsource/roboto-mono": "^4.1.0", + "@fontsource/ubuntu": "^4.1.0", + "@freesewing/components": "latest", + "@freesewing/core": "latest", + "@freesewing/css-theme": "latest", + "@freesewing/i18n": "latest", + "@freesewing/models": "latest", + "@freesewing/mui-theme": "latest", + "@freesewing/pattern-info": "latest", + "@freesewing/plugin-bundle": "latest", + "@freesewing/plugin-theme": "latest", + "@freesewing/plugin-i18n": "latest", + "@freesewing/plugin-svgattr": "latest", + "@freesewing/utils": "latest", + "@material-ui/core": "^4.11.2", + "@material-ui/icons": "^4.11.2", + "@material-ui/lab": "^v4.0.0-alpha.57", + "pattern": "link:..", + "prismjs": "1.22.0", + "react": "^17.0.1", + "react-dom": "^17.0.1", + "react-scripts": "^3.4.4", + "file-saver": "^2.0.5", + "react-markdown": "5.0.3" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": "react-app" + }, + "browserslist": [ + ">0.2%", + "not dead", + "not ie <= 11", + "not op_mini all" + ], + "devDependencies": { + "babel-plugin-prismjs": "2.0.1" + } +} diff --git a/packages/cornelius/example/public/favicon.ico b/packages/cornelius/example/public/favicon.ico new file mode 100644 index 00000000000..95061a260f1 Binary files /dev/null and b/packages/cornelius/example/public/favicon.ico differ diff --git a/packages/cornelius/example/public/index.html b/packages/cornelius/example/public/index.html new file mode 100644 index 00000000000..510abdaaf99 --- /dev/null +++ b/packages/cornelius/example/public/index.html @@ -0,0 +1,41 @@ + + + + + + + + + + + + cornelius + + + +
+ + + diff --git a/packages/cornelius/example/public/layout.css b/packages/cornelius/example/public/layout.css new file mode 100644 index 00000000000..c62502f9791 --- /dev/null +++ b/packages/cornelius/example/public/layout.css @@ -0,0 +1 @@ +div.layout-wrapper{width:100%;margin:0;padding:0;background-color:red;background:#f8f9fa;background:linear-gradient(90deg, #f1f3f5 0%, #f1f3f5 25%, #f8f9fa 26%, #f8f9fa 100%)}div.layout-wrapper div.layout{display:flex;max-width:1600px;margin:auto;padding:0;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;background-color:#f8f9fa;min-height:calc(100vh - 64px)}div.layout-wrapper div.layout>aside{width:33%;background:#f1f3f5;border-right:2px solid #dee2e6}div.layout-wrapper div.layout>section{margin:0;padding:1rem}div.layout-wrapper div.layout>section>div.content{max-width:66ch;min-width:340px}div.layout-wrapper div.layout>section>div.content.wide{max-width:100%;margin:auto}.theme-wrapper.dark header{background-color:#1a1d21}.theme-wrapper.dark div.layout-wrapper{background:#f8f9fa;background:linear-gradient(90deg, #1a1d21 0%, #1a1d21 25%, #212529 26%, #212529 100%)}.theme-wrapper.dark div.layout-wrapper div.layout{background-color:#212529}.theme-wrapper.dark div.layout-wrapper div.layout>aside{background-color:#1a1d21;border-right:2px solid #343a40}header a svg{color:#ced4da}header a:first-of-type svg{color:#f8f9fa}header a:hover svg{color:#b197fc}header a span,header button span{color:#ced4da}header a span svg,header button span svg{color:#dee2e6}header a:hover span,header button:hover span{color:#f8f9fa}header a:hover span svg,header button:hover span svg{color:#b197fc}header a,header button{padding:0 1vw !important}@media (min-width: 1200px){div.layout>section{width:63%}}@media (max-width: 1199px) and (min-width: 960px){div.layout>aside{width:298px}div.layout>section{width:calc(100% - 300px - 4rem);max-width:none;margin:0 1rem 0 3rem}}@media (max-width: 959px){div.layout>aside{width:218px}div.layout>section{width:calc(100% - 220px - 4rem);max-width:none;margin:0;padding:0 2rem}div.layout>section div.content{min-width:inherit}}@media (max-width: 599px){div.layout>aside{display:none}div.layout>section{width:calc(100%);margin:0 auto;padding:0 1.5rem;max-width:none}}div.gatsby-highlight{margin-bottom:1rem}@media (max-width: 599px){#mobile-menu{position:fixed;top:0;left:0;width:100%;height:100vh;padding:0 0 1rem;max-width:600px;z-index:-10;transition:opacity 0.25s ease 0s;opacity:0;overflow:scroll}#mobile-menu>ul,#mobile-menu>div{transform:translate(0px, 10px);transition:transform 0.25s ease 0s}.theme-wrapper.show-menu #mobile-menu{opacity:1;z-index:10}.theme-wrapper.show-menu #mobile-menu>div{transform:translate(0px, 0px)}}.theme-wrapper.light div.draft-ui-menu,.theme-wrapper.light div.menu{background:#f1f3f5}.theme-wrapper.dark div.draft-ui-menu,.theme-wrapper.dark div.menu{background:#343a40}.theme-wrapper.show-menu div.menu{opacity:1;z-index:10}.theme-wrapper.show-menu div.menu>div{transform:translate(0px, 0px)}div.spaced-buttons>button{margin:0 0.5rem 0.5rem 0}div.spaced>*{margin:0 0.5rem 0.5rem 0}ul#pre-main-menu{margin:0;padding:0}.boldish{font-weight:500}.freesewing.draft{padding:1rem}li.action{clear:both}li.action span.MuiSwitch-root{float:right}.theme-wrapper.light ul#draft-config li.action.toggle.off,.theme-wrapper.dark ul#draft-config li.action.toggle.off{color:#868e96}.theme-wrapper.light ul#draft-config li.action.toggle.off>span svg,.theme-wrapper.dark ul#draft-config li.action.toggle.off>span svg{color:#868e96}footer{background-color:#1a1d21;color:#adb5bd;padding:3rem 0 6rem}footer a{color:#dee2e6 !important;font-weight:400}footer a:hover{color:#d0bfff !important}footer div.cols{display:flex;flex-direction:row;justify-content:space-between;max-width:1600px;margin:auto;padding:0 1.5rem}footer div.cols>div{min-width:150px;max-width:calc(20% - 4rem);padding:0 2rem 0 0;width:100%}footer ul{text-align:left;font-size:1.1rem;margin:0;padding:0;width:100%}footer ul li:first-of-type{padding:0.35rem 0.75rem}footer ul li{display:block}footer ul li a:hover{text-decoration:none !important}footer ul li.heading{font-weight:bold;border-bottom:3px solid #adb5bd;margin-bottom:0.5rem}@media (min-width: 1200px){footer div.cols>div:last-of-type{min-width:350px}}@media (min-width: 600px) and (max-width: 959px){footer div.cols{flex-wrap:wrap}footer div.cols>div{width:calc(30% - 4rem);padding:0 1rem}}@media (max-width: 599px){footer div.cols{display:block}footer div.cols>div{margin:2rem auto 0;max-width:calc(100% - 4rem)}footer div.cols>div:first-of-type{margin-top:0}} diff --git a/packages/cornelius/example/public/manifest.json b/packages/cornelius/example/public/manifest.json new file mode 100644 index 00000000000..e75141904b4 --- /dev/null +++ b/packages/cornelius/example/public/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "cornelius", + "name": "cornelius", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/packages/cornelius/example/src/App.js b/packages/cornelius/example/src/App.js new file mode 100644 index 00000000000..79b7751e342 --- /dev/null +++ b/packages/cornelius/example/src/App.js @@ -0,0 +1,35 @@ +import React from 'react' +import freesewing from '@freesewing/core' +import Workbench from '@freesewing/components/Workbench' +import '@freesewing/css-theme' + +import Pattern from 'pattern' + +const App = (props) => { + // You can use this to add transations + /* + let translations = { + JSON: 'JSON', + someOtherString: 'Some other string that needs translation' + } + */ + + // Adds support for loading an external pattern configuration + let recreate = false + if (window) recreate = window.location.pathname.substr(1).split('/') + if (recreate.length === 3 && recreate[0] === 'recreate') + recreate = { from: recreate[1], id: recreate[2] } + else recreate = false + + return ( + + ) +} + +export default App diff --git a/packages/cornelius/example/src/index.js b/packages/cornelius/example/src/index.js new file mode 100644 index 00000000000..24aefad45a1 --- /dev/null +++ b/packages/cornelius/example/src/index.js @@ -0,0 +1,12 @@ +import React from 'react' +import ReactDOM from 'react-dom' +import App from './App' +import * as serviceWorker from './serviceWorker' +import './layout.css' + +ReactDOM.render(, document.getElementById('root')) + +// If you want your app to work offline and load faster, you can change +// unregister() to register() below. Note this comes with some pitfalls. +// Learn more about service workers: http://bit.ly/CRA-PWA +serviceWorker.unregister() diff --git a/packages/cornelius/example/src/serviceWorker.js b/packages/cornelius/example/src/serviceWorker.js new file mode 100644 index 00000000000..44e1b1b2f8c --- /dev/null +++ b/packages/cornelius/example/src/serviceWorker.js @@ -0,0 +1,123 @@ +// In production, we register a service worker to serve assets from local cache. + +// This lets the app load faster on subsequent visits in production, and gives +// it offline capabilities. However, it also means that developers (and users) +// will only see deployed updates on the "N+1" visit to a page, since previously +// cached resources are updated in the background. + +// To learn more about the benefits of this model, read https://goo.gl/KwvDNy. +// This link also includes instructions on opting out of this behavior. + +const isLocalhost = Boolean( + window.location.hostname === 'localhost' || + // [::1] is the IPv6 localhost address. + window.location.hostname === '[::1]' || + // 127.0.0.1/8 is considered localhost for IPv4. + window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/) +) + +export function register(config) { + if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { + // The URL constructor is available in all browsers that support SW. + const publicUrl = new URL(process.env.PUBLIC_URL, window.location) + if (publicUrl.origin !== window.location.origin) { + // Our service worker won't work if PUBLIC_URL is on a different origin + // from what our page is served on. This might happen if a CDN is used to + // serve assets; see https://github.com/facebook/create-react-app/issues/2374 + return + } + + window.addEventListener('load', () => { + const swUrl = `${process.env.PUBLIC_URL}/service-worker.js` + + if (isLocalhost) { + // This is running on localhost. Let's check if a service worker still exists or not. + checkValidServiceWorker(swUrl, config) + + // Add some additional logging to localhost, pointing developers to the + // service worker/PWA documentation. + navigator.serviceWorker.ready.then(() => { + console.log( + 'This web app is being served cache-first by a service ' + + 'worker. To learn more, visit https://goo.gl/SC7cgQ' + ) + }) + } else { + // Is not local host. Just register service worker + registerValidSW(swUrl, config) + } + }) + } +} + +function registerValidSW(swUrl, config) { + navigator.serviceWorker + .register(swUrl) + .then(registration => { + registration.onupdatefound = () => { + const installingWorker = registration.installing + installingWorker.onstatechange = () => { + if (installingWorker.state === 'installed') { + if (navigator.serviceWorker.controller) { + // At this point, the old content will have been purged and + // the fresh content will have been added to the cache. + // It's the perfect time to display a "New content is + // available; please refresh." message in your web app. + console.log('New content is available; please refresh.') + + // Execute callback + if (config.onUpdate) { + config.onUpdate(registration) + } + } else { + // At this point, everything has been precached. + // It's the perfect time to display a + // "Content is cached for offline use." message. + console.log('Content is cached for offline use.') + + // Execute callback + if (config.onSuccess) { + config.onSuccess(registration) + } + } + } + } + } + }) + .catch(error => { + console.error('Error during service worker registration:', error) + }) +} + +function checkValidServiceWorker(swUrl, config) { + // Check if the service worker can be found. If it can't reload the page. + fetch(swUrl) + .then(response => { + // Ensure service worker exists, and that we really are getting a JS file. + if ( + response.status === 404 || + response.headers.get('content-type').indexOf('javascript') === -1 + ) { + // No service worker found. Probably a different app. Reload the page. + navigator.serviceWorker.ready.then(registration => { + registration.unregister().then(() => { + window.location.reload() + }) + }) + } else { + // Service worker found. Proceed as normal. + registerValidSW(swUrl, config) + } + }) + .catch(() => { + console.log('No internet connection found. App is running in offline mode.') + }) +} + +export function unregister() { + if ('serviceWorker' in navigator) { + navigator.serviceWorker.ready.then(registration => { + registration.unregister() + }) + } +} diff --git a/packages/cornelius/package.json b/packages/cornelius/package.json new file mode 100644 index 00000000000..819a3c15cd0 --- /dev/null +++ b/packages/cornelius/package.json @@ -0,0 +1,95 @@ +{ + "name": "@freesewing/cornelius", + "version": "2.13.2", + "description": "A FreeSewing pattern for cycling breeches, based on the Keystone drafting system", + "author": "Joost De Cock (https://github.com/joostdecock)", + "homepage": "https://freesewing.org/", + "repository": "github:freesewing/freesewing", + "license": "MIT", + "bugs": { + "url": "https://github.com/freesewing/freesewing/issues" + }, + "keywords": [ + "freesewing", + "design", + "diy", + "fashion", + "made to measure", + "parametric design", + "pattern", + "sewing", + "sewing pattern" + ], + "main": "dist/index.js", + "module": "dist/index.mjs", + "scripts": { + "clean": "rimraf dist", + "build": "rollup -c", + "test": "BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.js --require @babel/register", + "pubtest": "npm publish --registry http://localhost:6662", + "pubforce": "npm publish", + "symlink": "mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -", + "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.13.2", + "@freesewing/plugin-bundle": "^2.13.2" + }, + "dependencies": {}, + "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.13.2", + "@freesewing/css-theme": "^2.13.2", + "@freesewing/i18n": "^2.13.2", + "@freesewing/mui-theme": "^2.13.2", + "@freesewing/plugin-bust": "^2.13.2", + "@freesewing/plugin-buttons": "^2.13.2", + "@freesewing/plugin-flip": "^2.13.2", + "@freesewing/utils": "^2.13.2", + "@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", + "axios": "0.21.1", + "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": [ + "dist/*", + "README.md", + "package.json" + ], + "publishConfig": { + "access": "public", + "tag": "latest" + }, + "engines": { + "node": ">=12.0.0", + "npm": ">=6" + }, + "rollup": { + "exports": "default" + } +} diff --git a/packages/cornelius/rollup.config.js b/packages/cornelius/rollup.config.js new file mode 100644 index 00000000000..a885f4cb4ec --- /dev/null +++ b/packages/cornelius/rollup.config.js @@ -0,0 +1,37 @@ +import resolve from '@rollup/plugin-node-resolve' +import commonjs from '@rollup/plugin-commonjs' +import json from '@rollup/plugin-json' +import { terser } from 'rollup-plugin-terser' +import peerDepsExternal from 'rollup-plugin-peer-deps-external' +import { name, version, description, author, license, main, module, rollup } from './package.json' + +const output = [ + { + file: main, + format: 'cjs', + sourcemap: true, + exports: rollup.exports + } +] +if (typeof module !== 'undefined') + output.push({ + file: module, + format: 'es', + sourcemap: true + }) + +export default { + input: 'src/index.js', + output, + plugins: [ + peerDepsExternal(), + resolve({ modulesOnly: true }), + commonjs(), + json(), + terser({ + output: { + preamble: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */` + } + }) + ] +} diff --git a/packages/cornelius/tests/shared.test.js b/packages/cornelius/tests/shared.test.js new file mode 100644 index 00000000000..074a3977753 --- /dev/null +++ b/packages/cornelius/tests/shared.test.js @@ -0,0 +1,39 @@ +// This file is auto-generated. +// Changes you make will be overwritten. +const expect = require("chai").expect; +const models = require("@freesewing/models") +const patterns = require("@freesewing/pattern-info") + +const Cornelius = require('../dist') + +// Shared tests +const testPatternConfig = require('../../../tests/patterns/config') +const testPatternDrafting = require('../../../tests/patterns/drafting') +const testPatternSampling = require('../../../tests/patterns/sampling') + +// Test config +testPatternConfig( + 'cornelius', + new Cornelius(), + expect, + models, + patterns +) + +// Test drafting +testPatternDrafting( + 'cornelius', + Cornelius, + expect, + models, + patterns +) + +// Test sampling +testPatternSampling( + 'cornelius', + Cornelius, + expect, + models, + patterns +)