koji-tools's People
koji-tools's Issues
Not working on backend
Can we get koji-tools working for backend services too?
koji-tools/tools/buildRoutes.js
Line 18 in 9d7f58a
Bug when watching files: Each event is reported two times
This does not cause a wrong operation. But it means doing some redundant work.
Don't do any of the wrapconsole/inject stuff if NODE_ENV === 'production'
Line 10 in 6a709c8
Bug in wrapConsole.js: `window.parent` is always truthy
koji-tools/tools/wrapConsole.js
Lines 34 to 38 in a1ca3c2
From if (window.parent)
seems the author wanted to sure the app (web page) is running in a container (not in the browser directly). If so, this is not the correct way. According to MDN:
If a window does not have a parent, its parent property is a reference to itself.
This means window.parent
is always truthy whether the window has a parent or not. So the if
statement filters nothing!
We can implement the same purpose as follows:
if (window.parent !== window)
Emitting build event before server is ready
Emitting this event before webpack has finished building is causing the preview to try to load before webpack has started, so webpack isn't ready to handle the request
Line 11 in 6a709c8
koji-tools ignores nested git repositories (git submodules)
In a root-level repository with one or more descendant submodules, like this:
> git submodule status
22080c4f11209c089b948c3a23c3513b7da85a9c browser (v0.2.0-4-g22080c4)
2b853655204e50a0f4c37a8b932647d4c04b8214 server (v0.2.7-3-g2b85365)
the result of koji-tools watch
is something like below:
> koji-tools watch
koji-tools watching
new config
Watching /PROJECT/ROOT/DIRECTORY/.koji/customization/about_customization.md
Watching /PROJECT/ROOT/DIRECTORY/.koji/customization/metadata.json
Watching /PROJECT/ROOT/DIRECTORY/.koji/customization/texts.json
Watching /PROJECT/ROOT/DIRECTORY/.koji/customization/theme.json
Watching /PROJECT/ROOT/DIRECTORY/.koji/hooks/about_hooks.md
Watching /PROJECT/ROOT/DIRECTORY/.koji/hooks/post-clone.sh
Watching /PROJECT/ROOT/DIRECTORY/.koji/project/about_project.md
Watching /PROJECT/ROOT/DIRECTORY/.koji/project/deploy.json
Watching /PROJECT/ROOT/DIRECTORY/.koji/project/develop.json
Watching /PROJECT/ROOT/DIRECTORY/.koji/scripts/buildConfig.js
Watching /PROJECT/ROOT/DIRECTORY/.koji/scripts/buildManifest.js
While there is two .koji
folders in above two submodules (browser
and server
).
-
Expected behavior:
> koji-tools watch koji-tools watching new config Watching /PROJECT/ROOT/DIRECTORY/.koji\customization\about_customization.md Watching /PROJECT/ROOT/DIRECTORY/.koji\customization\metadata.json Watching /PROJECT/ROOT/DIRECTORY/.koji\customization\texts.json Watching /PROJECT/ROOT/DIRECTORY/.koji\customization\theme.json Watching /PROJECT/ROOT/DIRECTORY/.koji\hooks\about_hooks.md Watching /PROJECT/ROOT/DIRECTORY/.koji\hooks\post-clone.sh Watching /PROJECT/ROOT/DIRECTORY/.koji\project\about_project.md Watching /PROJECT/ROOT/DIRECTORY/.koji\project\deploy.json Watching /PROJECT/ROOT/DIRECTORY/.koji\project\develop.json Watching /PROJECT/ROOT/DIRECTORY/.koji\scripts\buildConfig.js Watching /PROJECT/ROOT/DIRECTORY/.koji\scripts\buildManifest.js Watching /PROJECT/ROOT/DIRECTORY/browser\.koji\customization\about_customization.md Watching /PROJECT/ROOT/DIRECTORY/browser\.koji\customization\metadata.json Watching /PROJECT/ROOT/DIRECTORY/browser\.koji\customization\texts.json Watching /PROJECT/ROOT/DIRECTORY/browser\.koji\customization\theme.json Watching /PROJECT/ROOT/DIRECTORY/browser\.koji\hooks\about_hooks.md Watching /PROJECT/ROOT/DIRECTORY/browser\.koji\hooks\post-clone.sh Watching /PROJECT/ROOT/DIRECTORY/browser\.koji\project\about_project.md Watching /PROJECT/ROOT/DIRECTORY/browser\.koji\project\deploy.json Watching /PROJECT/ROOT/DIRECTORY/browser\.koji\project\develop.json Watching /PROJECT/ROOT/DIRECTORY/browser\.koji\scripts\buildConfig.js Watching /PROJECT/ROOT/DIRECTORY/browser\.koji\scripts\buildManifest.js Watching /PROJECT/ROOT/DIRECTORY/server\.koji\customization\about_customization.md Watching /PROJECT/ROOT/DIRECTORY/server\.koji\customization\metadata.json Watching /PROJECT/ROOT/DIRECTORY/server\.koji\customization\texts.json Watching /PROJECT/ROOT/DIRECTORY/server\.koji\customization\theme.json Watching /PROJECT/ROOT/DIRECTORY/server\.koji\hooks\about_hooks.md Watching /PROJECT/ROOT/DIRECTORY/server\.koji\hooks\post-clone.sh Watching /PROJECT/ROOT/DIRECTORY/server\.koji\project\about_project.md Watching /PROJECT/ROOT/DIRECTORY/server\.koji\project\deploy.json Watching /PROJECT/ROOT/DIRECTORY/server\.koji\project\develop.json Watching /PROJECT/ROOT/DIRECTORY/server\.koji\scripts\buildConfig.js Watching /PROJECT/ROOT/DIRECTORY/server\.koji\scripts\buildManifest.js
Bug in watch.js: Logs "Watching" before checking file accessibility
console.log('Watching', path)
should be after we sure the file is accessible. This means it should be a few lines lower, in if(!err) { ... }
block. Otherwise, the logged message may be incorrect.
Lines 21 to 25 in a1ca3c2
What is "VCC"?
Hello,
What is "VCC" stands for? I couldn't find its documentation.
I also saw a similar acronym in API section:
... Koji Customization Controls (CVV's) ...
Isn't this ("CVV") a misspelled (and the same "VCC")? Isn't "VCC" the abbreviation of "Visual Customization Controls", probably?
Bug in watch.js: Shoud check read-access, not just visibility
Line 24 in a1ca3c2
We want to read the file later. So we should check read-access (fs.R_OK
) not just visibility (fs.F_OK
). See https://nodejs.org/api/fs.html#fs_file_access_constants.
Remove koij-tools.request (or make more generic?)
https://github.com/madewithkoji/koji-tools/blob/master/tools/request.js#L80
This is too prescriptive, especially the authorization stuff. If we can have a generic JSON request wrapper that would be awesome, but defining headers and keys like isProtected
is too prescriptive
Including a lot of unnecessary paths, reduced performance significantly
koji-tools watch
is too slow on large projects. In my Angular project, it takes more than 30 seconds to reach watching state and watches 13 files!
Bug in request.js: throws error in onFulfilled handler!
According to MDN the first parameter of then
function (of a Promise
) is onFulfilled
callback:
p.then(onFulfilled[, onRejected]);
So below throw
command will run when json()
method successfully resolved:
Lines 22 to 32 in a1ca3c2
According to the same page
If a handler function [...] throws an error, the promise returned by
then
gets rejected with the thrown error as its value
So in the below lines:
Lines 72 to 80 in a1ca3c2
the first then()
will get rejected:
module.exports = (route, params) => {
return wrapFetch(route, params)
.then(checkStatus) // <- WILL GET REJECTED with: `new Error(error || 'api_error')`
.then(parseJSON)
.catch((err) => {
throw err;
});
}
Additionally, json()
method will apply two times in below sequence:
Lines 75 to 76 in a1ca3c2
first in checkStatus()
and then in parseJSON()
:
Lines 17 to 32 in a1ca3c2
Bug in watch.js: Doesn't fire if 2 events are less than 1 second apart
Hello,
The algorithm used in watch.js to handle near events (less than 1 second apart) together, has a bug. Such way the second (and third, fourth, ...) event is (are) not handled at all!
Lines 26 to 33 in a1ca3c2
This is the first thing in the handler callback (and there is nothing before it):
if (fsWait) return;
So the question is simple: What happens when fsWait
is not falsy? The answer is simple too. The function just returns! And the event? Who will handle it? It goes to a black hole.
Use callback array to allow for multiple `on('change')` handlers
Avoid hard-refresh on config.json change
How can we avoid webpack hard refreshing the page if only a key's value has changed from a VCC?
https://github.com/madewithkoji/koji-tools/blob/master/watch.js#L18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.