generated from naoyukik/docker-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ts
25 lines (21 loc) · 804 Bytes
/
build.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import Client, { connect } from '@dagger.io/dagger';
// initialize Dagger client
connect(async (client: Client) => {
// get Node image
// get Node version
// const node = client.container().from('bitnami/node:18').withExec(['node', '-v']);
const source = client.host().directory('.', { exclude: ['node_modules/'] });
const node = client.container().from('bitnami/node:18')
.withExec(['corepack', 'enable', 'pnpm'])
.withExec(['corepack', 'prepare', 'pnpm@latest', '--activate']);
// textlint
const runner = client
.container({ id: node })
.withMountedDirectory('/app', source)
.withExec(['pnpm', 'install'])
.withExec(['pnpm', 'run', 'textlint']);
// execute
const textlintResult = await runner.stdout();
// print output
console.log(textlintResult);
});