diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-24 13:16:55 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-24 13:28:33 +0100 |
commit | b969539c838ae3012d7a7040c5e310bb9c834e95 (patch) | |
tree | 821495c8457b19f5595c73e5778e30f6bc6a6cc7 /types | |
parent | 499be42ca2e03d73fef2f9501d121d830137bd6b (diff) | |
download | PeerTube-b969539c838ae3012d7a7040c5e310bb9c834e95.tar.gz PeerTube-b969539c838ae3012d7a7040c5e310bb9c834e95.tar.zst PeerTube-b969539c838ae3012d7a7040c5e310bb9c834e95.zip |
Fix types dist paths
Diffstat (limited to 'types')
-rw-r--r-- | types/generate-package.ts | 5 | ||||
-rw-r--r-- | types/src/client/tsconfig.json | 3 | ||||
-rw-r--r-- | types/src/index.ts | 2 | ||||
-rw-r--r-- | types/tests/test.ts | 32 | ||||
-rw-r--r-- | types/tsconfig.dist.json | 2 | ||||
-rw-r--r-- | types/tsconfig.json | 6 |
6 files changed, 42 insertions, 8 deletions
diff --git a/types/generate-package.ts b/types/generate-package.ts index a4f049a31..ae061f9b0 100644 --- a/types/generate-package.ts +++ b/types/generate-package.ts | |||
@@ -23,6 +23,7 @@ async function run () { | |||
23 | 23 | ||
24 | await remove(typesDistPath) | 24 | await remove(typesDistPath) |
25 | execSync('npm run tsc -- -b --verbose types', { stdio: 'inherit' }) | 25 | execSync('npm run tsc -- -b --verbose types', { stdio: 'inherit' }) |
26 | execSync(`npm run resolve-tspaths -- --project ${distTsConfigPath} --src ${typesDistPath} --out ${typesDistPath}`, { stdio: 'inherit' }) | ||
26 | 27 | ||
27 | const allDependencies = Object.assign( | 28 | const allDependencies = Object.assign( |
28 | mainPackageJson.dependencies, | 29 | mainPackageJson.dependencies, |
@@ -69,9 +70,5 @@ async function run () { | |||
69 | console.log(`Writing git ignore to ${typesDistGitIgnorePath}`) | 70 | console.log(`Writing git ignore to ${typesDistGitIgnorePath}`) |
70 | await writeFile(typesDistGitIgnorePath, '*.tsbuildinfo') | 71 | await writeFile(typesDistGitIgnorePath, '*.tsbuildinfo') |
71 | 72 | ||
72 | console.log('Copying tsconfig files') | ||
73 | await copyFile(distTsConfigPath, resolve(typesDistPath, './tsconfig.json')) | ||
74 | await copyFile(resolve(cwd(), './tsconfig.base.json'), resolve(typesDistPath, './tsconfig.base.json')) | ||
75 | |||
76 | await copyFile(resolve(typesPath, './README.md'), resolve(typesDistPath, './README.md')) | 73 | await copyFile(resolve(typesPath, './README.md'), resolve(typesDistPath, './README.md')) |
77 | } | 74 | } |
diff --git a/types/src/client/tsconfig.json b/types/src/client/tsconfig.json index 199273538..dea4c131c 100644 --- a/types/src/client/tsconfig.json +++ b/types/src/client/tsconfig.json | |||
@@ -1,6 +1,9 @@ | |||
1 | { | 1 | { |
2 | "extends": "../../../tsconfig.base.json", | 2 | "extends": "../../../tsconfig.base.json", |
3 | "compilerOptions": { | 3 | "compilerOptions": { |
4 | "stripInternal": true, | ||
5 | "removeComments": false, | ||
6 | "emitDeclarationOnly": true, | ||
4 | "outDir": "../../dist/client/", | 7 | "outDir": "../../dist/client/", |
5 | "rootDir": "./", | 8 | "rootDir": "./", |
6 | "tsBuildInfoFile": "../../dist/tsconfig.client.types.tsbuildinfo" | 9 | "tsBuildInfoFile": "../../dist/tsconfig.client.types.tsbuildinfo" |
diff --git a/types/src/index.ts b/types/src/index.ts index f1325777f..a8adca287 100644 --- a/types/src/index.ts +++ b/types/src/index.ts | |||
@@ -1 +1,3 @@ | |||
1 | export * from '@server/types' | 1 | export * from '@server/types' |
2 | export * from '@server/types/models' | ||
3 | export * from '@shared/models' | ||
diff --git a/types/tests/test.ts b/types/tests/test.ts new file mode 100644 index 000000000..8c53320a1 --- /dev/null +++ b/types/tests/test.ts | |||
@@ -0,0 +1,32 @@ | |||
1 | import { RegisterServerOptions, Video } from '../dist' | ||
2 | import { RegisterClientOptions } from '../dist/client' | ||
3 | |||
4 | function register1 ({ registerHook }: RegisterServerOptions) { | ||
5 | registerHook({ | ||
6 | target: 'action:application.listening', | ||
7 | handler: () => console.log('hello') | ||
8 | }) | ||
9 | } | ||
10 | |||
11 | function register2 ({ registerHook, peertubeHelpers }: RegisterClientOptions) { | ||
12 | registerHook({ | ||
13 | target: 'action:admin-plugin-settings.init', | ||
14 | handler: ({ npmName }: { npmName: string }) => { | ||
15 | if ('peertube-plugin-transcription' !== npmName) { | ||
16 | return | ||
17 | } | ||
18 | }, | ||
19 | }) | ||
20 | |||
21 | registerHook({ | ||
22 | target: 'action:video-watch.video.loaded', | ||
23 | handler: ({ video }: { video: Video }) => { | ||
24 | fetch(`${peertubeHelpers.getBaseRouterRoute()}/videos/${video.uuid}/captions`, { | ||
25 | method: 'PUT', | ||
26 | headers: peertubeHelpers.getAuthHeader(), | ||
27 | }) | ||
28 | .then((res) => res.json()) | ||
29 | .then((data) => console.log('Hi %s.', data)) | ||
30 | }, | ||
31 | }) | ||
32 | } | ||
diff --git a/types/tsconfig.dist.json b/types/tsconfig.dist.json index fc2dbe45b..fbc92712b 100644 --- a/types/tsconfig.dist.json +++ b/types/tsconfig.dist.json | |||
@@ -5,7 +5,7 @@ | |||
5 | "node_modules/@types", | 5 | "node_modules/@types", |
6 | "client/node_modules/@types" | 6 | "client/node_modules/@types" |
7 | ], | 7 | ], |
8 | "baseUrl": "./", | 8 | "baseUrl": "./dist", |
9 | "paths": { | 9 | "paths": { |
10 | "@server/*": [ "server/*" ], | 10 | "@server/*": [ "server/*" ], |
11 | "@shared/*": [ "shared/*" ], | 11 | "@shared/*": [ "shared/*" ], |
diff --git a/types/tsconfig.json b/types/tsconfig.json index 8f09c4a83..514683886 100644 --- a/types/tsconfig.json +++ b/types/tsconfig.json | |||
@@ -7,10 +7,11 @@ | |||
7 | "outDir": "./dist/", | 7 | "outDir": "./dist/", |
8 | "baseUrl": "./src/", | 8 | "baseUrl": "./src/", |
9 | "rootDir": "./src/", | 9 | "rootDir": "./src/", |
10 | "tsBuildInfoFile": "./dist/tsconfig.server.types.tsbuildinfo", | ||
10 | "paths": { | 11 | "paths": { |
11 | "@server/*": [ "../../server/*" ], | 12 | "@server/*": [ "../../server/*" ], |
12 | "@shared/*": [ "../../shared/*" ], | 13 | "@shared/*": [ "../../shared/*" ], |
13 | "@client/*": [ "../../client/src/*" ], | 14 | "@client/*": [ "../../client/src/*" ] |
14 | } | 15 | } |
15 | }, | 16 | }, |
16 | "references": [ | 17 | "references": [ |
@@ -18,6 +19,5 @@ | |||
18 | { "path": "../server/tsconfig.types.json" }, | 19 | { "path": "../server/tsconfig.types.json" }, |
19 | { "path": "./src/client/tsconfig.json" } | 20 | { "path": "./src/client/tsconfig.json" } |
20 | ], | 21 | ], |
21 | "files": ["./src/index.ts"], | 22 | "files": ["./src/index.ts"] |
22 | } | 23 | } |
23 | |||