Remove extollo/cc dependency and make ts-node the default runner

master
Garrett Mills 2 years ago
parent e234bc0d24
commit 426d5659a6

7
ex

@ -1,4 +1,4 @@
#!/bin/bash -e #!/bin/bash
ENV_NODE="$(which node)" ENV_NODE="$(which node)"
ENV_PNPM="$(which pnpm)" ENV_PNPM="$(which pnpm)"
@ -133,8 +133,5 @@ if [ ! -d "./node_modules" ]; then
echo "" echo ""
printf "\033[32m✓\033[39m Looks like you're all set up! Run this command again to access the Extollo CLI.\n" printf "\033[32m✓\033[39m Looks like you're all set up! Run this command again to access the Extollo CLI.\n"
else else
start_spinner "Building your app..." "$ENV_PNPM" cli "$@"
"$ENV_PNPM" run build > /dev/null
stop_spinner 0
"$ENV_NODE" --experimental-repl-await ./lib/cli.js $@
fi fi

@ -8,10 +8,13 @@
"lib": "lib" "lib": "lib"
}, },
"dependencies": { "dependencies": {
"@extollo/lib": "^0.9.0", "@extollo/lib": "link:../lib",
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
"feed": "^4.2.2",
"gotify": "^1.1.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"ts-expose-internals": "^4.5.4", "ts-expose-internals": "^4.5.4",
"ts-node": "^10.9.0",
"ts-patch": "^2.0.1", "ts-patch": "^2.0.1",
"ts-to-zod": "^1.8.0", "ts-to-zod": "^1.8.0",
"typescript": "^4.3.2", "typescript": "^4.3.2",
@ -19,9 +22,9 @@
}, },
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "excc -c package.json -t tsconfig.json", "app": "ts-node src/index.ts",
"app": "pnpm run build && node lib/index.js", "cli": "ts-node src/cli.ts",
"cli": "pnpm run build && node lib/cli.js" "watch": "nodemon --ext js,pug,ts --watch src --exec 'ts-node src/index.ts'"
}, },
"files": [ "files": [
"lib/**/*" "lib/**/*"
@ -46,6 +49,6 @@
} }
}, },
"devDependencies": { "devDependencies": {
"@extollo/cc": "^0.6.0" "nodemon": "^2.0.19"
} }
} }

File diff suppressed because it is too large Load Diff

@ -1,4 +1,4 @@
import {OAuth2Client, OAuth2Scope, env, /*uuid4*/} from '@extollo/lib' import {OAuth2Client, OAuth2Scope, env, uuid4} from '@extollo/lib'
export default { export default {
secret: env('OAUTH2_SECRET'), secret: env('OAUTH2_SECRET'),
@ -10,15 +10,15 @@ export default {
}, },
} as {[key: string]: OAuth2Scope}, } as {[key: string]: OAuth2Scope},
clients: { clients: {
// 'test-1': { 'test-1': {
// id: 'test-1', id: 'test-1',
// display: 'Test 1', display: 'Test 1',
// secret: env('TEST_CLIENT_SECRET', uuid4()), secret: env('TEST_CLIENT_SECRET', uuid4()),
// allowedFlows: ['code'], allowedFlows: ['code'],
// allowedScopeIds: ['user-info'], allowedScopeIds: ['user-info'],
// allowedRedirectUris: [ allowedRedirectUris: [
// 'http://localhost:1234/callback', 'http://localhost:1234/callback',
// ], ],
// }, },
} as {[key: string]: OAuth2Client}, } as {[key: string]: OAuth2Client},
} }

@ -1,4 +1,11 @@
import {Route, SessionAuthMiddleware, AuthRequiredMiddleware} from '@extollo/lib' import {
Route,
SessionAuthMiddleware,
AuthRequiredMiddleware,
scope,
OAuth2Server,
TokenAuthMiddleware
} from '@extollo/lib'
import {Home} from '../controllers/main/Home.controller' import {Home} from '../controllers/main/Home.controller'
Route.group('/', () => { Route.group('/', () => {
@ -11,3 +18,11 @@ Route.group('', () => {
.pre(AuthRequiredMiddleware) .pre(AuthRequiredMiddleware)
.calls<Home>(Home, home => home.welcome) .calls<Home>(Home, home => home.welcome)
}).pre(SessionAuthMiddleware) }).pre(SessionAuthMiddleware)
OAuth2Server.routes()
Route.group('', () => {
Route.get('tok')
.pre(scope('tok'))
.handledBy(() => 'Token!')
}).pre(TokenAuthMiddleware)

@ -1,10 +1,7 @@
import {Inject, Injectable, Logging, BaseJob} from '@extollo/lib' import {Injectable, BaseJob} from '@extollo/lib'
@Injectable() @Injectable()
export default class LogMessage extends BaseJob { export default class LogMessage extends BaseJob {
@Inject()
protected readonly logging!: Logging
async execute(): Promise<void> { async execute(): Promise<void> {
this.logging.info('Executing LogMessage...') this.logging.info('Executing LogMessage...')
await new Promise<void>(res => { await new Promise<void>(res => {

@ -1,13 +1,14 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es6", "target": "esnext",
"module": "commonjs", "module": "commonjs",
"declaration": true, "declaration": true,
"outDir": "./lib", "outDir": "./lib",
"strict": true, "strict": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"emitDecoratorMetadata": true "emitDecoratorMetadata": true,
}, "lib": ["esnext", "dom", "dom.iterable"]
"include": ["src"], },
"exclude": ["node_modules"] "include": ["src"],
"exclude": ["node_modules", "src/app/resources", "../lib", "../lib/node_modules"]
} }

Loading…
Cancel
Save