Skip to content

Commit 152f3c0

Browse files
authored
Merge pull request #15 from DouglasNeuroInformatics/dev
Dev
2 parents 32dfde1 + 37378e0 commit 152f3c0

36 files changed

+959
-681
lines changed

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/
2+
dist/

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default config(
99
es2021: true,
1010
node: true
1111
},
12+
exclude: ['build/**/*', 'dist/**/*'],
1213
typescript: {
1314
enabled: true,
1415
project: path.resolve(import.meta.dirname, 'tsconfig.json')

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
"@nestjs/passport": "^11.0.5",
7575
"@nestjs/swagger": "^11.0.6",
7676
"@nestjs/throttler": "^6.4.0",
77+
"@prisma/engines": "^6.5.0",
78+
"@prisma/get-platform": "^6.5.0",
7779
"@swc-node/register": "^1.10.10",
7880
"@swc/core": "^1.11.10",
7981
"@swc/helpers": "^0.5.15",

pnpm-lock.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/app.container.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class AppContainer {
7373
filterObject(
7474
{
7575
...process.env,
76-
// this is required so that NODE_ENV can be statically replaced in the bundle
76+
// this is required so that these can be statically replaced in the bundle
7777
NODE_ENV: process.env.NODE_ENV
7878
},
7979
(value) => value !== ''

src/cli/__tests__/libnest-build.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { describe, expect, it, vi } from 'vitest';
33

44
import { createExec, process } from '../../testing/helpers/cli.js';
55

6-
const { bundle } = vi.hoisted(() => ({
7-
bundle: vi.fn()
6+
const { buildProd } = vi.hoisted(() => ({
7+
buildProd: vi.fn()
88
}));
99

10-
vi.mock('../../utils/build.utils.js', () => ({
11-
bundle
10+
vi.mock('../../meta/build.js', () => ({
11+
buildProd
1212
}));
1313

1414
const exec = createExec({
@@ -47,9 +47,9 @@ describe('libnest-build', () => {
4747
const callback = action.mock.lastCall![0];
4848
vi.spyOn(process.env as any, 'LIBNEST_CONFIG_FILEPATH', 'get').mockReturnValueOnce('/path/to/config.js');
4949
const mapErr = vi.fn();
50-
bundle.mockReturnValueOnce({ mapErr });
50+
buildProd.mockReturnValueOnce({ mapErr });
5151
(callback as any)();
52-
expect(bundle).toHaveBeenCalledOnce();
52+
expect(buildProd).toHaveBeenCalledOnce();
5353
const programError = vi.spyOn(Command.prototype, 'error').mockImplementationOnce(() => null!);
5454
const errorHandler = mapErr.mock.lastCall![0];
5555
errorHandler(new Error('An error occurred'));

src/cli/__tests__/libnest-dev.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { runDev } = vi.hoisted(() => ({
77
runDev: vi.fn()
88
}));
99

10-
vi.mock('../../utils/meta.utils.js', () => ({
10+
vi.mock('../../meta/dev.js', () => ({
1111
runDev
1212
}));
1313

src/cli/__tests__/libnest.test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { describe, expect, it, vi } from 'vitest';
44

55
import { createExec, process } from '../../testing/helpers/cli.js';
66

7-
const { resolveAbsoluteImportPathFromCwd } = vi.hoisted(() => ({
8-
resolveAbsoluteImportPathFromCwd: vi.fn()
7+
const { resolveAbsoluteImportPath } = vi.hoisted(() => ({
8+
resolveAbsoluteImportPath: vi.fn()
99
}));
1010

11-
vi.mock('../../utils/meta.utils.js', () => ({
12-
resolveAbsoluteImportPathFromCwd
11+
vi.mock('../../meta/resolve.js', () => ({
12+
resolveAbsoluteImportPath
1313
}));
1414

1515
const exec = createExec({
@@ -28,16 +28,17 @@ describe('libnest', () => {
2828
);
2929
});
3030
it('should throw an InvalidArgumentError if the config path cannot be resolved', async () => {
31+
process.cwd.mockReturnValueOnce('/app');
3132
const parseAsync = vi.spyOn(Command.prototype, 'parseAsync');
32-
resolveAbsoluteImportPathFromCwd.mockReturnValueOnce(err('Failed'));
33+
resolveAbsoluteImportPath.mockReturnValueOnce(err('Failed'));
3334
const result = await exec(['-c', 'libnest.config.ts']);
3435
expect(parseAsync).toHaveBeenCalledExactlyOnceWith(['node', '../libnest.js', '-c', 'libnest.config.ts']);
35-
expect(resolveAbsoluteImportPathFromCwd).toHaveBeenLastCalledWith('libnest.config.ts');
36+
expect(resolveAbsoluteImportPath).toHaveBeenLastCalledWith('libnest.config.ts', '/app');
3637
expect(result).toMatchObject({ code: 'commander.invalidArgument', exitCode: 1 });
3738
});
3839
it('should pass the resolved config file to the subcommand', async () => {
3940
const hook = vi.spyOn(Command.prototype, 'hook');
40-
resolveAbsoluteImportPathFromCwd.mockReturnValueOnce(ok('/root/path/to/file.js'));
41+
resolveAbsoluteImportPath.mockReturnValueOnce(ok('/root/path/to/file.js'));
4142
await exec(['-c', 'libnest.config.ts']);
4243
expect(hook).toHaveBeenCalledExactlyOnceWith('preSubcommand', expect.any(Function));
4344
const callback = hook.mock.lastCall![1];

src/cli/bin/libnest-build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env node
1+
#!/usr/bin/env node --enable-source-maps
22

33
import { register } from 'node:module';
44

src/cli/bin/libnest-dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env node --watch
1+
#!/usr/bin/env node --enable-source-maps --watch
22

33
import { register } from 'node:module';
44

0 commit comments

Comments
 (0)