Skip to content

Commit

Permalink
Add Typescript (#117)
Browse files Browse the repository at this point in the history
* WIP: Add Typescript

* Fix webpace resolve extensions

* Lexicographically sort type attributes

* Prettier: ignore dist/

* Fix .prettierignore community-data.ts

* Set ts-loader to traspileOnly to allow builds with TS errors

* Update readme with message about typescript

* Run fetchEvents
  • Loading branch information
adam1658 authored May 20, 2024
1 parent f4bb397 commit 90ac807
Show file tree
Hide file tree
Showing 19 changed files with 4,052 additions and 7,305 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
run: npm ci
- run: npm run fetchEvents
- run: npm run build
- name: Commit events-data.js
- name: Commit events-data.ts
run: |
git status
git config --global user.name 'Newwwie Bot'
git config --global user.email '[email protected]'
git add src/js/events/events-data.js
git add src/js/events/events-data.ts
git add dist
git commit -m "Get latest set of Meetup events"
git push
5 changes: 3 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
src/js/events/events-data.js
src/js/communities/communities-data.js
src/js/events/events-data.ts
src/js/communities/community-data.ts
dist/
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ https://newwwie.com/#community

If you would like to get added, the content is in:

[`src/js/communities/community-data.js`](src/js/communities/community-data.js)
[`src/js/communities/community-data.ts`](src/js/communities/community-data.ts)

You can [edit it directly on the Github Website](https://github.com/newwwie/newwwie.com/edit/main/src/js/communities/community-data.js)
You can [edit it directly on the Github Website](https://github.com/newwwie/newwwie.com/edit/main/src/js/communities/community-data.ts)

Here is an example of a high quality entry:

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ npm install
npm run dev
```

### Typescript

This repository uses typescript for source files. Currently some typescript errors remain, though at some point (after existing issues in [#119](https://github.com/newwwie/newwwie.com/issues/119) are resolved) webpack will be configured to not build in the presence of typescript errors.

```sh
npm run typecheck -- --watch
```

## Contributing

For more information please see our [Contributing Guide](CONTRIBUTING.md)

This includes adding meetup groups and community listings.
5 changes: 0 additions & 5 deletions babel.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion dist/js/main.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions fetch-events/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Promise.all(
).then((events) => {
const sortedEvents = _.sortBy(events.flat().filter(filterEventsNext90Days), (e) => e.event.dateTime);
fs.writeFileSync(
path.join(__dirname, "..", "src", "js", "events", "events-data.js"),
`// Auto Generated on ${new Date().toISOString()}\n module.exports = ${JSON.stringify(sortedEvents, null, 2)}`,
path.join(__dirname, "..", "src", "js", "events", "events-data.ts"),
`// Auto Generated on ${new Date().toISOString()}\nimport { type EventItem } from "./types";\n\nexport const events: readonly EventItem[] = ${JSON.stringify(sortedEvents, null, 2)}`,
);
});
Loading

0 comments on commit 90ac807

Please sign in to comment.