Skip to content

Commit

Permalink
fix: move localRenderer out of test dir (#406)
Browse files Browse the repository at this point in the history
test dir isnt included in docker image, so exporting it in index.js is breaking the image, but working fine when installed via npm. Moving it out in a new lib dir so it is included in the both the image and npm package
  • Loading branch information
alewitt2 authored Jul 12, 2022
1 parent 7f85ab2 commit c7a6f76
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
12 changes: 6 additions & 6 deletions bin/renderlocal
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
const nopt = require('nopt');
const path = require('path');

const IOUtils = require('../test/lib/IOUtils');
const LocalRenderer = require('../test/lib/LocalRenderer');
const IOUtils = require('../lib/IOUtils');
const LocalRenderer = require('../lib/LocalRenderer');

const args = nopt(
{
Expand All @@ -16,12 +16,12 @@ const args = nopt(
);

if (args.mtp === undefined) {
console.error("exactly one --mtp is required!");
console.error('exactly one --mtp is required!');
process.exit(1);
}

if (args.env === undefined || args.env.length < 1) {
console.error("at least one --env is required!");
console.error('at least one --env is required!');
process.exit(1);
}

Expand All @@ -31,8 +31,8 @@ async function renderLocal() {
if (args.out === undefined) {
await IOUtils.printYaml(data);
} else {
await IOUtils.writeYamlFile(data, args.out)
await IOUtils.writeYamlFile(data, args.out);
}
};
}

renderLocal();
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { MockKubeResourceMeta } = require('@razee/razeedeploy-core');
const MustacheTemplateController = require('../../src/MustacheTemplateController');
const MustacheTemplateController = require('../src/MustacheTemplateController');

module.exports = class LocalMustacheTemplateController extends MustacheTemplateController {
constructor(params) {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "Razee: component to use the Mustache template processor on kubernetes resource configurations.",
"main": "./src/index.js",
"bin": {
"mustachetemplate": "./bin/mustachetemplate",
"renderlocal": "./bin/renderlocal"
"mustachetemplate": "./bin/mustachetemplate",
"renderlocal": "./bin/renderlocal"
},
"keywords": [
"kubernetes",
Expand Down
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const { EventHandler, KubeClass } = require('@razee/kubernetes-util');

const ControllerString = 'MustacheTemplate';
const Controller = require(`./${ControllerString}Controller`);
const LocalRenderer = require(`${__dirname}/../test/lib/LocalRenderer`);
const log = require('./logger').createLogger(ControllerString);

async function createNewEventHandler(kc) {
Expand Down Expand Up @@ -72,6 +71,6 @@ async function run() {

module.exports = {
run,
LocalRenderer,
LocalRenderer: require('../lib/LocalRenderer'),
MustacheTemplateController: Controller
};
2 changes: 1 addition & 1 deletion test/mustache-template-tests.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var assert = require('chai').assert;
var Controller = require('../test/lib/LocalMustacheTemplateController');
var Controller = require('../lib/LocalMustacheTemplateController');

describe('#processTemplates', async function () {
const eventData = {
Expand Down

0 comments on commit c7a6f76

Please sign in to comment.