@movable/rollup-plugin-manifest-merger 3.0.0-canary.0 → 3.0.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.
- package/build/src/plugins/manifest-merger.js +7 -0
- package/build/test/plugins/manifest-merger-test.js +71 -84
- package/package.json +24 -25
- package/src/plugins/manifest-merger.ts +9 -0
- package/test/fixtures/{test-app → test-app-no-integration-ids}/app-manifest.yml +0 -0
- package/test/fixtures/{test-app → test-app-no-integration-ids}/index.js +0 -0
- package/test/fixtures/{test-app → test-app-no-integration-ids}/node_modules/@movable-internal/test-dep/index.js +0 -0
- package/test/fixtures/{test-app → test-app-no-integration-ids}/node_modules/@movable-internal/test-dep/package-manifest.yml +0 -0
- package/test/fixtures/{test-app → test-app-no-integration-ids}/node_modules/@movable-internal/test-dep/package.json +0 -0
- package/test/fixtures/{test-app → test-app-no-integration-ids}/package.json +0 -0
- package/test/fixtures/test-app-with-app-and-package-integration-ids/app-manifest.yml +12 -0
- package/test/fixtures/test-app-with-app-and-package-integration-ids/index.js +9 -0
- package/test/fixtures/test-app-with-app-and-package-integration-ids/node_modules/@movable-internal/test-dep/index.js +1 -0
- package/test/fixtures/test-app-with-app-and-package-integration-ids/node_modules/@movable-internal/test-dep/package-manifest.yml +7 -0
- package/test/fixtures/test-app-with-app-and-package-integration-ids/node_modules/@movable-internal/test-dep/package.json +3 -0
- package/test/fixtures/test-app-with-app-and-package-integration-ids/node_modules/@movable-internal/test-dep-2/index.js +1 -0
- package/test/fixtures/test-app-with-app-and-package-integration-ids/node_modules/@movable-internal/test-dep-2/package-manifest.yml +7 -0
- package/test/fixtures/test-app-with-app-and-package-integration-ids/node_modules/@movable-internal/test-dep-2/package.json +3 -0
- package/test/fixtures/test-app-with-app-and-package-integration-ids/package.json +6 -0
- package/test/fixtures/test-app-with-app-integration-ids/app-manifest.yml +12 -0
- package/test/fixtures/test-app-with-app-integration-ids/index.js +7 -0
- package/test/fixtures/test-app-with-app-integration-ids/node_modules/@movable-internal/test-dep/index.js +1 -0
- package/test/fixtures/test-app-with-app-integration-ids/node_modules/@movable-internal/test-dep/package-manifest.yml +3 -0
- package/test/fixtures/test-app-with-app-integration-ids/node_modules/@movable-internal/test-dep/package.json +3 -0
- package/test/fixtures/test-app-with-app-integration-ids/package.json +5 -0
- package/test/helpers/expect-ast-equals.ts +2 -2
- package/test/plugins/manifest-merger-test.ts +76 -90
- package/.mocharc.yml +0 -1
|
@@ -80,10 +80,17 @@ function manifestMerger(opts) {
|
|
|
80
80
|
}
|
|
81
81
|
// Add the package manifests to the array
|
|
82
82
|
const manifests = [];
|
|
83
|
+
const integrationIds = [...(appManifest.integration_ids || [])];
|
|
83
84
|
for (const [, val] of packageCache.entries()) {
|
|
85
|
+
if (Array.isArray(val.integration_ids)) {
|
|
86
|
+
integrationIds.push(...val.integration_ids);
|
|
87
|
+
}
|
|
84
88
|
manifests.push(val);
|
|
85
89
|
}
|
|
86
90
|
appManifest.package_manifests = manifests;
|
|
91
|
+
if (integrationIds.length) {
|
|
92
|
+
appManifest.integration_ids = [...new Set(integrationIds)];
|
|
93
|
+
}
|
|
87
94
|
if (fileName) {
|
|
88
95
|
const inline = 12; // The level where you switch to inline YAML
|
|
89
96
|
const indent = 2; // The amount of spaces to use for indentation of nested nodes.
|
|
@@ -11,99 +11,86 @@ const yamljs_1 = __importDefault(require("yamljs"));
|
|
|
11
11
|
const index_1 = require("../../src/index");
|
|
12
12
|
const setup_fixture_1 = __importDefault(require("../helpers/setup-fixture"));
|
|
13
13
|
const studioFrameworkPkg = require('@movable/studio-framework/package.json');
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
14
|
+
const expectedAppManifest = {
|
|
15
|
+
name: 'App Manifest',
|
|
16
|
+
options: [{ name: 'Option 2' }, { framework_version: '1.10.0' }],
|
|
17
|
+
string_array: ['one', 'two', 'three'],
|
|
18
|
+
package_manifests: [
|
|
19
|
+
{
|
|
20
|
+
name: '@movable-internal/test-dep',
|
|
21
|
+
authors: ['Test Developer']
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
studio_options: {
|
|
25
|
+
framework_version: studioFrameworkPkg.version,
|
|
26
|
+
package_dependencies: [
|
|
27
|
+
{ name: '@movable/studio-framework', version: studioFrameworkPkg.version }
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const bundledManifest = async ({ outputJSON = true, ignoreFrameworkVersionUpdate = false } = {}) => {
|
|
32
|
+
const outputFile = outputJSON ? 'manifest.json' : 'manifest.yml';
|
|
33
|
+
const bundle = await rollup_1.rollup({
|
|
34
|
+
input: 'index.js',
|
|
35
|
+
plugins: [
|
|
36
|
+
index_1.manifestMerger({
|
|
37
|
+
outputJSON,
|
|
38
|
+
output: outputFile,
|
|
39
|
+
ignoreFrameworkVersionUpdate
|
|
40
|
+
}),
|
|
41
|
+
plugin_node_resolve_1.default()
|
|
42
|
+
]
|
|
43
|
+
});
|
|
44
|
+
const { output } = await bundle.generate({
|
|
45
|
+
format: 'es'
|
|
46
|
+
});
|
|
47
|
+
const file = output.find(({ fileName }) => fileName === outputFile);
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
return outputJSON ? JSON.parse(file.source) : yamljs_1.default.parse(file.source);
|
|
50
|
+
};
|
|
51
|
+
mocha_1.describe('manifestMerger - app test', async () => {
|
|
52
|
+
setup_fixture_1.default('test-app-no-integration-ids');
|
|
53
|
+
mocha_1.it('can build the manifest via dependencies with yml output', async () => {
|
|
54
|
+
const manifest = await bundledManifest({ outputJSON: false });
|
|
55
|
+
chai_1.expect(manifest).to.deep.equal(expectedAppManifest);
|
|
44
56
|
});
|
|
45
57
|
mocha_1.it('can optionally ignore the actual Studio Framework version', async () => {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
index_1.manifestMerger({ output: 'manifest.yml', ignoreFrameworkVersionUpdate: true }),
|
|
50
|
-
plugin_node_resolve_1.default()
|
|
51
|
-
]
|
|
52
|
-
});
|
|
53
|
-
const { output } = await bundle.generate({
|
|
54
|
-
format: 'es'
|
|
58
|
+
const manifest = await bundledManifest({
|
|
59
|
+
outputJSON: false,
|
|
60
|
+
ignoreFrameworkVersionUpdate: true
|
|
55
61
|
});
|
|
56
|
-
const ymlFile = output.find(({ fileName }) => fileName === 'manifest.yml');
|
|
57
|
-
// @ts-ignore
|
|
58
|
-
const manifest = yamljs_1.default.parse(ymlFile.source);
|
|
59
62
|
chai_1.expect(manifest).to.deep.equal({
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
authors: ['Test Developer']
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
studio_options: {
|
|
70
|
-
framework_version: '2.15'
|
|
71
|
-
}
|
|
63
|
+
...expectedAppManifest,
|
|
64
|
+
studio_options: { framework_version: '2.15' }
|
|
65
|
+
});
|
|
66
|
+
mocha_1.it('can build the manifest via dependencies with json output', async () => {
|
|
67
|
+
const manifest = await bundledManifest();
|
|
68
|
+
chai_1.expect(manifest).to.deep.equal(expectedAppManifest);
|
|
72
69
|
});
|
|
73
70
|
});
|
|
74
71
|
mocha_1.it('can build the manifest via dependencies', async () => {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
72
|
+
const manifest = await bundledManifest();
|
|
73
|
+
chai_1.expect(manifest).to.deep.equal(expectedAppManifest);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
mocha_1.describe('manifest merger - integration ids', () => {
|
|
77
|
+
mocha_1.describe('app with existing ids / dependencies with ids', () => {
|
|
78
|
+
setup_fixture_1.default('test-app-with-app-and-package-integration-ids');
|
|
79
|
+
mocha_1.it('it can build multiple integration ids from multiple packages', async () => {
|
|
80
|
+
const manifest = await bundledManifest();
|
|
81
|
+
chai_1.expect(manifest.integration_ids).to.have.members(['app-123', '123', 'abc', 'foo', 'bar']);
|
|
84
82
|
});
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
mocha_1.it('it does not duplicate appManifest.integration_ids upon regeneration', async () => {
|
|
84
|
+
await bundledManifest();
|
|
85
|
+
const manifest = await bundledManifest();
|
|
86
|
+
chai_1.expect(manifest.integration_ids).to.have.members(['app-123', '123', 'abc', 'foo', 'bar']);
|
|
87
87
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
string_array: ['one', 'two', 'three'],
|
|
95
|
-
package_manifests: [
|
|
96
|
-
{
|
|
97
|
-
name: '@movable-internal/test-dep',
|
|
98
|
-
authors: ['Test Developer']
|
|
99
|
-
}
|
|
100
|
-
],
|
|
101
|
-
studio_options: {
|
|
102
|
-
framework_version: studioFrameworkPkg.version,
|
|
103
|
-
package_dependencies: [
|
|
104
|
-
{ name: '@movable/studio-framework', version: studioFrameworkPkg.version }
|
|
105
|
-
]
|
|
106
|
-
}
|
|
88
|
+
});
|
|
89
|
+
mocha_1.describe('app with existing ids / dependencies with no ids', () => {
|
|
90
|
+
setup_fixture_1.default('test-app-with-app-integration-ids');
|
|
91
|
+
mocha_1.it('it can build integration ids with no package integration ids', async () => {
|
|
92
|
+
const manifest = await bundledManifest();
|
|
93
|
+
chai_1.expect(manifest.integration_ids).to.have.members(['app-123']);
|
|
107
94
|
});
|
|
108
95
|
});
|
|
109
96
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movable/rollup-plugin-manifest-merger",
|
|
3
|
-
"version": "3.0.0
|
|
4
|
-
"description": "Merges package
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Merges package manifests into an App manifest",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"keywords": [],
|
|
7
7
|
"homepage": "https://github.com/movableink/studio-framework/tree/master/packages/rollup-plugin-manifest-merger#readme",
|
|
@@ -17,36 +17,35 @@
|
|
|
17
17
|
"name": "Movable Ink"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"test": "NODE_ENV=test TS_NODE_FILES=true mocha --require ts-node/register test/**/*.ts",
|
|
20
|
+
"test": "NODE_ENV=test TS_NODE_FILES=true mocha --require ./node_modules/ts-node/register test/**/*.ts",
|
|
21
21
|
"build": "tsc && copyfiles src/**/*.html build",
|
|
22
22
|
"prepublish": "yarn run build"
|
|
23
23
|
},
|
|
24
|
-
"volta": {
|
|
25
|
-
"node": "12.17.0",
|
|
26
|
-
"yarn": "1.22.4"
|
|
27
|
-
},
|
|
28
24
|
"devDependencies": {
|
|
29
|
-
"@rollup/plugin-node-resolve": "^
|
|
30
|
-
"@types/chai": "^4.2.
|
|
31
|
-
"@types/find-root": "^1.1.
|
|
32
|
-
"@types/mocha": "^
|
|
33
|
-
"@types/uuid": "^8.
|
|
25
|
+
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
26
|
+
"@types/chai": "^4.2.18",
|
|
27
|
+
"@types/find-root": "^1.1.2",
|
|
28
|
+
"@types/mocha": "^8.2.2",
|
|
29
|
+
"@types/uuid": "^8.3.0",
|
|
34
30
|
"@types/yamljs": "^0.2.31",
|
|
35
|
-
"chai": "^4.
|
|
36
|
-
"mocha": "^
|
|
37
|
-
"rollup": "^2.
|
|
38
|
-
"ts-node": "^
|
|
39
|
-
"typescript": "^3.
|
|
31
|
+
"chai": "^4.3.4",
|
|
32
|
+
"mocha": "^8.4.0",
|
|
33
|
+
"rollup": "^2.52.2",
|
|
34
|
+
"ts-node": "^10.0.0",
|
|
35
|
+
"typescript": "^4.3.4"
|
|
40
36
|
},
|
|
41
37
|
"dependencies": {
|
|
42
|
-
"@rollup/pluginutils": "^
|
|
43
|
-
"ast-types": "^0.
|
|
44
|
-
"copyfiles": "^2.
|
|
45
|
-
"pkg-dir": "^
|
|
46
|
-
"recast": "^0.
|
|
47
|
-
"resolve": "^1.
|
|
48
|
-
"uuid": "^8.
|
|
38
|
+
"@rollup/pluginutils": "^4.1.0",
|
|
39
|
+
"ast-types": "^0.14.2",
|
|
40
|
+
"copyfiles": "^2.4.1",
|
|
41
|
+
"pkg-dir": "^5.0.0",
|
|
42
|
+
"recast": "^0.20.4",
|
|
43
|
+
"resolve": "^1.20.0",
|
|
44
|
+
"uuid": "^8.3.2",
|
|
49
45
|
"yamljs": "^0.3.0"
|
|
50
46
|
},
|
|
51
|
-
"
|
|
47
|
+
"volta": {
|
|
48
|
+
"extends": "../../package.json"
|
|
49
|
+
},
|
|
50
|
+
"gitHead": "2b832ab5a64597cffdc7f1225bbbdf53c6299994"
|
|
52
51
|
}
|
|
@@ -21,6 +21,7 @@ interface ManifestPackageDep {
|
|
|
21
21
|
interface Manifest {
|
|
22
22
|
name: string;
|
|
23
23
|
package_manifests?: Manifest[];
|
|
24
|
+
integration_ids?: string[];
|
|
24
25
|
studio_options?: {
|
|
25
26
|
framework_version?: string;
|
|
26
27
|
package_dependencies?: ManifestPackageDep[];
|
|
@@ -118,13 +119,21 @@ export default function manifestMerger(opts: Options): Plugin {
|
|
|
118
119
|
|
|
119
120
|
// Add the package manifests to the array
|
|
120
121
|
const manifests: Manifest[] = [];
|
|
122
|
+
const integrationIds = [...(appManifest.integration_ids || [])];
|
|
121
123
|
|
|
122
124
|
for (const [, val] of packageCache.entries()) {
|
|
125
|
+
if (Array.isArray(val.integration_ids)) {
|
|
126
|
+
integrationIds.push(...val.integration_ids);
|
|
127
|
+
}
|
|
123
128
|
manifests.push(val);
|
|
124
129
|
}
|
|
125
130
|
|
|
126
131
|
appManifest.package_manifests = manifests;
|
|
127
132
|
|
|
133
|
+
if (integrationIds.length) {
|
|
134
|
+
appManifest.integration_ids = [...new Set(integrationIds)];
|
|
135
|
+
}
|
|
136
|
+
|
|
128
137
|
if (fileName) {
|
|
129
138
|
const inline = 12; // The level where you switch to inline YAML
|
|
130
139
|
const indent = 2; // The amount of spaces to use for indentation of nested nodes.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* eslint-disable import/no-unresolved */
|
|
2
|
+
import something from '@movable-internal/test-dep';
|
|
3
|
+
import something2 from '@movable-internal/test-dep-2';
|
|
4
|
+
import '@movable-internal/test-dep/package-manifest.yml';
|
|
5
|
+
import '@movable-internal/test-dep-2/package-manifest.yml';
|
|
6
|
+
import './app-manifest.yml';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line no-console
|
|
9
|
+
console.log(something, something2);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default () => console.log('test-dep');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default () => console.log('test-dep-2');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default () => console.log('test-dep');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { expect } from 'chai';
|
|
2
2
|
import { prettyPrint, parse } from 'recast';
|
|
3
|
-
import
|
|
3
|
+
import * as types from 'ast-types';
|
|
4
4
|
|
|
5
|
-
function printAst(ast:
|
|
5
|
+
function printAst(ast: types.ASTNode): string {
|
|
6
6
|
return prettyPrint(ast, { tabWidth: 2 }).code;
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -8,115 +8,101 @@ import setupFixture from '../helpers/setup-fixture';
|
|
|
8
8
|
import { PackageJSON } from '../../src/types/packages';
|
|
9
9
|
|
|
10
10
|
const studioFrameworkPkg: PackageJSON = require('@movable/studio-framework/package.json');
|
|
11
|
+
const expectedAppManifest = {
|
|
12
|
+
name: 'App Manifest',
|
|
13
|
+
options: [{ name: 'Option 2' }, { framework_version: '1.10.0' }],
|
|
14
|
+
string_array: ['one', 'two', 'three'],
|
|
15
|
+
package_manifests: [
|
|
16
|
+
{
|
|
17
|
+
name: '@movable-internal/test-dep',
|
|
18
|
+
authors: ['Test Developer']
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
studio_options: {
|
|
22
|
+
framework_version: studioFrameworkPkg.version,
|
|
23
|
+
package_dependencies: [
|
|
24
|
+
{ name: '@movable/studio-framework', version: studioFrameworkPkg.version }
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const bundledManifest = async ({
|
|
30
|
+
outputJSON = true,
|
|
31
|
+
ignoreFrameworkVersionUpdate = false
|
|
32
|
+
} = {}) => {
|
|
33
|
+
const outputFile = outputJSON ? 'manifest.json' : 'manifest.yml';
|
|
34
|
+
const bundle = await rollup({
|
|
35
|
+
input: 'index.js',
|
|
36
|
+
plugins: [
|
|
37
|
+
manifestMerger({
|
|
38
|
+
outputJSON,
|
|
39
|
+
output: outputFile,
|
|
40
|
+
ignoreFrameworkVersionUpdate
|
|
41
|
+
}),
|
|
42
|
+
nodeResolve()
|
|
43
|
+
]
|
|
44
|
+
});
|
|
11
45
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
it('can build the manifest via dependencies', async () => {
|
|
16
|
-
const bundle = await rollup({
|
|
17
|
-
input: 'index.js',
|
|
18
|
-
plugins: [manifestMerger({ output: 'manifest.yml' }), nodeResolve()]
|
|
19
|
-
});
|
|
46
|
+
const { output } = await bundle.generate({
|
|
47
|
+
format: 'es'
|
|
48
|
+
});
|
|
20
49
|
|
|
21
|
-
|
|
22
|
-
format: 'es'
|
|
23
|
-
});
|
|
50
|
+
const file = output.find(({ fileName }) => fileName === outputFile);
|
|
24
51
|
|
|
25
|
-
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
return outputJSON ? JSON.parse(file.source) : YAML.parse(file.source);
|
|
54
|
+
};
|
|
26
55
|
|
|
27
|
-
|
|
28
|
-
|
|
56
|
+
describe('manifestMerger - app test', async () => {
|
|
57
|
+
setupFixture('test-app-no-integration-ids');
|
|
58
|
+
it('can build the manifest via dependencies with yml output', async () => {
|
|
59
|
+
const manifest = await bundledManifest({ outputJSON: false });
|
|
29
60
|
|
|
30
|
-
expect(manifest).to.deep.equal(
|
|
31
|
-
name: 'App Manifest',
|
|
32
|
-
options: [{ name: 'Option 2' }, { framework_version: '1.10.0' }],
|
|
33
|
-
string_array: ['one', 'two', 'three'],
|
|
34
|
-
package_manifests: [
|
|
35
|
-
{
|
|
36
|
-
name: '@movable-internal/test-dep',
|
|
37
|
-
authors: ['Test Developer']
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
studio_options: {
|
|
41
|
-
framework_version: studioFrameworkPkg.version,
|
|
42
|
-
package_dependencies: [
|
|
43
|
-
{ name: '@movable/studio-framework', version: studioFrameworkPkg.version }
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
});
|
|
61
|
+
expect(manifest).to.deep.equal(expectedAppManifest);
|
|
47
62
|
});
|
|
48
|
-
|
|
49
63
|
it('can optionally ignore the actual Studio Framework version', async () => {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
manifestMerger({ output: 'manifest.yml', ignoreFrameworkVersionUpdate: true }),
|
|
54
|
-
nodeResolve()
|
|
55
|
-
]
|
|
64
|
+
const manifest = await bundledManifest({
|
|
65
|
+
outputJSON: false,
|
|
66
|
+
ignoreFrameworkVersionUpdate: true
|
|
56
67
|
});
|
|
57
68
|
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
expect(manifest).to.deep.equal({
|
|
70
|
+
...expectedAppManifest,
|
|
71
|
+
studio_options: { framework_version: '2.15' }
|
|
60
72
|
});
|
|
61
73
|
|
|
62
|
-
|
|
74
|
+
it('can build the manifest via dependencies with json output', async () => {
|
|
75
|
+
const manifest = await bundledManifest();
|
|
63
76
|
|
|
64
|
-
|
|
65
|
-
const manifest = YAML.parse(ymlFile.source);
|
|
66
|
-
|
|
67
|
-
expect(manifest).to.deep.equal({
|
|
68
|
-
name: 'App Manifest',
|
|
69
|
-
options: [{ name: 'Option 2' }, { framework_version: '1.10.0' }],
|
|
70
|
-
string_array: ['one', 'two', 'three'],
|
|
71
|
-
package_manifests: [
|
|
72
|
-
{
|
|
73
|
-
name: '@movable-internal/test-dep',
|
|
74
|
-
authors: ['Test Developer']
|
|
75
|
-
}
|
|
76
|
-
],
|
|
77
|
-
studio_options: {
|
|
78
|
-
framework_version: '2.15'
|
|
79
|
-
}
|
|
77
|
+
expect(manifest).to.deep.equal(expectedAppManifest);
|
|
80
78
|
});
|
|
81
79
|
});
|
|
82
|
-
|
|
83
80
|
it('can build the manifest via dependencies', async () => {
|
|
84
|
-
const
|
|
85
|
-
input: 'index.js',
|
|
86
|
-
plugins: [
|
|
87
|
-
manifestMerger({
|
|
88
|
-
outputJSON: true,
|
|
89
|
-
output: 'manifest.json'
|
|
90
|
-
}),
|
|
91
|
-
nodeResolve()
|
|
92
|
-
]
|
|
93
|
-
});
|
|
81
|
+
const manifest = await bundledManifest();
|
|
94
82
|
|
|
95
|
-
|
|
96
|
-
|
|
83
|
+
expect(manifest).to.deep.equal(expectedAppManifest);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
describe('manifest merger - integration ids', () => {
|
|
87
|
+
describe('app with existing ids / dependencies with ids', () => {
|
|
88
|
+
setupFixture('test-app-with-app-and-package-integration-ids');
|
|
89
|
+
it('it can build multiple integration ids from multiple packages', async () => {
|
|
90
|
+
const manifest = await bundledManifest();
|
|
91
|
+
expect(manifest.integration_ids).to.have.members(['app-123', '123', 'abc', 'foo', 'bar']);
|
|
97
92
|
});
|
|
93
|
+
it('it does not duplicate appManifest.integration_ids upon regeneration', async () => {
|
|
94
|
+
await bundledManifest();
|
|
95
|
+
const manifest = await bundledManifest();
|
|
98
96
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
expect(manifest.integration_ids).to.have.members(['app-123', '123', 'abc', 'foo', 'bar']);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
describe('app with existing ids / dependencies with no ids', () => {
|
|
101
|
+
setupFixture('test-app-with-app-integration-ids');
|
|
103
102
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
string_array: ['one', 'two', 'three'],
|
|
108
|
-
package_manifests: [
|
|
109
|
-
{
|
|
110
|
-
name: '@movable-internal/test-dep',
|
|
111
|
-
authors: ['Test Developer']
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
studio_options: {
|
|
115
|
-
framework_version: studioFrameworkPkg.version,
|
|
116
|
-
package_dependencies: [
|
|
117
|
-
{ name: '@movable/studio-framework', version: studioFrameworkPkg.version }
|
|
118
|
-
]
|
|
119
|
-
}
|
|
103
|
+
it('it can build integration ids with no package integration ids', async () => {
|
|
104
|
+
const manifest = await bundledManifest();
|
|
105
|
+
expect(manifest.integration_ids).to.have.members(['app-123']);
|
|
120
106
|
});
|
|
121
107
|
});
|
|
122
108
|
});
|
package/.mocharc.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require: 'ts-node/register'
|