-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use preferences for node download template
- Loading branch information
Showing
9 changed files
with
126 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
packages/remote/src/electron-browser/remote-preferences.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// ***************************************************************************** | ||
// Copyright (C) 2023 TypeFox and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// http://www.eclipse.org/legal/epl-2.0. | ||
// | ||
// This Source Code may also be made available under the following Secondary | ||
// Licenses when the conditions for such availability set forth in the Eclipse | ||
// Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
// with the GNU Classpath Exception which is available at | ||
// https://www.gnu.org/software/classpath/license.html. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
|
||
import { interfaces } from '@theia/core/shared/inversify'; | ||
import { | ||
PreferenceProxy, | ||
PreferenceSchema, | ||
PreferenceContribution | ||
} from '@theia/core/lib/browser/preferences'; | ||
import { nls } from '@theia/core/lib/common/nls'; | ||
import { PreferenceProxyFactory } from '@theia/core/lib/browser/preferences/injectable-preference-proxy'; | ||
|
||
const nodeDownloadTemplateParts = [ | ||
nls.localize('theia/remote/nodeDownloadTemplateVersion', '`{version}` for the used node version'), | ||
nls.localize('theia/remote/nodeDownloadTemplateOS', '`{os}` for the remote operating system. Either `win`, `linux` or `darwin`.'), | ||
nls.localize('theia/remote/nodeDownloadTemplateArch', '`{arch}` for the remote system architecture.'), | ||
nls.localize('theia/remote/nodeDownloadTemplateExt', '`{ext}` for the file extension. Either `zip`, `tar.xz` or `tar.xz`, depending on the operating system.') | ||
]; | ||
|
||
export const RemotePreferenceSchema: PreferenceSchema = { | ||
'type': 'object', | ||
properties: { | ||
'remote.nodeDownloadTemplate': { | ||
type: 'string', | ||
default: '', | ||
markdownDescription: nls.localize( | ||
'theia/remote/nodeDownloadTemplate', | ||
'Controls the template used to download the node.js binaries for the remote backend. Points to the official node.js website by default. Uses multiple placeholders:' | ||
) + '\n- ' + nodeDownloadTemplateParts.join('\n- ') | ||
}, | ||
} | ||
}; | ||
|
||
export interface RemoteConfiguration { | ||
'remote.nodeDownloadTemplate': string; | ||
} | ||
|
||
export const RemotePreferenceContribution = Symbol('RemotePreferenceContribution'); | ||
export const RemotePreferences = Symbol('GettingStartedPreferences'); | ||
export type RemotePreferences = PreferenceProxy<RemoteConfiguration>; | ||
|
||
export function bindRemotePreferences(bind: interfaces.Bind): void { | ||
bind(RemotePreferences).toDynamicValue(ctx => { | ||
const factory = ctx.container.get<PreferenceProxyFactory>(PreferenceProxyFactory); | ||
return factory(RemotePreferenceSchema); | ||
}).inSingletonScope(); | ||
bind(RemotePreferenceContribution).toConstantValue({ schema: RemotePreferenceSchema }); | ||
bind(PreferenceContribution).toService(RemotePreferenceContribution); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,9 @@ | |
"references": [ | ||
{ | ||
"path": "../core" | ||
}, | ||
{ | ||
"path": "../filesystem" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8034,11 +8034,6 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" | ||
integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w== | ||
|
||
[email protected]: | ||
version "3.3.4" | ||
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" | ||
integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== | ||
|
||
nanoid@^3.3.6: | ||
version "3.3.6" | ||
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" | ||
|