Skip to content

Commit

Permalink
feat(build): simplify compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Jul 24, 2023
1 parent bf4d8b0 commit dd71b76
Show file tree
Hide file tree
Showing 27 changed files with 876 additions and 769 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,20 @@ jobs:
run: npm install

- name: Compile code
run: sh scripts/build
run: npm run build

- name: Copy README to build
run: cp README.md build/README.md

- name: Copy LICENSE to build
run: cp LICENSE.md build/LICENSE.md

- name: Automatic GitHub Release
uses: justincy/[email protected]
id: release

- name: Publish to NPM Registry
run: npm publish --access public
run: cd build && npm publish --access public
if: steps.release.outputs.released == 'true'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: npm run test:coverage

- name: Test code compilation
run: sh scripts/build
run: npm run build

windows:
runs-on: windows-latest
Expand All @@ -66,4 +66,4 @@ jobs:
run: npm run test:coverage

- name: Test code compilation
run: sh scripts/build
run: npm run build
57 changes: 8 additions & 49 deletions bin/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,12 @@
* file that was distributed with this source code.
*/

import { assert } from '@japa/assert'
import { Importer } from '@athenna/test'
import { specReporter } from '@japa/spec-reporter'
import { configure, processCliArgs, run } from '@japa/runner'
import { Runner, assert, specReporter } from '@athenna/test'

/*
|--------------------------------------------------------------------------
| Set IS_TS env.
|--------------------------------------------------------------------------
|
| Set the IS_TS environement variable to true. Very useful when using the
| Path helper.
*/

process.env.IS_TS = 'true'

/*
|--------------------------------------------------------------------------
| Configure tests
|--------------------------------------------------------------------------
|
| The configure method accepts the configuration to configure the Japa
| tests runner.
|
| The first method call "processCliArgs" process the command line arguments
| and turns them into a config object. Using this method is not mandatory.
|
| Please consult japa.dev/runner-config for the config docs.
*/

configure({
...processCliArgs(process.argv.slice(2)),
...{
files: ['tests/**/*Test.ts'],
plugins: [assert()],
reporters: [specReporter()],
importer: Importer.import,
},
})

/*
|--------------------------------------------------------------------------
| Run tests
|--------------------------------------------------------------------------
|
| The following "run" method is required to execute all the tests.
|
*/

run()
await Runner.setTsEnv()
.addPlugin(assert())
.addReporter(specReporter())
.addPath('tests/unit/**/*.ts')
.setCliArgs(process.argv.slice(2))
.setGlobalTimeout(5000)
.run()
5 changes: 5 additions & 0 deletions bin/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.json",
"include": ["../src", "../templates", "../configurer", "../package.json"],
"exclude": ["../bin", "../build", "../tests", "../node_modules"]
}
4 changes: 2 additions & 2 deletions node
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
# sh node --inspect bin/test.ts

# Node.js executable with all arguments required to run the application.
node="node --loader ts-node/esm --experimental-import-meta-resolve --no-warnings"
node="node --loader=ts-node/esm --experimental-import-meta-resolve --no-warnings"

$node $@
$node "$@"
Loading

0 comments on commit dd71b76

Please sign in to comment.