mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Relative ES6 module paths
http://stackoverflow.com/questions/20158401/how-do-i-manage-relative-path-aliasing-in-multiple-grunt-browserify-bundles/23608416#23608416 https://github.com/substack/node-browserify/issues/767 http://stackoverflow.com/questions/28078780/relative-paths-in-package-json https://github.com/npm/npm/issues/1558 http://stackoverflow.com/questions/31624567/webstorm-es6-named-import-getting-cannot-resolve-symbol-error/31631415 http://stackoverflow.com/questions/20158401/how-do-i-manage-relative-path-aliasing-in-multiple-grunt-browserify-bundles/23608416#23608416 https://github.com/vigetlabs/gulp-starter/issues/17#issuecomment-44292681
This commit is contained in:
parent
c70590e50c
commit
47dd7b48af
@ -4,12 +4,12 @@ import thunkMiddleware from 'redux-thunk';
|
||||
import createLogger from 'redux-logger';
|
||||
import reducerRegister from 'reducer-register';
|
||||
|
||||
import * as configActions from '../state/config/actions';
|
||||
import ConfigReducer from '../state/config/reducer';
|
||||
import SchemaReducer from '../state/schema/reducer';
|
||||
import * as configActions from 'state/config/actions';
|
||||
import ConfigReducer from 'state/config/reducer';
|
||||
import SchemaReducer from 'state/schema/reducer';
|
||||
|
||||
// Sections
|
||||
import CampaignAdmin from '../sections/campaign-admin';
|
||||
import CampaignAdmin from 'sections/campaign-admin';
|
||||
|
||||
function appBoot() {
|
||||
reducerRegister.add('config', ConfigReducer);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import SilverStripeComponent from '../../SilverStripeComponent';
|
||||
import SilverStripeComponent from 'silverstripe-component.js';
|
||||
|
||||
class ActionComponent extends SilverStripeComponent {
|
||||
constructor(props) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import SilverStripeComponent from '../../SilverStripeComponent';
|
||||
import SilverStripeComponent from 'silverstripe-component.js';
|
||||
|
||||
class FormActionComponent extends SilverStripeComponent {
|
||||
|
||||
|
@ -2,12 +2,12 @@ import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { bindActionCreators } from 'redux';
|
||||
import $ from 'jQuery';
|
||||
import * as schemaActions from '../../state/schema/actions';
|
||||
import SilverStripeComponent from '../../SilverStripeComponent';
|
||||
import FormComponent from '../form';
|
||||
import TextField from '../text-field';
|
||||
import HiddenField from '../hidden-field';
|
||||
import GridField from '../../components/grid-field';
|
||||
import * as schemaActions from 'state/schema/actions';
|
||||
import SilverStripeComponent from 'silverstripe-component.js';
|
||||
import FormComponent from 'components/form';
|
||||
import TextField from 'components/text-field';
|
||||
import HiddenField from 'components/hidden-field';
|
||||
import GridField from 'components/grid-field';
|
||||
|
||||
// Using this to map field types to components until we implement dependency injection.
|
||||
var fakeInjector = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
jest.unmock('../../../SilverStripeComponent');
|
||||
jest.unmock('silverstripe-component.js');
|
||||
jest.unmock('../');
|
||||
|
||||
import { FormBuilderComponent } from '../';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import SilverStripeComponent from '../../SilverStripeComponent';
|
||||
import FormActionComponent from '../form-action';
|
||||
import SilverStripeComponent from 'silverstripe-component.js';
|
||||
import FormActionComponent from 'components/form-action';
|
||||
|
||||
class FormComponent extends SilverStripeComponent {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import SilverStripeComponent from '../../SilverStripeComponent';
|
||||
import SilverStripeComponent from 'silverstripe-component.js';
|
||||
|
||||
class GridFieldCellComponent extends SilverStripeComponent {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import SilverStripeComponent from '../../SilverStripeComponent';
|
||||
import SilverStripeComponent from 'silverstripe-component.js';
|
||||
|
||||
class GridFieldHeaderCellComponent extends SilverStripeComponent {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import SilverStripeComponent from '../../SilverStripeComponent';
|
||||
import SilverStripeComponent from 'silverstripe-component.js';
|
||||
import GridFieldRowComponent from './row';
|
||||
|
||||
class GridFieldHeaderComponent extends SilverStripeComponent {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import SilverStripeComponent from '../../SilverStripeComponent';
|
||||
import SilverStripeComponent from 'silverstripe-component.js';
|
||||
import GridFieldTable from './table';
|
||||
import GridFieldHeader from './header';
|
||||
import GridFieldHeaderCell from './header-cell';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import SilverStripeComponent from '../../SilverStripeComponent';
|
||||
import SilverStripeComponent from 'silverstripe-component.js';
|
||||
|
||||
class GridFieldRowComponent extends SilverStripeComponent {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import SilverStripeComponent from '../../SilverStripeComponent';
|
||||
import SilverStripeComponent from 'silverstripe-component.js';
|
||||
|
||||
class GridFieldTableComponent extends SilverStripeComponent {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import SilverStripeComponent from '../../SilverStripeComponent';
|
||||
import SilverStripeComponent from 'silverstripe-component.js';
|
||||
|
||||
class HiddenFieldComponent extends SilverStripeComponent {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import SilverStripeComponent from '../../SilverStripeComponent';
|
||||
import SilverStripeComponent from 'silverstripe-component.js';
|
||||
|
||||
class NorthHeaderBreadcrumbsComponent extends SilverStripeComponent {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import NorthHeaderBreadcrumbsComponent from '../north-header-breadcrumbs';
|
||||
import SilverStripeComponent from '../../SilverStripeComponent';
|
||||
import SilverStripeComponent from 'silverstripe-component.js';
|
||||
|
||||
class NorthHeaderComponent extends SilverStripeComponent {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import SilverStripeComponent from '../../SilverStripeComponent';
|
||||
import SilverStripeComponent from 'silverstripe-component.js';
|
||||
|
||||
class TextFieldComponent extends SilverStripeComponent {
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import SilverStripeComponent from 'silverstripe-component';
|
||||
import ActionButton from 'action-button';
|
||||
import ActionButton from 'components/action-button';
|
||||
import i18n from 'i18n';
|
||||
import NorthHeader from 'north-header';
|
||||
import GridField from 'grid-field';
|
||||
import FormBuilder from '../../components/form-builder';
|
||||
import NorthHeader from 'components/north-header';
|
||||
import FormBuilder from 'components/form-builder';
|
||||
|
||||
class CampaignAdminContainer extends SilverStripeComponent {
|
||||
|
||||
|
@ -4,7 +4,7 @@ import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { Provider } from 'react-redux';
|
||||
import CampaignAdmin from './controller';
|
||||
import campaignsReducer from '../../state/campaigns/reducer';
|
||||
import campaignsReducer from 'state/campaigns/reducer';
|
||||
|
||||
// TODO: Move this to the controller.
|
||||
reducerRegister.add('campaigns', campaignsReducer);
|
||||
|
45
gulpfile.js
45
gulpfile.js
@ -41,7 +41,10 @@ var PATHS = {
|
||||
// Folders which contain both scss and css folders to be compiled
|
||||
var rootCompileFolders = [PATHS.FRAMEWORK, PATHS.ADMIN, PATHS.FRAMEWORK_DEV_INSTALL]
|
||||
|
||||
var browserifyOptions = { debug: true };
|
||||
var browserifyOptions = {
|
||||
debug: true,
|
||||
paths: [PATHS.ADMIN_JAVASCRIPT_SRC, PATHS.FRAMEWORK_JAVASCRIPT_SRC]
|
||||
};
|
||||
|
||||
var babelifyOptions = {
|
||||
presets: ['es2015', 'react'],
|
||||
@ -189,22 +192,23 @@ gulp.task('bundle-lib', function bundleLib() {
|
||||
.on('update', bundleLib)
|
||||
.on('log', function (msg) { gulpUtil.log('Finished', 'bundled ' + bundleFileName + ' ' + msg) })
|
||||
.transform('babelify', babelifyOptions)
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/action', { expose: 'action-button' })
|
||||
.require('deep-freeze', { expose: 'deep-freeze' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/form', { expose: 'form' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/form-action', { expose: 'form-action' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/form-builder', { expose: 'form-builder' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field', { expose: 'grid-field' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/cell', { expose: 'grid-field-cell' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/header', { expose: 'grid-field-header' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/header-cell', { expose: 'grid-field-header-cell' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/row', { expose: 'grid-field-row' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/table', { expose: 'grid-field-table' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/hidden-field', { expose: 'hidden-field' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/action', { expose: 'components/action-button' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/form', { expose: 'components/form' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/form-action', { expose: 'components/form-action' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/form-builder', { expose: 'components/form-builder' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field', { expose: 'components/grid-field' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/grid-field/cell', { expose: 'components/grid-field/cell' })
|
||||
.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/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/hidden-field', { expose: 'components/hidden-field' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/text-field', { expose: 'components/text-field' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/north-header', { expose: 'components/north-header' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/north-header-breadcrumbs', { expose: 'components/north-header-breadcrumbs' })
|
||||
.require('deep-freeze', { expose: 'deep-freeze' })
|
||||
.require(PATHS.FRAMEWORK_JAVASCRIPT_SRC + '/i18n.js', { expose: 'i18n' })
|
||||
.require(PATHS.FRAMEWORK_JAVASCRIPT_SRC + '/jQuery.js', { expose: 'jQuery' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/north-header', { expose: 'north-header' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/north-header-breadcrumbs', { expose: 'north-header-breadcrumbs' })
|
||||
.require('react', { expose: 'react' })
|
||||
.require('react-addons-css-transition-group', { expose: 'react-addons-css-transition-group' })
|
||||
.require('react-addons-test-utils', { expose: 'react-addons-test-utils' })
|
||||
@ -214,8 +218,7 @@ gulp.task('bundle-lib', function bundleLib() {
|
||||
.require('redux', { expose: 'redux' })
|
||||
.require('redux-thunk', { expose: 'redux-thunk' })
|
||||
.require(PATHS.FRAMEWORK_JAVASCRIPT_SRC + '/router.js', { expose: 'router' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/SilverStripeComponent', { expose: 'silverstripe-component' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/components/text-field', { expose: 'text-field' })
|
||||
.require(PATHS.ADMIN_JAVASCRIPT_SRC + '/silverstripe-component.js', { expose: 'silverstripe-component' })
|
||||
.bundle()
|
||||
.on('update', bundleLib)
|
||||
.on('error', notify.onError({ message: bundleFileName + ': <%= error.message %>' }))
|
||||
@ -256,13 +259,13 @@ gulp.task('bundle-framework', function bundleBoot() {
|
||||
.on('update', bundleBoot)
|
||||
.on('log', function (msg) { gulpUtil.log('Finished', 'bundled ' + bundleFileName + ' ' + msg) })
|
||||
.transform('babelify', babelifyOptions)
|
||||
.external('action-button')
|
||||
.external('components/action-button')
|
||||
.external('components/north-header')
|
||||
.external('components/form-builder')
|
||||
.external('deep-freeze')
|
||||
.external('grid-field')
|
||||
.external('components/grid-field')
|
||||
.external('i18n')
|
||||
.external('jQuery')
|
||||
.external('jQuery')
|
||||
.external('north-header')
|
||||
.external('page.js')
|
||||
.external('react-addons-test-utils')
|
||||
.external('react-dom')
|
||||
|
@ -11,13 +11,12 @@
|
||||
},
|
||||
"scripts": {
|
||||
"build": "gulp build",
|
||||
"bundle": "gulp bundle",
|
||||
"coverage": "jest --coverage",
|
||||
"css": "gulp css",
|
||||
"lock": "npm-shrinkwrap --dev",
|
||||
"sanity": "gulp sanity",
|
||||
"sprites": "gulp sprites",
|
||||
"test": "jest",
|
||||
"test": "NODE_PATH=\"./javascript/src:./admin/javascript/src\" jest",
|
||||
"coverage": "NODE_PATH=\"./javascript/src:./admin/javascript/src\" jest --coverage",
|
||||
"thirdparty": "gulp thirdparty"
|
||||
},
|
||||
"repository": {
|
||||
|
Loading…
Reference in New Issue
Block a user