@movable/rollup-plugin-manifest-merger 3.11.0 → 3.12.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 +1 -1
- package/build/test/plugins/manifest-merger-test.js +27 -0
- package/package.json +2 -2
- package/src/plugins/manifest-merger.ts +1 -1
- package/test/fixtures/test-app-custom-yaml/app-manifest.yml +20 -0
- package/test/fixtures/test-app-custom-yaml/index.js +2 -0
- package/test/fixtures/test-app-custom-yaml/package.json +7 -0
- package/test/plugins/manifest-merger-test.ts +32 -0
|
@@ -99,7 +99,7 @@ function manifestMerger(opts) {
|
|
|
99
99
|
const indent = 2; // The amount of spaces to use for indentation of nested nodes.
|
|
100
100
|
const source = outputJSON
|
|
101
101
|
? JSON.stringify(appManifest)
|
|
102
|
-
: js_yaml_1.default.dump(appManifest, { flowLevel: inline, indent: indent });
|
|
102
|
+
: js_yaml_1.default.dump(appManifest, { flowLevel: inline, indent: indent, forceQuotes: true });
|
|
103
103
|
// eslint-disable-next-line no-param-reassign
|
|
104
104
|
this.emitFile({
|
|
105
105
|
type: 'asset',
|
|
@@ -73,6 +73,33 @@ mocha_1.describe('manifestMerger - app test', async () => {
|
|
|
73
73
|
chai_1.expect(manifest).to.deep.equal(expectedAppManifest);
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
|
+
mocha_1.describe('manifestMerger - placeholder strings', () => {
|
|
77
|
+
setup_fixture_1.default('test-app-custom-yaml');
|
|
78
|
+
mocha_1.it('should add quotes around string values', async () => {
|
|
79
|
+
const bundle = await rollup_1.rollup({
|
|
80
|
+
input: 'index.js',
|
|
81
|
+
plugins: [
|
|
82
|
+
index_1.manifestMerger({
|
|
83
|
+
outputJSON: false,
|
|
84
|
+
output: 'manifest.yml'
|
|
85
|
+
}),
|
|
86
|
+
plugin_node_resolve_1.default()
|
|
87
|
+
]
|
|
88
|
+
});
|
|
89
|
+
const { output } = await bundle.generate({
|
|
90
|
+
format: 'es'
|
|
91
|
+
});
|
|
92
|
+
const file = output.find(({ fileName }) => fileName === 'manifest.yml');
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
const yamlOutput = file.source;
|
|
95
|
+
chai_1.expect(yamlOutput).to.include("placeholder: '60218907,60218908,60218909'");
|
|
96
|
+
chai_1.expect(yamlOutput).to.include("placeholder: '12345678, 60218908, 60218909'");
|
|
97
|
+
chai_1.expect(yamlOutput).to.include('placeholder: 3.1415926535');
|
|
98
|
+
chai_1.expect(yamlOutput).to.include("placeholder: '60,218,907'");
|
|
99
|
+
chai_1.expect(yamlOutput).to.include('placeholder: 987654321');
|
|
100
|
+
chai_1.expect(yamlOutput).to.include('placeholder: true');
|
|
101
|
+
});
|
|
102
|
+
});
|
|
76
103
|
mocha_1.describe('manifest merger - integration ids', () => {
|
|
77
104
|
mocha_1.describe('app with existing ids / dependencies with ids', () => {
|
|
78
105
|
setup_fixture_1.default('test-app-with-app-and-package-integration-ids');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movable/rollup-plugin-manifest-merger",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.0",
|
|
4
4
|
"description": "Merges package manifests into an App manifest",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"keywords": [],
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"volta": {
|
|
49
49
|
"extends": "../../package.json"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "b5864fdff154ca098482bb45ec9b9a53c18499b2"
|
|
52
52
|
}
|
|
@@ -144,7 +144,7 @@ export default function manifestMerger(opts: Options): Plugin {
|
|
|
144
144
|
|
|
145
145
|
const source = outputJSON
|
|
146
146
|
? JSON.stringify(appManifest)
|
|
147
|
-
: YAML.dump(appManifest, { flowLevel: inline, indent: indent });
|
|
147
|
+
: YAML.dump(appManifest, { flowLevel: inline, indent: indent, forceQuotes: true });
|
|
148
148
|
|
|
149
149
|
// eslint-disable-next-line no-param-reassign
|
|
150
150
|
this.emitFile({
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Test App
|
|
2
|
+
fields:
|
|
3
|
+
- name: quotesCommasString
|
|
4
|
+
type: text
|
|
5
|
+
placeholder: '60218907,60218908,60218909'
|
|
6
|
+
- name: commasSpacesString
|
|
7
|
+
type: text
|
|
8
|
+
placeholder: 12345678, 60218908, 60218909
|
|
9
|
+
- name: decimalNumber
|
|
10
|
+
type: number
|
|
11
|
+
placeholder: 3.1415926535
|
|
12
|
+
- name: commaString
|
|
13
|
+
type: text
|
|
14
|
+
placeholder: 60,218,907
|
|
15
|
+
- name: justNumbers
|
|
16
|
+
type: number
|
|
17
|
+
placeholder: 987654321
|
|
18
|
+
- name: booleanValue
|
|
19
|
+
type: boolean
|
|
20
|
+
placeholder: true
|
|
@@ -83,6 +83,38 @@ describe('manifestMerger - app test', async () => {
|
|
|
83
83
|
expect(manifest).to.deep.equal(expectedAppManifest);
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
|
+
|
|
87
|
+
describe('manifestMerger - placeholder strings', () => {
|
|
88
|
+
setupFixture('test-app-custom-yaml');
|
|
89
|
+
|
|
90
|
+
it('should add quotes around string values', async () => {
|
|
91
|
+
const bundle = await rollup({
|
|
92
|
+
input: 'index.js',
|
|
93
|
+
plugins: [
|
|
94
|
+
manifestMerger({
|
|
95
|
+
outputJSON: false,
|
|
96
|
+
output: 'manifest.yml'
|
|
97
|
+
}),
|
|
98
|
+
nodeResolve()
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const { output } = await bundle.generate({
|
|
103
|
+
format: 'es'
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const file = output.find(({ fileName }) => fileName === 'manifest.yml');
|
|
107
|
+
// @ts-ignore
|
|
108
|
+
const yamlOutput = file.source as string;
|
|
109
|
+
expect(yamlOutput).to.include("placeholder: '60218907,60218908,60218909'");
|
|
110
|
+
expect(yamlOutput).to.include("placeholder: '12345678, 60218908, 60218909'");
|
|
111
|
+
expect(yamlOutput).to.include('placeholder: 3.1415926535');
|
|
112
|
+
expect(yamlOutput).to.include("placeholder: '60,218,907'");
|
|
113
|
+
expect(yamlOutput).to.include('placeholder: 987654321');
|
|
114
|
+
expect(yamlOutput).to.include('placeholder: true');
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
86
118
|
describe('manifest merger - integration ids', () => {
|
|
87
119
|
describe('app with existing ids / dependencies with ids', () => {
|
|
88
120
|
setupFixture('test-app-with-app-and-package-integration-ids');
|