food-static-data / food-static-files-generator Goto Github PK
View Code? Open in Web Editor NEWModule that help to generate static JSON files with complex structure
Module that help to generate static JSON files with complex structure
Is your feature request related to a problem? Please describe.
https://github.com/GroceriStar/food-static-files-generator/blob/master/src/generateFile.js#L20-L22
Is it was created as task at GitHub issues? Please provide an issue number or link
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Function updateContent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Is your feature request related to a problem? Please describe.
As most of our methods were created and perfect, i think it's a good time for cover them with tests, that will help us at our future work
@AndrewSerra let's discuss here what methods should be covered with tests
TODO found
if we don't need them. lets then add and comment more objects. and hide them for next times?
for generator -- we need to create folders for each generated file as well(compare with src/data).
filesES5 -- we have very long paths
we should make it less long. we can update to ```var { resolve } = require('path') and make files easy to read again.
Config Generator -- why we comment a few things, methods?
if we don't need them. lets then add and comment more objects. and hide them for next times?
for generator -- we need to create folders for each generated file as well(compare with src/data
).
Vadim reply
Rename this js files:
generateFiles -> generateJSONS
generateFile -> generateJSON
generateArray - separate functions by projects and connect it in configGenerator.js
Note I'm actually not happy with this names as well. but i think it will be solved by the end of this task. we just overgrow those files and that structure
Is your feature request related to a problem? Please describe.
One of repeating errors shown by ESLint: Definition for rule 'jest/no-identical-title' was not found
Not sure if we just need to disable it. I assume that it's bad that we don't have a proper test coverage here
Btw, we should skip thinking about fixing errors from project
folder, because it's a rudiment, that we'll remove pretty soon
Is it was created as task at GitHub issues? Please provide an issue number or link
#108 #109
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Release 1
Generator moved outside
Release 2
Migrated functionality to ES6
Release 3
Projects goes away
Release 4
CSV parser as separated module
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Is it was created as task at GitHub issues? Please provide an issue number or link
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Intro
Now our need to rewrite all code that we have here into es6. The huge task will be separated into small.
Main instructions of what should be done:
require
on import
.const { generateFiles } = require('./generateFiles')
module.exports = {
generateFiles
}
after should be like this
import generateFiles from './generateFiles'
export default {
generateFiles
}
module.exports = {
}
on
export {
}
Debugging
To make debugging generator. Execute this command
npm run debug:generator
Rollup will build index.cjs in dist folder. Then in runGenerator.js happens calling function generateFiles()
Note
If you will see require
in functions doesn't change it. For example like this https://github.com/GroceriStar/food-static-files-generator/blob/master/src/generateArray.js#L21
Useful links:
Is your feature request related to a problem? Please describe.
It's a simple task. When we setup a ESLint module we install a bunch of modules in order to make it work with our current setup. that modules not required to be publishied at npm, so we should remove them from major dependencies and enable at dev section
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Is it was created as task at GitHub issues? Please provide an issue number or link
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
if we don't need them. lets then add and comment more objects. and hide them for next times?
for generator -- we need to create folders for each generated file as well(compare with src/data
).
filesES5 -- we have very long paths
we should make it less long. we can update to ```var { resolve } = require('path') and make files easy to read again.
Describe the bug
There is a function named getFileName()
trying to be imported from writeFile.js
to the file fileSystem.js
and it gives an error. There is no function named getFileName()
in the repository
To Reproduce
It can be found in the travis-ci error list in issue #113
Screenshots
No screenshots but here is the error:
/home/travis/build/GroceriStar/food-static-files-generator/src/fileSystem.js
5:47 error Parse errors in imported module './writeFile': Line 73: Export 'getFileName' is not defined
71 | readData,
72 | save,
> 73 | getFileName,
| ^
74 | };
75 | (73:3) import/named
Additional context
The function name may be changed but not for all the repo. I have checked utils.js and thought it may be an older version of getFileInfo()
Is your feature request related to a problem? Please describe.
remove these lines:
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
npm run build
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
src/data
).Is your feature request related to a problem? Please describe.
i'm not requiring anything complex right now.
simple tests that will check if methods exists will work for this task ok.
Tell me if you'll have questions - I can share examples with you
Is your feature request related to a problem? Please describe.
as generator is a separated module - we cannot just generate files inside of it folders
it should be an argument, that will be a pass(should be checked) and if this path exists - we should put there a generated file/files
Is it was created as task at GitHub issues? Please provide an issue number or link
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Rename this js files:
generateFiles -> generateJSONS
generateFile -> generateJSON
generateArray - separate functions by projects and connect it in configGenerator.js
Describe the bug
Partially it will relate on #114 because we have a lint inside of Travis CI
I have feeling, that with our latest changes - when we'll solve ESLint warnings - Travis became green without any problems.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Travis CI builds should pass green in our PRs
Additional context
Add any other context about the problem here.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Is it was created as task at GitHub issues? Please provide an issue number or link
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
we need to do it after #125 will be merged to master
Is your feature request related to a problem? Please describe.
https://github.com/GroceriStar/food-static-files-generator/blob/master/src/fileSystem.js
#72
Describe the solution you'd like
move write and read methods to a separated file. it will help to make writeFile.js less complicated and shorter
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
file: https://github.com/GroceriStar/food-static-files-generator/blob/master/src/generateFile.js
Is it was created as task at GitHub issues? Please provide an issue number or link
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
Is it was created as task at GitHub issues? Please provide an issue number or link
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Generator --> create examples folder, where we show how we combine data, in order to have different structures.
Separated module, so you can install it, and pass your own dataset, or use data, that we have at our static data repository.
Making a generator as an independent module will simplify our work with a graphql server as well.
We can generate files outside of sd for it.
Using promises and callbacks --> so we can call generator inside at our express servers.
First step for use generator at gs-gql will be items.
Then we should test structure for MeasurementsSystems.
Function splitObject
has 5 arguments (exceeds 4 allowed). Consider refactoring.
Is your feature request related to a problem? Please describe.
as we have babel, you should add bridge between babel and eslint and maybe connect it not only at babel.config.js but also at rollup(only in case if eslint wouldn't work well at rollup build)
Is it was created as task at GitHub issues? Please provide an issue number or link
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Is it was created as task at GitHub issues? Please provide an issue number or link
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
remove https://github.com/GroceriStar/food-static-files-generator/blob/master/rollup.config.js#L3-L4
We wouldn't have json inside of this module. please remove it https://github.com/GroceriStar/food-static-files-generator/blob/master/rollup.config.js#L14
This is an old setup. it wouldn't work well with latest changes in rollup plugin.
https://github.com/GroceriStar/food-static-files-generator/blob/master/rollup.config.js#L20-L31
example: https://github.com/GroceriStar/sd/blob/projects-v2.0/rollup.config.js#L21-L26 and https://github.com/GroceriStar/sd/blob/projects-v2.0/rollup.config.js#L35 (globals was also removed)
remove that lines. https://github.com/GroceriStar/food-static-files-generator/blob/master/rollup.config.js#L56-L62
remove that as well https://github.com/GroceriStar/food-static-files-generator/blob/master/rollup.config.js#L82-L94
remove https://github.com/GroceriStar/food-static-files-generator/blob/master/rollup.config.js#L96-L101
Describe the bug
I assume that we should change settings for cjs rollup because it generates strange errors
To Reproduce
Steps to reproduce the behavior:
https://github.com/GroceriStar/sd/blob/master/generator/projects/FoodComposition/csv_parser.js#L10
Expected behavior
cjs version at sd repo should work, while we not migrate it to es6
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Is your feature request related to a problem? Please describe.
require
with import
and module.exports
with export default {}
Describe the bug
https://travis-ci.org/GroceriStar/food-static-files-generator/jobs/552523511
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Describe the bug
A clear and concise description of what the bug is.
Generating of empty json MeasurementSystemUnits/measurementSystemUnits. This can be a simple mistake or typo. Find out what is the problem and fix this.
Here https://github.com/GroceriStar/food-static-files-generator/blob/master/src/generateArray.js#L125 is a function that returns an array with data. Here https://github.com/GroceriStar/food-static-files-generator/blob/master/src/configGenerator.js#L21 setting function to config.
Here https://github.com/GroceriStar/food-static-files-generator/blob/master/src/generateFiles.js#L32 Calling all functions from config.
Debug
To debug you can use play.js in folder play of food-static-files-generator. To run play.js use this command:
npm run play
Also in play js I have set running a generator. Change path ('../../../sd/src')
to sd here https://github.com/GroceriStar/food-static-files-generator/blob/master/src/play/play.js#L25 . SD and food-static-files-generator projects should be in one folder for example in javascript.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Is your feature request related to a problem? Please describe.
the main idea is simple. this module should have only methods that help to generate additional files, but all things like projects, csv parser and other should be independent as well and use this module as dependency inside of it
Is your feature request related to a problem? Please describe.
Ok, so we trying to separate our generator outside of sd module. But how to test it correctly, so we can understand that it works well with different cases and different code styles?
Is it was created as task at GitHub issues? Please provide an issue number or link
Describe the solution you'd like
A clear and concise description of what you want to happen.
Function updateContent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Is it was created as task at GitHub issues? Please provide an issue number or link
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Is it was created as task at GitHub issues? Please provide an issue number or link
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Is it was created as task at GitHub issues? Please provide an issue number or link
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.