Skip to content

Commit 837a048

Browse files
author
Mauko Quiroga
committed
Bootstrap application
1 parent a085bd0 commit 837a048

38 files changed

Lines changed: 858 additions & 0 deletions

‎assets/elm-package.json‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "0.0.1",
3+
"summary": "Rendre disponible, valoriser et améliorer les données transports",
4+
"license": "AGPL-3.0",
5+
"repository": "https://github.com/etalab/transport-site.git",
6+
"source-directories": [
7+
"."
8+
],
9+
"exposed-modules": [],
10+
"dependencies": {
11+
"elm-lang/core": "5.1.1 <= v < 6.0.0",
12+
"elm-lang/html": "2.0.0 <= v < 3.0.0",
13+
"elm-lang/http": "1.0.0 <= v < 2.0.0"
14+
},
15+
"elm-version": "0.18.0 <= v < 0.19.0"
16+
}

‎assets/javascripts/Transport.elm‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module Transport exposing (..)
2+
3+
import Html exposing (..)
4+
5+
-- MAIN
6+
7+
main : Html String
8+
main =
9+
view
10+
11+
-- VIEW
12+
13+
view : Html String
14+
view =
15+
h1 [] [ text "transport.beta.gouv.fr" ]

‎assets/javascripts/app.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const Elm = require('./Transport');
2+
Elm.Transport.embed(document.getElementById('elm-main'));

‎assets/package.json‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"scripts": {
3+
"watch": "webpack --stdin --progress --color",
4+
"build": "webpack",
5+
"deploy": "webpack -p",
6+
"errors": "webpack --display-error-details"
7+
},
8+
"dependencies": {
9+
"normalize.css": "^7.0.0"
10+
},
11+
"devDependencies": {
12+
"babel-core": "^7.0.0-alpha.12",
13+
"babel-loader": "^7.0.0",
14+
"babel-preset-es2017": "^7.0.0-alpha.12",
15+
"css-loader": "^0.28.4",
16+
"elm-webpack-loader": "^4.3.1",
17+
"extract-text-webpack-plugin": "^2.1.2",
18+
"import-glob-loader": "^1.1.0",
19+
"node-sass": "^4.5.3",
20+
"sass-loader": "^6.0.5",
21+
"webpack": "^2.5.1"
22+
}
23+
}

‎assets/stylesheets/app.scss‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@import '~normalize.css';
2+
3+
$black: hsl(0, 0%, 10%);
4+
5+
html,
6+
body {
7+
height: 100%;
8+
}
9+
10+
body {
11+
font-family: 'Hurme-No3', sans-serif;
12+
}
13+
14+
main {
15+
align-items: center;
16+
display: flex;
17+
height: 100%;
18+
justify-content: center;
19+
}
20+
21+
h1 {
22+
color: $black;
23+
font-size: calc(4vw + 1em);
24+
}

‎assets/webpack.config.js‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
const { resolve } = require('path');
2+
const ExtractTextPlugin = require('extract-text-webpack-plugin');
3+
const extractSass = new ExtractTextPlugin({ filename: '../css/app.css', allChunks: true });
4+
5+
module.exports = {
6+
entry: ['./javascripts/app.js', './stylesheets/app.scss'],
7+
output: {
8+
path: resolve('../priv/static/js'),
9+
filename: 'app.js'
10+
},
11+
resolve: {
12+
modules: [
13+
resolve('./javascripts'),
14+
resolve('./stylesheets'),
15+
resolve('elm-stuff'),
16+
resolve('node_modules')
17+
],
18+
extensions: ['.elm', '.js', '.scss']
19+
},
20+
plugins: [extractSass],
21+
devtool: 'source-map',
22+
module: {
23+
noParse: /\.elm$/,
24+
rules: [{
25+
test: /\.elm$/,
26+
exclude: [/elm-stuff/, /node_modules/],
27+
use: {
28+
loader: 'elm-webpack-loader',
29+
options: {
30+
cwd: __dirname,
31+
debug: false,
32+
warn: true
33+
}
34+
}
35+
}, {
36+
test: /\.js$/,
37+
exclude: [/elm-stuff/, /node_modules/],
38+
use: {
39+
loader: 'babel-loader',
40+
options: {
41+
presets: ['es2017']
42+
}
43+
}
44+
}, {
45+
test: /\.scss$/,
46+
use: extractSass.extract({
47+
use: [{
48+
loader: 'css-loader',
49+
options: {
50+
sourceMap: true
51+
}
52+
}, {
53+
loader: 'sass-loader',
54+
options: {
55+
sourceMap: true
56+
}
57+
}]
58+
})
59+
}, {
60+
test: /\.(js|scss)$/,
61+
enforce: 'pre',
62+
loader: 'import-glob-loader'
63+
}]
64+
}
65+
};

‎config/config.exs‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This file is responsible for configuring your application
2+
# and its dependencies with the aid of the Mix.Config module.
3+
#
4+
# This configuration file is loaded before any dependency and
5+
# is restricted to this project.
6+
use Mix.Config
7+
8+
# Configures the endpoint
9+
config :transport, TransportWeb.Endpoint,
10+
url: [host: "127.0.0.1"],
11+
secret_key_base: (System.get_env("SECRET_KEY_BASE") || "asdf1234"),
12+
render_errors: [view: TransportWeb.ErrorView, accepts: ~w(html json)],
13+
pubsub: [name: Transport.PubSub,
14+
adapter: Phoenix.PubSub.PG2]
15+
16+
# Configures Elixir's Logger
17+
config :logger, :console,
18+
format: "$time $metadata[$level] $message\n",
19+
metadata: [:request_id]
20+
21+
# Import environment specific config. This must remain at the bottom
22+
# of this file so it overrides the configuration defined above.
23+
import_config "#{Mix.env}.exs"

‎config/dev.exs‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
use Mix.Config
2+
3+
# For development, we disable any cache and enable
4+
# debugging and code reloading.
5+
#
6+
# The watchers configuration can be used to run external
7+
# watchers to your application. For example, we use it
8+
# with brunch.io to recompile .js and .css sources.
9+
config :transport, TransportWeb.Endpoint,
10+
http: [port: 5000],
11+
debug_errors: true,
12+
code_reloader: true,
13+
check_origin: false,
14+
watchers: ["npm": ["run", "--prefix", "assets", "watch"]]
15+
16+
# ## SSL Support
17+
#
18+
# In order to use HTTPS in development, a self-signed
19+
# certificate can be generated by running the following
20+
# command from your terminal:
21+
#
22+
# openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout priv/server.key -out priv/server.pem
23+
#
24+
# The `http:` config above can be replaced with:
25+
#
26+
# https: [port: 4000, keyfile: "priv/server.key", certfile: "priv/server.pem"],
27+
#
28+
# If desired, both `http:` and `https:` keys can be
29+
# configured to run both http and https servers on
30+
# different ports.
31+
32+
# Watch static and templates for browser reloading.
33+
config :transport, TransportWeb.Endpoint,
34+
live_reload: [
35+
url: "ws://127.0.0.1:5000",
36+
patterns: [
37+
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
38+
~r{priv/gettext/.*(po)$},
39+
~r{lib/transport_web/views/.*(ex)$},
40+
~r{lib/transport_web/templates/.*(eex)$}
41+
]
42+
]
43+
44+
# Do not include metadata nor timestamps in development logs
45+
config :logger, :console, format: "[$level] $message\n"
46+
47+
# Set a higher stacktrace during development. Avoid configuring such
48+
# in production as building large stacktraces may be expensive.
49+
config :phoenix, :stacktrace_depth, 20

‎config/prod.exs‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
use Mix.Config
2+
3+
# For production, we often load configuration from external
4+
# sources, such as your system environment. For this reason,
5+
# you won't find the :http configuration below, but set inside
6+
# TransportWeb.Endpoint.init/2 when load_from_system_env is
7+
# true. Any dynamic configuration should be done there.
8+
#
9+
# Don't forget to configure the url host to something meaningful,
10+
# Phoenix uses this information when generating URLs.
11+
#
12+
# Finally, we also include the path to a cache manifest
13+
# containing the digested version of static files. This
14+
# manifest is generated by the mix phx.digest task
15+
# which you typically run after static files are built.
16+
config :transport, TransportWeb.Endpoint,
17+
http: [port: {:system, "PORT"}],
18+
url: [scheme: "https", host: "transport.beta.gouv.fr", port: 443],
19+
cache_static_manifest: "priv/static/cache_manifest.json",
20+
secret_key_base: System.get_env("SECRET_KEY_BASE")
21+
22+
# Do not print debug messages in production
23+
config :logger, level: :info
24+
25+
# ## SSL Support
26+
#
27+
# To get SSL working, you will need to add the `https` key
28+
# to the previous section and set your `:url` port to 443:
29+
#
30+
# config :transport, TransportWeb.Endpoint,
31+
# ...
32+
# url: [host: "example.com", port: 443],
33+
# https: [:inet6,
34+
# port: 443,
35+
# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
36+
# certfile: System.get_env("SOME_APP_SSL_CERT_PATH")]
37+
#
38+
# Where those two env variables return an absolute path to
39+
# the key and cert in disk or a relative path inside priv,
40+
# for example "priv/ssl/server.key".
41+
#
42+
# We also recommend setting `force_ssl`, ensuring no data is
43+
# ever sent via http, always redirecting to https:
44+
#
45+
# config :transport, TransportWeb.Endpoint,
46+
# force_ssl: [hsts: true]
47+
#
48+
# Check `Plug.SSL` for all available options in `force_ssl`.
49+
50+
# ## Using releases
51+
#
52+
# If you are doing OTP releases, you need to instruct Phoenix
53+
# to start the server for all endpoints:
54+
#
55+
# config :phoenix, :serve_endpoints, true
56+
#
57+
# Alternatively, you can configure exactly which server to
58+
# start per endpoint:
59+
#
60+
# config :transport, TransportWeb.Endpoint, server: true
61+
#
62+
63+
# Finally import the config/prod.secret.exs
64+
# which should be versioned separately.
65+
import_config "prod.secret.exs"

‎config/test.exs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
use Mix.Config
2+
3+
# We don't run a server during test. If one is required,
4+
# you can enable the server option below.
5+
config :transport, TransportWeb.Endpoint,
6+
http: [port: 5001],
7+
server: false
8+
9+
# Print only warnings and errors during test
10+
config :logger, level: :warn

0 commit comments

Comments
 (0)