Skip to content

Commit

Permalink
Fix workflow to re-enable CI
Browse files Browse the repository at this point in the history
  • Loading branch information
cocopon committed May 10, 2021
1 parent 6e05ccf commit 79c3afe
Show file tree
Hide file tree
Showing 32 changed files with 328 additions and 302 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Expand Up @@ -6,7 +6,7 @@ module.exports = {
'plugin:prettier/recommended',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'simple-import-sort'],
plugins: ['@typescript-eslint', 'prettier', 'simple-import-sort'],
root: true,
rules: {
camelcase: 'off',
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/ci.yml
Expand Up @@ -9,21 +9,21 @@ on:
release:
types: [released]
jobs:
# TODO: Re-enable after releasing core
# test:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# with:
# node-version: '16'
# - run: npm install
# - run: npm run test --workspaces
# - run: npm run coverage
# - uses: coverallsapp/github-action@master
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# path-to-lcov: ./coverage/lcov.info
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '16'
# TODO: Find better way to set up packages
- run: npm run setup
- run: npm run test --workspaces
- run: npm run coverage
- uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/lcov.info
deploy:
needs: test
if: startsWith(github.ref, 'refs/tags/')
Expand Down
12 changes: 10 additions & 2 deletions package.json
Expand Up @@ -10,14 +10,22 @@
],
"scripts": {
"clean": "rimraf .nyc_output test",
"coverage": "run-s coverage:prepare coverage:merge coverage:report",
"coverage": "run-s coverage:prepare coverage:package coverage:merge coverage:report",
"coverage:merge": "run-s coverage:merge:*",
"coverage:merge:core": "nyc merge packages/core/.nyc_output .nyc_output/core.json",
"coverage:merge:tweakpane": "nyc merge packages/tweakpane/.nyc_output .nyc_output/tweakpane.json",
"coverage:package": "run-s coverage:package:*",
"coverage:package:core": "(cd packages/core && npm install && npm run coverage)",
"coverage:package:tweakpane": "(cd packages/tweakpane && npm install && npm run coverage)",
"coverage:prepare": "mkdirp .nyc_output",
"coverage:report": "nyc report --reporter=lcov"
"coverage:report": "nyc report --reporter=lcov",
"setup": "(cd packages/core && npm install) && (cd packages/tweakpane && npm install) && npm install"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.23.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-simple-import-sort": "^7.0.0",
"mkdirp": "^1.0.4",
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
Expand Down
6 changes: 1 addition & 5 deletions packages/core/package.json
Expand Up @@ -32,14 +32,10 @@
"@types/jsdom": "^16.2.10",
"@types/mocha": "^8.2.1",
"@types/node": "^10.12.18",
"@typescript-eslint/eslint-plugin": "^4.16.1",
"@typescript-eslint/parser": "^4.16.1",
"assert": "^2.0.0",
"autoprefixer": "^9.1.5",
"eslint": "^7.21.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint": "^7.26.0",
"jsdom": "^16.5.3",
"mocha": "^8.3.0",
"npm-run-all": "^4.1.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/blade/button/api/button-test.ts
Expand Up @@ -86,7 +86,7 @@ describe(ButtonApi.name, () => {
const win = createTestWindow();
const doc = win.document;
const api = createApi(doc);
api.on('click', function(this: any) {
api.on('click', function (this: any) {
assert.strictEqual(this, api);
done();
});
Expand Down
7 changes: 4 additions & 3 deletions packages/core/src/blade/common/controller/value-blade.ts
Expand Up @@ -11,9 +11,10 @@ interface Config<T, V extends View> {
viewProps: ViewProps;
}

export class ValueBladeController<T, V extends View> extends BladeController<
V
> {
export class ValueBladeController<
T,
V extends View,
> extends BladeController<V> {
public readonly value: Value<T>;

constructor(config: Config<T, V>) {
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/blade/common/model/blade-rack.ts
Expand Up @@ -124,9 +124,8 @@ export class BladeRack {
this.onChildViewPropsChange_ = this.onChildViewPropsChange_.bind(this);
this.onDescendantLayout_ = this.onDescendantLayout_.bind(this);
this.onDescendantInputChange_ = this.onDescendantInputChange_.bind(this);
this.onDescendantMonitorUpdate_ = this.onDescendantMonitorUpdate_.bind(
this,
);
this.onDescendantMonitorUpdate_ =
this.onDescendantMonitorUpdate_.bind(this);

this.emitter = new Emitter();

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/blade/folder/api/folder-test.ts
Expand Up @@ -108,7 +108,7 @@ describe(FolderApi.name, () => {
it('should bind `this` within handler to pane', (done) => {
const PARAMS = {foo: 1};
const pane = createApi();
pane.on('change', function(this: any) {
pane.on('change', function (this: any) {
assert.strictEqual(this, pane);
done();
});
Expand Down Expand Up @@ -148,7 +148,7 @@ describe(FolderApi.name, () => {
it('should bind `this` within handler to folder', (done) => {
const PARAMS = {foo: 1};
const api = createApi();
api.on('change', function(this: any) {
api.on('change', function (this: any) {
assert.strictEqual(this, api);
done();
});
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/blade/folder/api/folder.ts
Expand Up @@ -40,8 +40,10 @@ export interface FolderApiEvents {
};
}

export class FolderApi extends RackLikeApi<FolderController>
implements BladeRackApi {
export class FolderApi
extends RackLikeApi<FolderController>
implements BladeRackApi
{
private readonly emitter_: Emitter<FolderApiEvents>;

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/blade/label/controller/label.ts
Expand Up @@ -11,7 +11,7 @@ interface Config<C extends Controller<View>> {
}

export class LabelController<
C extends Controller<View>
C extends Controller<View>,
> extends BladeController<LabelView> {
public readonly props: LabelProps;
public readonly valueController: C;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/blade/label/controller/value-label.ts
Expand Up @@ -12,7 +12,7 @@ interface Config<T, C extends ValueController<T, View>> {

export class LabeledValueController<
T,
C extends ValueController<T, View>
C extends ValueController<T, View>,
> extends ValueBladeController<T, LabelView> {
public readonly props: LabelProps;
public readonly valueController: C;
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/blade/plugin.ts
Expand Up @@ -50,8 +50,9 @@ export function createBladeController<P extends BaseBladeParams>(
return null;
}

const disabled = ParamsParsers.optional.boolean(args.params['disabled'])
.value;
const disabled = ParamsParsers.optional.boolean(
args.params['disabled'],
).value;
const hidden = ParamsParsers.optional.boolean(args.params['hidden']).value;
return plugin.controller({
blade: createBlade(),
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/common/model/reactive.ts
Expand Up @@ -19,7 +19,7 @@ export function bindValue<T>(value: Value<T>, applyValue: (value: T) => void) {

export function bindValueMap<
O extends Record<string, unknown>,
Key extends keyof O
Key extends keyof O,
>(valueMap: ValueMap<O>, key: Key, applyValue: (value: O[Key]) => void) {
bindValue(valueMap.value(key), applyValue);
}
114 changes: 60 additions & 54 deletions packages/core/src/common/number-util-test.ts
Expand Up @@ -27,24 +27,26 @@ interface LoopTestCase {
}

describe('NumberUtil', () => {
([
{
args: [100, 0, 200, 0, 1],
expected: 0.5,
},
{
args: [32, 0, 16, 0, 1],
expected: 2,
},
{
args: [0.5, 0, 1, 20, 40],
expected: 30,
},
{
args: [1.5, 0, 1, -30, 30],
expected: 60,
},
] as MapTestCase[]).forEach((testCase) => {
(
[
{
args: [100, 0, 200, 0, 1],
expected: 0.5,
},
{
args: [32, 0, 16, 0, 1],
expected: 2,
},
{
args: [0.5, 0, 1, 20, 40],
expected: 30,
},
{
args: [1.5, 0, 1, -30, 30],
expected: 60,
},
] as MapTestCase[]
).forEach((testCase) => {
context(`when ${JSON.stringify(testCase.args)}`, () => {
it(`should map to ${testCase.expected}`, () => {
assert.ok(
Expand Down Expand Up @@ -91,49 +93,53 @@ describe('NumberUtil', () => {
});
});

([
{
args: [0, 0, 0],
expected: 0,
},
{
args: [-123, 10, 100],
expected: 10,
},
{
args: [123, 10, 100],
expected: 100,
},
] as ConstrainTestCase[]).forEach((testCase) => {
(
[
{
args: [0, 0, 0],
expected: 0,
},
{
args: [-123, 10, 100],
expected: 10,
},
{
args: [123, 10, 100],
expected: 100,
},
] as ConstrainTestCase[]
).forEach((testCase) => {
context(`when ${JSON.stringify(testCase.args)}`, () => {
it(`should constrain ${testCase.expected}`, () => {
assert.strictEqual(constrainRange(...testCase.args), testCase.expected);
});
});
});

([
{
args: [260 - 360 * 3, 360],
expected: 260,
},
{
args: [0, 360],
expected: 0,
},
{
args: [360, 360],
expected: 0,
},
{
args: [360 + 40, 360],
expected: 40,
},
{
args: [360 * 2 + 123, 360],
expected: 123,
},
] as LoopTestCase[]).forEach((testCase) => {
(
[
{
args: [260 - 360 * 3, 360],
expected: 260,
},
{
args: [0, 360],
expected: 0,
},
{
args: [360, 360],
expected: 0,
},
{
args: [360 + 40, 360],
expected: 40,
},
{
args: [360 * 2 + 123, 360],
expected: 123,
},
] as LoopTestCase[]
).forEach((testCase) => {
context(`when ${JSON.stringify(testCase.args)}`, () => {
it(`should loop ${testCase.expected}`, () => {
assert.strictEqual(loopRange(...testCase.args), testCase.expected);
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/common/number/controller/slider-text.ts
Expand Up @@ -21,7 +21,8 @@ interface Config {
* @hidden
*/
export class SliderTextController
implements ValueController<number, SliderTextView> {
implements ValueController<number, SliderTextView>
{
public readonly value: Value<number>;
public readonly view: SliderTextView;
public readonly viewProps: ViewProps;
Expand Down
Expand Up @@ -16,7 +16,8 @@ interface Config {
* @hidden
*/
export class CheckboxController
implements ValueController<boolean, CheckboxView> {
implements ValueController<boolean, CheckboxView>
{
public readonly value: Value<boolean>;
public readonly view: CheckboxView;
public readonly viewProps: ViewProps;
Expand Down

0 comments on commit 79c3afe

Please sign in to comment.