-
-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
1,884 additions
and
1,723 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist/**/* binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,34 @@ | ||
data/ | ||
node_modules/ | ||
coverage/ | ||
.nyc_output/ | ||
# Temporary files | ||
**/.DS_Store | ||
**/.AppleDouble | ||
**/.LSOverride | ||
**/.idea/ | ||
**/Icon\r\r | ||
|
||
# External disk files | ||
**/.Spotlight-V100 | ||
**/.Trashes | ||
|
||
# AFP share files | ||
**/.AppleDB | ||
**/.AppleDesktop | ||
**/.apdisk | ||
**/Network Trash Folder | ||
**/Temporary Items | ||
|
||
# Test artifacts | ||
coverage | ||
.nyc_output | ||
|
||
# Package Managers | ||
package-lock.json | ||
.env | ||
npm-debug.log | ||
node_modules | ||
|
||
# User data | ||
/data | ||
.env | ||
|
||
# Dist folder | ||
dist/* | ||
!dist/.gitkeep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#!/usr/bin/env node | ||
'use strict' | ||
require('dotenv').config() | ||
|
||
const { resolve } = require('path') | ||
const { writeFile, readFile } = require('fs').promises | ||
const sass = require('rosid-handler-sass') | ||
const js = require('rosid-handler-js') | ||
|
||
const html = require('./src/ui/index') | ||
const isDemoMode = require('./src/utils/isDemoMode') | ||
const isDevelopmentMode = require('./src/utils/isDevelopmentMode') | ||
const customTracker = require('./src/utils/customTracker') | ||
const signale = require('./src/utils/signale') | ||
|
||
const index = async () => { | ||
|
||
const data = html() | ||
|
||
return data | ||
|
||
} | ||
|
||
const favicon = async () => { | ||
|
||
const filePath = resolve(__dirname, 'src/ui/images/favicon.ico') | ||
const data = readFile(filePath) | ||
|
||
return data | ||
|
||
} | ||
|
||
const styles = async () => { | ||
|
||
const filePath = resolve(__dirname, 'src/ui/styles/index.scss') | ||
const data = sass(filePath, { optimize: isDevelopmentMode === false }) | ||
|
||
return data | ||
|
||
} | ||
|
||
const scripts = async () => { | ||
|
||
const filePath = resolve(__dirname, 'src/ui/scripts/index.js') | ||
|
||
const babel = { | ||
presets: [ | ||
[ | ||
'@babel/preset-env', { | ||
targets: { | ||
browsers: [ | ||
'last 2 Safari versions', | ||
'last 2 Chrome versions', | ||
'last 2 Opera versions', | ||
'last 2 Firefox versions' | ||
] | ||
} | ||
} | ||
] | ||
], | ||
babelrc: false | ||
} | ||
|
||
const data = js(filePath, { | ||
optimize: isDevelopmentMode === false, | ||
env: { | ||
ACKEE_TRACKER: process.env.ACKEE_TRACKER, | ||
ACKEE_DEMO: isDemoMode === true ? 'true' : 'false', | ||
NODE_ENV: isDevelopmentMode === true ? 'development' : 'production' | ||
}, | ||
babel | ||
}) | ||
|
||
return data | ||
|
||
} | ||
|
||
const tracker = async () => { | ||
|
||
const filePath = require.resolve('ackee-tracker') | ||
const data = readFile(filePath, 'utf8') | ||
|
||
return data | ||
|
||
} | ||
|
||
const build = async (path, fn) => { | ||
|
||
try { | ||
signale.await(`Building and writing '${ path }'`) | ||
const data = await fn() | ||
await writeFile(path, data) | ||
signale.success(`Finished building '${ path }'`) | ||
} catch (err) { | ||
signale.fatal(err) | ||
process.exit(1) | ||
} | ||
|
||
} | ||
|
||
// Required files | ||
build('dist/index.html', index) | ||
build('dist/favicon.ico', favicon) | ||
build('dist/index.css', styles) | ||
build('dist/index.js', scripts) | ||
build('dist/tracker.js', tracker) | ||
|
||
// Optional files | ||
if (customTracker.exists === true) { | ||
build(`dist/${ customTracker.path }`, tracker) | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict' | ||
|
||
const { ApolloServer } = require('apollo-server-lambda') | ||
const { UnsignedIntResolver, UnsignedIntTypeDefinition, DateTimeResolver, DateTimeTypeDefinition } = require('graphql-scalars') | ||
|
||
const connect = require('../src/utils/connect') | ||
const isDemoMode = require('../src/utils/isDemoMode') | ||
const isDevelopmentMode = require('../src/utils/isDevelopmentMode') | ||
const { createServerlessContext } = require('../src/utils/createContext') | ||
|
||
const dbUrl = process.env.ACKEE_MONGODB || process.env.MONGODB_URI | ||
|
||
if (dbUrl == null) { | ||
throw new Error('MongoDB connection URI missing in environment') | ||
} | ||
|
||
connect(dbUrl) | ||
|
||
const apolloServer = new ApolloServer({ | ||
introspection: isDemoMode === true || isDevelopmentMode === true, | ||
playground: isDemoMode === true || isDevelopmentMode === true, | ||
debug: isDevelopmentMode === true, | ||
typeDefs: [ | ||
UnsignedIntTypeDefinition, | ||
DateTimeTypeDefinition, | ||
require('../src/types') | ||
], | ||
resolvers: { | ||
UnsignedInt: UnsignedIntResolver, | ||
DateTime: DateTimeResolver, | ||
...require('../src/resolvers') | ||
}, | ||
context: createServerlessContext | ||
}) | ||
|
||
exports.handler = apolloServer.createHandler() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[build] | ||
publish = "dist" | ||
command = "yarn build" | ||
functions = "functions/" | ||
environment = { NODE_VERSION = "14.9.0", NODE_ENV = "production" } | ||
|
||
[[redirects]] | ||
from = "/api" | ||
to = "/.netlify/functions/api" | ||
status = 200 | ||
force = true | ||
|
||
[template.environment] | ||
ACKEE_MONGODB = "ACKEE_MONGODB" | ||
ACKEE_USERNAME = "ACKEE_USERNAME" | ||
ACKEE_PASSWORD = "ACKEE_PASSWORD" | ||
ACKEE_ALLOW_ORIGIN = "ACKEE_ALLOW_ORIGIN" |
Oops, something went wrong.