@abgov/nx-oc 3.2.0-beta.1 → 3.2.0-beta.2

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.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # About this project
2
- This is the Government of Alberta - DIO - Nx plugin for OpenShift.
2
+ This is the Government of Alberta - Nx plugin for OpenShift.
3
3
 
4
4
  The plugin includes generators for setting up OpenShift pipeline and application yaml files, and executors for `oc cli` commands.
5
5
 
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@abgov/nx-oc",
3
- "version": "3.2.0-beta.1",
3
+ "version": "3.2.0-beta.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "src/index.js",
6
- "description": "Government of Alberta - DIO - Nx plugin for OpenShift.",
6
+ "description": "Government of Alberta - Nx plugin for OpenShift.",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/abgov/nx-tools.git",
@@ -14,8 +14,8 @@
14
14
  "dependencies": {
15
15
  "yaml": "^1.10.2"
16
16
  },
17
- "typings": "./src/index.d.ts",
17
+ "types": "./src/index.d.ts",
18
18
  "peerDependencies": {
19
- "@nrwl/devkit": "13.10.5"
19
+ "@nrwl/devkit": "14.7.17"
20
20
  }
21
21
  }
@@ -1,5 +1,5 @@
1
1
  import { ExecutorContext } from '@nrwl/devkit';
2
- import { mocked } from 'ts-jest/utils'
2
+ import { mocked } from 'jest-mock'
3
3
  import { Schema } from './schema';
4
4
  import executor from './apply';
5
5
  import { runOcCommand } from '../../utils/oc-utils';
@@ -1,5 +1,5 @@
1
1
  import { createTree } from '@nrwl/devkit/testing';
2
- import { mocked } from 'ts-jest/utils'
2
+ import { mocked } from 'jest-mock'
3
3
  import generator from './apply-infra';
4
4
  import { runOcCommand } from '../../utils/oc-utils';
5
5
  import { writeJson } from '@nrwl/devkit';
@@ -2,7 +2,7 @@ import {
2
2
  addProjectConfiguration,
3
3
  readProjectConfiguration,
4
4
  } from '@nrwl/devkit';
5
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
5
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
6
6
  import pipeline from '../pipeline/pipeline';
7
7
  import { Schema } from './schema';
8
8
  import generator from './deployment';
@@ -10,7 +10,7 @@ describe('Deployment Generator', () => {
10
10
  const options: Schema = { project: 'test', tenant: 'test' };
11
11
 
12
12
  it('can run', async () => {
13
- const host = createTreeWithEmptyWorkspace();
13
+ const host = createTreeWithEmptyV1Workspace();
14
14
  await pipeline(host, {
15
15
  pipeline: 'test',
16
16
  type: 'jenkins',
@@ -41,7 +41,7 @@ describe('Deployment Generator', () => {
41
41
  });
42
42
 
43
43
  it('can generate deployment for react', async () => {
44
- const host = createTreeWithEmptyWorkspace();
44
+ const host = createTreeWithEmptyV1Workspace();
45
45
  await pipeline(host, {
46
46
  pipeline: 'test',
47
47
  type: 'jenkins',
@@ -68,7 +68,7 @@ describe('Deployment Generator', () => {
68
68
  });
69
69
 
70
70
  it('can generate deployment for angular', async () => {
71
- const host = createTreeWithEmptyWorkspace();
71
+ const host = createTreeWithEmptyV1Workspace();
72
72
  await pipeline(host, {
73
73
  pipeline: 'test',
74
74
  type: 'jenkins',
@@ -95,7 +95,7 @@ describe('Deployment Generator', () => {
95
95
  });
96
96
 
97
97
  it('can generate deployment for express', async () => {
98
- const host = createTreeWithEmptyWorkspace();
98
+ const host = createTreeWithEmptyV1Workspace();
99
99
  await pipeline(host, {
100
100
  pipeline: 'test',
101
101
  type: 'jenkins',
@@ -122,7 +122,7 @@ describe('Deployment Generator', () => {
122
122
  });
123
123
 
124
124
  it('can generate deployment for dotnet', async () => {
125
- const host = createTreeWithEmptyWorkspace();
125
+ const host = createTreeWithEmptyV1Workspace();
126
126
  await pipeline(host, {
127
127
  pipeline: 'test',
128
128
  type: 'jenkins',
@@ -149,7 +149,7 @@ describe('Deployment Generator', () => {
149
149
  });
150
150
 
151
151
  it('can skip unknown project type', async () => {
152
- const host = createTreeWithEmptyWorkspace();
152
+ const host = createTreeWithEmptyV1Workspace();
153
153
  await pipeline(host, {
154
154
  pipeline: 'test',
155
155
  type: 'jenkins',
@@ -1,71 +1,70 @@
1
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
1
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
2
2
  import { Schema } from './schema';
3
3
  import generator from './pipeline';
4
4
 
5
5
  describe('Pipeline Generator', () => {
6
-
7
6
  describe('Jenkins', () => {
8
- const options: Schema = {
9
- pipeline: 'test',
7
+ const options: Schema = {
8
+ pipeline: 'test',
10
9
  type: 'jenkins',
11
- infra: 'test-infra',
12
- envs: 'test-dev'
13
- }
14
-
15
- it ('can run', async () => {
16
- const host = createTreeWithEmptyWorkspace();
10
+ infra: 'test-infra',
11
+ envs: 'test-dev',
12
+ };
13
+
14
+ it('can run', async () => {
15
+ const host = createTreeWithEmptyV1Workspace();
17
16
  await generator(host, options);
18
17
  expect(host.exists('.openshift/Jenkinsfile')).toBeTruthy();
19
18
  expect(host.exists('.openshift/environment.infra.yml')).toBeTruthy();
20
19
  expect(host.exists('.openshift/environments.yml')).toBeTruthy();
21
20
  });
22
-
23
- it ('can generate multiple envs', async () => {
24
- const host = createTreeWithEmptyWorkspace();
21
+
22
+ it('can generate multiple envs', async () => {
23
+ const host = createTreeWithEmptyV1Workspace();
25
24
  await generator(host, { ...options, envs: 'test-dev test-test' });
26
25
  expect(host.exists('.openshift/environments.yml')).toBeTruthy();
27
-
26
+
28
27
  const envs = host.read('.openshift/environments.yml').toString();
29
28
  expect(envs).toContain('test-dev');
30
29
  expect(envs).toContain('test-test');
31
30
  });
32
-
33
- it ('can fail for duplicate env project', async () => {
34
- const host = createTreeWithEmptyWorkspace();
31
+
32
+ it('can fail for duplicate env project', async () => {
33
+ const host = createTreeWithEmptyV1Workspace();
35
34
  await expect(
36
35
  generator(host, { ...options, envs: 'test-dev test-dev' })
37
36
  ).rejects.toThrow('Each environment must be a unique project.');
38
37
  });
39
38
  });
40
-
39
+
41
40
  describe('GitHub Actions', () => {
42
- const options: Schema = {
43
- pipeline: 'test',
41
+ const options: Schema = {
42
+ pipeline: 'test',
44
43
  type: 'actions',
45
- infra: 'test-infra',
46
- envs: 'test-dev'
47
- }
48
-
49
- it ('can run', async () => {
50
- const host = createTreeWithEmptyWorkspace();
44
+ infra: 'test-infra',
45
+ envs: 'test-dev',
46
+ };
47
+
48
+ it('can run', async () => {
49
+ const host = createTreeWithEmptyV1Workspace();
51
50
  await generator(host, options);
52
51
  expect(host.exists('.github/workflows/pipeline.yml')).toBeTruthy();
53
52
  expect(host.exists('.openshift/environment.infra.yml')).toBeTruthy();
54
53
  expect(host.exists('.openshift/environments.yml')).toBeTruthy();
55
54
  });
56
-
57
- it ('can generate multiple envs', async () => {
58
- const host = createTreeWithEmptyWorkspace();
55
+
56
+ it('can generate multiple envs', async () => {
57
+ const host = createTreeWithEmptyV1Workspace();
59
58
  await generator(host, { ...options, envs: 'test-dev test-test' });
60
59
  expect(host.exists('.openshift/environments.yml')).toBeTruthy();
61
-
60
+
62
61
  const envs = host.read('.openshift/environments.yml').toString();
63
62
  expect(envs).toContain('test-dev');
64
63
  expect(envs).toContain('test-test');
65
64
  });
66
-
67
- it ('can fail for duplicate env project', async () => {
68
- const host = createTreeWithEmptyWorkspace();
65
+
66
+ it('can fail for duplicate env project', async () => {
67
+ const host = createTreeWithEmptyV1Workspace();
69
68
  await expect(
70
69
  generator(host, { ...options, envs: 'test-dev test-dev' })
71
70
  ).rejects.toThrow('Each environment must be a unique project.');