Skip to content
This repository was archived by the owner on Nov 22, 2025. It is now read-only.

Commit 433c6d2

Browse files
committed
Hello world!
0 parents  commit 433c6d2

8 files changed

Lines changed: 296 additions & 0 deletions

File tree

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file is for unifying the coding style for different editors and IDEs.
2+
# EditorConfig is AweSome: http://editorconfig.org/
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
indent_size = 2
12+
indent_style = space

.gitattributes

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# https://github.com/mhulse/gh-boiler/issues/42
2+
3+
* text=auto
4+
5+
*.ai binary
6+
*.dcst binary
7+
*.flst binary
8+
*.indb binary
9+
*.indd binary
10+
*.indt binary
11+
*.pdf binary
12+
*.psd binary
13+
*.blend* binary
14+
15+
*.eot binary
16+
*.ttf binary
17+
*.woff* binary

.gitignore

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# https://github.com/github/gitignore
2+
3+
# COMPILED SOURCE #
4+
###################
5+
6+
*.class
7+
*.com
8+
*.dll
9+
*.exe
10+
*.o
11+
*.py[cdo]
12+
*.so
13+
14+
# PACKAGES #
15+
############
16+
17+
*.7z
18+
*.dmg
19+
*.egg*
20+
*.gz
21+
*.iso
22+
*.jar
23+
*.rar
24+
*.tar
25+
*.tgz
26+
*.zip
27+
28+
# LOGS AND DATABASES #
29+
######################
30+
31+
*.log*
32+
*.sql
33+
*.sqlite
34+
*.db
35+
36+
# OS GENERATED FILES #
37+
######################
38+
39+
._*
40+
.DS_Store
41+
.DS_Store?
42+
.Spotlight-V100
43+
.Trashes
44+
Desktop.ini
45+
ehthumbs.db
46+
Icon^M^M
47+
Thumbs.db
48+
49+
# EDITORS #
50+
###########
51+
52+
_compareTemp
53+
.\#*
54+
.elc
55+
.idea
56+
.project
57+
.pydevproject
58+
.settings
59+
.vscode
60+
[_]notes/
61+
*.[lL][cC][kK]
62+
*.mno
63+
*.sublime-workspace
64+
*.swo
65+
*.swp
66+
*~
67+
/.emacs.desktop
68+
/.emacs.desktop.lock
69+
\#*\#
70+
auto-save-list
71+
configs/
72+
dwsync.xml
73+
tramp
74+
75+
# RUNTIME DATA #
76+
################
77+
78+
*.pid
79+
*.seed
80+
pids
81+
82+
# MISCELLANEOUS #
83+
#################
84+
85+
*.bak
86+
.cvs
87+
.svn
88+
sitemap.xml.gz*~
89+
90+
# PROJECT-SPECIFIC #
91+
####################
92+
93+
node_modules
94+
key.js

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Basic Node module
2+
3+
This is a work in progress!

index.js

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
const path = require('path');
2+
const fs = require('fs');
3+
4+
const html = (__dirname + '/temp.html');
5+
6+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
7+
class BasicNodeModule {
8+
9+
constructor(options = {}) {
10+
11+
this.defaults = {
12+
red: 'red',
13+
green: 'green'
14+
};
15+
16+
if ( ! BasicNodeModule.instance) {
17+
18+
BasicNodeModule.instance = this;
19+
20+
}
21+
22+
this.defaults = {
23+
...this.defaults,
24+
...options
25+
};
26+
27+
return BasicNodeModule.instance;
28+
29+
}
30+
31+
static of(options) {
32+
33+
const basicNodeModule = new BasicNodeModule();
34+
35+
basicNodeModule.defaults = {
36+
...basicNodeModule.defaults,
37+
...options
38+
};
39+
40+
console.log(basicNodeModule.defaults)
41+
42+
return basicNodeModule;
43+
44+
}
45+
46+
async run() {
47+
48+
//console.log('ddd', this.options);
49+
50+
// console.log(options);
51+
//
52+
// if (options.foo && options.bar) {
53+
//
54+
// await fs.writeFile(html, 'Hello world!', 'utf8');
55+
//
56+
// let result = await fs.readFile(html, 'utf8');
57+
//
58+
// await fs.unlink(html);
59+
//
60+
// return result;
61+
//
62+
// } else {
63+
//
64+
// throw new Error('missing foo AND bar');
65+
//
66+
// }
67+
68+
}
69+
70+
}
71+
72+
// These options come from `require()({ … options … })` syntax:
73+
module.exports = (options = {}) => {
74+
75+
if (Object.entries(options).length) {
76+
77+
new BasicNodeModule(options);
78+
79+
}
80+
81+
return BasicNodeModule.of
82+
83+
};

package-lock.json

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "rand-steet-view",
3+
"version": "1.0.0",
4+
"description": "",
5+
"author": "Michael Hulse",
6+
"license": "Apache-2.0",
7+
"scripts": {
8+
"test": "echo \"Error: no test specified\" && exit 1"
9+
},
10+
"keywords": [],
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/<user>/<repo-name>.git"
14+
},
15+
"main": "index.js",
16+
"dependencies": {
17+
"fs-extra": "^7.0.0"
18+
}
19+
}

test.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const bnm = require('./index')({
2+
// Options can be passed here:
3+
red: 'black'
4+
});
5+
6+
(async function start() {
7+
8+
let foo = bnm({
9+
green: 'purple'
10+
}).run();
11+
12+
// console.log('before');
13+
//
14+
// const options = {
15+
// bar: 'bar'
16+
// };
17+
//
18+
// try {
19+
//
20+
// let result = await bnm(options);
21+
//
22+
// console.log(result);
23+
//
24+
// } catch(err) {
25+
//
26+
// console.log(err);
27+
//
28+
// }
29+
//
30+
// console.log('after');
31+
32+
})();

0 commit comments

Comments
 (0)