gtfs-to-html 2.4.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.4.1] - 2022-07-10
9
+
10
+ ### Updated
11
+
12
+ - Update Dockerfile to node 16
13
+ - Dependency updates
14
+ - Use yoctocolors instead of chalk
15
+
8
16
  ## [2.4.0] - 2022-06-07
9
17
 
10
18
  ### Updated
package/docker/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
1
  # syntax=docker/dockerfile:1
2
- FROM node:14
2
+ FROM node:16
3
3
 
4
4
  RUN apt update
5
5
  RUN apt install -y chromium
package/lib/log-utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { clearLine, cursorTo } from 'node:readline';
2
2
  import PrettyError from 'pretty-error';
3
3
  import { noop } from 'lodash-es';
4
- import chalk from 'chalk';
4
+ import * as colors from 'yoctocolors';
5
5
  import { getFeedInfo } from 'gtfs';
6
6
  import Table from 'cli-table';
7
7
 
@@ -99,19 +99,20 @@ export function logError(config) {
99
99
  * Format console warning text
100
100
  */
101
101
  export function formatWarning(text) {
102
- return `${chalk.yellow.underline('Warning')}${chalk.yellow(
103
- ':'
104
- )} ${chalk.yellow(text)}`;
102
+ const warningMessage = `${colors.underline('Warning')}: ${text}`;
103
+ return colors.yellow(warningMessage);
105
104
  }
106
105
 
107
106
  /*
108
107
  * Format console error text
109
108
  */
110
109
  export function formatError(error) {
111
- const message = error instanceof Error ? error.message : error;
112
- return `${chalk.red.underline('Error')}${chalk.red(':')} ${chalk.red(
113
- message.replace('Error: ', '')
110
+ const messageText = error instanceof Error ? error.message : error;
111
+ const errorMessage = `${colors.underline('Error')}: ${messageText.replace(
112
+ 'Error: ',
113
+ ''
114
114
  )}`;
115
+ return colors.red(errorMessage);
115
116
  }
116
117
 
117
118
  /*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtfs-to-html",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "private": false,
5
5
  "description": "Build human readable transit timetables as HTML, PDF or CSV from GTFS",
6
6
  "keywords": [
@@ -38,15 +38,14 @@
38
38
  "@turf/helpers": "^6.5.0",
39
39
  "@turf/simplify": "^6.5.0",
40
40
  "archiver": "^5.3.1",
41
- "chalk": "^5.0.1",
42
41
  "cli-table": "^0.3.11",
43
42
  "copy-dir": "^1.3.0",
44
- "csv-stringify": "^6.1.0",
43
+ "csv-stringify": "^6.1.3",
45
44
  "express": "^4.18.1",
46
- "gtfs": "^3.3.1",
47
- "js-beautify": "^1.14.3",
45
+ "gtfs": "^3.5.0",
46
+ "js-beautify": "^1.14.4",
48
47
  "lodash-es": "^4.17.21",
49
- "moment": "^2.29.3",
48
+ "moment": "^2.29.4",
50
49
  "morgan": "^1.10.0",
51
50
  "pretty-error": "^4.0.0",
52
51
  "pug": "^3.0.2",
@@ -56,14 +55,15 @@
56
55
  "timer-machine": "^1.1.0",
57
56
  "toposort": "^2.0.2",
58
57
  "untildify": "^4.0.0",
59
- "yargs": "^17.5.1"
58
+ "yargs": "^17.5.1",
59
+ "yoctocolors": "^1.0.0"
60
60
  },
61
61
  "devDependencies": {
62
- "eslint": "^8.17.0",
62
+ "eslint": "^8.19.0",
63
63
  "eslint-config-prettier": "^8.5.0",
64
64
  "eslint-config-xo": "^0.41.0",
65
65
  "husky": "^8.0.1",
66
- "prettier": "^2.6.2",
66
+ "prettier": "^2.7.1",
67
67
  "pretty-quick": "^3.1.3"
68
68
  },
69
69
  "engines": {
@@ -490,7 +490,7 @@ The default trip-sorting algorithm is `common`.
490
490
 
491
491
  ### sqlitePath
492
492
 
493
- {String} A path to an SQLite database. Optional, defaults to using an in-memory database with a value of `:memory:`. If you want the data imported to persist, you need to specify a value for `sqlitePath`
493
+ {String} A path to an SQLite database. Optional, defaults to using an in-memory database with a value of `:memory:`. If you want the data imported to persist, you need to specify a value for `sqlitePath`. Supports tilde as part of the path, like `~/Documents/gtfs`.
494
494
 
495
495
  ```
496
496
  "sqlitePath": "/tmp/gtfs"
@@ -29,7 +29,6 @@ Skips importing GTFS into SQLite. Useful if you are rerunning with an unchanged
29
29
 
30
30
  gtfs-to-html --skipImport
31
31
 
32
-
33
32
  ### Processing very large GTFS files.
34
33
 
35
34
  By default, node has a memory limit of 512 MB or 1 GB. If you have a very large GTFS file and want to use the option `showOnlyTimepoint` = `false` you may need to allocate more memory. Use the `max-old-space-size` option. For example to allocate 4 GB:
@@ -44,17 +43,17 @@ You can use both [`docker`](https://docker.com) and [`docker-compose`](https://d
44
43
 
45
44
  A `Dockerfile` is available in the `docker` directory.
46
45
 
47
- * Create a `config.json` file and save in the same directory as your `Dockerfile`. You can use `config-sample.json` from the project root as a starting point.
46
+ - Create a `config.json` file and save in the same directory as your `Dockerfile`. You can use `config-sample.json` from the project root as a starting point. For Docker usage, remove any `sqlitePath` and `templatePath` values from the config.json.
48
47
 
49
- * Build the docker image:
48
+ - Build the docker image:
50
49
 
51
50
  docker build -t gtfs-to-html .
52
51
 
53
- * Run the docker image:
52
+ - Run the docker image:
54
53
 
55
54
  docker run gtfs-to-html
56
55
 
57
- * Copy the generated HTML out of the docker container
56
+ - Copy the generated HTML out of the docker container
58
57
 
59
58
  // Figure out what your container ID is
60
59
  docker container ls -a
@@ -69,17 +68,16 @@ A `Dockerfile` is available in the `docker` directory.
69
68
 
70
69
  Docker compose is used for multi-container Docker applications. In this context, it is just a convenient way to manage volumes. This allows (_i_) to get the generated HTML out of the docker container without explicitly copying with `docker cp`, and (_ii_) to tweak and run a new configuration without rebuilding the container from scratch.
71
70
 
72
- * Create a `config.json` file and save in the same directory as your `Dockerfile` and `docker-compose.yml`;
71
+ - Create a `config.json` file and save in the same directory as your `Dockerfile` and `docker-compose.yml`;
73
72
 
74
- * build and run the container:
73
+ - build and run the container:
75
74
 
76
75
  docker-compose up
77
76
 
78
- * the generated HTML will be available in the folder `html` next to docker files.
77
+ - the generated HTML will be available in the folder `html` next to docker files.
79
78
 
80
79
  Do you want to change something? Just delete the old HTML, change your `config.json`, and finally run `docker-compose up` again.
81
80
 
82
-
83
81
  ## Usage as a node module
84
82
 
85
83
  If you are using this as a node module as part of an application, you can include it in your project's `package.json` file.
@@ -87,22 +85,25 @@ If you are using this as a node module as part of an application, you can includ
87
85
  ### Code example
88
86
 
89
87
  ```javascript
90
- import gtfsToHtml from 'gtfs-to-html';
91
- import { readFile } from 'fs/promises';
92
- const config = JSON.parse(await readFile(new URL('./config.json', import.meta.url)));
93
-
94
- gtfsToHtml(config)
95
- .then(() => {
96
- console.log('HTML Generation Successful');
97
- process.exit();
98
- })
99
- .catch(err => {
100
- console.error(err);
101
- process.exit(1);
102
- });
88
+ import gtfsToHtml from 'gtfs-to-html';
89
+ import { readFile } from 'fs/promises';
90
+ const config = JSON.parse(
91
+ await readFile(new URL('./config.json', import.meta.url))
92
+ );
93
+
94
+ gtfsToHtml(config)
95
+ .then(() => {
96
+ console.log('HTML Generation Successful');
97
+ process.exit();
98
+ })
99
+ .catch((err) => {
100
+ console.error(err);
101
+ process.exit(1);
102
+ });
103
103
  ```
104
104
 
105
105
  ### Example Application
106
+
106
107
  An example Express application that uses `gtfs-to-html` is included in the `app` folder. After an initial run of `gtfs-to-html`, the GTFS data will be downloaded and loaded into SQLite.
107
108
 
108
109
  You can view an individual route HTML on demand by running the included Express app:
@@ -115,17 +116,16 @@ By default, `gtfs-to-html` will look for a `config.json` file in the project roo
115
116
 
116
117
  Once running, you can view the HTML in your browser at [localhost:3000](http://localhost:3000)
117
118
 
118
-
119
119
  ## Usage as a hosted web app
120
120
 
121
121
  A [hosted version of GTFS-to-HTML as a service](https://run.gtfstohtml.com) allows you to use it entirely within your browser - no downloads or command line necessary.
122
122
 
123
123
  It provides:
124
124
 
125
- * a web-based interface for finding GTFS feeds or ability to enter your own URL
126
- * support for adding [custom configuration](/docs/configuration) as JSON
127
- * creation of HTML timetables as a downloadable .zip file
128
- * a preview of all timetables generated directly in your browser
125
+ - a web-based interface for finding GTFS feeds or ability to enter your own URL
126
+ - support for adding [custom configuration](/docs/configuration) as JSON
127
+ - creation of HTML timetables as a downloadable .zip file
128
+ - a preview of all timetables generated directly in your browser
129
129
 
130
130
  [run.gtfstohtml.com](https://run.gtfstohtml.com)
131
131
 
@@ -136,8 +136,8 @@ Currently, it is limited to relatively small GTFS files and doesn't offer suppor
136
136
  ### SQLite3 unable to be installed with `Failed to exec install script`
137
137
 
138
138
  For an error like:
139
- ```lifecycle sqlite3@5.0.0~install: Failed to exec install script```
139
+ `lifecycle sqlite3@5.0.0~install: Failed to exec install script`
140
140
 
141
141
  Try installing `gtfs-to-html` using the following flags:
142
142
 
143
- ```npm install --unsafe-perm --allow-root -g```
143
+ `npm install --unsafe-perm --allow-root -g`
package/www/package.json CHANGED
@@ -9,11 +9,11 @@
9
9
  "deploy": "docusaurus deploy"
10
10
  },
11
11
  "dependencies": {
12
- "@docusaurus/core": "^2.0.0-beta.21",
13
- "@docusaurus/preset-classic": "^2.0.0-beta.21",
14
- "clsx": "^1.1.1",
15
- "react": "^18.1.0",
16
- "react-dom": "^18.1.0"
12
+ "@docusaurus/core": "^2.0.0-beta.22",
13
+ "@docusaurus/preset-classic": "^2.0.0-beta.22",
14
+ "clsx": "^1.2.1",
15
+ "react": "^18.2.0",
16
+ "react-dom": "^18.2.0"
17
17
  },
18
18
  "browserslist": {
19
19
  "production": [
@@ -7,7 +7,6 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
7
7
  import CodeBlock from '@theme/CodeBlock';
8
8
  import useBaseUrl from '@docusaurus/useBaseUrl';
9
9
  import styles from './styles.module.css';
10
- import { hsl } from 'chalk';
11
10
 
12
11
  const features = [
13
12
  {
@@ -15,28 +14,32 @@ const features = [
15
14
  imageUrl: 'img/undraw_proud_coder.svg',
16
15
  description: (
17
16
  <>
18
- Most transit agencies have schedule data in GTFS format but need to show each route's schedule to users on a website.
17
+ Most transit agencies have schedule data in GTFS format but need to show
18
+ each route's schedule to users on a website.
19
19
  </>
20
- )
20
+ ),
21
21
  },
22
22
  {
23
23
  title: <>What?</>,
24
24
  imageUrl: 'img/undraw_spreadsheets.svg',
25
25
  description: (
26
26
  <>
27
- This tool automates the process of creating nicely formatted HTML timetables for inclusion on a transit agency website.
27
+ This tool automates the process of creating nicely formatted HTML
28
+ timetables for inclusion on a transit agency website.
28
29
  </>
29
- )
30
+ ),
30
31
  },
31
32
  {
32
33
  title: <>Automate schedule changes</>,
33
34
  imageUrl: 'img/undraw_happy_music.svg',
34
35
  description: (
35
36
  <>
36
- Automating timetable creation means that timetables can be kept up to date and accurate when schedule changes happen and the likelihood of errors is reduced.
37
+ Automating timetable creation means that timetables can be kept up to
38
+ date and accurate when schedule changes happen and the likelihood of
39
+ errors is reduced.
37
40
  </>
38
- )
39
- }
41
+ ),
42
+ },
40
43
  ];
41
44
 
42
45
  function Feature({ imageUrl, title, description }) {
@@ -60,25 +63,35 @@ function Home() {
60
63
  return (
61
64
  <Layout
62
65
  title="GTFS-to-HTML"
63
- description="GTFS-to-HTML creates human-readable, user-friendly transit timetables in HTML format directly from GTFS transit data.">
66
+ description="GTFS-to-HTML creates human-readable, user-friendly transit timetables in HTML format directly from GTFS transit data."
67
+ >
64
68
  <header className={clsx('hero hero--dark', styles.heroBanner)}>
65
69
  <div className="container">
66
70
  <div className="row">
67
71
  <div className="col col--4">
68
- <img src="/img/gtfs-to-html-logo.svg" style={{ maxWidth: '150px' }} alt="" />
72
+ <img
73
+ src="/img/gtfs-to-html-logo.svg"
74
+ style={{ maxWidth: '150px' }}
75
+ alt=""
76
+ />
69
77
  </div>
70
78
 
71
79
  <div className="col col--8">
72
80
  <h1 className="hero__title">{siteConfig.title}</h1>
73
81
  <p className="hero__subtitle">{siteConfig.tagline}</p>
74
- <img alt="npm" src="https://img.shields.io/npm/v/gtfs-to-html?color=%2325c2a0&amp;label=stable&amp;style=for-the-badge" className="margin-bottom--sm" />
82
+ <img
83
+ alt="npm"
84
+ src="https://img.shields.io/npm/v/gtfs-to-html?color=%2325c2a0&amp;label=stable&amp;style=for-the-badge"
85
+ className="margin-bottom--sm"
86
+ />
75
87
  <div className={styles.buttons}>
76
88
  <Link
77
89
  className={clsx(
78
90
  'button button--outline button--secondary button--lg',
79
91
  styles.heroButton
80
92
  )}
81
- to={useBaseUrl('docs/')}>
93
+ to={useBaseUrl('docs/')}
94
+ >
82
95
  Get Started
83
96
  </Link>
84
97
  </div>
@@ -99,19 +112,44 @@ function Home() {
99
112
  </section>
100
113
  )}
101
114
 
102
- <section style={{backgroundColor: 'hsl(0, 0%, 85%)'}} className="padding--lg">
115
+ <section
116
+ style={{ backgroundColor: 'hsl(0, 0%, 85%)' }}
117
+ className="padding--lg"
118
+ >
103
119
  <div className="container">
104
120
  <div className="row">
105
121
  <div className="col"></div>
106
122
  <div className="col">
107
123
  <div className="avatar avatar--vertical margin-bottom--sm">
108
124
  <div className="avatar__photo avatar__photo--xl">
109
- <img src="https://avatars.githubusercontent.com/u/46612183?v=4" alt="Brody" width="200" height="200" style={{width: '100%', height: 'auto', maxWidth: '100%', marginBottom: '-4px'}} /></div>
110
- <div className="avatar__intro padding-top--sm"><div className="avatar__name">Brody</div>
111
- <small className="avatar__subtitle"><a href="https://github.com/transcollines">Transcollines</a></small>
125
+ <img
126
+ src="https://avatars.githubusercontent.com/u/46612183?v=4"
127
+ alt="Brody"
128
+ width="200"
129
+ height="200"
130
+ style={{
131
+ width: '100%',
132
+ height: 'auto',
133
+ maxWidth: '100%',
134
+ marginBottom: '-4px',
135
+ }}
136
+ />
137
+ </div>
138
+ <div className="avatar__intro padding-top--sm">
139
+ <div className="avatar__name">Brody</div>
140
+ <small className="avatar__subtitle">
141
+ <a href="https://github.com/transcollines">
142
+ Transcollines
143
+ </a>
144
+ </small>
112
145
  </div>
113
146
  </div>
114
- <p className="text--center text--italic padding-horiz--md">It's been a huge success. Not only do the timetables look fantastic, but I've had customer service agents tell me the interactive timetables are a total game changer and they make their jobs way easier.</p>
147
+ <p className="text--center text--italic padding-horiz--md">
148
+ It's been a huge success. Not only do the timetables look
149
+ fantastic, but I've had customer service agents tell me the
150
+ interactive timetables are a total game changer and they make
151
+ their jobs way easier.
152
+ </p>
115
153
  </div>
116
154
  <div className="col"></div>
117
155
  </div>