Skip to content
This repository has been archived by the owner on Dec 13, 2024. It is now read-only.

Another attempt at d3 module bundling with webpack #7

Merged
merged 6 commits into from
Dec 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,42 @@
This is a basic but opinionated starting point for prototyping apps, with an emphasis on data handling and visualization.

# Getting started
## Clone project into new folder
`git clone https://github.com/ejfox/starter.git project-slug-name`
`cd project-slug-name`

`git clone https://github.com/ejfox/starter.git PROJECT-NAME`
## Configure with init or edit by hand

`cd PROJECT-NAME`
### Initilization
For the quickest start, you can run `gulp init` to perform basic project starting actions.

Run `gulp init` to open atom, remove the `.git` folder, remove the default `README.md`, and run `npm install`

`npm start` to start gulp
```coffeescript
exec 'rm -rf .git'
exec 'git init'
exec 'rm README.md'
exec 'touch README.md'
exec 'atom .'
exec 'npm install'
exec 'gulp config'
```

Run `gulp config` for configuration walkthrough or edit `options.json` by hand

### Modifying the project
Edit coffeescript in `src/coffee/app.coffee`

Edit HTML in `src/tmpl/index.mustache`

Edit Stylus (CSS) in `src/styl/style.styl`

### Updating data
The default place for storing data is `data/data.csv`

If you have set `project.googledatakey` in `options.json` you can run `gulp getdata` to download that sheet using curl to `data/data.csv`

If you have set `project.s3bucket` in `options.json` and set your S3 credentials by renaming `.env-example` and filling it out you can run `gulp s3publish` to publish to an S3 bucket
### Publishing
The `/build/` folder is a standalone client-side web app with everything packaged. It can be put on a webserver or uploaded to a site like Netlify.

You can just upload or update the data on the S3 bucket by running `gulp s3publishdata`
If you have set `project.s3bucket` in `options.json` and set your S3 credentials by renaming `.env-example` and filling it out you can run `gulp s3publish` to publish to an S3 bucket, and update the data in the project by running `gulp s3publishdata` – you need to run both commands on first upload

To publish to github pages you can run `gulp github`
To publish to github pages you can run `gulp gh-pages`
18 changes: 3 additions & 15 deletions gulpfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,12 @@ gulp.task 'config', (cb) ->
message: 'Please enter the twitter handle to be associated with the project'
default: 'mrejfox'
},
{
type: 'input'
name: 'port'
message: 'Please enter the port to run the webserver on'
default: '8888'
},
{
type: 'input'
name: 'googledatakey'
message: 'If using a Google Sheet for data.csv, enter the sheet\'s publish key'
default: 'false'
},
{
type: 'input'
name: 's3bucket'
message: 'If you use S3, enter the name of the bucket you wanna use'
default: 'false'
}], (res) ->
# console.log 'response: ', res
configFile = editJSON './options.json'

parentDir = path.dirname(__filename).split('/')
Expand All @@ -55,7 +42,6 @@ gulp.task 'config', (cb) ->
configFile.set 'project.name', res.projectname
configFile.set 'project.slug', parentDir
configFile.set 'project.twitterhandle', res.twitterhandle
configFile.set 'website.port', res.port

if res.s3bucket isnt 'false'
configFile.set 'project.s3bucket', res.s3bucket
Expand Down Expand Up @@ -88,6 +74,7 @@ gulp.task 'init', gulp.series 'config', (cb) ->
exec 'npm install', (err, stdout, stderr) ->
console.log stdout
console.log stderr
exec 'gulp config'

gulp.task 'getdata', (cb) ->
if options.project.googledatakey isnt 'false' and options.project.googledatakey isnt undefined
Expand Down Expand Up @@ -175,9 +162,10 @@ gulp.task "svg", ->
.pipe gulp.dest("./build/img/")

# Publish to gh-pages
gulp.task 'github', ->
gulp.task 'gh-pages', ->
gulp.src('./build/**/*')
.pipe plugins.github()

# Start a local webserver for development
gulp.task "webserver", ->
gulp.src("./build/")
Expand Down
Loading