Skip to content

Commit

Permalink
Merge pull request backstage#526 from spotify/feat/issues/523
Browse files Browse the repository at this point in the history
Remove the default export from plugins
  • Loading branch information
benjdlambert authored Apr 10, 2020
2 parents 3e1e356 + 72c9865 commit 2da0697
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 21 deletions.
7 changes: 3 additions & 4 deletions packages/app/src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { default as HomePagePlugin } from '@backstage/plugin-home-page';
import { default as WelcomePlugin } from '@backstage/plugin-welcome';
import { default as LighthousePlugin } from '@backstage/plugin-lighthouse';
export { HomePagePlugin, WelcomePlugin, LighthousePlugin };
export { plugin as HomePagePlugin } from '@backstage/plugin-home-page';
export { plugin as WelcomePlugin } from '@backstage/plugin-welcome';
export { plugin as LighthousePlugin } from '@backstage/plugin-lighthouse';
2 changes: 1 addition & 1 deletion packages/cli/src/commands/create-plugin/createPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export async function addPluginToApp(rootDir: string, pluginName: string) {
.split('-')
.map(name => capitalize(name))
.join('');
const pluginImport = `import { default as ${pluginNameCapitalized} } from '${pluginPackage}';`;
const pluginImport = `import { plugin as ${pluginNameCapitalized} } from '${pluginPackage}';`;
const pluginExport = `export { ${pluginNameCapitalized} };`;
const pluginsFilePath = 'packages/app/src/plugins.ts';
const pluginsFile = resolvePath(rootDir, pluginsFilePath);
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default as WelcomePlugin } from 'plugin-welcome';
export { plugin as WelcomePlugin } from 'plugin-welcome';
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from './plugin';
export { plugin } from './plugin';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import plugin from './plugin';
import { plugin } from './plugin';

describe('welcome', () => {
it('should export plugin', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createPlugin } from '@backstage/core';
import WelcomePage from './components/WelcomePage';

export default createPlugin({
export const plugin = createPlugin({
id: 'welcome',
register({ router }) {
router.registerRoute('/', WelcomePage);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/templates/default-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/

export { default } from './plugin';
export { plugin } from './plugin';
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import plugin from './plugin';
import { plugin } from './plugin';

describe('{{ id }}', () => {
it('should export plugin', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/templates/default-plugin/src/plugin.ts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { createPlugin } from '@backstage/core';
import ExampleComponent from './components/ExampleComponent';

export default createPlugin({
export const plugin = createPlugin({
id: '{{ id }}',
register({ router }) {
router.registerRoute('/{{ id }}', ExampleComponent);
Expand Down
2 changes: 1 addition & 1 deletion plugins/home-page/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/

export { default } from './plugin';
export { plugin } from './plugin';
2 changes: 1 addition & 1 deletion plugins/home-page/src/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import plugin from './plugin';
import { plugin } from './plugin';

describe('home-page', () => {
it('should export plugin', () => {
Expand Down
2 changes: 1 addition & 1 deletion plugins/home-page/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { createPlugin } from '@backstage/core';
import HomePage from 'components/HomePage';

export default createPlugin({
export const plugin = createPlugin({
id: 'home-page',
register({ router }) {
router.registerRoute('/home', HomePage);
Expand Down
2 changes: 1 addition & 1 deletion plugins/lighthouse/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
* limitations under the License.
*/

export { default } from './plugin';
export { plugin } from './plugin';
export * from './api';
2 changes: 1 addition & 1 deletion plugins/lighthouse/src/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import plugin from './plugin';
import { plugin } from './plugin';

describe('lighthouse', () => {
it('should export plugin', () => {
Expand Down
2 changes: 1 addition & 1 deletion plugins/lighthouse/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import AuditList from './components/AuditList';
import AuditView from './components/AuditView';
import CreateAudit from './components/CreateAudit';

export default createPlugin({
export const plugin = createPlugin({
id: 'lighthouse',
register({ router }) {
router.registerRoute('/lighthouse', AuditList);
Expand Down
2 changes: 1 addition & 1 deletion plugins/welcome/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/

export { default } from './plugin';
export { plugin } from './plugin';
2 changes: 1 addition & 1 deletion plugins/welcome/src/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import plugin from './plugin';
import { plugin } from './plugin';

describe('welcome', () => {
it('should export plugin', () => {
Expand Down
2 changes: 1 addition & 1 deletion plugins/welcome/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { createPlugin } from '@backstage/core';
import WelcomePage from 'components/WelcomePage';

export default createPlugin({
export const plugin = createPlugin({
id: 'welcome',
register({ router, featureFlags }) {
router.registerRoute('/', WelcomePage);
Expand Down

0 comments on commit 2da0697

Please sign in to comment.