Coder Social home page Coder Social logo

codecat's People

Contributors

romancow avatar

Stargazers

 avatar

Watchers

 avatar

codecat's Issues

Command line bin

Create a bin file that can be run on the command line (with options) to concatenate files.

npmignore

Need to add a .npmignore file before releasing on npm

Reduce callbacks

Entered a little into "callback hell" territory, especially when adding recursive functionality, with callbacks that pass callbacks to callbacks. I'd love to reduce this a bit.

Ideas:

  • Promises? This would require a dependency.
  • Custom, synchronous version of "readlines". This might help by allowing for a single asynchronous "point" by not spinning off more async calls for each recursive call.
  • Make it an EventEmitter? Or concat methods return an EventEmitter? Or even implement CodeCat as a stream?
  • Something else?

Strategies for node modules

So when including node modules, currently their main file is just concatenated as is. This can be problematic if the package was not designed to be used as is in a browser (which is probably most packages). What we need is a strategy to adapt them. I think the best/easiest method of doing this is having a "node module strategy" option that can be passed in that dictates how the user wants to handle it. Not sure what the option would be named yet (nodeStrategy? just node? node_modules?). The potential values would probably be string keywords with scoped constants for convenience.

The possible options could be something like

  • bare: just concat the file as is (what it does currently)
  • wrap: just wrap the module in a function, but don't assign the exports to anything
  • global: wrap the module, adding exports globally (so to Window)
  • named: wrap the module and assign exports to a variable matching the name of the package. Since a lot of packages have hyphens in their names, we would have to camel-case or underscore the names. Maybe these can be tow different options - underscore and camelize
  • an object: a map of node module names to strings where the strings will be used as variable names to assign the node module exports to. We will also need some sort of general key ('' or *? Something that wouldn't be a valid js variable name to begin with) to use as the variable name for node modules not explicitly defined in the map (defaulting to global).
  • any other string: save all node modules to a variable with this name
  • maybe some way of doing both the "named" options and the supplied name option - in other words there would be a custom named variable object, and each module's exports would be added to it under the name of the module - node_modules.my_module.exported_function()

GULP

Hi! Good initiative, man!

Can we use it on GULP? (newbiealert)

Thank you!

Custom directives

The ability to add custom "directives" (like prepend or append) and associated code that will modify the resulting file in some way.

Nested functionality

Ability to use prepend & append directives inside prepended or appended files.

Should we guard against infinite recurse? (e.g. a file including another file that in turn includes the original) Maybe (at least initially) this will just be up to the user to not do.

Include node modules

Add the ability to perpend/append node modules (packages installed via npm, yarn, etc.).

How would you specify that an include is a mode module instead of a file? I guess kind of like require works - looks for it as a relative file first, then as a node module.

not compile

Hello,

I create config file and run with node but it does not concat my file. i have something like this:

var CodeCat = require('codecat');


var indexFile = new CodeCat("/www/proj/src/js/custom.js", {encoding: 'utf8'});
var options = {recursive: true, separator: "\n\n\n"};

indexFile.concatTo('/www/proj/static/assets/js/custom.min.js', options, function(error) {
	if (error) console.error(error);
});

what I wrong?

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.