Skip to content

Commit

Permalink
Merge pull request #56 from K-FOSS/next
Browse files Browse the repository at this point in the history
Next
  • Loading branch information
EntraptaJ authored May 12, 2020
2 parents b3a2345 + b5ce103 commit 7bb945f
Show file tree
Hide file tree
Showing 27 changed files with 589 additions and 525 deletions.
5 changes: 4 additions & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
"SHELL": "/bin/sh"
},

"extensions": ["esbenp.prettier-vscode"],
"extensions": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"],

"remoteUser": "node",

"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",
"workspaceFolder": "/workspace",

"mounts": [
"source=ts-esnode-modules,target=/workspace/node_modules,type=volume"
],
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/Push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ jobs:
Test:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
node: ['13.9', '13.10', '13.11']
steps:
- uses: actions/checkout@v2
- uses: k-foss/npm-run-action@master
- uses: actions/[email protected]
with:
scriptName: 'test'
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Run Tests
run: npm run test
13 changes: 11 additions & 2 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@ on:
push:
branches:
- master
- next

jobs:
Test:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
node: ['13.9', '13.10', '13.11']
steps:
- uses: actions/checkout@v2
- uses: k-foss/npm-run-action@master
- uses: actions/[email protected]
with:
scriptName: 'test'
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Run Tests
run: npm run test

Publish:
name: NPM Publish
Expand Down
11 changes: 10 additions & 1 deletion .releaserc
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
Expand All @@ -20,5 +25,9 @@
}
],
"@semantic-release/github"
],
"branches": [
"master",
"next"
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
![Libraries.io dependency status for latest release, scoped npm package](https://img.shields.io/librariesio/release/npm/@k-foss/ts-esnode)

This is a Node.JS Loader hook for Node.JS 13.7 or newer that transpiles TypeScript files into JavaScript using the `getFormat`, `resolve`, and `transformSource` hooks.
This is a Node.JS Loader hook for Node.JS 13.9 or newer that transpiles TypeScript files into JavaScript using the `getFormat`, `resolve`, and `transformSource` hooks.

## Usage

Expand Down Expand Up @@ -41,7 +41,7 @@ When you open this folder in VSCode you should get a notication to reopen in con

### Testing

**MUST HAVE NODE.JS v13.7 or newer**
**MUST HAVE NODE.JS v13.9 or newer**

To try this out, clone repo

Expand Down
4 changes: 3 additions & 1 deletion Testing/Runner/Utils/runTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export interface Result {
}

export function runTest(test: Test): Promise<Result> {
const worker = spawnWorker(test.path, {});
const worker = spawnWorker(test.path, {
helloWorld: ['test', 'test2'],
});

return new Promise((resolve, reject) => {
worker.on('exit', (exitCode) => {
Expand Down
5 changes: 5 additions & 0 deletions Testing/Tests/DotImport/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Testing/Tests/DotImport/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "dotimport",
"version": "0.0.0",
"description": "",
"main": "src/index.ts",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
5 changes: 5 additions & 0 deletions Testing/Tests/DotImport/src/Hello/helloWorld.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// DotImport/src/Hello/helloWorld.ts
import { helloString } from '.';
import { deepEqual } from 'assert';

deepEqual(helloString, 'helloWorld', 'helloString does not equal helloWorld');
2 changes: 2 additions & 0 deletions Testing/Tests/DotImport/src/Hello/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// src/Hello/index.ts
export const helloString = 'helloWorld';
21 changes: 21 additions & 0 deletions Testing/Tests/DotImport/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Template/src/index.ts

export async function startApp(): Promise<void> {
console.log('Starting DotImport test');

console.log('Loading randomLoader');

const { loadRandom } = await import('./randomLoader');

console.log('Running loadRandom()');

const result = await loadRandom();

console.log('loadRandom() result: ', result);

console.debug('Done');
}

startApp();

export {};
10 changes: 10 additions & 0 deletions Testing/Tests/DotImport/src/randomLoader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// DotImport/src/randomLoader.ts
export async function loadRandom(): Promise<boolean> {
console.log('Importing Hello/helloWorld.ts');

await import('./Hello/helloWorld');

console.log('Imported Hello/helloWorld.ts');

return true;
}
8 changes: 8 additions & 0 deletions Testing/Tests/DotImport/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
}
}
1 change: 1 addition & 0 deletions Testing/Tests/SimilarFindFileFolder/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This tests if the findFiles folder detection takes into account non exact folder names when the expected file is part of the name of the folder.
5 changes: 5 additions & 0 deletions Testing/Tests/SimilarFindFileFolder/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Testing/Tests/SimilarFindFileFolder/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "test-similar-find-files-folder",
"version": "0.0.0",
"description": "",
"main": "src/index.ts",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
2 changes: 2 additions & 0 deletions Testing/Tests/SimilarFindFileFolder/src/Library/React.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// SimilarFindFileFolder/src/Library/React.ts
export const helloWorld = 'helloWorld';
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SimilarFindFileFolder/src/Library/ReactFlight/index.ts
export async function stuff(): Promise<'reactFlight'> {
console.log(`I'm react Flight`);

return 'reactFlight';
}
8 changes: 8 additions & 0 deletions Testing/Tests/SimilarFindFileFolder/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Template/src/index.ts
import assert from 'assert';
import * as React from './Library/React';
import { stuff } from './Library/ReactFlight';

assert.equal(React.helloWorld, 'helloWorld');

stuff().then((result) => assert.equal(result, 'reactFlight'));
8 changes: 8 additions & 0 deletions Testing/Tests/SimilarFindFileFolder/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
}
}
42 changes: 42 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
## [1.3.7](https://github.com/K-FOSS/TS-ESNode/compare/v1.3.6...v1.3.7) (2020-05-12)


### Bug Fixes

* **dot import:** Fix `import XYZ from '.'` ([#52](https://github.com/K-FOSS/TS-ESNode/issues/52)) ([19df585](https://github.com/K-FOSS/TS-ESNode/commit/19df585d6d683a499f9df47301abf3d23d267541)), closes [#34](https://github.com/K-FOSS/TS-ESNode/issues/34)

## [1.3.6](https://github.com/K-FOSS/TS-ESNode/compare/v1.3.5...v1.3.6) (2020-05-12)


### Bug Fixes

* **dynamicInstantiate:** works with pnpm ([#45](https://github.com/K-FOSS/TS-ESNode/issues/45)) ([5c0fadf](https://github.com/K-FOSS/TS-ESNode/commit/5c0fadf4d0508ee842578ab4a65899fad69d4b72))

## [1.3.5](https://github.com/K-FOSS/TS-ESNode/compare/v1.3.4...v1.3.5) (2020-04-05)


### Bug Fixes

* **resolve:** Don't run findFiles if we can already see an extension. ([b0e2b85](https://github.com/K-FOSS/TS-ESNode/commit/b0e2b850487d91b4ef8f101d64ef481689d5c875))

## [1.3.4](https://github.com/K-FOSS/TS-ESNode/compare/v1.3.3...v1.3.4) (2020-04-05)


### Bug Fixes

* **findFiles:** Fix the discovery of files when a directory of partial name match occurs ([2f108e2](https://github.com/K-FOSS/TS-ESNode/commit/2f108e26c4218af3079c265741f5dcca45e343ba))

## [1.3.3](https://github.com/K-FOSS/TS-ESNode/compare/v1.3.2...v1.3.3) (2020-03-30)


### Bug Fixes

* Readd JS_EXTS to findFIles to allow for post build JS support ([82b27c0](https://github.com/K-FOSS/TS-ESNode/commit/82b27c04432ccd2b3a5e065927bfcf9f5ebcb24a))

## [1.3.2](https://github.com/K-FOSS/TS-ESNode/compare/v1.3.1...v1.3.2) (2020-03-30)


### Bug Fixes

* **Resovler:** Refactor resolver and module loader to prevent loading of URLs and already discovered javascript files ([#28](https://github.com/K-FOSS/TS-ESNode/issues/28)) ([4825f19](https://github.com/K-FOSS/TS-ESNode/commit/4825f19e305081d340fb68629a5e5ba813555f46))

## [1.3.1](https://github.com/K-FOSS/TS-ESNode/compare/v1.3.0...v1.3.1) (2020-03-28)


Expand Down
Loading

0 comments on commit 7bb945f

Please sign in to comment.