chore: Reconfigure packages
This commit is contained in:
parent
d7c14d9055
commit
3d0291d6d1
51 changed files with 719 additions and 36 deletions
32
.github/workflows/tests.albert.yml
vendored
Normal file
32
.github/workflows/tests.albert.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
name: Unit tests - Albert
|
||||
|
||||
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/albert && npm install
|
||||
env:
|
||||
CI: true
|
||||
- name: Install peer & test dependencies
|
||||
run: "cd packages/albert && npm install @freesewing/core@^2.9.0 @freesewing/plugin-bundle@^2.9.0 @freesewing/models@2.9.0 @freesewing/pattern-info@2.9.0 mocha chai"
|
||||
env:
|
||||
CI: true
|
||||
- name: Build pattern
|
||||
run: cd packages/albert && npm run build
|
||||
- name: Run pattern unit tests
|
||||
run: cd packages/albert && npm run testci
|
|
@ -1,4 +1,5 @@
|
|||
aaron: 'A FreeSewing pattern for a A-shirt or tank top'
|
||||
albert: 'A FreeSewing pattern for an apron'
|
||||
benjamin: 'A FreeSewing pattern for a bow tie'
|
||||
bent: 'A FreeSewing pattern for a menswear body block with a two-part sleeve'
|
||||
breanna: 'A FreeSewing pattern for a basic body block for womenswear'
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
9
packages/albert/CHANGELOG.md
Normal file
9
packages/albert/CHANGELOG.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Change log for: @freesewing/albert
|
||||
|
||||
|
||||
|
||||
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.
|
||||
|
100
packages/albert/README.md
Normal file
100
packages/albert/README.md
Normal file
|
@ -0,0 +1,100 @@
|
|||

|
||||
<p align='center'><a
|
||||
href="https://www.npmjs.com/package/@freesewing/albert"
|
||||
title="@freesewing/albert on NPM"
|
||||
><img src="https://img.shields.io/npm/v/@freesewing/albert.svg"
|
||||
alt="@freesewing/albert on NPM"/>
|
||||
</a><a
|
||||
href="https://opensource.org/licenses/MIT"
|
||||
title="License: MIT"
|
||||
><img src="https://img.shields.io/npm/l/@freesewing/albert.svg?label=License"
|
||||
alt="License: MIT"/>
|
||||
</a><a
|
||||
href="https://deepscan.io/dashboard#view=project&tid=2114&pid=2993&bid=23256"
|
||||
title="Code quality on DeepScan"
|
||||
><img src="https://deepscan.io/api/teams/2114/projects/2993/branches/23256/badge/grade.svg"
|
||||
alt="Code quality on DeepScan"/>
|
||||
</a><a
|
||||
href="https://github.com/freesewing/freesewing/issues?q=is%3Aissue+is%3Aopen+label%3Apkg%3Aalbert"
|
||||
title="Open issues tagged pkg:albert"
|
||||
><img src="https://img.shields.io/github/issues/freesewing/freesewing/pkg:albert.svg?label=Issues"
|
||||
alt="Open issues tagged pkg:albert"/>
|
||||
</a></p><p align='center'><a
|
||||
href="https://twitter.com/freesewing_org"
|
||||
title="Follow @freesewing_org on Twitter"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Follow%20us-blue.svg?logo=twitter&logoColor=white&logoWidth=15"
|
||||
alt="Follow @freesewing_org on Twitter"/>
|
||||
</a><a
|
||||
href="https://chat.freesewing.org"
|
||||
title="Chat with us on Discord"
|
||||
><img src="https://img.shields.io/discord/698854858052075530?label=Chat%20on%20Discord"
|
||||
alt="Chat with us on Discord"/>
|
||||
</a><a
|
||||
href="https://freesewing.org/patrons/join"
|
||||
title="Become a FreeSewing Patron"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Support%20us-blueviolet.svg?logo=cash-app&logoColor=white&logoWidth=15"
|
||||
alt="Become a FreeSewing Patron"/>
|
||||
</a><a
|
||||
href="https://instagram.com/freesewing_org"
|
||||
title="Follow @freesewing_org on Twitter"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Follow%20us-E4405F.svg?logo=instagram&logoColor=white&logoWidth=15"
|
||||
alt="Follow @freesewing_org on Twitter"/>
|
||||
</a></p>
|
||||
|
||||
## What am I looking at? 🤔
|
||||
|
||||
This repository is our *monorepo* holding [all our NPM packages](https://www.npmjs.com/search?q=keywords:freesewing).
|
||||
This folder holds **@freesewing/albert**
|
||||
|
||||
A FreeSewing pattern for an apron
|
||||
|
||||
|
||||
|
||||
## About FreeSewing 💀
|
||||
|
||||
Where the world of makers and developers collide, that's where you'll find FreeSewing.
|
||||
|
||||
Our [core library](https://freesewing.dev/reference/api/) is a *batteries-included* toolbox
|
||||
for parametric design of sewing patterns. It's a modular system (check our list
|
||||
of [plugins](https://freesewing.dev/reference/plugins/) and getting started is as simple as:
|
||||
|
||||
```bash
|
||||
npm init freesewing-pattern
|
||||
```
|
||||
|
||||
The [getting started](https://freesewing.dev/guides/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 reference](https://freesewing.dev/reference/api/),
|
||||
as well as [our turorial](https://freesewing.dev/tutorials/pattern-design/),
|
||||
and [howtos](https://freesewing.dev/howtos/).
|
||||
|
||||
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.dev)
|
||||
- 💬 Chat: On Discord via [chat.freesewing.org](https://chat.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).
|
|
@ -1,7 +1,5 @@
|
|||
import { version } from '../package.json'
|
||||
|
||||
// ?? 🤔 ?? --> https://en.freesewing.dev/packages/core/config
|
||||
|
||||
export default {
|
||||
name: 'albert',
|
||||
version,
|
||||
|
|
10
packages/albert/example/.babelrc
Normal file
10
packages/albert/example/.babelrc
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"plugins": [
|
||||
["prismjs", {
|
||||
"languages": ["javascript", "css", "markup"],
|
||||
"plugins": ["line-numbers"],
|
||||
"theme": "twilight",
|
||||
"css": true
|
||||
}]
|
||||
]
|
||||
}
|
96
packages/albert/example/README.md
Normal file
96
packages/albert/example/README.md
Normal file
|
@ -0,0 +1,96 @@
|
|||
<p align="center">
|
||||
<a title="Go to freesewing.org" href="https://freesewing.org/"><img src="https://freesewing.org/img/logo/black.svg" align="center" width="150px" alt="Freesewing logo"/></a>
|
||||
<br>
|
||||
<a href="https://freesewing.org/">FreeSewing v2</a>
|
||||
</p>
|
||||
<p align="center">A JavaScript library for made-to-measure sewing patterns</p>
|
||||
<p align='center'><a
|
||||
href="https://twitter.com/freesewing_org"
|
||||
title="Follow @freesewing_org on Twitter"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Follow%20us-blue.svg?logo=twitter&logoColor=white&logoWidth=15"
|
||||
alt="Follow @freesewing_org on Twitter"/>
|
||||
</a><a
|
||||
href="https://gitter.im/freesewing/freesewing"
|
||||
title="Chat with us on Gitter"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Chat%20with%20us-CA0547.svg?logo=gitter&logoColor=white&logoWidth=15"
|
||||
alt="Chat with us on Gitter"/>
|
||||
</a><a
|
||||
href="https://freesewing.org/patrons/join"
|
||||
title="Become a FreeSewing Patron"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Support%20us-blueviolet.svg?logo=cash-app&logoColor=white&logoWidth=15"
|
||||
alt="Become a FreeSewing Patron"/>
|
||||
</a><a
|
||||
href="https://instagram.com/freesewing_org"
|
||||
title="Follow @freesewing_org on Twitter"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Follow%20us-E4405F.svg?logo=instagram&logoColor=white&logoWidth=15"
|
||||
alt="Follow @freesewing_org on Twitter"/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# albert 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://albert.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).
|
||||
|
49
packages/albert/example/package.json
Normal file
49
packages/albert/example/package.json
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "albert-example",
|
||||
"homepage": "https://freesewing.github.io/albert",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@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.0",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"@material-ui/lab": "^v4.0.0-alpha.56",
|
||||
"pattern": "link:..",
|
||||
"prismjs": "1.20.0",
|
||||
"react": "^16.13",
|
||||
"react-dom": "^16.13",
|
||||
"react-scripts": "^3.4.1",
|
||||
"file-saver": "^2.0.2",
|
||||
"react-markdown": "4.3.1",
|
||||
"typeface-roboto-condensed": "latest"
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
BIN
packages/albert/example/public/favicon.ico
Normal file
BIN
packages/albert/example/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
40
packages/albert/example/public/index.html
Normal file
40
packages/albert/example/public/index.html
Normal file
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<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="theme-color" content="#000000">
|
||||
<!--
|
||||
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/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>albert</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
You need to enable JavaScript to run this app.
|
||||
</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
15
packages/albert/example/public/manifest.json
Normal file
15
packages/albert/example/public/manifest.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"short_name": "albert",
|
||||
"name": "albert",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
29
packages/albert/example/src/App.js
Normal file
29
packages/albert/example/src/App.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
import React from 'react'
|
||||
import freesewing from '@freesewing/core'
|
||||
import Workbench from '@freesewing/components/Workbench'
|
||||
import 'typeface-roboto-condensed'
|
||||
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'
|
||||
}
|
||||
*/
|
||||
|
||||
return (
|
||||
<Workbench
|
||||
freesewing={freesewing}
|
||||
Pattern={Pattern}
|
||||
config={Pattern.config}
|
||||
userLanguage="en"
|
||||
//translations={translations}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default App
|
11
packages/albert/example/src/index.js
Normal file
11
packages/albert/example/src/index.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import App from './App'
|
||||
import * as serviceWorker from './serviceWorker'
|
||||
|
||||
ReactDOM.render(<App />, 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()
|
123
packages/albert/example/src/serviceWorker.js
Normal file
123
packages/albert/example/src/serviceWorker.js
Normal file
|
@ -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()
|
||||
})
|
||||
}
|
||||
}
|
94
packages/albert/package.json
Normal file
94
packages/albert/package.json
Normal file
|
@ -0,0 +1,94 @@
|
|||
{
|
||||
"name": "@freesewing/albert",
|
||||
"version": "2.9.0",
|
||||
"description": "A FreeSewing pattern for an apron",
|
||||
"author": "Joost De Cock <joost@decock.org> (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.9.0",
|
||||
"@freesewing/plugin-bundle": "^2.9.0"
|
||||
},
|
||||
"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.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
"@freesewing/mui-theme": "^2.9.0",
|
||||
"@freesewing/plugin-bust": "^2.9.0",
|
||||
"@freesewing/plugin-buttons": "^2.9.0",
|
||||
"@freesewing/plugin-flip": "^2.9.0",
|
||||
"@freesewing/utils": "^2.9.0",
|
||||
"@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": [
|
||||
"dist/*",
|
||||
"README.md",
|
||||
"package.json"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"tag": "latest"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0",
|
||||
"npm": ">=6"
|
||||
},
|
||||
"rollup": {
|
||||
"exports": "default"
|
||||
}
|
||||
}
|
37
packages/albert/rollup.config.js
Normal file
37
packages/albert/rollup.config.js
Normal file
|
@ -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 */`
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
39
packages/albert/tests/shared.test.js
Normal file
39
packages/albert/tests/shared.test.js
Normal file
|
@ -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 Albert = 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(
|
||||
'albert',
|
||||
new Albert(),
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'albert',
|
||||
Albert,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'albert',
|
||||
Albert,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.5.3",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.9.0",
|
||||
"@freesewing/css-theme": "^2.9.0",
|
||||
"@freesewing/i18n": "^2.9.0",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue