Better build/dev scripts
This commit is contained in:
parent
69f616ab3a
commit
66dd264f7b
15 changed files with 612 additions and 27 deletions
10
README.md
10
README.md
|
@ -183,9 +183,15 @@ The following commands will upgrade the source (according to your current branch
|
|||
|
||||
### Development
|
||||
|
||||
In this mode, the server will run requests between pods more quickly, the videos duration are limited to a few seconds and the client files are automatically compiled when we modify them:
|
||||
In this mode, the server will run requests between pods more quickly, the videos duration are limited to a few seconds.
|
||||
|
||||
$ npm run dev
|
||||
To develop on the server side (server files are automatically compiled when we modify them and the server restarts automatically too):
|
||||
|
||||
$ npm run dev:server
|
||||
|
||||
To develop on the client side (client files are automatically compiled when we modify them):
|
||||
|
||||
$ npm run dev:client
|
||||
|
||||
**Username**: *root* <br/>
|
||||
**Password**: *test*
|
||||
|
|
|
@ -5,6 +5,7 @@ export class AuthUser extends User {
|
|||
private static KEYS = {
|
||||
ID: 'id',
|
||||
ROLE: 'role',
|
||||
EMAIL: 'email',
|
||||
USERNAME: 'username',
|
||||
DISPLAY_NSFW: 'display_nsfw'
|
||||
};
|
||||
|
@ -18,6 +19,7 @@ export class AuthUser extends User {
|
|||
{
|
||||
id: parseInt(localStorage.getItem(this.KEYS.ID)),
|
||||
username: localStorage.getItem(this.KEYS.USERNAME),
|
||||
email: localStorage.getItem(this.KEYS.EMAIL),
|
||||
role: localStorage.getItem(this.KEYS.ROLE),
|
||||
displayNSFW: localStorage.getItem(this.KEYS.DISPLAY_NSFW) === 'true'
|
||||
},
|
||||
|
@ -40,6 +42,7 @@ export class AuthUser extends User {
|
|||
id: number,
|
||||
username: string,
|
||||
role: string,
|
||||
email: string,
|
||||
displayNSFW: boolean
|
||||
}, hashTokens: any) {
|
||||
super(userHash);
|
||||
|
|
|
@ -218,6 +218,7 @@ export class AuthService {
|
|||
const id = obj.id;
|
||||
const username = obj.username;
|
||||
const role = obj.role;
|
||||
const email = obj.email;
|
||||
const displayNSFW = obj.displayNSFW;
|
||||
const hashTokens = {
|
||||
access_token: obj.access_token,
|
||||
|
@ -225,7 +226,7 @@ export class AuthService {
|
|||
refresh_token: obj.refresh_token
|
||||
};
|
||||
|
||||
this.user = new AuthUser({ id, username, role, displayNSFW }, hashTokens);
|
||||
this.user = new AuthUser({ id, username, role, displayNSFW, email }, hashTokens);
|
||||
this.user.save();
|
||||
|
||||
this.setStatus(AuthStatus.LoggedIn);
|
||||
|
|
|
@ -313,7 +313,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
|||
|
||||
this.metaService.setTag('og:image', this.video.thumbnailPath);
|
||||
|
||||
this.metaService.setTag('og:duration', this.video.duration);
|
||||
this.metaService.setTag('og:duration', this.video.duration.toString());
|
||||
|
||||
this.metaService.setTag('og:site_name', 'PeerTube');
|
||||
|
||||
|
|
16
package.json
16
package.json
|
@ -17,27 +17,30 @@
|
|||
"url": "git://github.com/Chocobozzz/PeerTube.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "scripty",
|
||||
"build:server:prod": "scripty",
|
||||
"build:client:prod": "scripty",
|
||||
"build": "SCRIPTY_PARALLEL=true scripty",
|
||||
"build:server": "scripty",
|
||||
"build:client": "scripty",
|
||||
"clean": "npm run clean:client",
|
||||
"clean:client": "scripty",
|
||||
"clean:server:test": "scripty",
|
||||
"watch:client": "SCRIPTY_PARALLEL=true scripty",
|
||||
"watch:client": "scripty",
|
||||
"watch:server": "scripty",
|
||||
"danger:clean:dev": "scripty",
|
||||
"danger:clean:prod": "scripty",
|
||||
"danger:clean:modules": "scripty",
|
||||
"reset-password": "scripty",
|
||||
"play": "scripty",
|
||||
"dev": "scripty",
|
||||
"dev:server": "scripty",
|
||||
"dev:client": "scripty",
|
||||
"start": "node dist/server",
|
||||
"check": "scripty",
|
||||
"upgrade": "scripty",
|
||||
"update-host": "scripty",
|
||||
"test": "scripty",
|
||||
"help": "scripty",
|
||||
"postinstall": "cd client && yarn install",
|
||||
"tsc": "tsc",
|
||||
"postinstall": "cd client && yarn install"
|
||||
"nodemon": "nodemon"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": "^2.0.0",
|
||||
|
@ -96,6 +99,7 @@
|
|||
"chai": "^3.3.0",
|
||||
"commander": "^2.9.0",
|
||||
"mocha": "^3.0.1",
|
||||
"nodemon": "^1.11.0",
|
||||
"source-map-support": "^0.4.15",
|
||||
"standard": "^10.0.0",
|
||||
"supertest": "^3.0.0",
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
NODE_ENV=test concurrently \
|
||||
"npm run build:client:prod" \
|
||||
"npm run build:server:prod"
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
NODE_ENV=test concurrently -k \
|
||||
"npm run watch:client" \
|
||||
"tsc && npm start"
|
||||
"npm run build:server && NODE_ENV=test npm start"
|
8
scripts/dev/server.sh
Executable file
8
scripts/dev/server.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
if [ ! -d "./client/dist" ]; then
|
||||
echo "client/dist does not exist, compile client files..."
|
||||
npm run build:client
|
||||
fi
|
||||
|
||||
npm run watch:server
|
5
scripts/watch/server.sh
Executable file
5
scripts/watch/server.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
NODE_ENV=test concurrently \
|
||||
"npm run tsc -- --sourceMap && npm run nodemon -- --delay 2 --watch ./dist dist/server" \
|
||||
"npm run tsc -- --sourceMap -w"
|
|
@ -55,7 +55,7 @@ Uses [TSLint](https://palantir.github.io/tslint/) for TypeScript linting and [An
|
|||
* Install [the dependencies](https://github.com/Chocobozzz/PeerTube#dependencies)
|
||||
* Run `npm install` at the root directory to install all the dependencies
|
||||
* Run PostgreSQL and create the database `peertube_dev`.
|
||||
* Run `npm run dev` to compile the client and automatically run the server. Then the server will watch and compile the client files automatically. You just need to refresh the browser to see your modifications.
|
||||
* Run `npm run dev:client` to compile the client, run the server and watch client files modifications.
|
||||
|
||||
In a Angular application, we create components that we put together. Each component is defined by an HTML structure, a TypeScript file and optionnaly a SASS file.
|
||||
If you are not familiar with Angular I recommend you to read the [quickstart guide](https://angular.io/docs/ts/latest/quickstart.html).
|
||||
|
|
|
@ -42,7 +42,7 @@ Uses [JavaScript Standard Style](http://standardjs.com/).
|
|||
* Install [the dependencies](https://github.com/Chocobozzz/PeerTube#dependencies)
|
||||
* Run `npm install` at the root directory to install all the dependencies
|
||||
* Run PostgreSQL and create the database `peertube_dev`.
|
||||
* Run `npm run dev` to compile the client and automatically run the server. If the client files are already compiled you can simply run `NODE_ENV=test node dist/server`
|
||||
* Run `npm run dev:server` to compile the client, run the server and watch server files modifications.
|
||||
|
||||
The `NODE_ENV=test` is set to speed up communications between pods (see [constants.ts](https://github.com/Chocobozzz/PeerTube/blob/master/server/initializers/constants.ts)).
|
||||
|
||||
|
|
Loading…
Reference in a new issue