Skip to content
Browse files

Public warehouse Package Configuration (#59)

  • Loading branch information...
SivanMehta committed Jun 3, 2019
1 parent 7caafcc commit 0741afdf9aad387dca28431efd9606e85d939333
Showing with 92 additions and 0 deletions.
  1. +2 −0
  2. +90 −0
@@ -1,5 +1,6 @@

- [#59] Add documentation on what goes into a specific package
- Add proper swagger route for optional path variable `/assets/files` route
- [#57] Update ``
- Add badges
@@ -21,3 +22,4 @@
@@ -51,6 +51,8 @@ painless as possible when issues arise.
- [ Internals](#warehouseai-internals)
- [Data Models](#data-models)
- [Config options](#config-options)
- [Getting a package ``-ready](#getting-a-package-warehouseai---ready)
- [Private or scoped packages](#private-or--scoped-packages)
- [Local development environment](#local-development-environment)
- [Running tests](#running-tests)

@@ -351,6 +353,94 @@ Warehouse has the ability to use [passport-npm] to check authorization when
connecting via `npm`. An example of this can be found in the
[tests for npm auth][auth].

## Getting a package `` - ready

Let's take a client-side package and augment it so that it can be properly
consumed in ``. In this case, we will be:

- Using a public package
- Building with `webpack`
- Localizing for 2 different locales `en-US`, and `es-MX`.
- Defaulting to minified files in test and production

First, add these parameters in your `package.json`:

"name": "yet-another-js-framework",
"scripts": {
"build": "webpack && npm run minify",
"minify": "run-some-minification-tool"
+ "build": "webpack",
+ "locales": [
+ "en-US",
+ "es-MX"
+ ],
+ "publishConfig": {
+ "registry": ""
+ }

This indicates to `` that you're building with `webpack` for the
appropriate locales. Currently, 3 build systems are supported, `webpack`, `es*`,
and `browserify`. These additional systems are further detailed
Very simply, you can change the `build` keyword in your `package.json` to invoke
these build tools.

Next, add a `wrhs.toml` at the top-level directory, with following contents,
indicating which assets are to be served by default in each environment:

dev = ['dist/js/compiled-code.js']
test = ['dist/js/compiled-code.min.js']
prod = ['dist/js/compiled-code.min.js']

You see the full enumeration of options available
[here]( Finally, you
will need a [`webpack.config.js`](
in the root directory, if you don't already have one. It is important to note
that all `` is doing is to call `webpack` in this case. All of your
configuration must live within this file (not as command line arguments).

const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist', 'js'),
filename: 'compiled-code.js'

It is also important to note that the `dist` directory is not an arbitrary
choice, `` will need the `dist` directory to explicitly exist so it
knows which files to serve.

That's it. You can now follow the guide for [releasing code](#releasing-code).

### Private or `@`-scoped packages

If your package is [private]( or [scoped](, it
is important that you setup an `.npmrc` file that provides proper authorization
so that `` can properly `npm install` and build your assets. For
example, if you're using a private registry you may need to add this to your
repository's `.npmrc` file:

# for a private registry

If using a private registry, be sure that your instance of ``
has network access to that registry so that `npm install` can succeed.

## Tests

Running the tests will require a running cassandra instance on your local

0 comments on commit 0741afd

Please sign in to comment.
You can’t perform that action at this time.