Use /index suffix for JS import statements

Otherwise browserify or gulp-sourcemaps doesn't include these
in the *.map file, which makes debugging impossible
This commit is contained in:
Ingo Schommer 2016-03-30 16:38:34 +13:00
parent 2cf5fbcfce
commit 0675f85d32
17 changed files with 54 additions and 54 deletions

View File

@ -10,7 +10,7 @@ import SchemaReducer from 'state/schema/reducer';
import RecordsReducer from 'state/records/reducer'; import RecordsReducer from 'state/records/reducer';
// Sections // Sections
import CampaignAdmin from 'sections/campaign-admin'; import CampaignAdmin from 'sections/campaign-admin/index';
function appBoot() { function appBoot() {
reducerRegister.add('config', ConfigReducer); reducerRegister.add('config', ConfigReducer);

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import SilverStripeComponent from 'silverstripe-component.js'; import SilverStripeComponent from 'silverstripe-component';
class FormActionComponent extends SilverStripeComponent { class FormActionComponent extends SilverStripeComponent {
constructor(props) { constructor(props) {

View File

@ -3,11 +3,11 @@ import { connect } from 'react-redux';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import $ from 'jQuery'; import $ from 'jQuery';
import * as schemaActions from 'state/schema/actions'; import * as schemaActions from 'state/schema/actions';
import SilverStripeComponent from 'silverstripe-component.js'; import SilverStripeComponent from 'silverstripe-component';
import FormComponent from 'components/form'; import FormComponent from 'components/form/index';
import TextField from 'components/text-field'; import TextField from 'components/text-field/index';
import HiddenField from 'components/hidden-field'; import HiddenField from 'components/hidden-field/index';
import GridField from 'components/grid-field'; import GridField from 'components/grid-field/index';
import fetch from 'isomorphic-fetch'; import fetch from 'isomorphic-fetch';
import es6promise from 'es6-promise'; import es6promise from 'es6-promise';

View File

@ -1,4 +1,4 @@
jest.unmock('silverstripe-component.js'); jest.unmock('silverstripe-component');
jest.unmock('../'); jest.unmock('../');
import { FormBuilderComponent } from '../'; import { FormBuilderComponent } from '../';

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import SilverStripeComponent from 'silverstripe-component.js'; import SilverStripeComponent from 'silverstripe-component';
import FormActionComponent from 'components/form-action'; import FormActionComponent from 'components/form-action/index';
class FormComponent extends SilverStripeComponent { class FormComponent extends SilverStripeComponent {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import SilverStripeComponent from 'silverstripe-component.js'; import SilverStripeComponent from 'silverstripe-component';
class GridFieldCellComponent extends SilverStripeComponent { class GridFieldCellComponent extends SilverStripeComponent {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import SilverStripeComponent from 'silverstripe-component.js'; import SilverStripeComponent from 'silverstripe-component';
class GridFieldHeaderCellComponent extends SilverStripeComponent { class GridFieldHeaderCellComponent extends SilverStripeComponent {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import SilverStripeComponent from 'silverstripe-component.js'; import SilverStripeComponent from 'silverstripe-component';
import GridFieldRowComponent from './row'; import GridFieldRowComponent from './row';
class GridFieldHeaderComponent extends SilverStripeComponent { class GridFieldHeaderComponent extends SilverStripeComponent {

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import SilverStripeComponent from 'silverstripe-component.js'; import SilverStripeComponent from 'silverstripe-component';
import GridFieldTable from './table'; import GridFieldTable from './table';
import GridFieldHeader from './header'; import GridFieldHeader from './header';
import GridFieldHeaderCell from './header-cell'; import GridFieldHeaderCell from './header-cell';

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import SilverStripeComponent from 'silverstripe-component.js'; import SilverStripeComponent from 'silverstripe-component';
class GridFieldRowComponent extends SilverStripeComponent { class GridFieldRowComponent extends SilverStripeComponent {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import SilverStripeComponent from 'silverstripe-component.js'; import SilverStripeComponent from 'silverstripe-component';
class GridFieldTableComponent extends SilverStripeComponent { class GridFieldTableComponent extends SilverStripeComponent {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import SilverStripeComponent from 'silverstripe-component.js'; import SilverStripeComponent from 'silverstripe-component';
class HiddenFieldComponent extends SilverStripeComponent { class HiddenFieldComponent extends SilverStripeComponent {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import SilverStripeComponent from 'silverstripe-component.js'; import SilverStripeComponent from 'silverstripe-component';
class NorthHeaderBreadcrumbsComponent extends SilverStripeComponent { class NorthHeaderBreadcrumbsComponent extends SilverStripeComponent {

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import NorthHeaderBreadcrumbsComponent from '../north-header-breadcrumbs'; import NorthHeaderBreadcrumbsComponent from '../north-header-breadcrumbs/index';
import SilverStripeComponent from 'silverstripe-component.js'; import SilverStripeComponent from 'silverstripe-component';
class NorthHeaderComponent extends SilverStripeComponent { class NorthHeaderComponent extends SilverStripeComponent {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import SilverStripeComponent from 'silverstripe-component.js'; import SilverStripeComponent from 'silverstripe-component';
class TextFieldComponent extends SilverStripeComponent { class TextFieldComponent extends SilverStripeComponent {

View File

@ -1,10 +1,10 @@
import React from 'react'; import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import SilverStripeComponent from 'silverstripe-component'; import SilverStripeComponent from 'silverstripe-component';
import FormAction from 'components/form-action'; import FormAction from 'components/form-action/index';
import i18n from 'i18n'; import i18n from 'i18n';
import NorthHeader from 'components/north-header'; import NorthHeader from 'components/north-header/index';
import FormBuilder from 'components/form-builder'; import FormBuilder from 'components/form-builder/index';
class CampaignAdminContainer extends SilverStripeComponent { class CampaignAdminContainer extends SilverStripeComponent {

View File

@ -192,32 +192,32 @@ gulp.task('bundle-lib', function bundleLib() {
.on('update', bundleLib) .on('update', bundleLib)
.on('log', function (msg) { gulpUtil.log('Finished', 'bundled ' + bundleFileName + ' ' + msg) }) .on('log', function (msg) { gulpUtil.log('Finished', 'bundled ' + bundleFileName + ' ' + msg) })
.transform('babelify', babelifyOptions) .transform('babelify', babelifyOptions)
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/form', { expose: 'components/form' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/form/index', { expose: 'components/form/index' })
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/form-action', { expose: 'components/form-action' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/form-action/index', { expose: 'components/form-action' })
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/form-builder', { expose: 'components/form-builder' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/form-builder/index', { expose: 'components/form-builder/index' })
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field', { expose: 'components/grid-field' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/index', { expose: 'components/grid-field/index' })
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/cell', { expose: 'components/grid-field/cell' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/cell', { expose: 'components/grid-field/cell/index' })
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/header', { expose: 'components/grid-field/header' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/header', { expose: 'components/grid-field/header' })
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/header-cell', { expose: 'components/grid-field/header-cell' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/header-cell', { expose: 'components/grid-field/header-cell' })
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/row', { expose: 'components/grid-field/row' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/row', { expose: 'components/grid-field/row' })
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/table', { expose: 'components/grid-field/table' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/table', { expose: 'components/grid-field/table' })
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/hidden-field', { expose: 'components/hidden-field' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/hidden-field/index', { expose: 'components/hidden-field/index' })
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/text-field', { expose: 'components/text-field' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/text-field/index', { expose: 'components/text-field/index' })
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/north-header', { expose: 'components/north-header' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/north-header/index', { expose: 'components/north-header/index' })
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/north-header-breadcrumbs', { expose: 'components/north-header-breadcrumbs' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/north-header-breadcrumbs/index', { expose: 'components/north-header-breadcrumbs/index' })
.require('deep-freeze', { expose: 'deep-freeze' }) .require('deep-freeze', { expose: 'deep-freeze' })
.require(PATHS.FRAMEWORK_JAVASCRIPT_SRC + '/i18n.js', { expose: 'i18n' }) .require(PATHS.FRAMEWORK_JAVASCRIPT_SRC + '/i18n.js', { expose: 'i18n' })
.require(PATHS.FRAMEWORK_JAVASCRIPT_SRC + '/jQuery.js', { expose: 'jQuery' }) .require(PATHS.FRAMEWORK_JAVASCRIPT_SRC + '/jQuery.js', { expose: 'jQuery' })
.require('react', { expose: 'react' }) .require('react', { expose: 'react' })
.require('react-addons-css-transition-group', { expose: 'react-addons-css-transition-group' }) .require('react-addons-css-transition-group', { expose: 'react-addons-css-transition-group' })
.require('react-addons-test-utils', { expose: 'react-addons-test-utils' }) .require('react-addons-test-utils', { expose: 'react-addons-test-utils' })
.require('react-dom', { expose: 'react-dom' }) .require('react-dom', { expose: 'react-dom' })
.require('react-redux', { expose: 'react-redux' }) .require('react-redux', { expose: 'react-redux' })
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/reducer-register.js', { expose: 'reducer-register' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/reducer-register.js', { expose: 'reducer-register' })
.require('redux', { expose: 'redux' }) .require('redux', { expose: 'redux' })
.require('redux-thunk', { expose: 'redux-thunk' }) .require('redux-thunk', { expose: 'redux-thunk' })
.require(PATHS.FRAMEWORK_JAVASCRIPT_SRC + '/router.js', { expose: 'router' }) .require(PATHS.FRAMEWORK_JAVASCRIPT_SRC + '/router.js', { expose: 'router' })
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/silverstripe-component.js', { expose: 'silverstripe-component' }) .require(PATHS.ADMIN_JAVASCRIPT_SRC + '/silverstripe-component', { expose: 'silverstripe-component' })
.bundle() .bundle()
.on('update', bundleLib) .on('update', bundleLib)
.on('error', notify.onError({ message: bundleFileName + ': <%= error.message %>' })) .on('error', notify.onError({ message: bundleFileName + ': <%= error.message %>' }))
@ -258,11 +258,11 @@ gulp.task('bundle-framework', function bundleBoot() {
.on('update', bundleBoot) .on('update', bundleBoot)
.on('log', function (msg) { gulpUtil.log('Finished', 'bundled ' + bundleFileName + ' ' + msg) }) .on('log', function (msg) { gulpUtil.log('Finished', 'bundled ' + bundleFileName + ' ' + msg) })
.transform('babelify', babelifyOptions) .transform('babelify', babelifyOptions)
.external('components/action-button') .external('components/action-button/index')
.external('components/north-header') .external('components/north-header/index')
.external('components/form-builder') .external('components/form-builder/index')
.external('deep-freeze') .external('deep-freeze')
.external('components/grid-field') .external('components/grid-field/index')
.external('i18n') .external('i18n')
.external('jQuery') .external('jQuery')
.external('page.js') .external('page.js')