Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 3 additions & 23 deletions src/__snapshots__/appPackageManifest.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ Object {
"watch": Object {
"higgs": Object {
"filename": "device-higgs.zip",
"platform": Array [
"30.1.2+",
],
},
},
},
Expand Down Expand Up @@ -38,9 +35,6 @@ Object {
"watch": Object {
"higgs": Object {
"filename": "device-higgs.zip",
"platform": Array [
"30.1.2+",
],
},
},
},
Expand Down Expand Up @@ -68,9 +62,6 @@ Object {
"watch": Object {
"higgs": Object {
"filename": "device-higgs.zip",
"platform": Array [
"30.1.2+",
],
},
},
},
Expand All @@ -91,9 +82,6 @@ Object {
"watch": Object {
"higgs": Object {
"filename": "device-higgs.zip",
"platform": Array [
"30.1.2+",
],
},
},
},
Expand All @@ -117,15 +105,9 @@ Object {
"watch": Object {
"higgs": Object {
"filename": "device-higgs.zip",
"platform": Array [
"30.1.2+",
],
},
"meson": Object {
"filename": "device-meson.zip",
"platform": Array [
"32.4.18+",
],
},
},
},
Expand All @@ -143,13 +125,11 @@ Object {
}
`;

exports[`emits an error if a component bundle tag has a device type but invalid platform 1`] = `"Unknown bundle component tag: Invalid value \\"1.1.1+\\" supplied to : (({ type: \\"device\\", family: string, platform: Array<string> } & Partial<{ isNative: true }>) | { type: \\"companion\\" })/0: ({ type: \\"device\\", family: string, platform: Array<string> } & Partial<{ isNative: true }>)/0: { type: \\"device\\", family: string, platform: Array<string> }/platform: Array<string>"`;
exports[`emits an error if a component bundle tag has a device type but invalid platform 1`] = `"Unknown bundle component tag: Invalid value \\"1.1.1+\\" supplied to : (({ type: \\"device\\", family: string } & Partial<{ platform: Array<string>, isNative: true }>) | { type: \\"companion\\" })/0: ({ type: \\"device\\", family: string } & Partial<{ platform: Array<string>, isNative: true }>)/1: Partial<{ platform: Array<string>, isNative: true }>/platform: Array<string>"`;

exports[`emits an error if a component bundle tag has a device type but missing family 1`] = `"Unknown bundle component tag: Invalid value undefined supplied to : (({ type: \\"device\\", family: string, platform: Array<string> } & Partial<{ isNative: true }>) | { type: \\"companion\\" })/0: ({ type: \\"device\\", family: string, platform: Array<string> } & Partial<{ isNative: true }>)/0: { type: \\"device\\", family: string, platform: Array<string> }/family: string"`;
exports[`emits an error if a component bundle tag has a device type but missing family 1`] = `"Unknown bundle component tag: Invalid value undefined supplied to : (({ type: \\"device\\", family: string } & Partial<{ platform: Array<string>, isNative: true }>) | { type: \\"companion\\" })/0: ({ type: \\"device\\", family: string } & Partial<{ platform: Array<string>, isNative: true }>)/0: { type: \\"device\\", family: string }/family: string"`;

exports[`emits an error if a component bundle tag has a device type but missing platform 1`] = `"Unknown bundle component tag: Invalid value undefined supplied to : (({ type: \\"device\\", family: string, platform: Array<string> } & Partial<{ isNative: true }>) | { type: \\"companion\\" })/0: ({ type: \\"device\\", family: string, platform: Array<string> } & Partial<{ isNative: true }>)/0: { type: \\"device\\", family: string, platform: Array<string> }/platform: Array<string>"`;

exports[`emits an error if a component bundle tag has an invalid type field 1`] = `"Unknown bundle component tag: Invalid value {\\"type\\":\\"__invalid__\\"} supplied to : (({ type: \\"device\\", family: string, platform: Array<string> } & Partial<{ isNative: true }>) | { type: \\"companion\\" })"`;
exports[`emits an error if a component bundle tag has an invalid type field 1`] = `"Unknown bundle component tag: Invalid value {\\"type\\":\\"__invalid__\\"} supplied to : (({ type: \\"device\\", family: string } & Partial<{ platform: Array<string>, isNative: true }>) | { type: \\"companion\\" })"`;

exports[`emits an error if both JS and native device components are present 1`] = `"Cannot bundle mixed native/JS device components"`;

Expand Down
5 changes: 0 additions & 5 deletions src/appPackageManifest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Readable } from 'stream';

import Vinyl from 'vinyl';
import appPackageManifest from './appPackageManifest';
import buildTargets from './buildTargets';
import { ComponentType } from './componentTargets';
import ProjectConfiguration, {
AppType,
Expand Down Expand Up @@ -74,7 +73,6 @@ function expectValidPackageManifest(options?: {
componentBundle: {
type: 'device',
family: platform,
platform: buildTargets[platform].platform,
...(nativeApp && { isNative: true }),
},
}),
Expand Down Expand Up @@ -129,7 +127,6 @@ it('emits an error if both JS and native device components are present', () => {
componentBundle: {
type: 'device',
family: 'foo',
platform: ['1.1.1+'],
},
path: 'bundle.zip',
contents: Buffer.alloc(0),
Expand Down Expand Up @@ -164,7 +161,6 @@ it('emits an error if multiple bundles are present for the same device family',
componentBundle: {
type: 'device',
family: 'foo',
platform: ['1.1.1+'],
},
path: `bundle${i}.zip`,
contents: Buffer.alloc(0),
Expand All @@ -190,7 +186,6 @@ it('builds a package manifest with a native device component and companion', ()

it.each<[string, any]>([
['has an invalid type field', { type: '__invalid__' }],
['has a device type but missing platform', { type: 'device', family: 'foo' }],
[
'has a device type but missing family',
{ type: 'device', platform: ['1.1.1+'] },
Expand Down
10 changes: 7 additions & 3 deletions src/appPackageManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface Components {
watch?: {
[platform: string]: {
filename: string;
platform: string[];
platform?: string[];
};
};
companion?: {
Expand All @@ -33,9 +33,9 @@ const ComponentBundleTag = t.taggedUnion('type', [
t.interface({
type: t.literal('device'),
family: t.string,
platform: t.array(t.string),
}),
t.partial({
platform: t.array(t.string),
isNative: t.literal(true),
}),
]),
Expand Down Expand Up @@ -71,6 +71,7 @@ class AppPackageManifestTransform extends Transform {
super({ objectMode: true });
}

// tslint:disable-next-line:cognitive-complexity
private transformComponentBundle(file: Vinyl) {
const bundleInfo = getBundleInfo(file);

Expand Down Expand Up @@ -106,9 +107,12 @@ class AppPackageManifestTransform extends Transform {
}

this.components.watch[bundleInfo.family] = {
platform: bundleInfo.platform,
filename: file.relative,
};

if (bundleInfo.platform) {
this.components.watch[bundleInfo.family].platform = bundleInfo.platform;
}
} else {
if (this.components[bundleInfo.type] !== undefined) {
throwDuplicateComponent(this.components[bundleInfo.type]!.filename);
Expand Down
1 change: 0 additions & 1 deletion src/buildTargets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ it('merges the build target descriptors', () => {
expect(generateBuildTargets()).toMatchObject({
higgs: {
displayName: 'Fitbit Ionic',
platform: expect.any(Array),
resourceFilterTag: '348x250',
},
// Unfortunately, due to the way that module mocking works, the
Expand Down
4 changes: 0 additions & 4 deletions src/buildTargets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { PolyfillMap } from './plugins/polyfill';

export interface BuildTargetDescriptor {
displayName: string;
platform: string[];
resourceFilterTag: string;
polyfills?: PolyfillMap;
maxDeviceBundleSize?: number; // in bytes
Expand All @@ -16,17 +15,14 @@ export interface BuildTargetDescriptor {
const baseBuildTargets: { [platform: string]: BuildTargetDescriptor } = {
higgs: {
displayName: 'Fitbit Ionic',
platform: ['30.1.2+'],
resourceFilterTag: '348x250',
},
meson: {
displayName: 'Fitbit Versa',
platform: ['32.4.18+'],
resourceFilterTag: '300x300',
},
gemini: {
displayName: 'Fitbit Versa Lite',
platform: ['33.1.30+'],
resourceFilterTag: '300x300',
minSDKVersion: '3.1.0',
maxDeviceBundleSize: 3145728,
Expand Down
10 changes: 3 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,9 @@ export function buildDeviceComponents({
// before building the resources for each component.
...projectConfig.buildTargets.map((family) =>
lazyObjectReadable(() => {
const {
platform,
displayName,
polyfills,
maxDeviceBundleSize,
} = buildTargets[family];
const { displayName, polyfills, maxDeviceBundleSize } = buildTargets[
family
];
onDiagnostic({
messageText: `Building app for ${displayName}`,
category: DiagnosticCategory.Message,
Expand Down Expand Up @@ -275,7 +272,6 @@ export function buildDeviceComponents({
gulpSetProperty({
componentBundle: {
family,
platform,
type: 'device',
},
}),
Expand Down
17 changes: 8 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2684,10 +2684,10 @@ invert-kv@^2.0.0:
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02"
integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==

io-ts@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/io-ts/-/io-ts-2.0.0.tgz#560f8ddf92cce7ea73820cedab7b31044e464d1e"
integrity sha512-6i8PKyNR/dvEbUU9uE+v4iVFU7l674ZEGQsh92y6xEZF/rj46fXbPy+uPPXJEsCP0J0X3UpzXAxp04K4HR2jVw==
io-ts@2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/io-ts/-/io-ts-2.0.1.tgz#1261c12f915c2f48d16393a36966636b48a45aa1"
integrity sha512-RezD+WcCfW4VkMkEcQWL/Nmy/nqsWTvTYg7oUmTGzglvSSV2P9h2z1PVeREPFf0GWNzruYleAt1XCMQZSg1xxQ==

is-absolute@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -3954,12 +3954,11 @@ ms@^2.1.1:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"
integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==

multistream@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/multistream/-/multistream-3.0.0.tgz#93d6a672828c311a5b228212d319a5e9073d2e45"
integrity sha512-v1Fx9uhHEpTB725/Kj8YpRCvrLhb20LeABFLw+0dkBkKUUAbDCY6CUUNzGQsJ94ji/p50wBPsRjIQXN1iOwZYA==
multistream@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/multistream/-/multistream-4.0.0.tgz#c771b6d17d169138b6abcb15f0061170e3c09cea"
integrity sha512-t0C8MAtH/d3Y+5nooEtUMWli92lVw9Jhx4uOhRl5GAwS5vc+YTmp/VXNJNsCBAMeEyK/6zhbk6x9JE3AiCvo4g==
dependencies:
inherits "^2.0.1"
readable-stream "^3.4.0"

mute-stream@0.0.7:
Expand Down