Skip to content

Commit 4ddce14

Browse files
authored
feat: release v0.0.11 (#5)
1 parent 4309a39 commit 4ddce14

File tree

7 files changed

+74
-8
lines changed

7 files changed

+74
-8
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Testing
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
testing:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: [14.x, 16.x, 17.x]
16+
steps:
17+
- name: Git checkout
18+
uses: actions/checkout@v2
19+
20+
- uses: actions/setup-node@v2
21+
with:
22+
node-version: '16.x'
23+
registry-url: 'https://registry.npmjs.org'
24+
25+
- name: Use Node.js ${{ matrix.node-version }}
26+
uses: actions/setup-node@v1
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
30+
- run: npm install
31+
32+
- run: npm test

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# Release 0.0.11
2+
3+
- Bugfix for Node LTS version, ERR_UNKNOWN_BUILTIN_MODULE
4+
- Update github actions & npm publish
5+
- Improve init template, add .gitignore, .env
6+
- Improve creation of the env variables for new environments
7+
18
# Release 0.0.10
29

310
- Tests

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "hlambda-cli",
33
"type": "module",
4-
"version": "0.0.10",
4+
"version": "0.0.11",
55
"description": "CLI for hlambda server.",
66
"main": "src/index.js",
77
"bin": {

src/commands/environment/add.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const addEnv = async (envName, options, program) => {
6767
console.log(`Create folder failed`.red);
6868
});
6969

70-
await writeFile(`${initEnvFilePath}/config.yaml`, configEnvTemplate, 'utf-8')
70+
await writeFile(`${initEnvFilePath}/config.yaml`, configEnvTemplate(envName), 'utf-8')
7171
.then(() => {
7272
// console.log(`File write ${initEnvFilePath}/config.yaml successfull!`.green);
7373
})

src/commands/init.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {
1111
errorTemplate,
1212
hlambdaYamlTemplate,
1313
hlambdaREADMETemplate,
14+
rootGitIgnoreTemplate,
15+
rootDotenvTemplate,
1416
} from './../templates/index.js';
1517

1618
import CLIErrorHandler from './../utils/CLIErrorHandler.js';
@@ -90,6 +92,22 @@ export const init = async (dirName, options, program) => {
9092
console.log(`File write ${`./${dirName}/config.yaml`} failed`.red);
9193
});
9294

95+
await writeFile(`./${dirName}/.gitignore`, rootGitIgnoreTemplate, 'utf-8')
96+
.then(() => {
97+
// console.log(`File write ${`./${dirName}/.gitignore`} successfull!`.green);
98+
})
99+
.catch(() => {
100+
console.log(`File write ${`./${dirName}/.gitignore`} failed`.red);
101+
});
102+
103+
await writeFile(`./${dirName}/.env`, rootDotenvTemplate, 'utf-8')
104+
.then(() => {
105+
// console.log(`File write ${`./${dirName}/.env`} successfull!`.green);
106+
})
107+
.catch(() => {
108+
console.log(`File write ${`./${dirName}/.env`} failed`.red);
109+
});
110+
93111
if (includeDemoApp) {
94112
await writeFile(`./${dirName}/README.md`, hlambdaREADMETemplate, 'utf-8')
95113
.then(() => {

src/commands/server.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from 'path';
22
import fetch from 'node-fetch';
3-
import * as readline from 'node:readline/promises';
4-
import { stdin as input, stdout as output } from 'node:process';
3+
import * as readline from 'readline';
4+
import { stdin as input, stdout as output } from 'process';
55

66
import { FormData, File } from 'formdata-node';
77

@@ -161,8 +161,9 @@ export const serverShell = async (options, program) => {
161161
// console.log(`Thank you for your valuable feedback: ${answer}`);
162162

163163
rl.on('line', async (terminalInput) => {
164-
if (terminalInput === 'exit' || terminalInput === 'quit') {
164+
if (terminalInput.toLowerCase() === 'exit' || terminalInput.toLowerCase() === 'quit') {
165165
rl.close();
166+
process.exit(0);
166167
return;
167168
}
168169
if (terminalInput.toLowerCase().startsWith('cd')) {

src/templates/index.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,19 @@ metadata_directory: metadata
1616
1717
`;
1818

19-
export const configEnvTemplate = `version: 1
20-
endpoint: "{{ENV_DEV_HLAMBDA_ENDPOINT}}"
21-
admin_secret: "{{ENV_DEV_HLAMBDA_ADMIN_SECRET}}"
19+
export const rootDotenvTemplate = `
2220
`;
2321

22+
export const rootGitIgnoreTemplate = `.env
23+
`;
24+
25+
export const configEnvTemplate = (envName) => {
26+
return `version: 1
27+
endpoint: "{{ENV_${`${envName}`.toUpperCase()}_HLAMBDA_ENDPOINT}}"
28+
admin_secret: "{{ENV_${`${envName}`.toUpperCase()}_HLAMBDA_ADMIN_SECRET}}"
29+
`;
30+
};
31+
2432
export const packageJsonTemplate = `{
2533
"type": "module",
2634
"dependencies": {}

0 commit comments

Comments
 (0)