Skip to content

Commit

Permalink
Reworked build scripts to implement default=production in a way that …
Browse files Browse the repository at this point in the history
…it works better with load-time side-effects.
  • Loading branch information
swernerx committed Jul 2, 2018
1 parent a22d06f commit 69d4843
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 28 deletions.
12 changes: 8 additions & 4 deletions app/angular/src/server/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { buildStatic } from '@storybook/core/server';
// Building for distribution defaults to production target.
process.env.NODE_ENV = process.env.NODE_ENV || 'production';

import options from './options';

buildStatic(options);
// Note: We are importing via CommonJS to be able to adjust NODE_ENV
// to production first before proceeding. This is required to correctly
// e.g. selecting the `.env` files to import. It also helps with all ESM
// imports which as some side-effect decide on things at "loadtime".
const server = require('@storybook/core/server');
server.buildStatic(require('./options').default);
12 changes: 8 additions & 4 deletions app/html/src/server/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { buildStatic } from '@storybook/core/server';
// Building for distribution defaults to production target.
process.env.NODE_ENV = process.env.NODE_ENV || 'production';

import options from './options';

buildStatic(options);
// Note: We are importing via CommonJS to be able to adjust NODE_ENV
// to production first before proceeding. This is required to correctly
// e.g. selecting the `.env` files to import. It also helps with all ESM
// imports which as some side-effect decide on things at "loadtime".
const server = require('@storybook/core/server');
server.buildStatic(require('./options').default);
12 changes: 8 additions & 4 deletions app/marko/src/server/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { buildStatic } from '@storybook/core/server';
// Building for distribution defaults to production target.
process.env.NODE_ENV = process.env.NODE_ENV || 'production';

import options from './options';

buildStatic(options);
// Note: We are importing via CommonJS to be able to adjust NODE_ENV
// to production first before proceeding. This is required to correctly
// e.g. selecting the `.env` files to import. It also helps with all ESM
// imports which as some side-effect decide on things at "loadtime".
const server = require('@storybook/core/server');
server.buildStatic(require('./options').default);
12 changes: 8 additions & 4 deletions app/mithril/src/server/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { buildStatic } from '@storybook/core/server';
// Building for distribution defaults to production target.
process.env.NODE_ENV = process.env.NODE_ENV || 'production';

import options from './options';

buildStatic(options);
// Note: We are importing via CommonJS to be able to adjust NODE_ENV
// to production first before proceeding. This is required to correctly
// e.g. selecting the `.env` files to import. It also helps with all ESM
// imports which as some side-effect decide on things at "loadtime".
const server = require('@storybook/core/server');
server.buildStatic(require('./options').default);
12 changes: 8 additions & 4 deletions app/polymer/src/server/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { buildStatic } from '@storybook/core/server';
// Building for distribution defaults to production target.
process.env.NODE_ENV = process.env.NODE_ENV || 'production';

import options from './options';

buildStatic(options);
// Note: We are importing via CommonJS to be able to adjust NODE_ENV
// to production first before proceeding. This is required to correctly
// e.g. selecting the `.env` files to import. It also helps with all ESM
// imports which as some side-effect decide on things at "loadtime".
const server = require('@storybook/core/server');
server.buildStatic(require('./options').default);
12 changes: 8 additions & 4 deletions app/react/src/server/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { buildStatic } from '@storybook/core/server';
// Building for distribution defaults to production target.
process.env.NODE_ENV = process.env.NODE_ENV || 'production';

import options from './options';

buildStatic(options);
// Note: We are importing via CommonJS to be able to adjust NODE_ENV
// to production first before proceeding. This is required to correctly
// e.g. selecting the `.env` files to import. It also helps with all ESM
// imports which as some side-effect decide on things at "loadtime".
const server = require('@storybook/core/server');
server.buildStatic(require('./options').default);
12 changes: 8 additions & 4 deletions app/vue/src/server/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { buildStatic } from '@storybook/core/server';
// Building for distribution defaults to production target.
process.env.NODE_ENV = process.env.NODE_ENV || 'production';

import options from './options';

buildStatic(options);
// Note: We are importing via CommonJS to be able to adjust NODE_ENV
// to production first before proceeding. This is required to correctly
// e.g. selecting the `.env` files to import. It also helps with all ESM
// imports which as some side-effect decide on things at "loadtime".
const server = require('@storybook/core/server');
server.buildStatic(require('./options').default);

0 comments on commit 69d4843

Please sign in to comment.