Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@devcontainer/generator

Package Overview
Dependencies
Maintainers
1
Versions
330
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devcontainer/generator - npm Package Compare versions

Comparing version 14.6.6 to 14.6.8

templates/dotnet6.Dockerfile

101

lib/src/devcontainerGenerator.d.ts

@@ -1,60 +0,49 @@

declare type Base =
| "stretch"
| "buster"
| "bionic"
| "disco"
| "eoan"
| "groovy"
| "focal"
| "hirsute"
| "implish"
| "rolling"
| "gitpod/workspace-full";
declare type Base = "stretch" | "buster" | "bionic" | "disco" | "eoan" | "groovy" | "focal" | "hirsute" | "implish" | "rolling" | "gitpod/workspace-full";
declare type nodeVersion = "lts" | "current";
export declare class DevcontainerGenerator {
private base;
private _dockerfile;
private _readme;
private _dockerTemplates;
private _readmeTemplates;
private _templateInputs;
private _nodeVersion;
private _gitVersion;
private _cypressVersion;
private _dotnet;
private _xfce;
private _debianBackports;
private _docker;
private _android;
private _vscode;
private _xpra;
private _k8s;
private _deno;
private _noVNC;
private _zsh;
private _chromium;
private _chrome;
constructor(base: Base);
private init;
setNodeVersion(nodeVersion: nodeVersion): void;
setVscode(): void;
updateGit(forceFromSource?: boolean): void;
setDebianBackports(): void;
setXfce(): void;
setDeno(): void;
setK8s(): void;
setChrome(): void;
setChromium(): void;
setAndroid(): void;
setRemoteDesktop(type?: "xpra" | "noVNC"): void;
setZsh(): void;
setDocker(): void;
setDotnet(version?: "2" | "3" | "5"): void;
setCypress(): void;
generate(): Promise<{
Dockerfile: string;
README: string;
}>;
private loadTemplate;
private base;
private _dockerfile;
private _readme;
private _dockerTemplates;
private _readmeTemplates;
private _templateInputs;
private _nodeVersion;
private _gitVersion;
private _cypressVersion;
private _dotnet;
private _xfce;
private _debianBackports;
private _docker;
private _android;
private _vscode;
private _xpra;
private _k8s;
private _deno;
private _noVNC;
private _zsh;
private _chromium;
private _chrome;
constructor(base: Base);
private init;
setNodeVersion(nodeVersion: nodeVersion): void;
setVscode(): void;
updateGit(forceFromSource?: boolean): void;
setDebianBackports(): void;
setXfce(): void;
setDeno(): void;
setK8s(): void;
setChrome(): void;
setChromium(): void;
setAndroid(): void;
setRemoteDesktop(type?: "xpra" | "noVNC"): void;
setZsh(): void;
setDocker(): void;
setDotnet(version?: "3" | "5" | "6"): void;
setCypress(): void;
generate(): Promise<{
Dockerfile: string;
README: string;
}>;
private loadTemplate;
}
export {};

@@ -6,286 +6,245 @@ "use strict";

const fs_1 = require("fs");
const getDistro = (b) =>
b === "gitpod/workspace-full"
const getDistro = (b) => b === "gitpod/workspace-full"
? "gitpod/workspace-full"
: b === "stretch" || b === "buster"
? "debian"
: "ubuntu";
? "debian"
: "ubuntu";
const softwareVersions = require("../versions.json");
class DevcontainerGenerator {
constructor(base) {
this.base = base;
this._dockerfile = "";
this._readme = "";
this._dockerTemplates = {};
this._readmeTemplates = {};
this._templateInputs = [
"base",
"android",
"git",
"debianBackports",
"google-chrome",
"chromium",
"gitUbuntu",
"node",
"cypress",
"dotnet",
"docker",
"kubernetes",
"dotnet3",
"xfce",
"noVNC",
"xpra",
"deno",
"zsh",
"vscode",
"suffix",
];
this._nodeVersion = null;
this._gitVersion = "";
this._cypressVersion = "";
this._dotnet = null;
this._xfce = false;
this._debianBackports = false;
this._docker = false;
this._android = false;
this._vscode = false;
this._xpra = false;
this._k8s = false;
this._deno = false;
this._noVNC = false;
this._zsh = false;
this._chromium = false;
this._chrome = false;
this.loadTemplate = async (filename, extension) =>
await fs_1.promises
.readFile(`${__dirname}/../../templates/${filename}.${extension}`)
.catch((e) => {
console.error({ e });
return "";
constructor(base) {
this.base = base;
this._dockerfile = "";
this._readme = "";
this._dockerTemplates = {};
this._readmeTemplates = {};
this._templateInputs = [
"base",
"android",
"git",
"debianBackports",
"google-chrome",
"chromium",
"gitUbuntu",
"node",
"cypress",
"dotnet6",
"docker",
"kubernetes",
"dotnet3",
"xfce",
"noVNC",
"xpra",
"deno",
"zsh",
"vscode",
"suffix",
];
this._nodeVersion = null;
this._gitVersion = "";
this._cypressVersion = "";
this._dotnet = null;
this._xfce = false;
this._debianBackports = false;
this._docker = false;
this._android = false;
this._vscode = false;
this._xpra = false;
this._k8s = false;
this._deno = false;
this._noVNC = false;
this._zsh = false;
this._chromium = false;
this._chrome = false;
this.loadTemplate = async (filename, extension) => await fs_1.promises
.readFile(`${__dirname}/../../templates/${filename}.${extension}`)
.catch((e) => {
console.error({ e });
return "";
});
}
async init() {
const bufferDockerfiles = await Promise.all(
this._templateInputs.map(async (fileName) =>
await this.loadTemplate(fileName, "Dockerfile")
),
);
const bufferReadmeFiles = await Promise.all(
this._templateInputs.map(async (fileName) =>
await this.loadTemplate(fileName, "README")
),
);
this._templateInputs.forEach((
input,
index,
) => (this._dockerTemplates[input] = String(bufferDockerfiles[index])));
this._templateInputs.forEach((
input,
index,
) => (this._readmeTemplates[input] = String(bufferReadmeFiles[index])));
return {
dockerTemplates: this._dockerTemplates,
readmeTemplates: this._readmeTemplates,
};
}
setNodeVersion(nodeVersion) {
this._nodeVersion = nodeVersion;
}
setVscode() {
this._vscode = true;
}
updateGit(forceFromSource = false) {
if (getDistro(this.base) === "ubuntu" && !forceFromSource) {
this._gitVersion = "ubuntu";
} else {
this._gitVersion = softwareVersions.git;
}
}
setDebianBackports() {
this._debianBackports = true;
}
setXfce() {
this._xfce = true;
}
setDeno() {
this._deno = true;
}
setK8s() {
this._k8s = true;
}
setChrome() {
this._chrome = true;
}
setChromium() {
this._chromium = true;
}
setAndroid() {
this._android = true;
}
setRemoteDesktop(type = "xpra") {
if (type === "xpra") {
this._xpra = true;
} else {
this._noVNC = true;
async init() {
const bufferDockerfiles = await Promise.all(this._templateInputs.map(async (fileName) => await this.loadTemplate(fileName, "Dockerfile")));
const bufferReadmeFiles = await Promise.all(this._templateInputs.map(async (fileName) => await this.loadTemplate(fileName, "README")));
this._templateInputs.forEach((input, index) => (this._dockerTemplates[input] = String(bufferDockerfiles[index])));
this._templateInputs.forEach((input, index) => (this._readmeTemplates[input] = String(bufferReadmeFiles[index])));
return {
dockerTemplates: this._dockerTemplates,
readmeTemplates: this._readmeTemplates,
};
}
// if ((this._noVNC===true || this._xfce) && this._xpra===true) throw new Error("You can't have VNC and Xpra on the same image");
}
setZsh() {
this._zsh = true;
}
setDocker() {
this._docker = true;
}
setDotnet(version = "2") {
this._dotnet = version;
}
setCypress() {
this._cypressVersion = softwareVersions.cypress;
}
async generate() {
const { dockerTemplates, readmeTemplates } = await this.init();
this._dockerfile += dockerTemplates["base"].replace(
"{DISTRO}",
getDistro(this.base) + ":" + this.base,
);
this._readme += readmeTemplates["base"].replace("{DISTRO}", this.base);
if (this._debianBackports) {
this._dockerfile += dockerTemplates["debianBackports"]
.replace("{DISTRO}", this.base)
.replace("{DISTRO}", this.base);
setNodeVersion(nodeVersion) {
this._nodeVersion = nodeVersion;
}
if (this._gitVersion) {
if (this._gitVersion === "ubuntu") {
this._dockerfile += dockerTemplates["gitUbuntu"];
} else {
this._dockerfile += dockerTemplates["git"].replace(
"{GIT_VERSION}",
this._gitVersion,
);
}
setVscode() {
this._vscode = true;
}
if (this._deno) {
this._dockerfile += dockerTemplates["deno"]
.replace("{DENO_VERSION}", softwareVersions.deno);
this._readme += readmeTemplates["deno"]
.replace("{DENO_VERSION}", softwareVersions.deno);
updateGit(forceFromSource = false) {
if (getDistro(this.base) === "ubuntu" && !forceFromSource) {
this._gitVersion = "ubuntu";
}
else
this._gitVersion = softwareVersions.git;
}
if (this._nodeVersion) {
this._dockerfile += dockerTemplates["node"]
.replace("{NODE_VERSION}", softwareVersions.node[this._nodeVersion])
.replace("{YARN_VERSION}", softwareVersions.yarn);
this._readme += readmeTemplates["node"]
.replace("{NODE_VERSION}", softwareVersions.node[this._nodeVersion])
.replace("{YARN_VERSION}", softwareVersions.yarn);
setDebianBackports() {
this._debianBackports = true;
}
if (this._dotnet) {
if (this._dotnet === "2") {
this._dockerfile += dockerTemplates["dotnet"]
.replace("{DOTNET_SDK_VERSION}", softwareVersions.dotnet)
.replace(
"{dotnet_sha512}",
softwareVersions.sha.dotnet_sha512["2.1.817"],
);
} else if (this._dotnet === "3") {
this._dockerfile += dockerTemplates["dotnet3"]
.replace("{DOTNET_SDK_VERSION}", softwareVersions.dotnet3)
.replace(
"{dotnet_sha512}",
softwareVersions.sha.dotnet_sha512["3.1.413"],
);
} else {
this._dockerfile += dockerTemplates["dotnet3"]
.replace("{DOTNET_SDK_VERSION}", softwareVersions.dotnet5)
.replace(
"{dotnet_sha512}",
softwareVersions.sha.dotnet_sha512["5.0.401"],
);
}
setXfce() {
this._xfce = true;
}
if (this._cypressVersion) {
this._dockerfile += dockerTemplates["cypress"].replace(
"{CYPRESS_VERSION}",
this._cypressVersion,
);
this._readme += readmeTemplates["cypress"].replace(
"{CYPRESS_VERSION}",
this._cypressVersion,
);
setDeno() {
this._deno = true;
}
if (this._xpra) {
this._dockerfile += dockerTemplates["xpra"].replace(
/{XPRADISTRO}/g,
this.base,
);
this._readme += readmeTemplates["xpra"];
let xpraStart = "xpra start --start=xterm";
if (this._xfce) {
this._dockerfile += dockerTemplates["xfce"];
this._readme += readmeTemplates["xfce"];
xpraStart = "xpra start-desktop --start=xfce4-session";
}
this._dockerfile +=
`\nRUN echo "${xpraStart} --html=on --bind-tcp=0.0.0.0:14500 --daemon=no --encoding=x264" > /usr/bin/startx\n`;
if (this._vscode) {
this._dockerfile += dockerTemplates["vscode"];
this._readme += readmeTemplates["vscode"];
}
} else if (this._noVNC) {
this._dockerfile += dockerTemplates["noVNC"];
this._readme += readmeTemplates["noVNC"];
if (this._xfce) {
this._dockerfile += dockerTemplates["xfce"];
this._readme += readmeTemplates["xfce"];
}
setK8s() {
this._k8s = true;
}
if (this._chrome) {
this._dockerfile += dockerTemplates["google-chrome"].replace(
"{CHROMIUM}",
getDistro(this.base) === "debian" ? "chromium" : "firefox",
);
this._readme += readmeTemplates["google-chrome"];
setChrome() {
this._chrome = true;
}
if (this._chromium) {
this._dockerfile += dockerTemplates["chromium"].replace(
"{CHROMIUM}",
getDistro(this.base) === "debian" ? "chromium" : "firefox",
);
this._readme += readmeTemplates["chromium"];
setChromium() {
this._chromium = true;
}
if (this._android) {
this._dockerfile += dockerTemplates["android"];
this._readme += readmeTemplates["android"];
setAndroid() {
this._android = true;
}
if (this._vscode) {
this._dockerfile += dockerTemplates["vscode"];
this._readme += readmeTemplates["vscode"];
setRemoteDesktop(type = "xpra") {
if (type === "xpra") {
this._xpra = true;
}
else {
this._noVNC = true;
}
// if ((this._noVNC===true || this._xfce) && this._xpra===true) throw new Error("You can't have VNC and Xpra on the same image");
}
if (this._docker || this._k8s) {
this._dockerfile += dockerTemplates["docker"].replace(
"{DISTRO}",
getDistro(this.base),
);
this._readme += readmeTemplates["docker"];
if (this._k8s) {
this._dockerfile += dockerTemplates["kubernetes"].replace(
"{DISTRO}",
getDistro(this.base),
);
this._readme += readmeTemplates["kubernetes"];
}
setZsh() {
this._zsh = true;
}
if (this._zsh) {
this._dockerfile += dockerTemplates["zsh"];
this._readme += readmeTemplates["zsh"];
setDocker() {
this._docker = true;
}
this._dockerfile += dockerTemplates["suffix"];
this._readme += readmeTemplates["suffix"];
this._dockerfile = this._dockerfile.replace(/FROM devimage\n/g, "");
return {
Dockerfile: this._dockerfile,
README: this._readme,
};
}
setDotnet(version = "6") {
this._dotnet = version;
}
setCypress() {
this._cypressVersion = softwareVersions.cypress;
}
async generate() {
const { dockerTemplates, readmeTemplates } = await this.init();
this._dockerfile += dockerTemplates["base"].replace("{DISTRO}", getDistro(this.base) + ":" + this.base);
this._readme += readmeTemplates["base"].replace("{DISTRO}", this.base);
if (this._debianBackports) {
this._dockerfile += dockerTemplates["debianBackports"]
.replace("{DISTRO}", this.base)
.replace("{DISTRO}", this.base);
}
if (this._gitVersion) {
if (this._gitVersion === "ubuntu") {
this._dockerfile += dockerTemplates["gitUbuntu"];
}
else {
this._dockerfile += dockerTemplates["git"].replace("{GIT_VERSION}", this._gitVersion);
}
}
if (this._deno) {
this._dockerfile += dockerTemplates["deno"]
.replace("{DENO_VERSION}", softwareVersions.deno);
this._readme += readmeTemplates["deno"]
.replace("{DENO_VERSION}", softwareVersions.deno);
}
if (this._nodeVersion) {
this._dockerfile += dockerTemplates["node"]
.replace("{NODE_VERSION}", softwareVersions.node[this._nodeVersion])
.replace("{YARN_VERSION}", softwareVersions.yarn);
this._readme += readmeTemplates["node"]
.replace("{NODE_VERSION}", softwareVersions.node[this._nodeVersion])
.replace("{YARN_VERSION}", softwareVersions.yarn);
}
if (this._dotnet) {
if (this._dotnet === "6") {
this._dockerfile += dockerTemplates["dotnet6"]
.replace("{DOTNET_SDK_VERSION}", softwareVersions.dotnet6)
.replace("{dotnet_sha512}", softwareVersions.sha
.dotnet_sha512[softwareVersions
.dotnet6]);
}
else if (this._dotnet === "3") {
this._dockerfile += dockerTemplates["dotnet3"]
.replace("{DOTNET_SDK_VERSION}", softwareVersions.dotnet3)
.replace("{dotnet_sha512}", softwareVersions.sha
.dotnet_sha512[softwareVersions
.dotnet3]);
}
else {
this._dockerfile += dockerTemplates["dotnet5"]
.replace("{DOTNET_SDK_VERSION}", softwareVersions.dotnet5)
.replace("{dotnet_sha512}", softwareVersions.sha
.dotnet_sha512[softwareVersions
.dotnet5]);
}
}
if (this._cypressVersion) {
this._dockerfile += dockerTemplates["cypress"].replace("{CYPRESS_VERSION}", this._cypressVersion);
this._readme += readmeTemplates["cypress"].replace("{CYPRESS_VERSION}", this._cypressVersion);
}
if (this._xpra) {
this._dockerfile += dockerTemplates["xpra"].replace(/{XPRADISTRO}/g, this.base);
this._readme += readmeTemplates["xpra"];
let xpraStart = "xpra start --start=xterm";
if (this._xfce) {
this._dockerfile += dockerTemplates["xfce"];
this._readme += readmeTemplates["xfce"];
xpraStart = "xpra start-desktop --start=xfce4-session";
}
this._dockerfile +=
`\nRUN echo "${xpraStart} --html=on --bind-tcp=0.0.0.0:14500 --daemon=no --encoding=x264" > /usr/bin/startx\n`;
if (this._vscode) {
this._dockerfile += dockerTemplates["vscode"];
this._readme += readmeTemplates["vscode"];
}
}
else if (this._noVNC) {
this._dockerfile += dockerTemplates["noVNC"];
this._readme += readmeTemplates["noVNC"];
if (this._xfce) {
this._dockerfile += dockerTemplates["xfce"];
this._readme += readmeTemplates["xfce"];
}
}
if (this._chrome) {
this._dockerfile += dockerTemplates["google-chrome"].replace("{CHROMIUM}", getDistro(this.base) === "debian" ? "chromium" : "firefox");
this._readme += readmeTemplates["google-chrome"];
}
if (this._chromium) {
this._dockerfile += dockerTemplates["chromium"].replace("{CHROMIUM}", getDistro(this.base) === "debian" ? "chromium" : "firefox");
this._readme += readmeTemplates["chromium"];
}
if (this._android) {
this._dockerfile += dockerTemplates["android"];
this._readme += readmeTemplates["android"];
}
if (this._vscode) {
this._dockerfile += dockerTemplates["vscode"];
this._readme += readmeTemplates["vscode"];
}
if (this._docker || this._k8s) {
this._dockerfile += dockerTemplates["docker"].replace("{DISTRO}", getDistro(this.base));
this._readme += readmeTemplates["docker"];
if (this._k8s) {
this._dockerfile += dockerTemplates["kubernetes"].replace("{DISTRO}", getDistro(this.base));
this._readme += readmeTemplates["kubernetes"];
}
}
if (this._zsh) {
this._dockerfile += dockerTemplates["zsh"];
this._readme += readmeTemplates["zsh"];
}
this._dockerfile += dockerTemplates["suffix"];
this._readme += readmeTemplates["suffix"];
this._dockerfile = this._dockerfile.replace(/FROM devimage\n/g, "");
return {
Dockerfile: this._dockerfile,
README: this._readme,
};
}
}
exports.DevcontainerGenerator = DevcontainerGenerator;
//# sourceMappingURL=devcontainerGenerator.js.map
//# sourceMappingURL=devcontainerGenerator.js.map

@@ -5,8 +5,3 @@ "use strict";

var devcontainerGenerator_1 = require("./devcontainerGenerator");
Object.defineProperty(exports, "DevcontainerGenerator", {
enumerable: true,
get: function () {
return devcontainerGenerator_1.DevcontainerGenerator;
},
});
//# sourceMappingURL=index.js.map
Object.defineProperty(exports, "DevcontainerGenerator", { enumerable: true, get: function () { return devcontainerGenerator_1.DevcontainerGenerator; } });
//# sourceMappingURL=index.js.map
{
"upgraded": "2021-10-12",
"node": {
"lts": "14.18.1",
"current": "16.11.1"
},
"deno": "1.15.0",
"git": "2.33.0",
"cypress": "8.6.0",
"yarn": "1.22.15",
"dotnet": "2.1.817",
"dotnet3": "3.1.413",
"dotnet5": "5.0.401",
"sha": {
"dotnet_sha512": {
"2.1.817": "484b46e998ab9a998b190809569fe039efc2cc31717bf4819e90c6e77a8742833c535ef7555628bb0a0052be6f366c5d0147fbc0488a30ee97fa1bc3b54816e1",
"3.1.413": "2a0824f11aba0b79d3f9a36af0395649bc9b4137e61b240a48dccb671df0a5b8c2086054f8e495430b7ed6c344bb3f27ac3dfda5967d863718a6dadeca951a83",
"5.0.401": "a444d44007709ceb68d8f72dec0531e17f85f800efc0007ace4fa66ba27f095066930e6c6defcd2f85cdedea2fec25e163f5da461c1c2b8563e5cd7cb47091e0"
"upgraded": "2021-10-12",
"node": {
"lts": "14.18.1",
"current": "16.11.1"
},
"deno": "1.15.1",
"git": "2.33.1",
"cypress": "8.6.0",
"yarn": "1.22.15",
"dotnet3": "3.1.414",
"dotnet5": "5.0.402",
"dotnet6": "6.0.100-rc.2",
"sha": {
"dotnet_sha512": {
"3.1.414": "f0a133a2bfbbdb6e3f35ad543bfd8e48f35e2a0e0bd719f712853d686e5f453b89569504813fde33baf8788dfe509bb3bc7ad69026588761f0a07362eac76104",
"5.0.402": "6b2937ad1f026fd91d0c8e6101b0422a8d19ead022055021b55a722c34dcc3697b592592eacc6def8748981bd996bc2a511d7c3f05b0ae431c00ede0376deacc",
"6.0.100-rc.2": "0a8f85a2757f61ca7f9b8c546af4554c2aac9cdb06f6d62879a60de6f2a3d37ea7136f48896c9c85828a2d55df354e7b9b5b4dc22896c927f0c6370a5ade1b9c"
}
}
}
}
{
"name": "@devcontainer/generator",
"version": "14.6.6",
"version": "14.6.8",
"description": "generates custom devcontainer Dockerfiles",

@@ -21,3 +21,3 @@ "files": [

},
"gitHead": "40b140695e240db236ae517e4f9cdbc72ef0655a"
"gitHead": "798e69105e32cef45e025421a6e1d32597aecc5e"
}

@@ -7,16 +7,17 @@ {

},
"deno": "1.15.0",
"git": "2.33.0",
"deno": "1.15.1",
"git": "2.33.1",
"cypress": "8.6.0",
"yarn": "1.22.15",
"dotnet": "2.1.817",
"dotnet3": "3.1.413",
"dotnet5": "5.0.401",
"dotnet3": "3.1.414",
"dotnet5": "5.0.402",
"dotnet6": "6.0.100-rc.2",
"sha": {
"dotnet_sha512": {
"2.1.817": "484b46e998ab9a998b190809569fe039efc2cc31717bf4819e90c6e77a8742833c535ef7555628bb0a0052be6f366c5d0147fbc0488a30ee97fa1bc3b54816e1",
"3.1.413": "2a0824f11aba0b79d3f9a36af0395649bc9b4137e61b240a48dccb671df0a5b8c2086054f8e495430b7ed6c344bb3f27ac3dfda5967d863718a6dadeca951a83",
"5.0.401": "a444d44007709ceb68d8f72dec0531e17f85f800efc0007ace4fa66ba27f095066930e6c6defcd2f85cdedea2fec25e163f5da461c1c2b8563e5cd7cb47091e0"
"3.1.414": "f0a133a2bfbbdb6e3f35ad543bfd8e48f35e2a0e0bd719f712853d686e5f453b89569504813fde33baf8788dfe509bb3bc7ad69026588761f0a07362eac76104",
"5.0.402": "6b2937ad1f026fd91d0c8e6101b0422a8d19ead022055021b55a722c34dcc3697b592592eacc6def8748981bd996bc2a511d7c3f05b0ae431c00ede0376deacc",
"6.0.100-rc.2": "0a8f85a2757f61ca7f9b8c546af4554c2aac9cdb06f6d62879a60de6f2a3d37ea7136f48896c9c85828a2d55df354e7b9b5b4dc22896c927f0c6370a5ade1b9c"
}
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc