forked from FINAKON/HelpProject
1. Initial Commit - a boiler plate code and POC to realize the concept of context sensitive help 2. Frontend code written in ReactJS 3. Backend code written in Java, Spring Boot Framework 4. Frontend Start: pre-requisites : node, npm npm run dev ==> to start the frontend vite server 5. Backend Start: pre-requisites : java, mvn mvn spring-boot:run ==> to start the backend server 6. Visit http://localhost:5173/ for basic demo of help, press F1 in textboxes 7. Visit http://localhost:5173/editor and enter "admin123" to add/modify texts. Happy Coding !!! Thank you, Bhargava.
37 lines
791 B
JavaScript
37 lines
791 B
JavaScript
'use strict';
|
|
|
|
var stream = require('stream');
|
|
var util = require('util');
|
|
var replace = require('./replace');
|
|
|
|
var jsonExtRe = /\.json$/;
|
|
|
|
module.exports = function(rootEnv) {
|
|
rootEnv = rootEnv || process.env;
|
|
return function (file, trOpts) {
|
|
if (jsonExtRe.test(file)) {
|
|
return stream.PassThrough();
|
|
}
|
|
var envs = trOpts ? [rootEnv, trOpts] : [rootEnv];
|
|
return new LooseEnvify(envs);
|
|
};
|
|
};
|
|
|
|
function LooseEnvify(envs) {
|
|
stream.Transform.call(this);
|
|
this._data = '';
|
|
this._envs = envs;
|
|
}
|
|
util.inherits(LooseEnvify, stream.Transform);
|
|
|
|
LooseEnvify.prototype._transform = function(buf, enc, cb) {
|
|
this._data += buf;
|
|
cb();
|
|
};
|
|
|
|
LooseEnvify.prototype._flush = function(cb) {
|
|
var replaced = replace(this._data, this._envs);
|
|
this.push(replaced);
|
|
cb();
|
|
};
|