From 9b3294a8496c89c7880054de1f1f09c9990f1b46 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 14 Dec 2021 13:48:13 +0100 Subject: [PATCH] Fix some build scripts and lint --- package.json | 1 - scripts/ci.sh | 2 ++ scripts/dev/server.sh | 4 ++-- support/doc/development/lib.md | 16 +++++++++------- types/generate-package.ts | 1 + types/tsconfig.dist.json | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 88d8329e6..c9717b5e9 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "build:embed": "bash ./scripts/build/embed.sh", "build:server": "bash ./scripts/build/server.sh", "build:client": "bash ./scripts/build/client.sh", - "build:types": "tsc -b --verbose types", "clean:client": "bash ./scripts/clean/client/index.sh", "clean:server:test": "bash ./scripts/clean/server/test.sh", "i18n:update": "bash ./scripts/i18n/update.sh", diff --git a/scripts/ci.sh b/scripts/ci.sh index a628cbced..7ad6f38e9 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -98,6 +98,8 @@ elif [ "$1" = "external-plugins" ]; then runTest "$1" 1 $externalPluginsFiles elif [ "$1" = "lint" ]; then + npm run build:server + npm run eslint -- --ext .ts "./server/**/*.ts" "shared/**/*.ts" "scripts/**/*.ts" npm run swagger-cli -- validate support/doc/api/openapi.yaml diff --git a/scripts/dev/server.sh b/scripts/dev/server.sh index 5aac470eb..07d88eb2f 100755 --- a/scripts/dev/server.sh +++ b/scripts/dev/server.sh @@ -19,10 +19,10 @@ rm -rf "./dist" mkdir "./dist" cp "./tsconfig.json" "./dist" -npm run tsc -- --incremental --sourceMap +npm run tsc -- -b -v --incremental cp -r ./server/static ./server/assets ./dist/server cp -r "./server/lib/emails" "./dist/server/lib" NODE_ENV=test node node_modules/.bin/concurrently -k \ "node_modules/.bin/nodemon --delay 1 --watch ./dist dist/server" \ - "node_modules/.bin/tsc --incremental --sourceMap --preserveWatchOutput -w" + "node_modules/.bin/tsc -b -w --preserveWatchOutput" diff --git a/support/doc/development/lib.md b/support/doc/development/lib.md index 9c67a39dd..097afa4fb 100644 --- a/support/doc/development/lib.md +++ b/support/doc/development/lib.md @@ -2,22 +2,24 @@ ## @peertube/embed-api -### Build +### Build & Publish ``` $ cd client/src/standalone/player/ $ npm run build +$ npm publish --access=public ``` ## @peertube/peertube-types -Typescript definition files generation is controlled by the various `tsconfig.types.json` files, see: +Typescript definition files generation is controlled by the various `tsconfig.types.json` files. + +The complete types package is generated via: + ``` -yarn tsc -b --verbose tsconfig.types.json +$ npm run generate-types-package +$ cd dist +$ npm publish --access=public ``` -But the complete types package is generated via: -``` -yarn generate-types-package -``` > See [scripts/generate-types-package.ts](scripts/generate-types-package.ts) for details. diff --git a/types/generate-package.ts b/types/generate-package.ts index e0bdd721a..ae7937430 100644 --- a/types/generate-package.ts +++ b/types/generate-package.ts @@ -13,6 +13,7 @@ run() async function run () { execSync('npm run build:types', { stdio: 'inherit' }) + const typesPath = resolve(cwd(), './types/') const typesDistPath = resolve(cwd(), typesPath, './dist/') const typesDistPackageJsonPath = resolve(typesDistPath, './package.json') diff --git a/types/tsconfig.dist.json b/types/tsconfig.dist.json index d9c3fdfc3..fc2dbe45b 100644 --- a/types/tsconfig.dist.json +++ b/types/tsconfig.dist.json @@ -1,5 +1,5 @@ { - "extends": "./tsconfig.base.json", + "extends": "./tsconfig.json", "compilerOptions": { "typeRoots": [ "node_modules/@types",