Skip to content

Commit 4298d57

Browse files
committed
Initial Project scaffolding
1 parent a3e52bd commit 4298d57

22 files changed

Lines changed: 16803 additions & 104 deletions

.eslintignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
**/node_modules/**/*.js
2+
src/thirdparty/**
3+
src/assets/new-project/assets/thirdparty/**
4+
src/widgets/bootstrap-*.js
5+
src/extensions/**/unittest-files/**/*.js
6+
src/extensions/**/thirdparty/**/*.js
7+
src/extensions/dev/**
8+
src/extensions/disabled/**
9+
src/**/*-min.js
10+
src/**/*.min.js
11+
src/virtual-server-main.js
12+
src/service-worker.js
13+
14+
test/perf/*-files/**/*.js
15+
test/spec/*-files/**/*.js
16+
test/spec/*-known-goods/**/*.js
17+
test/spec/FindReplace-test-files-*/**/*.js
18+
test/smokes/**
19+
test/temp/**
20+
test/thirdparty/**
21+
test/**/node_modules/**/*.js
22+
test/virtual-server-test.js
23+
24+

.eslintrc.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"commonjs": true,
5+
"es6": true,
6+
"mocha": true,
7+
"node": true,
8+
"worker": true
9+
},
10+
"extends": "eslint:recommended",
11+
"parserOptions": {
12+
"ecmaVersion": 2017,
13+
"sourceType": "module"
14+
},
15+
"rules": {
16+
"indent": [
17+
"error",
18+
4
19+
],
20+
"linebreak-style": [
21+
"error",
22+
"unix"
23+
],
24+
"quotes": [
25+
"error",
26+
"single"
27+
],
28+
"semi": [
29+
"error",
30+
"always"
31+
],
32+
"eqeqeq": [
33+
"error",
34+
"always"
35+
]
36+
}
37+
}

.gitignore

Lines changed: 8 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,10 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
lerna-debug.log*
8-
9-
# Diagnostic reports (https://nodejs.org/api/report.html)
10-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11-
12-
# Runtime data
13-
pids
14-
*.pid
15-
*.seed
16-
*.pid.lock
17-
18-
# Directory for instrumented libs generated by jscoverage/JSCover
19-
lib-cov
20-
21-
# Coverage directory used by tools like istanbul
22-
coverage
23-
*.lcov
24-
25-
# nyc test coverage
26-
.nyc_output
27-
28-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29-
.grunt
30-
31-
# Bower dependency directory (https://bower.io/)
32-
bower_components
33-
34-
# node-waf configuration
35-
.lock-wscript
36-
37-
# Compiled binary addons (https://nodejs.org/api/addons.html)
38-
build/Release
39-
40-
# Dependency directories
41-
node_modules/
42-
jspm_packages/
43-
44-
# TypeScript v1 declaration files
45-
typings/
46-
47-
# TypeScript cache
48-
*.tsbuildinfo
49-
50-
# Optional npm cache directory
51-
.npm
52-
53-
# Optional eslint cache
54-
.eslintcache
55-
56-
# Microbundle cache
57-
.rpt2_cache/
58-
.rts2_cache_cjs/
59-
.rts2_cache_es/
60-
.rts2_cache_umd/
61-
62-
# Optional REPL history
63-
.node_repl_history
64-
65-
# Output of 'npm pack'
66-
*.tgz
67-
68-
# Yarn Integrity file
69-
.yarn-integrity
70-
71-
# dotenv environment variables file
72-
.env
73-
.env.test
74-
75-
# parcel-bundler cache (https://parceljs.org/)
1+
*~
2+
node_modules
763
.cache
4+
.env
5+
.idea
6+
.parcel-cache
777

78-
# Next.js build output
79-
.next
80-
81-
# Nuxt.js build / generate output
82-
.nuxt
83-
dist
84-
85-
# Gatsby files
86-
.cache/
87-
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88-
# https://nextjs.org/blog/next-9-1#public-directory-support
89-
# public
90-
91-
# vuepress build output
92-
.vuepress/dist
93-
94-
# Serverless directories
95-
.serverless/
96-
97-
# FuseBox cache
98-
.fusebox/
99-
100-
# DynamoDB Local files
101-
.dynamodb/
102-
103-
# TernJS port file
104-
.tern-port
8+
dist/*
9+
!dist/fslib.js
10+
!dist/fslib.js.map

.release-it.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"scripts": {
3+
"beforeStart": "npm run test",
4+
"beforeBump": "npm run build",
5+
"changelogCommand": "git log --pretty=format:'* %s (%h)' [REV_RANGE]"
6+
},
7+
"git": {
8+
"tagName": "v%s"
9+
},
10+
"npm": {
11+
"publish": true
12+
},
13+
"github": {
14+
"release": true,
15+
"releaseName": "Nohost %s Released"
16+
}
17+
}

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,20 @@
1-
# phoenix-fs
2-
phoenix file system lib
1+
# Phoenix fs
2+
3+
node like `fs` API for the browser that uses indexedDB/ fs access browser APIs for persistence.
4+
5+
## Installation
6+
7+
To build it:
8+
9+
```
10+
npm install
11+
npm run build
12+
```
13+
14+
The js library will be built in `dist/nohost-sw.js`.
15+
NOTE: you can also use `npm run dev` to also start a web server for development.
16+
17+
18+
```js
19+
<script src=""/>
20+
```

dist/fslib.js

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

dist/fslib.js.map

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

env.sample

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
###
2+
# Dev ENVIRONMENT file
3+
#
4+
# Copy to .env to use defaults when releasing via `npm release`
5+
###
6+
7+
# GitHub Personal Access Token (to push releases)
8+
# https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
9+
GITHUB_TOKEN=

example/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype HTML>
2+
<html>
3+
<head>
4+
<title>nohost</title>
5+
</head>
6+
<body>
7+
<p>Browse filesystem at <a href="/fs">/fs</a></p>
8+
<!-- Pull in Filer so we can write some files -->
9+
<script src="https://unpkg.com/filer/dist/filer.min.js"></script>
10+
<!-- NOTE: use of module here to use workbox-window -->
11+
<script type="module" src="./index.js"></script>
12+
</body>
13+
</html>

example/index.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/* eslint no-console:0 */
2+
3+
import { Workbox } from 'https://storage.googleapis.com/workbox-cdn/releases/4.0.0/workbox-window.prod.mjs';
4+
5+
function serverReady() {
6+
console.log('Server ready! use `window.Filer.fs if you need an fs');
7+
}
8+
9+
function serverInstall() {
10+
console.log('Server installed for first time');
11+
12+
const fs = window.Filer.fs;
13+
fs.writeFile('/The Bridge.txt', 'hello world!', function(err) {
14+
if(err) console.error(err);
15+
});
16+
}
17+
18+
/**
19+
* Register the nohost service worker, passing `route` or other options.
20+
*/
21+
if ('serviceWorker' in navigator) {
22+
const wb = new Workbox('/nohost-sw.js?debug');
23+
24+
// Wait on the server to be fully ready to handle routing requests
25+
wb.controlling.then(serverReady);
26+
27+
// Deal with first-run install, if necessary
28+
wb.addEventListener('installed', (event) => {
29+
if(!event.isUpdate) {
30+
serverInstall();
31+
}
32+
});
33+
34+
wb.register();
35+
}

0 commit comments

Comments
 (0)