Skip to content

Commit

Permalink
feat: remove comments (resolves #1847) (#1848)
Browse files Browse the repository at this point in the history
* feat: remove comments (resolves #1847)

* fix: remove unneeded ID field
  • Loading branch information
greatislander authored Aug 2, 2024
1 parent 3d63f25 commit 5d6e283
Show file tree
Hide file tree
Showing 14 changed files with 5 additions and 695 deletions.
3 changes: 3 additions & 0 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"format_on_save": "off"
}
121 changes: 1 addition & 120 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ The website uses [Decap CMS](https://decapcms.org) to manage the following conte
- [news](src/collections/news)
- [initiatives](src/collections/initiatives)

The website also uses one backend API:

- [Airtable API](https://airtable.com/api) that serves user comments for events.
- The production table: WeCount
- The development table: WeCount_DEV

## Getting Started

To contribute, please be sure to review our development processes as documented in the
Expand Down Expand Up @@ -68,10 +62,6 @@ As an example, here is the configuration for the events collection, stored in [`
- label: Event Title
name: title
widget: string
- label: Event ID
name: id
widget: uuid
hint: The ID is used to associate comments with this event and cannot be edited.
- label: Permanent Link
name: permalink
widget: string
Expand Down Expand Up @@ -145,99 +135,14 @@ behaves as expected, but content should not be edited this way under normal circ
log in under their Netlify Identity accounts at <https://wecount.inclusivedesign.ca/admin/> and create content through the
CMS interface.

## How to Run

The website uses [Netlify Functions](https://functions.netlify.com/) to provide a server side endpoint that supports
the save of user comments for initiatives on the "Initiatives" page. To run the website in local development mode that
supports a live reload at file changes, there are two ways to test the website with and without Netlify Functions.
The latter is easier than the former:

### Test the website with Netlify Functions

1. Follow [Netlify instructions](https://docs.netlify.com/functions/build-with-javascript/#tools) to install tools for testing
and deploying Netlify functions locally;
2. Once the tool is set up, using Netlify Dev as an example, run following commands:

```bash
# Due to security concerns, these environment variables are only available to WeCount team members
export AIRTABLE_API_KEY=AIRTABLE_API_KEY_VALUE
export EMAIL_FROM=EMAIL_TO_VALUE
export EMAIL_FROM_PWD=EMAIL_FROM_PWD_VALUE
export EMAIL_TO_PRODUCTION=PRODUCTION_SITE_MODERATOR_EMAIL
export EMAIL_TO_DEV=DEV_SITE_MODERATOR_EMAIL
export AIRTABLE_BASE_PRODUCTION=AIRTABLE_BASE_VALUE_FOR_PRODUCTION
export AIRTABLE_BASE_DEV=AIRTABLE_BASE_VALUE_FOR_DEV

netlify dev
```

Look for this box in your console output:

```bash
┌──────────────────────────────────────────────────┐
│ │
* Server now ready on http://localhost:64939 │
│ │
└──────────────────────────────────────────────────┘
```

The website will be available at [http://localhost:64939](http://localhost:64939).

Alternatively, a `.env` file can be created within the local project directory and
environment variables can be added directly to it as follows:

```env
AIRTABLE_API_KEY=AIRTABLE_API_KEY_VALUE
EMAIL_FROM=EMAIL_TO_VALUE
EMAIL_FROM_PWD=EMAIL_FROM_PWD_VALUE
EMAIL_TO_PRODUCTION=PRODUCTION_SITE_MODERATOR_EMAIL
EMAIL_TO_DEV=DEV_SITE_MODERATOR_EMAIL
AIRTABLE_BASE_PRODUCTION=AIRTABLE_BASE_VALUE_FOR_PRODUCTION
AIRTABLE_BASE_DEV=AIRTABLE_BASE_VALUE_FOR_DEV
```

(Note: `.env` is in the project's `.gitignore` file to prevent sensitive information from being accidentally
committed to git.)

If a `.env` file is used, the local development server can be started with the following command:
### Test the website

```bash
netlify dev
```

### Test the website without Netlify Functions

Note that the website launched via this testing method cannot save user comments to Airtable due to the absence of the
server side save function.

```bash
# Due to security concerns, these environment variables are only available to WeCount team members
export AIRTABLE_API_KEY=WECOUNT_API_KEY
export AIRTABLE_BASE_PRODUCTION=AIRTABLE_BASE_VALUE_FOR_PRODUCTION
export AIRTABLE_BASE_DEV=AIRTABLE_BASE_VALUE_FOR_DEV
npm run start
```

The website will be available at [http://localhost:3000](http://localhost:3000).

Alternatively, a `.env` file can be created within the local project directory and
environment variables can be added directly to it as follows:

```env
AIRTABLE_API_KEY=AIRTABLE_API_KEY_VALUE
AIRTABLE_BASE_PRODUCTION=AIRTABLE_BASE_VALUE_FOR_PRODUCTION
AIRTABLE_BASE_DEV=AIRTABLE_BASE_VALUE_FOR_DEV
```

(Note: `.env` is in the project's `.gitignore` file to prevent sensitive information from being accidentally
committed to git.)

If a `.env` file is used, the local development server can be started with the following command:

```bash
npm run start
```

## How to Lint

To lint JavaScript, CSS and Markdown files in the project (including JavaScript and CSS in Vue components),
Expand All @@ -255,39 +160,15 @@ We use the following lint configurations:

## How to Build

Note that the website launched via this build method cannot save user comments to Airtable due to the absence of the
server side save function.

To build and serve a static version of the website, enter the following in your command line:

```bash
# Due to security concerns, these environment variables are only available to WeCount team members
export AIRTABLE_API_KEY=AIRTABLE_API_KEY_VALUE
export AIRTABLE_BASE_PRODUCTION=AIRTABLE_BASE_VALUE_FOR_PRODUCTION
npm run build
npm run serve
```

The website will be available at [http://localhost:5000](http://localhost:5000).

Alternatively, a `.env` file can be created within the local project directory and
environment variables can be added directly to it as follows:

```env
AIRTABLE_API_KEY=AIRTABLE_API_KEY_VALUE
AIRTABLE_BASE_PRODUCTION=AIRTABLE_BASE_VALUE_FOR_PRODUCTION
```

(Note: `.env` is in the project's `.gitignore` file to prevent sensitive information from being accidentally
committed to git.)

If a `.env` file is used, the site can be built and served with the following commands:

```bash
npm run build
npm run serve
```

## How to Deploy

This repository is connected to [Netlify](https://netlify.com), and commits will be automatically deployed as follows:
Expand Down
1 change: 0 additions & 1 deletion eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const eleventyNavigation = require("@11ty/eleventy-navigation");
const fluidPlugin = require("eleventy-plugin-fluid");
const fs = require("fs");

// const dataFetcherAirtable = require("./src/utils/data-fetcher-airtable.js");
const htmlMinifyTransform = require("./src/transforms/html-minify.js");
const parseTransform = require("./src/transforms/parse.js");
const categoryFromFocusFilter = require("./src/filters/categoryFromFocus.js");
Expand Down
121 changes: 0 additions & 121 deletions functions/comments.js

This file was deleted.

23 changes: 0 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
"lite-youtube-embed": "0.3.2",
"markdown-it": "14.1.0",
"modern-css-reset": "1.4.0",
"netlify-cms-widget-uuid-v4": "1.1.1",
"nodemailer": "6.9.14",
"nunjucks": "3.2.4",
"uuid": "10.0.0"
},
Expand Down
1 change: 0 additions & 1 deletion src/_data/env.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require("dotenv").config();

module.exports = {
airtableBase: process.env.CONTEXT === "production" ? process.env.AIRTABLE_BASE_PRODUCTION : process.env.AIRTABLE_BASE_DEV,
context: process.env.CONTEXT || "dev",
baseUrl: process.env.DEPLOY_PRIME_URL || false
};
Loading

0 comments on commit 5d6e283

Please sign in to comment.