Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
{
"name": "Node.js",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-20-bullseye"

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
'func-names': 'off',
'consistent-return': 'off',
'prefer-arrow-callback': 'off',
'arrow-parens': 'as-needed',
'arrow-parens': 'off',
// Windows friendly -- does not show errors on every line of every file
'no-unused-vars': 1,
'linebreak-style': 0
Expand Down
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
24 changes: 24 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"singleAttributePerLine": false,
"bracketSameLine": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false,
"embeddedLanguageFormatting": "auto",
"vueIndentScriptAndStyle": false,
"filepath": "/Users/opsparkowl/Documents/opspark/dev_shop/opspark/.eslintrc.js",
"parser": "babel"
}
6 changes: 2 additions & 4 deletions controller/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ const util = require('util');
const prompt = require('inquirer').prompt;
const mkdirp = require('mkdirp');
const fsJson = require('fs-json')();
const octonode = require('octonode');
const rp = require('request-promise');

const exec = require('child_process').exec;

const env = require('./env');
const config = require('../config.json');
const janitor = require('./janitor');
const {
createGithubToken,
deleteGithubToken,
Expand Down Expand Up @@ -300,7 +298,7 @@ function deauthorizeUser() {
console.log(clc.blue('Successfully logged out!'));
res(true);
})
.catch(err => rej(`${err}`.red));
.catch(err => rej(clc.red(`${err}`)));
});
}

Expand Down
2 changes: 1 addition & 1 deletion controller/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = function () {
.catch(janitor.error(clc.red('Failure installing project')))
.then(projects.initializeProject)
.catch(janitor.error(clc.red('Failure initializing')))
.then(res => console.log(`Successfully installed ${res.name}!`.blue))
.then(res => console.log(clc.blue(`Successfully installed ${res.name}!`)))
.catch(err => {
console.error(err);
});
Expand Down
8 changes: 4 additions & 4 deletions controller/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function selectProject({ session, projectAction }) {
],
function (response) {
if (response.project === cancelOption) {
console.log(`${action} cancelled, bye bye!`.green);
console.log(clc.green(`${action} cancelled, bye bye!`));
process.exitCode = 0;
process.exit();
}
Expand Down Expand Up @@ -126,7 +126,7 @@ function installProject(project) {
const projectName = changeCase.paramCase(project.name);
const projectDirectory = `${projectsDirectory}/${projectName}`;
if (ensureProjectDirectory(projectDirectory)) {
rej(`${project.name} already installed!`.red);
rej(clc.red(`${project.name} already installed!`));
}
console.log(
clc.yellow('Installing project %s, please wait...'),
Expand All @@ -152,9 +152,9 @@ function uninstallProject(project) {
{
type: 'confirm',
name: 'delete',
message:
message: clc.bgRed(
`Are you sure you want to delete ${project.name}? This cannot be undone.`
.bgRed
)
},
function (confirm) {
if (confirm.delete) {
Expand Down
3 changes: 1 addition & 2 deletions controller/sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const clc = require('cli-color');
const _ = require('lodash');
const inquirer = require('inquirer');
const { waterfall } = require('async');
const changeCase = require('change-case');

const projects = require('./projects');

Expand Down Expand Up @@ -34,7 +33,7 @@ function selectSession(sessions) {
],
function (response) {
if (response.class === cancelOption) {
console.log(`${projects.action} cancelled, bye bye!`.green);
console.log(clc.green(`${projects.action} cancelled, bye bye!`));
process.exitCode = 0;
process.exit();
}
Expand Down
2 changes: 1 addition & 1 deletion controller/shelve.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = function () {
.then(projects.shelveProject)
.catch(janitor.error(clc.red('Failure shelving project')))
.then(path =>
console.log(clc.blue('Project now available at'), `${path}!`.yellow)
console.log(clc.blue('Project now available at'), clc.yellow(`${path}!`))
)
.catch(err => {
console.error(err);
Expand Down
2 changes: 1 addition & 1 deletion controller/submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ module.exports.createGist = createGist;
function ensureGistExists({ project, gist, tries }) {
return new Promise(function (res, rej) {
if (tries < 4) {
console.log(`Ensuring gist exists. . . Attempt ${tries}`.yellow);
console.log(clc.yellow(`Ensuring gist exists. . . Attempt ${tries}`));
const cmd = readGistHelper(gist.files['grade.txt'].raw_url);
exec(cmd, function (err, stdout, stderr) {
if (err) {
Expand Down
25 changes: 14 additions & 11 deletions controller/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const fs = require('fs');
const changeCase = require('change-case');
const exec = require('child_process').exec;

const { codenvyUser, home, cloud9User } = require('./env');
const { home } = require('./env');
const janitor = require('./janitor');
const github = require('./github');
const greenlight = require('./greenlight');
Expand All @@ -18,8 +18,7 @@ const {
execAsync
} = require('./helpers');

let rootDirectory = `${home()}/environment`;
let githubDir;
const rootDirectory = `${home()}/environment`;

// if (cloud9User) {
// githubDir = fs
Expand Down Expand Up @@ -70,7 +69,7 @@ module.exports.test = test;
function grabTests(project) {
return new Promise(function (res, rej) {
const name = changeCase.paramCase(project.name);
console.log(`Downloading tests for ${name}. . .`.yellow);
console.log(clc.yellow(`Downloading tests for ${name}. . .`));
const directory = `${projectsDirectory}/${name}`;
const cmd = downloadProjectTests(
project.url,
Expand Down Expand Up @@ -137,15 +136,17 @@ function runTests(project) {

console.log(clc.bgBlue.white(` Passing tests: ${getFillStr(passes)}`));
console.log(clc.bgRed.white(` Failing tests: ${getFillStr(failures)}`));
console.log(clc.bgYellow.black(` Pending tests: ${getFillStr(pending)}`));
console.log(
clc.bgYellow.black(` Pending tests: ${getFillStr(pending)}`)
);
console.log(clc.bgBlack.white(` Total tests: ${getFillStr(tests)}`));

return { project, testResults };
})
.then(
testResults => removeProjectTests().then(() => testResults),
error => removeProjectTests().then(() => Promise.reject(error))
)
);
}

module.exports.runTests = runTests;
Expand All @@ -161,15 +162,17 @@ function displayResults({ testResults }) {
const stackLineOne = stack[0];
const stackLineTwo = stack[1];
const errorInfo = stackLineOne.slice(stackLineOne.indexOf(':'));
console.log(`${i + 1}) ${whichTest}`.red.bold.underline);
console.log(`> > > ${message}`.red);
console.log(`> > > ${errorInfo}`.grey);
console.log(`> > > ${stackLineTwo}`.grey);
console.log(clc.red.bold.underline(`${i + 1}) ${whichTest}`));
console.log(clc.red(`> > > ${message}`));
console.log(clc.xterm(252)(`> > > ${errorInfo}`));
console.log(clc.xterm(252)(`> > > ${stackLineTwo}`));
});

//part divided by the whole 3/4 = 75%
//use math.round to round to the nearest whole percent
let grade = Math.round(100 * (testResults.stats.passes / testResults.stats.tests))
let grade = Math.round(
100 * (testResults.stats.passes / testResults.stats.tests)
);
const clcMethod = grade > 75 ? clc.yellow : clc.red;
console.log(clcMethod(`You have passed ${grade}% of the test.`));

Expand Down
Loading