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

Add task for publishing to npm #3071

Merged
merged 3 commits into from Dec 20, 2014
Merged

Add task for publishing to npm #3071

merged 3 commits into from Dec 20, 2014

Conversation

tschaub
Copy link
Member

@tschaub tschaub commented Dec 20, 2014

This task publishes an existing tag to the npm registry. To publish a new release, create a commit that updates the version number in package.json (e.g. to "3.1.0"). Then create a tag, push to GitHub, and run the publish task. Assuming openlayers is the remote for the canonical repo, this would look like the following:

git tag -a v3.1.0 -m "3.1.0"
git push --tags openlayers
./tasks/publish.sh 3.1.0

The task creates a build for each of the PROFILES in publish.sh (these correspond to .json files in the config directory). Builds are generated in the dist directory. Our package.json specifies dist/ol.js as the "main" build. So when people use a module loader to require('openlayers'), they get the full build. It is also possible to load a debug build (e.g. require('openlayers/dist/ol-debug')), and we can publish additional builds by adding config files and updating PROFILES in publish.sh.

The .npmignore file determines what is not included in the package (note that node_modules are always ignored). So if additional items are added to .gitignore that should not be included in the npm package, they need to go in .npmignore as well (ideally, we don't need to generate anything else outside of the build directory that doesn't belong in the package).

This task publishes an existing tag to the npm registry.  To publish a new release, create a commit that updates the version number in package.json (e.g. to "3.1.0").  Then create a tag, push to GitHub, and run the publish task.  Assuming "openlayers" is the remote for the canonical repo, this would look like the following:

    git tag -a v3.1.0 -m "3.1.0"
    git push --tags openlayers
    ./tasks/publish.sh 3.1.0

The task creates a build for each of the `PROFILES` in `publish.sh` (these correspond to `.json` files in the `config` directory).  Builds are generated in the `dist` directory.  Our `package.json` specifies `dist/ol.js` as the "main" build.  So when people use a module loader to `require('openlayers')`, they get the full build.  It is also possible to load a debug build (e.g. `require('openlayers/dist/ol-debug')`), and we can publish additional builds by adding `config` files and updating `PROFILES` in `publish.sh`.

The `.npmignore` file determines what is *not* included in the package (note that `node_modules` are always ignored).  So if additional items are added to `.gitignore` that should not be included in the npm package, they need to go in `.npmignore` as well (ideally, we don't need to generate anything else outside of the `build` directory that doesn't belong in the package).
@tschaub
Copy link
Member Author

tschaub commented Dec 20, 2014

If anybody wants to test out the result, I've published an openlayers-test package. With Browserify (or other CommonJS loaders) you can get it by adding openlayers-test as a dependency in your package.json:

  "devDependencies": {
    "openlayers-test": "3.1.0-pre.4"
  }

And then in any module that depends on OpenLayers:

var ol = require('openlayers-test');

There is still an issue with the debug build in that it tries to load deps.js (which doesn't exist). I'll address that separately.

@tschaub
Copy link
Member Author

tschaub commented Dec 20, 2014

d4763a0 makes it so deps.js is no longer requested in debug mode.

@elemoine
Copy link
Member

Please merge. And +1 for the shell script.

tschaub added a commit that referenced this pull request Dec 20, 2014
Add task for publishing to npm.
@tschaub tschaub merged commit 0ae00fb into openlayers:master Dec 20, 2014
@tschaub tschaub deleted the publish branch December 20, 2014 16:46
@ahocevar ahocevar mentioned this pull request Jan 13, 2015
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