Skip to content

Commit 04b53aa

Browse files
authored
feat(cli) added native dotenv file support (#293)
1 parent 1d910ae commit 04b53aa

File tree

12 files changed

+116
-0
lines changed

12 files changed

+116
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ packages/services/node-info/coverage
1919
.lh
2020
packages/core/repl/.vscode
2121
.idea
22+
.nx

misc/development/cli/dotenv/.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
API_KEY=testkey
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports.makeSomething = () => {
2+
return 'something made__';
3+
};

misc/development/cli/dotenv/package-lock.json

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "test",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"start": "node ../../../../packages/core/cli/lib/index.js start --services ./services --config --repl --watch --dotenv"
8+
},
9+
"author": "",
10+
"license": "ISC"
11+
}

misc/development/cli/dotenv/services/index.js

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const { testFunc } = require('../testlib');
2+
const { makeSomething } = require('../external/external-test');
3+
exports.name = 'test-private';
4+
5+
exports.settings = {
6+
$private: true
7+
};
8+
9+
exports.started = function () {
10+
this.timer = setInterval(() => {
11+
}, 2000);
12+
};
13+
14+
exports.actions = {
15+
hello () {
16+
return makeSomething();
17+
}
18+
};
19+
20+
exports.started = async function () {
21+
testFunc();
22+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const { testFunc } = require('../testlib');
2+
3+
exports.name = 'test-service';
4+
5+
exports.started = function () {
6+
this.timer = setInterval(() => {
7+
}, 2000);
8+
};
9+
10+
exports.actions = {
11+
hello (context) {
12+
return context.data;
13+
},
14+
fromEnv (_) {
15+
return process.env['API_KEY'];
16+
}
17+
};
18+
19+
exports.started = async function () {
20+
testFunc();
21+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const { testFunc } = require('../testlib');
2+
3+
exports.name = 'test-service2';
4+
5+
exports.started = function () {
6+
this.timer = setInterval(() => {
7+
}, 2000);
8+
};
9+
10+
exports.actions = {
11+
hello (context) {
12+
return context.data;
13+
}
14+
};
15+
16+
exports.started = async function () {
17+
testFunc();
18+
};
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
exports.testFunc = () => {
2+
return 'test';
3+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
module.exports = {
3+
nodeId: 'weave-js-cli',
4+
logger: {
5+
level: 'debug'
6+
}
7+
};

misc/development/test.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
process.stdout.fli
2+
process.stdout.write('Hello, World!\n');
3+
process.stdout.write('Hello, World!\n');
4+
process.stdout.write('Hello, World!\n');
5+
process.stdout.write('Hello, World!\n');
6+
process.stdout.write('Hello, World!\n');
7+
process.stdout.write('Hello, World!\n');
8+
process.stdout.write('Hello, World!\n');
9+
process.stdout.write('Hello, World!\n');
10+
process.stdout.write('Hello, World!\n');
11+
process.stdout.write('Hello, World!\n');
12+
process.stdout.write('Hello, World!\n');
13+
process.stdout.write('Hello, World!\n');
14+
process.stdout.write('Hello, World!\n');
15+
process.stdout.write('Hello, World!\n');
16+
process.stdout.write('Hello, World!\n');

0 commit comments

Comments
 (0)