@backstage/cli 0.7.16 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/config/jest.js +42 -14
  3. package/config/jestEsmTransform.js +4 -21
  4. package/config/jestSucraseTransform.js +66 -0
  5. package/dist/cjs/{build-adad8b22.cjs.js → build-5907bd33.cjs.js} +4 -3
  6. package/dist/cjs/{build-093508d5.cjs.js → build-73b8edfc.cjs.js} +4 -3
  7. package/dist/cjs/{build-d7862d7c.cjs.js → build-7571e64b.cjs.js} +4 -3
  8. package/dist/cjs/{build-292d259f.cjs.js → build-9e812f65.cjs.js} +6 -5
  9. package/dist/cjs/{buildImage-7e3cf320.cjs.js → buildImage-7b597eb4.cjs.js} +5 -4
  10. package/dist/cjs/{buildWorkspace-cfea104f.cjs.js → buildWorkspace-779679cc.cjs.js} +5 -4
  11. package/dist/cjs/{bump-27623ef3.cjs.js → bump-67695db2.cjs.js} +31 -8
  12. package/dist/cjs/{bundle-80c7cf66.cjs.js → bundle-561463d9.cjs.js} +6 -5
  13. package/dist/cjs/{clean-f750c0dc.cjs.js → clean-1156a89f.cjs.js} +3 -2
  14. package/dist/cjs/{config-3e7b308b.cjs.js → config-10d49423.cjs.js} +21 -6
  15. package/dist/cjs/create-b0f456f9.cjs.js +483 -0
  16. package/dist/cjs/{createPlugin-a03aceea.cjs.js → createPlugin-2c95815c.cjs.js} +11 -9
  17. package/dist/cjs/{dev-f7d06c3d.cjs.js → dev-a04f9251.cjs.js} +5 -4
  18. package/dist/cjs/{diff-fd2bda97.cjs.js → diff-d009aa81.cjs.js} +3 -2
  19. package/dist/cjs/{docs-8dde3bb5.cjs.js → docs-d4bb9d0c.cjs.js} +4 -3
  20. package/dist/cjs/{index-8ece1803.cjs.js → index-25ca4442.cjs.js} +172 -51
  21. package/dist/cjs/{index-07ce0d55.cjs.js → index-351d0371.cjs.js} +3 -2
  22. package/dist/cjs/{index-39056740.cjs.js → index-af2b13e0.cjs.js} +13 -11
  23. package/dist/cjs/{info-85a45abd.cjs.js → info-05aaf204.cjs.js} +4 -3
  24. package/dist/cjs/{install-8c0b53e3.cjs.js → install-5d8e8fe5.cjs.js} +5 -4
  25. package/dist/cjs/{lint-fffadef5.cjs.js → lint-85c90960.cjs.js} +4 -3
  26. package/dist/cjs/{lint-d2e5b1ca.cjs.js → lint-d1316de9.cjs.js} +4 -3
  27. package/dist/cjs/{pack-f73a4522.cjs.js → pack-58a2ab5d.cjs.js} +3 -2
  28. package/dist/cjs/{packager-e61b2b16.cjs.js → packager-b251454c.cjs.js} +2 -2
  29. package/dist/cjs/{packages-be161005.cjs.js → packages-4a2d7110.cjs.js} +3 -3
  30. package/dist/cjs/{paths-5e0e5ffc.cjs.js → paths-034708b3.cjs.js} +20 -5
  31. package/dist/cjs/{print-5df69d1b.cjs.js → print-5d03aebd.cjs.js} +6 -4
  32. package/dist/cjs/{removePlugin-865c314e.cjs.js → removePlugin-c64823bb.cjs.js} +13 -3
  33. package/dist/cjs/{run-cc82f277.cjs.js → run-924136d8.cjs.js} +9 -4
  34. package/dist/cjs/{schema-66b2f248.cjs.js → schema-d59459da.cjs.js} +4 -3
  35. package/dist/cjs/{serve-7656d962.cjs.js → serve-0f30d0fc.cjs.js} +7 -6
  36. package/dist/cjs/{serve-b1a08c13.cjs.js → serve-28c83157.cjs.js} +8 -7
  37. package/dist/cjs/{server-4f73b8b5.cjs.js → server-652ec9a3.cjs.js} +2 -2
  38. package/dist/cjs/{tasks-4d9e9b1f.cjs.js → tasks-802f087f.cjs.js} +78 -12
  39. package/dist/cjs/{testCommand-55c14530.cjs.js → testCommand-11d07d1b.cjs.js} +4 -3
  40. package/dist/cjs/{validate-1542a59a.cjs.js → validate-3cc188fa.cjs.js} +6 -4
  41. package/dist/index.cjs.js +2 -1
  42. package/package.json +21 -22
  43. package/templates/default-backend-plugin/package.json.hbs +39 -37
  44. package/templates/default-common-plugin-package/.eslintrc.js +3 -0
  45. package/templates/default-common-plugin-package/README.md.hbs +5 -0
  46. package/templates/default-common-plugin-package/package.json.hbs +34 -0
  47. package/templates/default-common-plugin-package/src/index.ts.hbs +19 -0
  48. package/templates/default-common-plugin-package/src/setupTests.ts +1 -0
  49. package/templates/default-common-plugin-package/tsconfig.json +9 -0
  50. package/templates/default-plugin/package.json.hbs +5 -3
  51. package/templates/default-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +5 -2
  52. package/templates/default-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +2 -2
  53. package/templates/scaffolder-module/.eslintrc.js +3 -0
  54. package/templates/scaffolder-module/README.md.hbs +5 -0
  55. package/templates/scaffolder-module/package.json.hbs +37 -0
  56. package/templates/scaffolder-module/src/actions/example/example.test.ts +50 -0
  57. package/templates/scaffolder-module/src/actions/example/example.ts +57 -0
  58. package/templates/scaffolder-module/src/actions/example/index.ts +1 -0
  59. package/templates/scaffolder-module/src/actions/index.ts +1 -0
  60. package/templates/scaffolder-module/src/index.ts.hbs +8 -0
  61. package/templates/scaffolder-module/tsconfig.json +9 -0
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "{{name}}",
3
+ "description": "Common functionalities for the {{id}} plugin",
4
+ "version": "{{pluginVersion}}",
5
+ "main": "src/index.ts",
6
+ "types": "src/index.ts",
7
+ "license": "Apache-2.0",
8
+ {{#if privatePackage}}
9
+ "private": {{privatePackage}},
10
+ {{/if}}
11
+ "publishConfig": {
12
+ {{#if npmRegistry}}
13
+ "registry": "{{npmRegistry}}",
14
+ {{/if}}
15
+ "access": "public",
16
+ "main": "dist/index.cjs.js",
17
+ "module": "dist/index.esm.js",
18
+ "types": "dist/index.d.ts"
19
+ },
20
+ "scripts": {
21
+ "build": "backstage-cli build",
22
+ "lint": "backstage-cli lint",
23
+ "test": "backstage-cli test",
24
+ "prepack": "backstage-cli prepack",
25
+ "postpack": "backstage-cli postpack",
26
+ "clean": "backstage-cli clean"
27
+ },
28
+ "devDependencies": {
29
+ "@backstage/cli": "{{versionQuery '@backstage/cli'}}"
30
+ },
31
+ "files": [
32
+ "dist"
33
+ ]
34
+ }
@@ -0,0 +1,19 @@
1
+ /***/
2
+ /**
3
+ * Common functionalities for the {{id}} plugin.
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+
8
+ /**
9
+ * In this package you might for example declare types that are common
10
+ * between the frontend and backend plugin packages.
11
+ */
12
+ export type CommonType = {
13
+ field: string
14
+ }
15
+
16
+ /**
17
+ * Or you might declare some common constants.
18
+ */
19
+ export const COMMON_CONSTANT = 1
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@backstage/cli/config/tsconfig.json",
3
+ "include": ["src"],
4
+ "exclude": ["node_modules"],
5
+ "compilerOptions": {
6
+ "outDir": "dist-types",
7
+ "rootDir": "."
8
+ }
9
+ }
@@ -4,10 +4,12 @@
4
4
  "main": "src/index.ts",
5
5
  "types": "src/index.ts",
6
6
  "license": "Apache-2.0",
7
- {{#if privatePackage}} "private": {{privatePackage}},
7
+ {{#if privatePackage}}
8
+ "private": {{privatePackage}},
8
9
  {{/if}}
9
10
  "publishConfig": {
10
- {{#if npmRegistry}} "registry": "{{npmRegistry}}",
11
+ {{#if npmRegistry}}
12
+ "registry": "{{npmRegistry}}",
11
13
  {{/if}}
12
14
  "access": "public",
13
15
  "main": "dist/index.esm.js",
@@ -44,7 +46,7 @@
44
46
  "@testing-library/user-event": "{{versionQuery '@testing-library/user-event' '13.1.8'}}",
45
47
  "@types/jest": "{{versionQuery '@types/jest' '26.0.7'}}",
46
48
  "@types/node": "{{versionQuery '@types/node' '14.14.32'}}",
47
- "msw": "{{versionQuery 'msw' '0.29.0'}}",
49
+ "msw": "{{versionQuery 'msw' '0.35.0'}}",
48
50
  "cross-fetch": "{{versionQuery 'cross-fetch' '3.0.6'}}"
49
51
  },
50
52
  "files": [
@@ -4,12 +4,15 @@ import { ThemeProvider } from '@material-ui/core';
4
4
  import { lightTheme } from '@backstage/theme';
5
5
  import { rest } from 'msw';
6
6
  import { setupServer } from 'msw/node';
7
- import { msw, renderInTestApp } from '@backstage/test-utils';
7
+ import {
8
+ setupRequestMockHandlers,
9
+ renderInTestApp,
10
+ } from "@backstage/test-utils";
8
11
 
9
12
  describe('ExampleComponent', () => {
10
13
  const server = setupServer();
11
14
  // Enable sane handlers for network requests
12
- msw.setupDefaultHandlers(server);
15
+ setupRequestMockHandlers(server);
13
16
 
14
17
  // setup mock response
15
18
  beforeEach(() => {
@@ -3,12 +3,12 @@ import { render } from '@testing-library/react';
3
3
  import { ExampleFetchComponent } from './ExampleFetchComponent';
4
4
  import { rest } from 'msw';
5
5
  import { setupServer } from 'msw/node';
6
- import { msw } from '@backstage/test-utils';
6
+ import { setupRequestMockHandlers } from '@backstage/test-utils';
7
7
 
8
8
  describe('ExampleFetchComponent', () => {
9
9
  const server = setupServer();
10
10
  // Enable sane handlers for network requests
11
- msw.setupDefaultHandlers(server);
11
+ setupRequestMockHandlers(server);
12
12
 
13
13
  // setup mock response
14
14
  beforeEach(() => {
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ extends: [require.resolve('@backstage/cli/config/eslint.backend')],
3
+ };
@@ -0,0 +1,5 @@
1
+ # {{name}}
2
+
3
+ The {{id}} module for [@backstage/plugin-scaffolder-backend](https://www.npmjs.com/package/@backstage/plugin-scaffolder-backend).
4
+
5
+ _This plugin was created through the Backstage CLI_
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "{{name}}",
3
+ "description": "The {{id}} module for @backstage/plugin-scaffolder-backend",
4
+ "version": "{{pluginVersion}}",
5
+ "main": "src/index.ts",
6
+ "types": "src/index.ts",
7
+ "license": "Apache-2.0",
8
+ {{#if privatePackage}}
9
+ "private": {{privatePackage}},
10
+ {{/if}}
11
+ "publishConfig": {
12
+ {{#if npmRegistry}}
13
+ "registry": "{{npmRegistry}}",
14
+ {{/if}}
15
+ "access": "public",
16
+ "main": "dist/index.cjs.js",
17
+ "types": "dist/index.d.ts"
18
+ },
19
+ "scripts": {
20
+ "build": "backstage-cli build --output cjs,types",
21
+ "lint": "backstage-cli lint",
22
+ "test": "backstage-cli test",
23
+ "prepack": "backstage-cli prepack",
24
+ "postpack": "backstage-cli postpack",
25
+ "clean": "backstage-cli clean"
26
+ },
27
+ "dependencies": {
28
+ "@backstage/plugin-scaffolder-backend": "{{versionQuery '@backstage/plugin-scaffolder-backend'}}"
29
+ },
30
+ "devDependencies": {
31
+ "@backstage/backend-common": "{{versionQuery '@backstage/backend-common'}}",
32
+ "@backstage/cli": "{{versionQuery '@backstage/cli'}}"
33
+ },
34
+ "files": [
35
+ "dist"
36
+ ]
37
+ }
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Copyright 2021 The Backstage Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { PassThrough } from 'stream';
18
+ import { createAcmeExampleAction } from './example';
19
+ import { getVoidLogger } from '@backstage/backend-common';
20
+
21
+ describe('acme:example', () => {
22
+ afterEach(() => {
23
+ jest.resetAllMocks();
24
+ });
25
+
26
+ it('should call action', async () => {
27
+ const action = createAcmeExampleAction();
28
+
29
+ const logger = getVoidLogger();
30
+ jest.spyOn(logger, 'info');
31
+
32
+ await action.handler({
33
+ input: {
34
+ myParameter: 'test',
35
+ },
36
+ workspacePath: '/tmp',
37
+ logger,
38
+ logStream: new PassThrough(),
39
+ output: jest.fn(),
40
+ createTemporaryDirectory() {
41
+ // Usage of mock-fs is recommended for testing of filesystem operations
42
+ throw new Error('Not implemented');
43
+ },
44
+ });
45
+
46
+ expect(logger.info).toHaveBeenCalledWith(
47
+ 'Running example template with parameters: test',
48
+ );
49
+ });
50
+ });
@@ -0,0 +1,57 @@
1
+ /*
2
+ * Copyright 2021 The Backstage Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { createTemplateAction } from '@backstage/plugin-scaffolder-backend';
18
+
19
+ /**
20
+ * Creates an `acme:example` Scaffolder action.
21
+ *
22
+ * @remarks
23
+ *
24
+ * See {@link https://example.com} for more information.
25
+ *
26
+ * @public
27
+ */
28
+ export function createAcmeExampleAction() {
29
+ // For more information on how to define custom actions, see
30
+ // https://backstage.io/docs/features/software-templates/writing-custom-actions
31
+ return createTemplateAction<{
32
+ myParameter: string;
33
+ }>({
34
+ id: 'acme:example',
35
+ description: 'Runs Yeoman on an installed Yeoman generator',
36
+ schema: {
37
+ input: {
38
+ type: 'object',
39
+ required: ['myParameter'],
40
+ properties: {
41
+ myParameter: {
42
+ title: 'An example parameter',
43
+ description: 'This is the schema for our example parameter',
44
+ type: 'string',
45
+ },
46
+ },
47
+ },
48
+ },
49
+ async handler(ctx) {
50
+ ctx.logger.info(
51
+ `Running example template with parameters: ${ctx.input.myParameter}`,
52
+ );
53
+
54
+ await new Promise(resolve => setTimeout(resolve, 1000));
55
+ },
56
+ });
57
+ }
@@ -0,0 +1 @@
1
+ export { createAcmeExampleAction } from './example';
@@ -0,0 +1 @@
1
+ export * from './example';
@@ -0,0 +1,8 @@
1
+ /***/
2
+ /**
3
+ * The {{id}} module for @backstage/plugin-scaffolder-backend.
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+
8
+ export * from './actions';
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@backstage/cli/config/tsconfig.json",
3
+ "include": ["src"],
4
+ "exclude": ["node_modules"],
5
+ "compilerOptions": {
6
+ "outDir": "dist-types",
7
+ "rootDir": "."
8
+ }
9
+ }