@travetto/scaffold 7.0.10 → 7.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  // @ts-check
3
- import { delimiter } from 'node:path';
3
+ import { resolve } from 'node:path';
4
4
  import { writeFileSync, readFileSync } from 'node:fs';
5
+ import '@travetto/compiler/bin/hook.js';
5
6
 
6
- await import('@travetto/compiler/bin/hook.js');
7
-
8
- const { invoke } = await import('@travetto/compiler/support/invoke.ts');
7
+ const current = process.cwd();
9
8
 
10
9
  if (process.env.npm_lifecycle_script?.includes('trv-scaffold')) { // Is npx run
11
- writeFileSync('package.json', JSON.stringify({ ...JSON.parse(readFileSync('./package.json', 'utf-8')), type: 'module' }));
12
- const parts = process.env.PATH?.split(delimiter) ?? [];
13
- const item = parts.find(part => part.includes('npx') && part.includes('.bin'));
14
- if (item) {
15
- process.chdir(item.split('/node_modules')[0]);
16
- }
10
+ const folder = import.meta.dirname.split('node_modules')[0];
11
+ const pkg = resolve(folder, 'package.json');
12
+ writeFileSync(pkg, JSON.stringify({ ...JSON.parse(readFileSync(pkg, 'utf-8')), type: 'module' }));
13
+ process.chdir(folder);
17
14
  }
18
15
 
19
- await invoke('exec', ['@travetto/cli/support/entry.trv.js', 'scaffold', '-c', process.cwd(), ...process.argv.slice(2)]);
16
+ const { invoke } = await import('@travetto/compiler/support/invoke.ts');
17
+ await invoke('exec', ['@travetto/cli/support/entry.trv.js', 'scaffold', '-c', current, ...process.argv.slice(2)]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/scaffold",
3
- "version": "7.0.10",
3
+ "version": "7.0.11",
4
4
  "type": "module",
5
5
  "description": "App Scaffold for the Travetto framework",
6
6
  "keywords": [
@@ -28,8 +28,8 @@
28
28
  "trv-scaffold": "bin/trv-scaffold.js"
29
29
  },
30
30
  "dependencies": {
31
- "@travetto/cli": "^7.0.7",
32
- "@travetto/compiler": "^7.0.5",
31
+ "@travetto/cli": "^7.0.8",
32
+ "@travetto/compiler": "^7.0.6",
33
33
  "@travetto/runtime": "^7.0.5",
34
34
  "enquirer": "^2.4.1",
35
35
  "mustache": "^4.2.0"
@@ -1,4 +1,4 @@
1
- import { Model, ModelType } from '@travetto/model';
1
+ import { Model, type ModelType } from '@travetto/model';
2
2
 
3
3
  @Model()
4
4
  export class Todo implements ModelType {
@@ -1,8 +1,8 @@
1
- import { Authorizer, Authenticator, AuthenticationError } from '@travetto/auth';
1
+ import { type Authorizer, type Authenticator, AuthenticationError } from '@travetto/auth';
2
2
  import { SessionModelSymbol } from '@travetto/auth-session';
3
3
  import { InjectableFactory } from '@travetto/di';
4
- import { ModelExpirySupport } from '@travetto/model';
5
- import { MemoryModelService } from '@travetto/model-memory';
4
+ import type { ModelExpirySupport } from '@travetto/model';
5
+ import type { MemoryModelService } from '@travetto/model-memory';
6
6
 
7
7
  export const BasicAuthSymbol = Symbol.for('AUTH_BASIC');
8
8
 
@@ -1,8 +1,8 @@
1
1
  import { Controller, Get, Post, WebResponse, ContextParam } from '@travetto/web';
2
2
  import { Login, Authenticated, Logout } from '@travetto/auth-web';
3
- import { Principal } from '@travetto/auth';
3
+ import type { Principal } from '@travetto/auth';
4
4
 
5
- import { BasicAuthSymbol } from './auth.config';
5
+ import { BasicAuthSymbol } from './auth.config.ts';
6
6
 
7
7
  /**
8
8
  * Auth API
@@ -1,16 +1,16 @@
1
1
  import { Controller, Get, Put, Post, Delete } from '@travetto/web';
2
2
  import { NotFoundError } from '@travetto/model';
3
3
  import { Inject } from '@travetto/di';
4
- import { ModelQuery } from '@travetto/model-query';
4
+ import type { ModelQuery } from '@travetto/model-query';
5
5
  import { Schema } from '@travetto/schema';
6
6
  // {{#modules.auth}}
7
- import { AuthContext } from '@travetto/auth';
7
+ import type { AuthContext } from '@travetto/auth';
8
8
  // {{/modules.auth}}
9
9
  // {{#modules.auth_web}}
10
10
  import { Authenticated } from '@travetto/auth-web';
11
11
  // {{/modules.auth_web}}
12
12
  // @ts-expect-error
13
- import { $_modelService_$ } from '$_modelImport_$';
13
+ import type { $_modelService_$ } from '$_modelImport_$';
14
14
 
15
15
  import { Todo } from '../model/todo.ts';
16
16
 
@@ -1,8 +1,9 @@
1
1
  import assert from 'node:assert';
2
2
 
3
3
  import { Suite, Test } from '@travetto/test';
4
- import { ModelCrudSupport } from '@travetto/model';
4
+ import type { ModelCrudSupport } from '@travetto/model';
5
5
  import { BaseModelSuite } from '@travetto/model/support/test/base.ts';
6
+ // @ts-expect-error
6
7
  import { $_modelConfig_$, $_modelService_$ } from '$_modelImport_$';
7
8
 
8
9
  import { Todo } from '../../src/model/todo.ts';