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 1.4.0 to 1.5.0

templates/amplify.Dockerfile

15

lib/src/devcontainerGenerator.d.ts

@@ -6,6 +6,9 @@ declare type Base = "stretch" | "buster" | "disco" | "eoan";

private _dockerfile;
private _templates;
private _readme;
private _dockerTemplates;
private _readmeTemplates;
private _templateInputs;
private _nodeVesion;
private _gitVersion;
private _amplify;
private _cypressVersion;

@@ -16,3 +19,3 @@ private _dotnet;

private _docker;
private _noVNC;
private _remoteDesktop;
private _zsh;

@@ -24,3 +27,4 @@ constructor(base: Base);

setXfce(): void;
setNoVNC(): void;
setAmplify(): void;
setremoteDesktop(): void;
setUpgraded(): void;

@@ -31,5 +35,8 @@ setZsh(): void;

setCypress(): void;
generateDockerfile(): Promise<string>;
generate(): Promise<{
Dockerfile: string;
README: string;
}>;
private loadTemplate;
}
export {};

@@ -13,6 +13,9 @@ "use strict";

this._dockerfile = "";
this._templates = {};
this._templateInputs = ['base', 'upgrade', 'git', 'gitUbuntu', 'node', 'cypress', 'dotnet', 'docker', 'dotnet3', 'xfce', 'noVNC', 'zsh'];
this._readme = "";
this._dockerTemplates = {};
this._readmeTemplates = {};
this._templateInputs = ['base', 'upgrade', 'git', 'amplify', 'gitUbuntu', 'node', 'cypress', 'dotnet', 'docker', 'dotnet3', 'xfce', 'remoteDesktop', 'zsh'];
this._nodeVesion = null;
this._gitVersion = '';
this._amplify = false;
this._cypressVersion = '';

@@ -23,11 +26,16 @@ this._dotnet = null;

this._docker = false;
this._noVNC = false;
this._remoteDesktop = false;
this._zsh = false;
this.loadTemplate = async (filename) => await fs_1.promises.readFile(`${__dirname}/../../templates/${filename}.Dockerfile`);
this.loadTemplate = async (filename, extension) => await fs_1.promises.readFile(`${__dirname}/../../templates/${filename}.${extension}`).catch(e => { console.error({ e }); return ""; });
}
;
async init() {
const buffer = await Promise.all(this._templateInputs.map(async (fileName) => await this.loadTemplate(fileName)));
this._templateInputs.forEach((input, index) => this._templates[input] = String(buffer[index]));
return this._templates;
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
};
}

@@ -43,5 +51,8 @@ setNodeVersion(nodeVersion) {

}
setNoVNC() {
this._noVNC = true;
setAmplify() {
this._amplify = true;
}
setremoteDesktop() {
this._remoteDesktop = true;
}
setUpgraded() {

@@ -62,46 +73,76 @@ this._upgrade = true;

}
async generateDockerfile() {
const templates = await this.init();
this._dockerfile += templates['base'].replace('{DISTRO}', this.base);
async generate() {
const { dockerTemplates, readmeTemplates } = await this.init();
this._dockerfile += dockerTemplates['base'].replace('{DISTRO}', this.base);
this._readme += readmeTemplates['base'].replace('{DISTRO}', this.base);
if (this._upgrade) {
const now = new Date();
this._dockerfile += templates['upgrade'].replace('{DEV_VERSION}', `${now.getFullYear()}-${now.getMonth()}-${now.getDate()}`);
this._dockerfile += dockerTemplates['upgrade'].replace('{DEV_VERSION}', `${now.getFullYear()}-${now.getMonth()}-${now.getDate()}`);
this._readme += readmeTemplates['upgrade'].replace('{DEV_VERSION}', `${now.getFullYear()}-${now.getMonth()}-${now.getDate()}`);
}
if (this._gitVersion) {
if (getDistro(this.base) === "Ubuntu") {
this._dockerfile += templates['gitUbuntu'];
this._dockerfile += dockerTemplates['gitUbuntu'];
}
else {
this._dockerfile += templates['git'].replace('{GIT_VERSION}', this._gitVersion);
this._dockerfile += dockerTemplates['git'].replace('{GIT_VERSION}', this._gitVersion);
}
if (getDistro(this.base) === "Ubuntu") {
this._readme += readmeTemplates['gitUbuntu'];
}
else {
this._readme += readmeTemplates['git'].replace('{GIT_VERSION}', this._gitVersion);
}
}
if (this._nodeVesion) {
this._dockerfile += templates['node'].replace('{NODE_VERSION}', softwareVersions.node[this._nodeVesion])
this._dockerfile += dockerTemplates['node'].replace('{NODE_VERSION}', softwareVersions.node[this._nodeVesion])
.replace('{YARN_VERSION}', softwareVersions.yarn);
this._readme += readmeTemplates['node'].replace('{NODE_VERSION}', softwareVersions.node[this._nodeVesion])
.replace('{YARN_VERSION}', softwareVersions.yarn);
}
if (this._cypressVersion) {
this._dockerfile += templates['cypress'].replace('{CYPRESS_VERION}', this._cypressVersion);
this._dockerfile += dockerTemplates['cypress'].replace('{CYPRESS_VERION}', this._cypressVersion);
this._readme += readmeTemplates['cypress'].replace('{CYPRESS_VERION}', this._cypressVersion);
}
if (this._docker) {
this._dockerfile += templates['docker'];
this._dockerfile += dockerTemplates['docker'];
this._readme += readmeTemplates['docker'];
}
if (this._amplify) {
this._dockerfile += dockerTemplates['amplify'].replace('{AMPLIFY}', softwareVersions.amplify);
this._readme += readmeTemplates['amplify'].replace('{AMPLIFY}', softwareVersions.amplify);
}
if (this._dotnet) {
if (this._dotnet === "2")
this._dockerfile += templates['dotnet'].replace('{DOTNET_SDK_VERSION}', softwareVersions.dotnet)
this._dockerfile += dockerTemplates['dotnet'].replace('{DOTNET_SDK_VERSION}', softwareVersions.dotnet)
.replace('{dotnet_sha512}', softwareVersions.sha.dotnet_sha512["2.2.402"]);
else {
this._dockerfile += templates['dotnet'].replace('{DOTNET_SDK_VERSION}', softwareVersions.dotnet3)
this._dockerfile += dockerTemplates['dotnet'].replace('{DOTNET_SDK_VERSION}', softwareVersions.dotnet3)
.replace('{dotnet_sha512}', softwareVersions.sha.dotnet_sha512["3.0.100-preview9-014004"]);
}
if (this._dotnet === "2")
this._readme += readmeTemplates['dotnet'].replace('{DOTNET_SDK_VERSION}', softwareVersions.dotnet)
.replace('{dotnet_sha512}', softwareVersions.sha.dotnet_sha512["2.2.402"]);
else {
this._readme += readmeTemplates['dotnet'].replace('{DOTNET_SDK_VERSION}', softwareVersions.dotnet3)
.replace('{dotnet_sha512}', softwareVersions.sha.dotnet_sha512["3.0.100-preview9-014004"]);
}
}
if (this._remoteDesktop) {
this._dockerfile += dockerTemplates['remoteDesktop'].replace('{XPRADISTRO}', this.base === "eoan" ? "disco" : this.base);
this._readme += readmeTemplates['remoteDesktop'];
}
if (this._xfce) {
this._dockerfile += templates['xfce'];
this._dockerfile += dockerTemplates['xfce'];
this._readme += readmeTemplates['xfce'];
}
if (this._noVNC) {
this._dockerfile += templates['noVNC'];
}
if (this._zsh) {
this._dockerfile += templates['zsh'];
this._dockerfile += dockerTemplates['zsh'];
this._readme += readmeTemplates['zsh'];
}
return this._dockerfile.replace(/FROM devimage\n/g, "");
this._dockerfile = this._dockerfile.replace(/FROM devimage\n/g, "");
return {
Dockerfile: this._dockerfile,
README: this._readme
};
}

@@ -108,0 +149,0 @@ }

@@ -6,2 +6,3 @@ {

},
"amplify": "3.2.0",
"git": "2.23.0",

@@ -8,0 +9,0 @@ "cypress": "3.4.1",

{
"name": "@devcontainer/generator",
"version": "1.4.0",
"version": "1.5.0",
"description": "generates custorm devcontainer Dockerfiles",

@@ -16,4 +16,4 @@ "files": [

"devDependencies": {
"@types/node": "^12.7.3",
"typescript": "^3.6.2"
"@types/node": "^12.7.5",
"typescript": "^3.6.3"
},

@@ -24,3 +24,3 @@ "publishConfig": {

"license": "MIT",
"gitHead": "25ddb8dafb740976f9b537abeafa66b1760860f3"
"gitHead": "a056813493672c6e5be572b2e466612757ae7fb7"
}

@@ -6,2 +6,3 @@ {

},
"amplify": "3.2.0",
"git": "2.23.0",

@@ -8,0 +9,0 @@ "cypress": "3.4.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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