Skip to content

Commit

Permalink
Update Gathering to Ember 4.12 (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
backspace authored Dec 1, 2023
1 parent c4544e9 commit 28646f0
Show file tree
Hide file tree
Showing 72 changed files with 26,937 additions and 30,250 deletions.
8 changes: 7 additions & 1 deletion gathering/.ember-cli
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
"disableAnalytics": false,

/**
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
*/
"isTypeScriptProject": false
}
3 changes: 3 additions & 0 deletions gathering/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@
# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
38 changes: 11 additions & 27 deletions gathering/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

module.exports = {
root: true,
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 2018,
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
requireConfigFile: false,
babelOptions: {
plugins: [
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }],
],
},
},
plugins: ['ember'],
Expand All @@ -30,28 +33,15 @@ module.exports = {
},
},
],
'import/no-unresolved': [
2,
{
ignore: [
'^@ember',
'^adventure-gathering',
'^ember$',
'^ember-cli-page-object',
'^ember-feature-flags',
'^ember-local-storage',
'^ember-pouch',
'htmlbars-inline-precompile',
],
},
],
'import/no-unresolved': 'off',
},
overrides: [
// node files
{
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./.stylelintrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./testem.js',
Expand All @@ -67,16 +57,10 @@ module.exports = {
browser: false,
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
rules: {
// this can be removed once the following is fixed
// https://github.com/mysticatea/eslint-plugin-node/issues/77
'node/no-unpublished-require': 'off',
},
extends: ['plugin:n/recommended'],
},
{
// Test files:
// test files
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
},
Expand Down
47 changes: 47 additions & 0 deletions gathering/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
push:
branches:
- main
- master
pull_request: {}

concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
lint:
name: "Lint"
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 14.x
cache: npm
- name: Install Dependencies
run: npm ci
- name: Lint
run: npm run lint

test:
name: "Test"
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 14.x
cache: npm
- name: Install Dependencies
run: npm ci
- name: Run Tests
run: npm test
6 changes: 6 additions & 0 deletions gathering/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@
# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try

# broccoli-debug
/DEBUG/
4 changes: 4 additions & 0 deletions gathering/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
/coverage/
!.*
.eslintcache
.lint-todo/

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
1 change: 0 additions & 1 deletion gathering/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

module.exports = {
singleQuote: true,
plugins: ['prettier-plugin-ember-template-tag'],
overrides: [
{
Expand Down
8 changes: 8 additions & 0 deletions gathering/.stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# unconventional files
/blueprints/*/files/

# compiled output
/dist/

# addons
/.node_modules.ember-try/
5 changes: 5 additions & 0 deletions gathering/.stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
extends: ['stylelint-config-standard', 'stylelint-prettier/recommended'],
};
4 changes: 2 additions & 2 deletions gathering/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ You will need the following things properly installed on your computer.

- [Git](https://git-scm.com/)
- [Node.js](https://nodejs.org/) (with npm)
- [Ember CLI](https://ember-cli.com/)
- [Ember CLI](https://cli.emberjs.com/release/)
- [Google Chrome](https://google.com/chrome/)

## Installation
Expand Down Expand Up @@ -53,7 +53,7 @@ Specify what it takes to deploy your app.
## Further Reading / Useful Links

- [ember.js](https://emberjs.com/)
- [ember-cli](https://ember-cli.com/)
- [ember-cli](https://cli.emberjs.com/release/)
- Development Browser Extensions
- [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
- [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
10 changes: 3 additions & 7 deletions gathering/app/components/loading.gjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import Component from '@glimmer/component';

export default class LoadingComponent extends Component {
<template>
<div class='lds-ellipsis'><div></div><div></div><div></div><div></div></div>
</template>
}
<template>
<div class='lds-ellipsis'><div></div><div></div><div></div><div></div></div>
</template>
25 changes: 12 additions & 13 deletions gathering/app/components/mappable-region.gjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { on } from '@ember/modifier';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { htmlSafe } from '@ember/template';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { ref } from 'ember-ref-bucket';
import createRef from 'ember-ref-bucket/modifiers/create-ref';
import { on } from '@ember/modifier';
import { and } from 'ember-truth-helpers';

// FIXME not used but needed by Foundation??
Expand Down Expand Up @@ -49,10 +49,11 @@ export default class MappableRegionComponent extends Component {
const meetingAncestorRegionIds = highlightedTeam
.hasMany('meetings')
.value()
.rejectBy('isNew')
.filter((m) => !m.isNew)
.map((meeting) => meeting.belongsTo('destination').value())
.map((destination) => destination.belongsTo('region').value())
.mapBy('ancestor.id');
.map(
(destination) => destination.belongsTo('region').value().ancestor.id
);

const index = meetingAncestorRegionIds.indexOf(regionId);

Expand All @@ -78,11 +79,9 @@ export default class MappableRegionComponent extends Component {
const waypointMeetingAncestorRegionIds = highlightedTeam
.hasMany('meetings')
.value()
.rejectBy('isNew')
.filterBy('waypoint')
.filter((m) => !m.isNew && m.waypoint)
.map((meeting) => meeting.belongsTo('waypoint').value())
.map((waypoint) => waypoint.belongsTo('region').value())
.mapBy('ancestor.id');
.map((waypoint) => waypoint.belongsTo('region').value().ancestor.id);

const index = waypointMeetingAncestorRegionIds.indexOf(regionId);

Expand All @@ -102,7 +101,7 @@ export default class MappableRegionComponent extends Component {
return;
}

let { clientX, clientY, offsetX } = e;
let { clientX, clientY } = e;

this.unsavedX = undefined;
this.unsavedY = undefined;
Expand Down Expand Up @@ -156,12 +155,12 @@ export default class MappableRegionComponent extends Component {
{{! template-lint-disable no-invalid-interactive }}
<div
class='region
{{if @isHighlighted "highlighted"}}
{{if (and @survey @region.surveyIncomplete) "incomplete"}}
{{if this.moving "moving"}}'
{{if @isHighlighted 'highlighted'}}
{{if (and @survey @region.surveyIncomplete) 'incomplete'}}
{{if this.moving 'moving'}}'
style={{this.style}}
{{on 'click' this.click}}
{{! template-lint-disable no-down-event-binding }}
{{! template-lint-disable no-pointer-down-event-binding }}
{{on 'mousedown' this.dragStart}}
{{on 'mouseup' this.dragEnd}}
{{createRef 'Region'}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import Component from '@glimmer/component';
import { trackedFunction } from 'ember-resources/util/function';
import Loading from 'adventure-gathering/components/loading';

import config from 'adventure-gathering/config/environment';

import blobStream from 'blob-stream';
import { trackedFunction } from 'ember-resources/util/function';

import uniq from 'lodash.uniq';
import moment from 'moment';
import PDFDocument from 'pdfkit';

Expand All @@ -19,7 +20,7 @@ export default class ClandestineRendezvousAnswersComponent extends Component {
const stream = doc.pipe(blobStream());

const meetings = this.args.meetings;
const meetingIndices = meetings.mapBy('index').uniq().sort();
const meetingIndices = uniq(meetings.map((m) => m.index)).sort();

this.args.teams.forEach((team) => {
doc.text(
Expand All @@ -38,15 +39,15 @@ export default class ClandestineRendezvousAnswersComponent extends Component {

doc.moveDown();

const meetingsWithIndex = meetings.filterBy('index', index);
const meetingsWithIndex = meetings.filter((m) => m.index === index);

doc.text(
meetingsWithIndex
.map((meeting) => {
const teamNames = meeting
.hasMany('teams')
.value()
.mapBy('name')
.map((t) => t.name)
.sort()
.join(', ');

Expand Down
14 changes: 7 additions & 7 deletions gathering/app/components/output/clandestine-rendezvous/cards.gjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { alias } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import Component from '@glimmer/component';
import Loading from 'adventure-gathering/components/loading';
import { get } from '@ember/object';

import config from 'adventure-gathering/config/environment';

import blobStream from 'blob-stream';
import { trackedFunction } from 'ember-resources/util/function';

import sortBy from 'lodash.sortby';
import moment from 'moment';
import PDFDocument from 'pdfkit';

Expand Down Expand Up @@ -167,7 +166,7 @@ export default class ClandestineRendezvousCardsComponent extends Component {
label: `from ${cardData.otherTeamName}`,
};

const sortedTeams = [cardData.team, otherTeam].sortBy('name');
const sortedTeams = sortBy([cardData.team, otherTeam], ['name']);

if (sortedTeams[0] === cardData.team) {
rows.push(myRow);
Expand Down Expand Up @@ -274,7 +273,8 @@ export default class ClandestineRendezvousCardsComponent extends Component {
team
.hasMany('meetings')
.value()
.sortBy('index')
.slice()
.sort((a, b) => a.index - b.index)
.map((meeting, index) => {
return this._rendezvousCardDataForTeamMeeting(team, meeting, index);
})
Expand All @@ -294,13 +294,13 @@ export default class ClandestineRendezvousCardsComponent extends Component {
const rendezvousLetter = String.fromCharCode(65 + index);
const rendezvousTime = this._getRendezvousTimeForIndex(index);

const otherTeams = teams.rejectBy('id', team.id);
const otherTeamName = otherTeams.mapBy('name');
const otherTeams = teams.filter((t) => t.id !== team.id);
const otherTeamName = otherTeams.map((t) => t.name);

const answer = destination.get('answer');
const mask = destination.get('mask');

const goalLetter = get(this.args.settings, 'goal')[index];
const goalLetter = this.args.settings.goal[index];
const goalDigit = parseInt(goalLetter);

const chosenBlankIndex = this.puzzles.implementation.chooseBlankIndex({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import Component from '@glimmer/component';
import Loading from 'adventure-gathering/components/loading';
import blobStream from 'blob-stream';
import classic from 'ember-classic-decorator';
import { trackedFunction } from 'ember-resources/util/function';
import Loading from 'adventure-gathering/components/loading';

import PDFDocument from 'pdfkit';

Expand Down Expand Up @@ -73,7 +72,8 @@ export default class ClandestineRendezvousMapsComponent extends Component {
team
.hasMany('meetings')
.value()
.sortBy('index')
.slice()
.sort((a, b) => a.index - b.index)
.forEach((meeting, index) => {
const destination = meeting.belongsTo('destination').value();
const region = destination.belongsTo('region').value();
Expand Down
Loading

0 comments on commit 28646f0

Please sign in to comment.