rdig / es6g-init Goto Github PK
View Code? Open in Web Editor NEWAn init package to get you up and running **fast** with a clean environment to prototype with javascript.
License: MIT License
An init package to get you up and running **fast** with a clean environment to prototype with javascript.
License: MIT License
I got lazy at some point and imported rimraf
to help delete files / folders.
A method should be written that only relies on node's fs
core library. This way we can cut the number of dependencies
from 1
to 0
.
This is relevant mostly to contributors.
If you accidentally run npm install
on your local repository the install process will run and overwrite / delete your files and folders (even .git
, so this means lost work).
Since we don't want to remove the feature of installing via cloning the repo, a way to detect where the npm install
was run from need to be implement.
There is such an implementation, that the detects the mode we are in (package
/repository
).
A naive way would be to check if we are in repository
mode and if the local folder name equals the original project name (es6g-init
).
The command execution helper method (execute
) shows the output of a successful run only after it's done.
For something like npm install
this will take a long time (depending on the number of packages) and not show anything for all that time span.
A method that streams the output line by line should be implemented.
After each step in the install process we output to the console.
This should be rewritten / re-though as right now these are just log()
methods plopped in, so they lack any sort of structure.
When transpiling, Babel automatically adds use strict
on the beginning of the file.
Since this is meant as a quick prototyping environment, we should not restrict anything.
I think it should be possible to remove the strict mode transformation on files.
Extract the logic to check if a given input is of type string
or array
(object) into a local helper method to cut down on boilerplate code.
Reliably.
You can trick it by giving it the extension as the last part of the extensionless file. But this neither reliable nor clean.
For a case in which the source folder includes .rc
files this is a real issue.
Node.js v4 does not support multiple es6 syntaxes used thought the helper methods
npm i es6g-init
or via cloning the repositoryExpected behavior: Install the package
Actual behavior: Crashes with syntax error
Windows cannot execute commands without spawning a new shell. At the moment we are skipping the shell and spawning a new process directly.
npm i es6g-init
or clone repoExpected behavior: To install the package
Actual behavior: Error: spawn ENOENT
We can either revert back to using the exec()
method or pass the { shell: true}
option to current execFile()
method.
I think the second option seems a better approach.
Installing as a cloned repository is way faster that installing it as node package (almost 3x).
This issue should be investigate, maybe there is a way to speed it up.
Output text to console / terminal using colors.
Something along the line of colors npm package.
These two similar methods (getFilesByExt() and getFoldersByFileExt()) only recurse one level deep.
This is working for us at the moment since the structure is known.
But if the input structure is not know, the install process will break at some point.
Plus, the two methods are very similar and can be refactored into one.
Right now, the method that generates package.json file (generatePackageJson
) only gets the name
from the environment.
We could use something like nodegit
to get the user/email values from git configuration and add them to the author
field
Windows does not recognize the nodejs
alias versus the node
command. The alias is installed by default on unix systems, but not on windows-based ones.
npm i es6g-init
or via cloning the repositoryExpected behavior: Run the install.js
script
Actual behavior: Error: could not find nodejs
The install mode detection detect the mode by looking if the script is invoked from under a node_modules/<your-folder>
folder tree.
This is unreliable since you can replicate this folder structure outside of a package / repository.
A better detection method should be implemented.
We introduced a delay message because we are not streaming (see #3 ) the output of the execute() method.
This should only be displayed if the time to execute the command is longer then a preset timeout.
Right now we are prepending file paths with a /
. This is ok for linux / osx, but not for Windows machines.
Even if this just for display and does not affect the way it works, it would be nice to display paths correctly.
This is related to #10
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.