Skip to content
This repository has been archived by the owner on Apr 5, 2018. It is now read-only.

Depend on versions of colors that are compatible #2

Merged
merged 1 commit into from
Oct 3, 2014

Conversation

misterdjules
Copy link
Contributor

colors.js recently released version 1.0.0, which breaks how colors-tmpl
uses it.

colors.js recently released version 1.0.0, which breaks how colors-tmpl
uses it.
rvagg added a commit that referenced this pull request Oct 3, 2014
Depend on versions of colors that are compatible
@rvagg rvagg merged commit 22917bc into rvagg:master Oct 3, 2014
@rvagg
Copy link
Owner

rvagg commented Oct 3, 2014

thanks @misterdjules, n00b move there on my part

@misterdjules
Copy link
Contributor Author

@rvagg No problem, thank you for merging this!

@Marak
Copy link

Marak commented Oct 5, 2014

The versions should always be compatible.

What broke? Did you try updating to latest version? v1.0.0 had a bug in it.

@misterdjules
Copy link
Contributor Author

@Marak Here's how colors-tmpl uses colors.js: https://github.com/rvagg/colors-tmpl/blob/master/colors-tmpl.js. It seems to me that it relies on implementation details, which is why it broke with latest colors.js versions.

@Marak
Copy link

Marak commented Oct 6, 2014

@misterdjules - Did you try with colors v1.0.2 or higher?

@misterdjules
Copy link
Contributor Author

@Marak Yes, I tried with several versions of colors.js. Here's the output from the tests when using colors.js@1.0.2:

➜  colors-tmpl git:(master) rm -rf node_modules
➜  colors-tmpl git:(master) npm install 
colors@1.0.2 node_modules/colors
➜  colors-tmpl git:(master) node test.js 
✗ full {red} string
    {red}this should be red{/red}
    this should be red
✗ full {green} string
    {green}this should be green{/green}
    this should be green
✗ full {underline} string
    {underline}this should be underlined{/underline}
    this should be underlined
✗ partial {red} string
    partial {red}red{/red} string
    partial red string
✗ partial {green} string
    partial {green}green{/green} string
    partial green string
✓ unmatched {green} tag, leave it alone
✓ nonsense {foobar} tag, leave it alone
✓ nonsense, matched {foobar}tag{/foobar}, leave it alone
✗ multiple colours in one line
    lotsa colours: {red}red{/red}, {green}green{/green}, {blue}blue{/blue}, yeehaw!
    lotsa colours: red, green, blue, yeehaw!
✗ multiple colours contained within colours
    {bold}colours {red}within {green}colours{/green} within {yellow}colours, {underline}oh my!{/underline}{/yellow}{/red} EEEK!{/bold}
    colours within colours within colours, oh my! EEEK!
✗ multiple occurances of a tag in a single string
    {red}red1{/red}, {red}red2{/red}, {red}red3{/red}
    red1, red2, red3
✗ multi-line strings

{red}red1{/red}
{red}red2{/red}
{red}red3{/red}


red1
red2
red3

✗ tags can surround multi-line strings

{red}red1
red2
red3{/red}


red1
red2
red3

➜  colors-tmpl git:(master)

You can see that a lot of tests fail.

When using colors.js@0.6.2, all tests pass:

➜  colors-tmpl git:(master) ✗ rm -rf node_modules 
➜  colors-tmpl git:(master) ✗ git diff > diff.patch
➜  colors-tmpl git:(master) ✗ cat diff.patch 
diff --git a/package.json b/package.json
index e24908a..6880f98 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,6 @@
         "test": "node test.js"
     }
   , "dependencies": {
-        "colors": "*"
+        "colors": "0.6.2"
     }
 }
➜  colors-tmpl git:(master) ✗ npm install
colors@0.6.2 node_modules/colors
➜  colors-tmpl git:(master) ✗ node test.js 
✓ full {red} string
✓ full {green} string
✓ full {underline} string
✓ partial {red} string
✓ partial {green} string
✓ unmatched {green} tag, leave it alone
✓ nonsense {foobar} tag, leave it alone
✓ nonsense, matched {foobar}tag{/foobar}, leave it alone
✓ multiple colours in one line
✓ multiple colours contained within colours
✓ multiple occurances of a tag in a single string
✓ multi-line strings
✓ tags can surround multi-line strings
➜  colors-tmpl git:(master) ✗

@rvagg
Copy link
Owner

rvagg commented Oct 9, 2014

Fixed, upgraded to colors@1 and released as colors-tmpl@1.0.0. It was simply because we were using Object.keys() to find supported colours which doesn't work with the new version that adds a getter for each colour instead of a simple property.

@misterdjules
Copy link
Contributor Author

@rvagg Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants