Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade deps #149

Merged
merged 16 commits into from
Dec 5, 2021
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
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
strategy:
matrix:
node:
- "12"
- "14"
- "16"
steps:
- uses: actions/checkout@v2
- uses: volta-cli/action@v1
with:
node-version: ${{ matrix.node }}

- run: npm install
- run: yarn install

- name: Test with ${{ matrix.node }}
run: node_modules/.bin/ember test
Expand Down Expand Up @@ -68,19 +68,19 @@ jobs:
matrix:
ember-try-scenario:
- ember-3.25
- ember-3.26
- ember-3.28
- ember-release
- ember-beta
# - ember-canary
- ember-canary
- embroider-safe
- embroider-optimized
steps:
- uses: actions/checkout@v2
- uses: volta-cli/action@v1
with:
node-version: 12.x
node-version: 14.x
- name: install dependencies
run: npm install
run: yarn install
- name: test
run: node_modules/.bin/ember try:one ${{ matrix.ember-try-scenario }} --skip-cleanup

Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
with:
persist-credentials: false
- uses: volta-cli/action@v1
- run: npm install
- run: yarn install

- name: Release
run: node_modules/.bin/semantic-release
Expand Down
29 changes: 26 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,37 @@ jobs:
- uses: actions/checkout@v2
- uses: volta-cli/action@v1

- run: npm install
- run: yarn install

- name: ESLint
run: npm run lint:js
run: yarn lint:js

- name: Templates
run: npm run lint:hbs
run: yarn lint:hbs

tooling:
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
name: Tooling
runs-on: ubuntu-latest
needs: [install_dependencies]

steps:
- uses: actions/checkout@v2
- uses: volta-cli/action@v1
with:
node-version: "14" # min-supported

- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Semantic Release
run: yarn semantic-release --dry-run
working-directory: ./ember-resources
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# docs:
# if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
- uses: actions/checkout@v2
- uses: volta-cli/action@v1

- run: npm install
- run: yarn install

- name: Type Checking
# run: yarn tsc --build
run: npm run prepack
run: yarn prepack
# run: npm run prepack
31 changes: 20 additions & 11 deletions addon/-private/proxy.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { assert } from '@ember/debug';
import { isDestroyed, isDestroying } from '@ember/destroyable';
import { get as consumeTag, notifyPropertyChange as dirtyKey } from '@ember/object';

import { tracked, TrackedWeakMap } from 'tracked-built-ins';
import { createStorage, getValue, setValue } from 'ember-tracked-storage-polyfill';

import type { TrackedStorage } from 'ember-tracked-storage-polyfill';
import type { EventObject, Interpreter, State } from 'xstate';

export const UPDATE_EVENT_NAME = 'ARGS_UPDATE';

const CACHE = new TrackedWeakMap<Interpreter<unknown>, Record<string, unknown>>();
const CACHE = new WeakMap<Interpreter<unknown>, TrackedStorage<null>>();

export function reactiveInterpreter(interpreter: Interpreter<unknown>) {
CACHE.set(interpreter, tracked({}));
ensureStorage(interpreter);

interpreter.onTransition(async (_state: State<unknown>, event: EventObject) => {
// init always runs, we don't need to dirty
Expand Down Expand Up @@ -39,22 +39,31 @@ export function reactiveInterpreter(interpreter: Interpreter<unknown>) {
return new Proxy(interpreter, {
get(target, key, receiver) {
if (key === '_state') {
let tracking = CACHE.get(target);
let storage = ensureStorage(target);

assert(`Tracking context lost!`, tracking);

consumeTag(tracking, key);
getValue(storage);
}

return Reflect.get(target, key, receiver);
},
});
}

function ensureStorage(interpreter: Interpreter<unknown>) {
let storage = CACHE.get(interpreter);

if (!storage) {
storage = createStorage(null, () => false);
CACHE.set(interpreter, storage);
}

return storage;
}

function dirtyState(interpreter: Interpreter<unknown>) {
let tracking = CACHE.get(interpreter);
let storage = CACHE.get(interpreter);

assert(`Tracking context lost!`, tracking);
assert(`Tracking context lost!`, storage);

dirtyKey(tracking, '_state');
setValue(storage, null);
}
14 changes: 7 additions & 7 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
'use strict';

module.exports = {
extends: ['@commitlint/config-conventional'],
extends: ['@commitlint/config-conventional'],
// https://commitlint.js.org/#/reference-rules
// Level [0..2]: 0 disables the rule. For 1 it will be considered a warning for 2 an error.
// Applicable always|never: never inverts the rule.
// Value: value to use for this rule.
rules: {
// 72, the default, is a little short
"header-max-length": [1, "always", 100],
'header-max-length': [1, 'always', 100],
// Let people use caps
"header-case": [0],
'header-case': [0],
// Let people write sentences
"header-full-stop": [0],
"subject-case": [0],
}
}
'header-full-stop': [0],
'subject-case': [0],
},
};
20 changes: 16 additions & 4 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ module.exports = async function () {
},
},
{
name: 'ember-3.26',
name: 'ember-3.28',
npm: {
devDependencies: {
'ember-source': '~3.26.0',
'ember-source': '~3.28.0',
},
},
},
Expand Down Expand Up @@ -46,8 +46,20 @@ module.exports = async function () {
},
},
},
embroiderSafe(),
embroiderOptimized(),
embroiderSafe({
npm: {
devDependencies: {
'@babel/plugin-proposal-private-methods': '^7.0.0',
},
},
}),
embroiderOptimized({
npm: {
devDependencies: {
'@babel/plugin-proposal-private-methods': '^7.0.0',
},
},
}),
],
};
};
11 changes: 10 additions & 1 deletion ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function (defaults) {
let app = new EmberAddon(defaults, {
// Add options here
// 'ember-cli-babel': {
// compileModules: false,
// },
babel: {
loose: true,
plugins: [
// ['@babel/plugin-proposal-private-property-in-object', { loose: true }],
['@babel/plugin-proposal-private-methods', { loose: true }],
],
},
});

/*
Expand Down
Loading