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

fix: useTask's types not available in some consuming apps #409

Merged
merged 5 commits into from
Feb 24, 2022
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
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,23 @@ env:
CI: true

jobs:
build_test:
name: Build Tests
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: volta-cli/action@v1
- run: yarn install
- run: yarn test
working-directory: ./testing/build


tests:
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
name: Base Tests
timeout-minutes: 5
runs-on: ubuntu-latest
needs: build_test
strategy:
matrix:
node:
Expand Down Expand Up @@ -59,7 +71,6 @@ jobs:
# run: yarn ember test

try-scenarios:
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
name: "Compatibility"
timeout-minutes: 7
runs-on: ubuntu-latest
Expand Down
2 changes: 0 additions & 2 deletions ember-resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
"@babel/preset-typescript": "7.16.7",
"@embroider/addon-dev": "1.2.0",
"@nullvoxpopuli/eslint-configs": "^2.1.1",
"@rollup/plugin-babel": "5.3.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"@semantic-release/changelog": "^5.0.0",
"@semantic-release/git": "^9.0.0",
"@types/ember__destroyable": "^4.0.0",
Expand Down
5 changes: 3 additions & 2 deletions ember-resources/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export default defineConfig({
// These are the modules that should get reexported into the traditional
// "app" tree. Things in here should also be in publicEntrypoints above, but
// not everything in publicEntrypoints necessarily needs to go here.
addon.appReexports([]),
// addon.appReexports([]),

// This babel config should *not* apply presets or compile away ES modules.
// It exists only to provide development niceties for you, like automatic
// template colocation.
Expand All @@ -42,7 +43,7 @@ export default defineConfig({
addon.dependencies(),

// Ensure that standalone .hbs files are properly integrated as Javascript.
addon.hbs(),
// addon.hbs(),

// addons are allowed to contain imports of .css files, which we want rollup
// to leave alone and keep in the published output.
Expand Down
3 changes: 3 additions & 0 deletions ember-resources/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ export type { ArgsWrapper, Named, Positional } from './-private/types';

// Protected Type Utilities that need to be documented,
// but hopefully shouldn't be used in consuming apps.
// These types may *need* to be exported for folks relying on
// inference
export type { TaskInstance, TaskIsh } from './-private/resources/ember-concurrency-task';
export type { Thunk } from './-private/types';
3 changes: 3 additions & 0 deletions testing/build/expected-output-files.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
index.js
index.d.ts
index.js.map
16 changes: 16 additions & 0 deletions testing/build/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "ember-resources-build-test",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"test": "node ./test.js"
},
"devDependencies": {
"chai": "^4.3.6",
"execa": "^6.1.0"
},
"volta": {
"extends": "../../package.json"
}
}
43 changes: 43 additions & 0 deletions testing/build/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict';

import fs from 'fs/promises';
import path from 'path';
import { fileURLToPath } from 'url';
import { execa } from 'execa';
import { assert } from 'chai';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const addonPath = path.join(__dirname, '..', '..', 'ember-resources');

async function main() {
await build();

let expected = await getExpected();
let actual = await listFiles();

expected.sort();
actual.sort();

console.debug({ expected, actual });

assert.deepEqual(actual, expected);
}

async function build() {
await execa('yarn', ['build:js'], { cwd: addonPath, preferLocal: true });
}

async function getExpected() {
let expectedFile = await fs.readFile(path.join(__dirname, 'expected-output-files.txt'));
let expected = expectedFile.toString().split('\n');

return expected.filter(Boolean);
}

async function listFiles(ofDir = path.join(addonPath, 'dist')) {
let read = await fs.readdir(ofDir, { withFileTypes: true });

return read.filter(Boolean).map((item) => item.name);
}

main();
Loading