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.5.4 to 14.6.0

101

lib/src/devcontainerGenerator.d.ts

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

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?: "2" | "3" | "5"): void;
setCypress(): void;
generate(): Promise<{
Dockerfile: string;
README: string;
}>;
private loadTemplate;
}
export {};

@@ -6,239 +6,286 @@ "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",
"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 "";
});
}
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;
}
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,
};
}
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;
}
setNodeVersion(nodeVersion) {
this._nodeVersion = nodeVersion;
// 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);
}
setVscode() {
this._vscode = true;
if (this._gitVersion) {
if (this._gitVersion === "ubuntu") {
this._dockerfile += dockerTemplates["gitUbuntu"];
} else {
this._dockerfile += dockerTemplates["git"].replace(
"{GIT_VERSION}",
this._gitVersion,
);
}
}
updateGit(forceFromSource = false) {
if (getDistro(this.base) === "ubuntu" && !forceFromSource) {
this._gitVersion = "ubuntu";
}
else
this._gitVersion = softwareVersions.git;
if (this._deno) {
this._dockerfile += dockerTemplates["deno"]
.replace("{DENO_VERSION}", softwareVersions.deno);
this._readme += readmeTemplates["deno"]
.replace("{DENO_VERSION}", softwareVersions.deno);
}
setDebianBackports() {
this._debianBackports = true;
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);
}
setXfce() {
this._xfce = 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"],
);
}
}
setDeno() {
this._deno = true;
if (this._cypressVersion) {
this._dockerfile += dockerTemplates["cypress"].replace(
"{CYPRESS_VERSION}",
this._cypressVersion,
);
this._readme += readmeTemplates["cypress"].replace(
"{CYPRESS_VERSION}",
this._cypressVersion,
);
}
setK8s() {
this._k8s = 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"];
}
}
setChrome() {
this._chrome = true;
if (this._chrome) {
this._dockerfile += dockerTemplates["google-chrome"].replace(
"{CHROMIUM}",
getDistro(this.base) === "debian" ? "chromium" : "firefox",
);
this._readme += readmeTemplates["google-chrome"];
}
setChromium() {
this._chromium = true;
if (this._chromium) {
this._dockerfile += dockerTemplates["chromium"].replace(
"{CHROMIUM}",
getDistro(this.base) === "debian" ? "chromium" : "firefox",
);
this._readme += readmeTemplates["chromium"];
}
setAndroid() {
this._android = true;
if (this._android) {
this._dockerfile += dockerTemplates["android"];
this._readme += readmeTemplates["android"];
}
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._vscode) {
this._dockerfile += dockerTemplates["vscode"];
this._readme += readmeTemplates["vscode"];
}
setZsh() {
this._zsh = true;
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"];
}
}
setDocker() {
this._docker = true;
if (this._zsh) {
this._dockerfile += dockerTemplates["zsh"];
this._readme += readmeTemplates["zsh"];
}
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);
}
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 === "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.412"]);
}
else {
this._dockerfile += dockerTemplates["dotnet3"]
.replace("{DOTNET_SDK_VERSION}", softwareVersions.dotnet5)
.replace("{dotnet_sha512}", softwareVersions.sha.dotnet_sha512["5.0.400"]);
}
}
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,
};
}
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,3 +5,8 @@ "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-09-22",
"node": {
"lts": "14.18.0",
"current": "16.10.0"
},
"deno": "1.14.2",
"git": "2.33.0",
"cypress": "8.5.0",
"yarn": "1.22.15",
"dotnet": "2.1.817",
"dotnet3": "3.1.412",
"dotnet5": "5.0.400",
"sha": {
"dotnet_sha512": {
"2.1.817": "484b46e998ab9a998b190809569fe039efc2cc31717bf4819e90c6e77a8742833c535ef7555628bb0a0052be6f366c5d0147fbc0488a30ee97fa1bc3b54816e1",
"3.1.412": "1ed0c1ab48723cef834906a55fb1889b29dd810cd2bc66cbd345a0baf8a2796045b5b7f4beef3c48bd56bef3ffed690b6fae4a5f017ad8687817b25a76fbd9be",
"5.0.400": "4d1a92e0885ade03de0fdb41c27cfd948ab749a2f3e686c4a9dee314888c19d76efa6f8663a7aa7eb56cf36f508638c1a1f01c845d1acb19d8662d6ae365d572"
}
"upgraded": "2021-09-22",
"node": {
"lts": "14.18.0",
"current": "16.10.0"
},
"deno": "1.14.2",
"git": "2.33.0",
"cypress": "8.5.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"
}
}
}
{
"name": "@devcontainer/generator",
"version": "14.5.4",
"version": "14.6.0",
"description": "generates custom devcontainer Dockerfiles",

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

},
"gitHead": "6a99297a1673b8cc4e2bb3fa5d10c093add8609d"
"gitHead": "9575ba1f19c41babc993e98309dbefb4ed82c696"
}

@@ -12,11 +12,11 @@ {

"dotnet": "2.1.817",
"dotnet3": "3.1.412",
"dotnet5": "5.0.400",
"dotnet3": "3.1.413",
"dotnet5": "5.0.401",
"sha": {
"dotnet_sha512": {
"2.1.817": "484b46e998ab9a998b190809569fe039efc2cc31717bf4819e90c6e77a8742833c535ef7555628bb0a0052be6f366c5d0147fbc0488a30ee97fa1bc3b54816e1",
"3.1.412": "1ed0c1ab48723cef834906a55fb1889b29dd810cd2bc66cbd345a0baf8a2796045b5b7f4beef3c48bd56bef3ffed690b6fae4a5f017ad8687817b25a76fbd9be",
"5.0.400": "4d1a92e0885ade03de0fdb41c27cfd948ab749a2f3e686c4a9dee314888c19d76efa6f8663a7aa7eb56cf36f508638c1a1f01c845d1acb19d8662d6ae365d572"
"3.1.413": "2a0824f11aba0b79d3f9a36af0395649bc9b4137e61b240a48dccb671df0a5b8c2086054f8e495430b7ed6c344bb3f27ac3dfda5967d863718a6dadeca951a83",
"5.0.401": "a444d44007709ceb68d8f72dec0531e17f85f800efc0007ace4fa66ba27f095066930e6c6defcd2f85cdedea2fec25e163f5da461c1c2b8563e5cd7cb47091e0"
}
}
}
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