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 module alias for cleaner imports #825

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
map: [
[ 'App', './src/app' ],
[ 'Assets', './aseets' ],
[ '@modules', './vendor/newfold-labs' ],
],
extensions: [ '.js', '.jsx', '.json' ],
},
Expand Down
2 changes: 1 addition & 1 deletion src/app/data/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Performance from '../pages/performance';
import Settings from '../pages/settings';
import Staging from '../pages/staging';
import Help from '../pages/help';
import { getMarketplaceSubnavRoutes } from '../../../vendor/newfold-labs/wp-module-marketplace/components/marketplaceSubnav';
import { getMarketplaceSubnavRoutes } from '@modules/wp-module-marketplace/components/marketplaceSubnav';
import { ReactComponent as HelpIcon } from '../components/icons/HelpIcon.svg';

const addPartialMatch = ( prefix, path ) =>
Expand Down
2 changes: 1 addition & 1 deletion src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { SiteInfoBar } from './components/site-info';
import { NotificationFeed } from './components/notifications';

// component sourced from module
import { default as NewfoldNotifications } from '../../vendor/newfold-labs/wp-module-notifications/assets/js/components/notifications/';
import { default as NewfoldNotifications } from '@modules/wp-module-notifications/assets/js/components/notifications/';
// to pass to notifications module
import apiFetch from '@wordpress/api-fetch';
import { addQueryArgs } from '@wordpress/url';
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/marketplace/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from 'App/components/section';
import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
// component sourced from marketplace module
import { default as NewfoldMarketplace } from '../../../../vendor/newfold-labs/wp-module-marketplace/components/marketplace/';
import { default as NewfoldMarketplace } from '@modules/wp-module-marketplace/components/marketplace/';

const MarketplacePage = () => {
// constants to pass to module
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/performance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
bluehostPurgeCacheApiFetch as newfoldPurgeCacheApiFetch,
} from 'App/util/helpers';

import { default as NewfoldPerformance } from '../../../../vendor/newfold-labs/wp-module-performance/components/performance/';
import { default as NewfoldPerformance } from '@modules/wp-module-performance/components/performance/';

const PerformancePage = () => {
// constants to pass to module
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/staging/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from 'App/components/section';
import { useNotification } from 'App/components/notifications';
// component sourced from staging module
import { default as NewfoldStaging } from '../../../../vendor/newfold-labs/wp-module-staging/components/staging/';
import { default as NewfoldStaging } from '@modules/wp-module-staging/components/staging/';

const Staging = () => {
// constants to pass to module
Expand Down
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const alias = {
Assets: path.resolve( __dirname, '/assets/' ),
Store: path.resolve( __dirname, '/src/app/data/store.js' ),
Routes: path.resolve( __dirname, '/src/app/data/routes.js' ),
'@modules': path.resolve( __dirname, '/vendor/newfold-labs/' ),
};
/**
* Make most-common imports available globally to ease import debt.
Expand Down
Loading