Giter Site home page Giter Site logo

accurat / accurapp Goto Github PK

View Code? Open in Web Editor NEW
21.0 11.0 5.0 7.67 MB

Create JS apps with flexible build configuration, tailored for the specific needs of Accurat

License: MIT License

JavaScript 93.69% HTML 0.63% CSS 1.55% TypeScript 2.18% Shell 1.96%
react create-react-app webpack babel eslint webpack-blocks

accurapp's People

Contributors

alexzherdev avatar bebbi avatar caesarsol avatar cloudmu avatar dceddia avatar dependabot[bot] avatar eanplatter avatar ekaradon avatar existentialism avatar fson avatar gaearon avatar hnordt avatar insin avatar keyz avatar koistya avatar kripod avatar lacker avatar lucafalasco avatar lucamattiazzi avatar marcofugaro avatar mxstbr avatar nhajidin avatar nkint avatar pdillon avatar ruggerocastagnola avatar shubheksha avatar tylermcginnis avatar valscion avatar vjeux avatar yesmeck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

accurapp's Issues

Show help if app name is missing

Instead of throwing an error, it's better to show the usage help if missing on the CLI

$ create-accurapp
path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.resolve (path.js:1146:7)
    at Object.<anonymous> (/Users/marco/.config/yarn/global/node_modules/create-accurapp/index.js:91:21)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:420:7)

json-perf-loader, for improved JSON parsing

Suggestion: use json-perf-loader instead of the default webpack JSON loader.

Because the JSON grammar is much simpler than JavaScript’s grammar, JSON can be parsed more efficiently than JavaScript. This knowledge can be applied to improve start-up performance for web apps that ship large JSON-like configuration object literals (such as inline Redux stores). Instead of inlining the data as a JavaScript object literal.

As long as the JSON string is only evaluated once, the JSON.parse approach is much faster compared to the JavaScript object literal

I've asked if that is still useful for webpack v4 here, just to be sure it makes sense :)

Add lint commamd

In the package.json scripts, so that you can check what's wrong by running yarn lint

Add linting scripts for use in CI

emulate this:

"scripts": {
    "lint": "node node_modules/eslint/bin/eslint.js src/",
    "lint:errors": "node node_modules/eslint/bin/eslint.js --quiet src/"
}

SVG files names beginning with a number cause an error in SVGO

For SVG imported like this:

import { ReactComponent as SvgIcon } from './123-abc.svg'

Webpack gives this error:

!!! Errors in compiling:

 • ./src/123-abc.svg
   TypeError: Cannot read property 'each' of undefined
       at Array.forEach (<anonymous>)
       at Array.forEach (<anonymous>)

The solution is start the SVG filename with a letter.

This is due to the SVGO plugin which has a bug prefixing CSS classes names with the filename, and CSS classes cannot begin with a number. @ilariaventurini is filing an issue (and a fix) on SVGO repo right now! Both for the non-meaningful error of numeric classes, and for the filename-prefixing code.
Then we should alert the SVGR team, and then update accurapp's SVGR version.

In the meanwhile remember to rename the SVGs and maybe we should add an alert in the accurapp README.

Randomly generated favicon

Default react favicon sucks. What about something like this with random colors?
favicon-5
Much nicer to share demos with clients 🙃

Staging deploys should block search engines

The solution is easy: adding a robots.txt in the build dir.
The problem is to be extra-sure we don't add that in production, but only in staging env!

We can't be sure about this since the same yarn build command is used, and the NODE_ENV variable is apparently not correctly set (@marcofugaro told me, but is that true?).
Seems like the best option could be to use something like:

[[ ! -v GENERATE_SOURCEMAP ]] && [[ -v CI ]] && echo 'User-agent: *\nDisallow: /' > build/robots.txt

Detect if a `package-lock.json` is present, and error out blocking everything if true

Is your feature request related to a problem? Please describe.

Sometimes for developers overlook, an npm command gets run in the repo and a package-lock.json gets created even if a yarn.lock is already present.
This creates problems in Netlify and other auto-deploy platforma, because they choose the tool depending on which files they find.

Describe the solution you'd like

Any accurapp command (start / build / lint) could check: if package-lock.json AND yarn.lock are present, block everything and alert with a big red flashy warning.
Solution for the user: delete one of the two files (preferably the NPM one)

Thoughts?

Generator star spacing rule

We currently have a conflict between the rules in eslint and the formatting in prettier. In particular eslint forces to put a space before the generator function * fetchOutsample() and prettier defaults to function* fetchOutsample(). I like the prettier version more and would remove the eslint rule but I wanted to raise the issue to @marcofugaro first. For now you can do:

// .eslintrc
{
  "extends": "eslint-config-accurapp",
  "rules": {
    "generator-star-spacing": 0
  }
}

CSV loader

Now done with:

yarn add -D csv-loader

and in webpack.config.js:

const buildWebpackConfig = require('webpack-preset-accurapp')
module.exports = buildWebpackConfig([
  (context) => ({
    module: {
      loaders: [
        {
          test: /\.csv$/,
          loader: 'csv-loader',
          options: {
            dynamicTyping: true,
            header: true,
            skipEmptyLines: true,
          },
        },
      ],
    },
  }),
])

Missing the `fs-extra` module used by build.js

$ yarn build
yarn build v0.21.3
$ accurapp-scripts build
module.js:472
    throw err;
    ^

Error: Cannot find module 'fs-extra'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/marco/Workspaces/Accurat/tools/prova/node_modules/accurapp-scripts/scripts/build.js:22:10)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
error Command failed with exit code 1.

Detect circular dependencies (and avoid them)

Is your feature request related to a problem? Please describe.

Sometimes circular dependencies are introduced in the project. Often without knowing, maybe for simple exported strings or trivial constants.
This introduces these possible problems:

  • webpack always refreshes the page, instead of using Hot Module Replacement;
  • some imports fail with no error, and the variable being imported results null or undefined;
  • TypeScript crazies put and laptop goes BOOOM.

Describe the solution you'd like

Add circular-dependency-plugin to Webpack by default, to error out (or a BIG warning, but I prefer error) in case of a circular dependency.

Related project: madge

cc @ivanross (for problem 3 and for the discovery of madge)
cc @pitou (for problem 2)

SVG IDs are not prefixed for *.color.svg files

Steps to reproduce

  • Make two SVGs each with a clipPath with the same ID
  • Pass them in SVGO by importing them with accurapp as *.color.svg

Actual behavior

The two IDs clashes, because they are note rewritten, and the second clipPath does not work.

Expected behavior

The IDs should be renamed and prefixed (with filenames).
Easy to do just removing this line:

@marcofugaro do you remember why for *.color.svg the IDs are not prefixed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.