blob: a62119adbba67930e611e8e95706f2bae17d0874 [file] [log] [blame]
// Copyright 2022 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// NB(sollyross): these are in a separate file so that we can load it in
// our build generator and inject the corresponding JSON into package.json
/**
* Stability levels for flags (under what conditions they're turned on).
*/
export type Stability = 'nightly' | 'stable' | 'never';
// NB(sollyross): these should be camelCase as per the vscode config name conventions
// we do a little dance here so that `keyof typeof featureFlags` still works
// and the typescript compiler can check flags are used correctly at compile time,
// but we also still typecheck our flagset at compile time
const flags = {
// testing features, hidden by the deprecationMessage
stableFeature: {
stability: 'stable',
description: '(testing) this will always be on',
deprecationMessage: 'this is for testing only',
},
nightlyOnlyFeature: {
stability: 'nightly',
description: '(testing) this will only be on in a nightly build',
deprecationMessage: 'this is for testing only',
},
offFeature: {
stability: 'never',
description: '(testing) this will always off',
deprecationMessage: 'this is for testing only',
},
changedFeature: {
stability: 'never',
description: '(testing) this will be changed during tests',
deprecationMessage: 'this is for testing only',
},
} as const;
export type Known = keyof typeof flags;
type FeatureFlags = Readonly<{
[K in Known]: {
stability: Stability,
description: string
}
}>;
export const features: FeatureFlags = flags;