Skip to content

Commit

Permalink
Merge pull request #1348 from david-heidema/feat/migrate-scaffolder-b…
Browse files Browse the repository at this point in the history
…ackend-module-utils-to-new-backend

Feat/migrate scaffolder backend module utils to new backend
  • Loading branch information
Xantier authored Apr 24, 2024
2 parents 6c7f9d3 + 7de72ac commit 9762391
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/empty-avocados-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@roadiehq/scaffolder-backend-module-utils': minor
---

Update to new backend system
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,27 @@ return await createRouter({
});
```

### New backend system

## From your Backstage root directory

```
cd packages/backend
yarn add @roadiehq/scaffolder-backend-module-utils/new-backend
```

```typescript
// packages/backend/src/index.ts
import { createBackend } from '@backstage/backend-defaults';
import { createBackendModule } from '@backstage/backend-plugin-api';

const backend = createBackend();
backend.add(import('@backstage/plugin-proxy-backend/alpha'));
backend.add(import('@backstage/plugin-scaffolder-backend/alpha'));
backend.add(import('@roadiehq/scaffolder-backend-module-utils/new-backend'));
backend.start();
```

## Actions:

### Zip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
},
"dependencies": {
"@backstage/backend-common": "^0.21.6",
"@backstage/backend-plugin-api": "^0.6.16",
"@backstage/config": "^1.2.0",
"@backstage/errors": "^1.2.4",
"@backstage/plugin-scaffolder-backend": "^1.22.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2021 Larder Software Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './zip';
export * from './fs';
export * from './merge';
export * from './sleep';
export * from './jsonata';
export * from './serialize';
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2024 Larder Software Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createBackendModule } from '@backstage/backend-plugin-api';
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';
import * as backendModuleUtils from './actions';

/**
* @public
* The Roadie Module for the Scaffolder Backend
*/
export const scaffolderBackendModuleUtils = createBackendModule({
pluginId: 'scaffolder',
moduleId: 'scaffolder-backend-module-utils',
register({ registerInit }) {
registerInit({
deps: {
scaffolder: scaffolderActionsExtensionPoint,
},
async init({ scaffolder }) {
scaffolder.addActions(
backendModuleUtils.createAppendFileAction(),
backendModuleUtils.createJSONataAction(),
backendModuleUtils.createJsonJSONataTransformAction(),
backendModuleUtils.createMergeAction(),
backendModuleUtils.createMergeJSONAction({}),
backendModuleUtils.createParseFileAction(),
backendModuleUtils.createReplaceInFileAction(),
backendModuleUtils.createSerializeJsonAction(),
backendModuleUtils.createSerializeYamlAction(),
backendModuleUtils.createSleepAction(),
backendModuleUtils.createWriteFileAction(),
backendModuleUtils.createYamlJSONataTransformAction(),
backendModuleUtils.createZipAction(),
);
},
});
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2024 Larder Software Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './module';
export { scaffolderBackendModuleUtils as default } from './module';

0 comments on commit 9762391

Please sign in to comment.