1
0
Fork 0

🚧 Ongoing work on CFP

This commit is contained in:
Joost De Cock 2019-05-02 12:39:30 +02:00
parent 7cc4130a11
commit 6b6f6fd7cd
54 changed files with 1360 additions and 3295 deletions

View file

@ -23,7 +23,7 @@ module.exports = async () => {
.option('-r, --repo <string>', 'package repo path') .option('-r, --repo <string>', 'package repo path')
.option('-g, --no-git', 'generate without git init') .option('-g, --no-git', 'generate without git init')
.option('-m, --manager <npm|yarn>', 'package manager to use', /^(npm|yarn)$/, defaults.manager) .option('-m, --manager <npm|yarn>', 'package manager to use', /^(npm|yarn)$/, defaults.manager)
.option('-t, --template <light|dark>', 'package template to use', /^(light|dark|custom)$/, defaults.template) .option('-t, --template <default|custom>', 'package template to use', /^(default|custom)$/, defaults.template)
.option('-p, --template-path <string>', 'custom package template path') .option('-p, --template-path <string>', 'custom package template path')
.option('-s, --skip-prompts', 'skip all prompts (must provide package-name via cli)') .option('-s, --skip-prompts', 'skip all prompts (must provide package-name via cli)')
.parse(process.argv) .parse(process.argv)

View file

@ -15,7 +15,7 @@ module.exports = async () => {
repo: (info) => `${info.author}/${info.name}`, repo: (info) => `${info.author}/${info.name}`,
license: config.get('license', 'MIT'), license: config.get('license', 'MIT'),
manager: config.get('manager', 'npm'), manager: config.get('manager', 'npm'),
template: config.get('template', 'light') template: config.get('template', 'default')
} }
try { try {

View file

@ -4,9 +4,19 @@ const path = require('path')
const fs = require('fs') const fs = require('fs')
const inquirer = require('inquirer') const inquirer = require('inquirer')
const validateNpmName = require('validate-npm-package-name') const validateNpmName = require('validate-npm-package-name')
const languages = require('@freesewing/i18n').languages;
const strings = require('@freesewing/i18n').strings;
const config = require('./config') const config = require('./config')
let languageChoices = []
for (let l of Object.keys(languages)) {
languageChoices.push({
name: languages[l],
value: l,
short: languages[l]
});
}
module.exports = async (opts) => { module.exports = async (opts) => {
if (opts.name && !validateNpmName(opts.name).validForNewPackages) { if (opts.name && !validateNpmName(opts.name).validForNewPackages) {
throw new Error(`invalid package name "${opts.name}"`) throw new Error(`invalid package name "${opts.name}"`)
@ -27,11 +37,18 @@ module.exports = async (opts) => {
return opts return opts
} else { } else {
const info = await inquirer.prompt([ const info = await inquirer.prompt([
{
type: 'list',
name: 'language',
message: 'Language',
choices: languageChoices,
default: 'en'
},
{ {
type: 'input', type: 'input',
name: 'name', name: 'name',
message: 'Pattern Name', message: info => strings[info.language]['cfp.patternName'],
validate: (name) => { validate: name => {
return name && validateNpmName(name).validForNewPackages return name && validateNpmName(name).validForNewPackages
}, },
default: opts.name default: opts.name
@ -39,63 +56,56 @@ module.exports = async (opts) => {
{ {
type: 'input', type: 'input',
name: 'description', name: 'description',
message: 'Pattern Description', message: info => strings[info.language]['cfp.patternDescription'],
default: opts.description default: opts.description
}, },
{
type: 'list',
name: 'type',
message: info => strings[info.language]['cfp.patternType'],
choices: info => [
{ name: strings[info.language]['filter.type.pattern'], value: 'pattern'},
{ name: strings[info.language]['filter.type.block'], value: 'block'},
],
default: 'pattern',
},
{
type: 'list',
name: 'department',
message: info => strings[info.language]['filter.department.title'],
choices: info => [
{ name: strings[info.language]['filter.department.menswear'], value: 'menswear'},
{ name: strings[info.language]['filter.department.womenswear'], value: 'womenswear'},
{ name: strings[info.language]['filter.department.accessories'], value: 'accessories'},
],
default: 'womenswear',
},
{ {
type: 'input', type: 'input',
name: 'author', name: 'author',
message: 'Author\'s GitHub Handle', message: info => strings[info.language]['cfp.author'],
default: opts.author default: opts.author
}, },
{ {
type: 'input', type: 'input',
name: 'repo', name: 'repo',
message: 'GitHub Repo Path', message: info => strings[info.language]['cfp.githubRepo'],
default: opts.repo default: opts.repo
}, },
{
type: 'input',
name: 'license',
message: 'License',
default: opts.license
},
{ {
type: 'list', type: 'list',
name: 'manager', name: 'manager',
message: 'Package Manager', message: info => strings[info.language]['cfp.packageManager'],
choices: [ 'npm', 'yarn' ], choices: [ 'npm', 'yarn' ],
default: opts.manager default: opts.manager
}, },
{
type: 'list',
name: 'template',
message: 'Development Mode',
choices: [ 'light', 'dark', 'custom' ],
default: opts.template
},
{
type: 'input',
name: 'templatePath',
message: 'Template Path',
default: opts.templatePath,
when: ({ template }) => template === 'custom',
validate: input => new Promise(resolve => {
const fullPath = path.resolve(process.cwd(), input)
fs.stat(fullPath, (err, stats) => {
if (err) {
return resolve(`Cannot resolve directory at: ${fullPath}`)
}
resolve(true)
})
})
}
]) ])
config.set('author', info.author) config.set('author', info.author)
config.set('license', info.license)
config.set('manager', info.manager) config.set('manager', info.manager)
config.set('template', info.template) config.set('template', 'default')
config.set('license', 'MIT')
info.template = 'default';
return { return {
...info, ...info,

File diff suppressed because it is too large Load diff

View file

@ -24,7 +24,8 @@
"build": "npm run clean && npm run mkdist && npm run copyfiles", "build": "npm run clean && npm run mkdist && npm run copyfiles",
"test": "ava -v && standard *.js lib/*.js", "test": "ava -v && standard *.js lib/*.js",
"pubtest": "npm publish --registry http://localhost:6662", "pubtest": "npm publish --registry http://localhost:6662",
"publish": "npm build && npm publish --access=public --tag=alpha", "pubforce": "npm publish",
"symlink": "mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -",
"mkdist": "mkdir -p dist", "mkdist": "mkdir -p dist",
"copyfiles": "cp -R index.js package.json README.md lib template dist/" "copyfiles": "cp -R index.js package.json README.md lib template dist/"
}, },

View file

@ -0,0 +1,29 @@
/* eslint-disable no-console */
//const path = require("path");
//const fse = require("fs-extra");
const i18n = require("@freesewing/i18n").languages;
console.log(i18n);
//const strings = {
// languages: {}
//};
//for (let lang of Object.keys(i18n.languages)) {
// strings.languages[lang] = i18n.languages[lang][lang];
// strings[lang] = {};
// for (let s of ['department', 'type'])
// strings[lang][s] = i18n.filter[lang][s].title;
// for (let s of ['menswear', 'womenswear', 'accessories'])
// strings[lang][s] = i18n.filter[lang].department[s];
// for (let s of ['block', 'pattern'])
// strings[lang][s] = i18n.filter[lang].type[s];
// strings[lang].difficulty = i18n.filter[lang].difficulty;
// strings[lang].name = i18n.app[lang].name;
//
//}
//
//fse.writeFileSync(
// path.join(".", "lib", "strings.js"),
// "export default "+JSON.stringify(strings)
//);
//console.log(strings);

View file

@ -1,27 +0,0 @@
{
"name": "{{name}}-example",
"homepage": "https://{{author}}.github.io/{{name}}",
"version": "0.0.0",
"private": true,
"dependencies": {
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-scripts": "2.0.4",
"{{name}}": "{{#if yarn}}link:..{{else}}file:..{{/if}}"
},
"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"
]
}

View file

@ -1,12 +0,0 @@
import React, { Component } from 'react';
import './App.css';
import ExampleComponent from '{{name}}';
class App extends Component {
render() {
return <ExampleComponent text='Modern React component module' />;
}
}
export default App;

View file

@ -1,76 +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"
},
"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-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"
},
"files": [
"dist"
]
}

View file

@ -1,39 +0,0 @@
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'
import resolve from 'rollup-plugin-node-resolve'
import url from 'rollup-plugin-url'
import svgr from '@svgr/rollup'
import pkg from './package.json'
export default {
input: 'src/index.js',
output: [
{
file: pkg.main,
format: 'cjs',
sourcemap: true
},
{
file: pkg.module,
format: 'es',
sourcemap: true
}
],
plugins: [
external(),
postcss({
modules: true
}),
url({ exclude: ['**/*.svg'] }),
svgr(),
babel({
exclude: 'node_modules/**',
plugins: [ '@babel/external-helpers' ]
}),
resolve(),
commonjs()
]
}

View file

@ -1,22 +0,0 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import styles from './styles.css'
export default class ExampleComponent extends Component {
static propTypes = {
text: PropTypes.string
}
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

@ -0,0 +1,21 @@
import { version } from "../package.json";
// ?? 🤔 ?? --> https://{{language}}.freesewing.dev/packages/core/config
export default {
name: "{{name}}",
version,
design: "{{author}}",
code: "{{author}}",
department: "{{department}}",
type: "{{type}}",
difficulty: 3,
tags: [],
optionGroups: {},
measurements: [],
dependencies: {},
inject: {},
hide: [],
parts: [],
options: {}
};

View file

@ -0,0 +1,34 @@
{
"name": "{{name}}",
"version": "0.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@freesewing/core": {
"version": "2.0.0-alpha.3",
"resolved": "https://registry.npmjs.org/@freesewing/core/-/core-2.0.0-alpha.3.tgz",
"integrity": "sha512-3iL1wHBUyF4ew/CiVzZ5/ut/qoB5x1TKmOvkltJhiGaI/k8+3kcrBkhnScNcazkeidwjJ53wmpn0lvewbMlgxw==",
"dev": true,
"requires": {
"bezier-js": "^2.2.13",
"bin-pack": "1.0.2",
"hooks": "^0.3.2"
}
},
"bezier-js": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/bezier-js/-/bezier-js-2.4.0.tgz",
"integrity": "sha512-ttwqGL47RtYOoZy10oFJZ1VlEC6w1eJW1xMPBAvEx57cTWgmaJNr/c2ZLMr/O2RD50saR0OaLBIpgyZ7rkHLSw=="
},
"bin-pack": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bin-pack/-/bin-pack-1.0.2.tgz",
"integrity": "sha1-wqAU7b8L7XCjKSBi7UZXe5YSBnk="
},
"hooks": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/hooks/-/hooks-0.3.2.tgz",
"integrity": "sha1-ox8GDCAmzqbPHKPrF4Qw5xjhxKM="
}
}
}

View file

@ -47,6 +47,19 @@
"@babel/plugin-syntax-import-meta": "^7.0.0", "@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/preset-env": "^7.0.0", "@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0", "@babel/preset-react": "^7.0.0",
"@freesewing/core": "2.0.0-alpha.3",
"@freesewing/plugin-bundle": "2.0.0-alpha.3",
"@freesewing/components": "2.0.0-alpha.3",
"@freesewing/css-theme": "2.0.0-alpha.3",
"@freesewing/i18n": "2.0.0-alpha.3",
"@freesewing/mui-theme": "2.0.0-alpha.3",
"@freesewing/patterns": "2.0.0-alpha.3",
"@freesewing/plugin-bust": "2.0.0-alpha.3",
"@freesewing/plugin-buttons": "2.0.0-alpha.3",
"@freesewing/plugin-debug": "2.0.0-alpha.3",
"@freesewing/plugin-designer": "2.0.0-alpha.3",
"@freesewing/plugin-flip": "2.0.0-alpha.3",
"@freesewing/utils": "2.0.0-alpha.3",
"@svgr/rollup": "^2.4.1", "@svgr/rollup": "^2.4.1",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.1",
"cross-env": "^5.1.4", "cross-env": "^5.1.4",
@ -64,15 +77,13 @@
"react-scripts": "^1.1.4", "react-scripts": "^1.1.4",
"rollup": "^0.64.1", "rollup": "^0.64.1",
"rollup-plugin-babel": "^4.0.1", "rollup-plugin-babel": "^4.0.1",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-babel-minify": "^7.0.0", "rollup-plugin-babel-minify": "^7.0.0",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-json": "^3.1.0", "rollup-plugin-json": "^3.1.0",
"rollup-plugin-node-resolve": "^3.3.0", "rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-peer-deps-external": "^2.2.0", "rollup-plugin-peer-deps-external": "^2.2.0",
"rollup-plugin-postcss": "^1.6.2", "rollup-plugin-postcss": "^1.6.2",
"rollup-plugin-url": "^1.4.0", "rollup-plugin-url": "^1.4.0"
"@freesewing/plugin-bundle": "0.8.0",
"freesewing": "0.30.6"
}, },
"files": [ "files": [
"dist" "dist"

View file

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

View file

@ -1,9 +0,0 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

View file

@ -1,23 +0,0 @@
{
"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,20 +0,0 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
node_modules
# builds
build
dist
# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View file

@ -1,4 +0,0 @@
language: node_js
node_js:
- 9
- 8

View file

@ -1,31 +0,0 @@
# {{name}}
> {{description}}
[![NPM](https://img.shields.io/npm/v/{{name}}.svg)](https://www.npmjs.com/package/{{name}}) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
## Install
```bash
npm install --save {{name}}
```
## Usage
```jsx
import React, { Component } from 'react'
import MyComponent from '{{name}}'
class Example extends Component {
render () {
return (
<MyComponent />
)
}
}
```
## License
{{license}} © [{{author}}](https://github.com/{{author}})

View file

@ -1,199 +0,0 @@
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"
// ]
//}
}
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View file

@ -1,40 +0,0 @@
<!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>{{name}}</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>

View file

@ -1,15 +0,0 @@
{
"short_name": "{{name}}",
"name": "{{name}}",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View file

@ -1,32 +0,0 @@
.App {
text-align: center;
}
.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 40vmin;
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

View file

@ -1,9 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});

View file

@ -1,14 +0,0 @@
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
}

View file

@ -1,12 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
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();

View file

@ -1,127 +0,0 @@
// 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();
});
}
}

View file

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