Add .npmignore file (issue 7531049)

8 views
Skip to first unread message

a...@chromium.org

unread,
Mar 25, 2013, 2:59:11 PM3/25/13
to usrb...@yahoo.com, traceur-comp...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reviewers: usrbincc,

Message:
Right now I include the whole src even though I think only src/node/*
is needed for things to work correctly.

Description:
Add .npmignore file

BUG=https://code.google.com/p/traceur-compiler/issues/detail?id=225


Please review this at https://codereview.appspot.com/7531049/

Affected files:
A .npmignore


Index: .npmignore
diff --git a/.npmignore b/.npmignore
new file mode 100644
index
0000000000000000000000000000000000000000..020ffb742efee0e056ecd3e9d973073360cdf0a2
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,6 @@
+build
+demo
+example
+Makefile
+test
+third_party


usrb...@yahoo.com

unread,
Mar 25, 2013, 5:06:16 PM3/25/13
to a...@chromium.org, traceur-comp...@googlegroups.com, re...@codereview-hr.appspotmail.com
After reading that .npmignore uses the same format as .gitignore, I
tried this, and it worked nicely. The whitelist strategy probably works
better for traceur, considering how many non-package files we have
everywhere.

The minimal distro package is surprisingly small, considering the repo
used to be 25 MB (mostly thanks to closure-library, though). I might
have left out something important, though.

#--cut--
cat > .npmignore <<"END"
*
!src/runtime/runtime.js
!src/node/*.js
!bin/traceur.js
!traceur
!Makefile
END

ln -s ~+ ../pkg-dir ## ~+ === abs path of cwd
mkdir ../npm-dir
cd ../npm-dir
npm install --local ../pkg-dir

## or you can just do a global install and skip the alias tricks
alias traceur=node_modules/traceur/traceur

cat > t.js <<"END"
var s = `${'hello'} world ${[for (x of [1,2,3]) x*10]}`;
console.log(s, s.startsWith('h'), s.endsWith('0'));
END

## interpret, compile + link traceur, compile + link runtime.

traceur t.js

traceur --out t.out.js -- t.js
{ printf "require('traceur');\n"
cat t.out.js
} > t.linked1.js
node t.linked1.js

## This works too, now that runtime.js modifies the global object.
## There should be some way to make this work with just
## "require('traceur/runtime')", right?
{ printf "require('traceur/src/runtime/runtime');\n"
cat t.out.js
} > t.linked2.js
node t.linked2.js

unalias traceur
#--cut--



https://codereview.appspot.com/7531049/diff/1/.npmignore
File .npmignore (right):

https://codereview.appspot.com/7531049/diff/1/.npmignore#newcode2
.npmignore:2: demo
It might be nice to include demo/repl.html and demo/repl.js, even though
they're both still a little rough around the edges.

https://codereview.appspot.com/7531049/

usrb...@yahoo.com

unread,
Mar 25, 2013, 5:09:49 PM3/25/13
to a...@chromium.org, traceur-comp...@googlegroups.com, re...@codereview-hr.appspotmail.com
Almost forgot. .npmignore should be added to .gitignore

https://codereview.appspot.com/7531049/

a...@chromium.org

unread,
Mar 25, 2013, 6:00:22 PM3/25/13
to usrb...@yahoo.com, traceur-comp...@googlegroups.com, re...@codereview-hr.appspotmail.com
On 2013/03/25 21:09:49, usrbincc wrote:
> Almost forgot. .npmignore should be added to .gitignore

Don't you mean the other way around? .gitignore should be ignored by
.npmignore.

https://codereview.appspot.com/7531049/

a...@chromium.org

unread,
Mar 25, 2013, 6:01:21 PM3/25/13
to usrb...@yahoo.com, traceur-comp...@googlegroups.com, re...@codereview-hr.appspotmail.com
On 2013/03/25 21:06:16, usrbincc wrote:
> After reading that .npmignore uses the same format as .gitignore, I
> tried this, and it worked nicely. The whitelist strategy probably
works
> better for traceur, considering how many non-package files we have
> everywhere.

> The minimal distro package is surprisingly small, considering the repo
> used to be 25 MB (mostly thanks to closure-library, though). I might
> have left out something important, though.

> #--cut--
> cat > .npmignore <<"END"
> *
> !src/runtime/runtime.js
> !src/node/*.js
> !bin/traceur.js
> !traceur
> !Makefile

We don't want the Makefile.

a...@chromium.org

unread,
Mar 25, 2013, 6:01:41 PM3/25/13
to usrb...@yahoo.com, traceur-comp...@googlegroups.com, re...@codereview-hr.appspotmail.com
I knew it was good to have you review this.

https://codereview.appspot.com/7531049/

usrb...@yahoo.com

unread,
Mar 25, 2013, 6:26:31 PM3/25/13
to a...@chromium.org, traceur-comp...@googlegroups.com, re...@codereview-hr.appspotmail.com
> Don't you mean the other way around? .gitignore should be ignored by
> .npmignore.

I meant it the way I said it, but I don't really know what I was
thinking when I said it. It's *supposed* to get committed, after all.
Doh.

(.git|.npm)Ignore my previous comment.

----

I forgot to include README, COPYING, and AUTHORS. Possibly some other
things. Definitely double check.


https://codereview.appspot.com/7531049/
Reply all
Reply to author
Forward
0 new messages