Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile coffeescript #30

Merged
merged 13 commits into from Oct 24, 2015
Merged

Compile coffeescript #30

merged 13 commits into from Oct 24, 2015

Conversation

jasonkarns
Copy link
Member

Resolves #29

@searls
Copy link
Member

searls commented Oct 1, 2015

Would you mind removing changes to dist/ in this PR. I only want those to change on version bump commits

@@ -8,40 +8,40 @@
"email": "justin@testdouble.com",
"url": "http://testdouble.com"
},
"main": "index.js",
"browser": "lib/testdouble.coffee",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no more "browser" entry?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope. the browser entry was only used to bypass the coffeescript registration being done in index.js. now that there is no coffeescript registration, the node entrypoint and browser entrypoint are the same.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fantastic

On Thu, Oct 1, 2015 at 2:38 PM Jason Karns notifications@github.com wrote:

In package.json
#30 (comment)
:

@@ -8,40 +8,40 @@
"email": "justin@testdouble.com",
"url": "http://testdouble.com"
},

  • "main": "index.js",
  • "browser": "lib/testdouble.coffee",

nope. the browser entry was only used to bypass the coffeescript
registration being done in index.js. now that there is no coffeescript
registration, the node entrypoint and browser entrypoint are the same.


Reply to this email directly or view it on GitHub
https://github.com/testdouble/testdouble.js/pull/30/files#r40949956.

@searls
Copy link
Member

searls commented Oct 1, 2015

Looks pretty exhaustive

don't use .gitignore

git ignores generated js, but we need generated js in the package
git includes coffee but we don't want coffee in package
git includes tests but we don't want tests in package
coffee already implicitly compiled before published because we use
npm-version (which does a build which does a compile) is what kicks off
a publish step. However, publish is also invoked whenever a package is
installed at the top level. (Such as when `npm install` is run inside of
a cloned repo) Compilation is necessary in this case so that a single
npm-install will result in a requireable package. This is precisely why
npm runs publish on `npm install` (with no args)
@jasonkarns
Copy link
Member Author

The package.json diff looks bigger than it is.

  • clean is the same as before except i moved it to the top (and swapped tmp for generated)
  • test is the same except with long switch names instead of short flags
  • test:ci is the same except reports all results in TAP
  • build is the same except i use full switch names, and no longer register the .coffee extension

Bigger picture:

  • coffee source is compiled before a browserify build so browserify doesn't do the coffee compilation itself (no more coffeeify)
  • thus both node and browser entrypoints are the same, which is the compiled JS under generated/
  • coffee source is compiled before publish
  • thus the main entrypoint exists when published to registry as well as when npm install is run with no args
  • coffee tests and source are compiled to generated/ before testem browser test runs thus browser tests point to generated/

mocha tests still point to coffee source, though this can be changed if desired.

The important thing to me is that the same coffee compiler is used to compile for distribution (npm run compile) as does the compilation under test. Mocha just delegates to the locally-installed coffee compiler so this holds. (It did not hold when browserify was using coffeeify, so coffeeify was ripped out.) We could go a step further and do a coffee compilation of source and tests prior to the mocha run, that way we know the tests are hitting the same compiled JS as will be distributed. As it stands now, it's using the same coffee compiler, but we're not guaranteed the same compiler settings.

@jasonkarns
Copy link
Member Author

In order to see what the published tarball will look like:

  • ensure the working copy is clean
  • npm run clean
  • npm pack

the tarball should include:

  • bower.json
  • package.json
  • LICENSE
  • README
  • dist/testdouble.js
  • generated/*/.js

@searls
Copy link
Member

searls commented Oct 1, 2015

+1

On Oct 1, 2015, at 14:57, Jason Karns notifications@github.com wrote:

The package.json diff looks bigger than it is.

clean is the same as before except i moved it to the top (and swapped tmp for generated)
test is the same except with long switch names instead of short flags
test:ci is the same except reports all results in TAP
build is the same except i use full switch names, and no longer register the .coffee extension
Bigger picture:

coffee source is compiled before a browserify build so browserify doesn't do the coffee compilation itself (no more coffeeify)
thus both node and browser entrypoints are the same, which is the compiled JS under generated/
coffee source is compiled before publish
thus the main entrypoint exists when published to registry as well as npm install with no args
coffee tests and source are compiled to generated/ before testem browser test runs thus browser tests point to generated/
mocha tests still point to coffee source, though this can be changed if desired.

The important thing to me is that the same coffee compiler is used to compile for distribution (npm run compile) as does the compilation under test. Mocha just delegates to the locally-installed coffee compiler so this holds. (It did not hold when browserify was using coffeeify, so coffeeify was ripped out.) We could go a step further and do a coffee compilation of source and tests prior to the mocha run, that way we know the tests are hitting the same compiled JS as will be distributed. As it stands now, it's using the same coffee compiler, but we're not guaranteed the same compiler settings.


Reply to this email directly or view it on GitHub.

@searls
Copy link
Member

searls commented Oct 12, 2015

Is this ready to merge?

@jasonkarns
Copy link
Member Author

I think so, though it's been sufficiently purged from my memory

@searls
Copy link
Member

searls commented Oct 12, 2015

Mind pushing to a @next tag or something? Just added you as owner

@jasonkarns
Copy link
Member Author

sure thing

On Mon, Oct 12, 2015 at 1:28 PM, Justin Searls notifications@github.com
wrote:

Mind pushing to a @next https://github.com/next tag or something? Just
added you as owner


Reply to this email directly or view it on GitHub
#30 (comment)
.

@searls
Copy link
Member

searls commented Oct 24, 2015

merging because nobody knows if this works.

searls added a commit that referenced this pull request Oct 24, 2015
@searls searls merged commit 5475693 into master Oct 24, 2015
@jasonkarns jasonkarns deleted the compile-coffee branch November 18, 2015 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants