gulpfile.js: only use gulp and gulp-nodemon (instead of nodemon) for watching file changes

pull/1/head
leonnicolas 4 years ago
parent 8711aa3b38
commit 706f11ac41
No known key found for this signature in database
GPG Key ID: 088D0743E2B65C07

@ -8,7 +8,7 @@ docker build -t <image name> .
docker run --rm -p 4000:4000 <image name>
```
The Dockerfile is pretty stupid and could produce a smaller image, e.g. with multistage build.
### NPM and gulp
### Compile and run
Install gulp if not installed
```bash
npm -g gulp
@ -19,11 +19,13 @@ gulp
npm start
```
### For Development
Install node_modules and gulp
```bash
gulp watch
npm -g gulp
npm install
```
to compile in watch mode. And in another terminal run
And start gulp in watch mode
```bash
npm start
gulp watch
```
The later command uses nodemon. I am sure you can so this with gulp as well.
This will watch *.ts files in _./src_ and recompile to _./dist_ and finally restart the server.

@ -1,8 +1,8 @@
const {src, dest, watch, series, task} = require('gulp');
const ts = require('gulp-typescript');
const del = require('delete');
var tslint = require("gulp-tslint");
var tslint = require('gulp-tslint');
const nodemon = require('gulp-nodemon');
/**
* Clears the dist folder by deleting all files inside.
* @param cb
@ -39,6 +39,7 @@ function runTSlint(){
}))
.pipe(tslint.report())
}
task("tslint", () =>
src('src/**/*.ts')
.pipe(tslint({
@ -50,12 +51,17 @@ task("tslint", () =>
task('default', series(clearDist, compileTypescript, moveRemaining));
task('watch', () => {
watch('**/*.ts', runTSlint);
watch('**/*.ts', compileTypescript);
watch(['src/**/*', '!src/**/*.ts'], moveRemaining());
nodemon({
script: 'dist/index.js',
watch: ['dist/**/*.js'],
ext: 'js'
});
});
task('watchtslint', () => {
watch('**/*.ts', runTSlint);
task('watchnolint', () => {
watch('**/*.ts', compileTypescript);
watch(['src/**/*', '!src/**/*.ts'], moveRemaining());
});

17
package-lock.json generated

@ -1422,6 +1422,12 @@
"integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",
"dev": true
},
"colors": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
"dev": true
},
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@ -2576,6 +2582,17 @@
}
}
},
"gulp-nodemon": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/gulp-nodemon/-/gulp-nodemon-2.5.0.tgz",
"integrity": "sha512-vXfaP72xo2C6XOaXrNcLEM3QqDJ1x21S3x97U4YtzN2Rl2kH57++aFkAVxe6BafGRSTxs/xVfE/jNNlCv5Ym2Q==",
"dev": true,
"requires": {
"colors": "^1.2.1",
"gulp": "^4.0.0",
"nodemon": "^2.0.2"
}
},
"gulp-tslint": {
"version": "8.1.4",
"resolved": "https://registry.npmjs.org/gulp-tslint/-/gulp-tslint-8.1.4.tgz",

@ -5,7 +5,7 @@
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon dist/index.js",
"start": "node dist/index.js",
"start:ci": "node dist/index.js"
},
"keywords": [],
@ -14,9 +14,9 @@
"devDependencies": {
"delete": "^1.1.0",
"gulp": "^4.0.2",
"gulp-nodemon": "^2.5.0",
"gulp-tslint": "^8.1.4",
"gulp-typescript": "^6.0.0-alpha.1",
"nodemon": "^2.0.4",
"tslint": "^6.1.3",
"typescript": "^4.0.2"
},

@ -1,11 +1,14 @@
// tslint:disable: no-console
import { ApolloServer } from 'apollo-server';
import bikeresolver from './resolvers/cargobike';
// import resolvers from './resolvers';
import typeDefs from './schema/type-defs';
const server = new ApolloServer({ typeDefs });
const server = new ApolloServer({
resolvers:[bikeresolver],
typeDefs
});
server.listen()
.then(({ url }) => console.log(`Server ready at ${url}.. `));
.then(({ url }) => console.log(`Server ready at ${url} `));

@ -0,0 +1,10 @@
export default {
Query: {
cargobike: () => {
return {
id:1,
name: "hello!"
};
}
}
};

@ -1,10 +1,240 @@
import { gql } from 'apollo-server';
export default gql`
type Query {
scalar Date
"The CargoBike type is central to the graph. You could call it the root."
type CargoBike {
id: ID!
"see column A in info tabelle"
group: Group
name: String
modelName: String
numberOfWheels: Int
forCargo: Boolean
forChildren: Boolean
numberOfChildren: Int
serialno: String
"""
Safety is a custom type, that stores information about security features.
TODO: Should this be calles Security?
"""
security: Security
technicalEquipment: TechnicalEquipment
dimensionsAndLoad: DimensionsAndLoad
events: [BikeEvent]
equipment: [Equipment]
"Refers to equipment that is not unique. See kommentierte info tabelle -> Fragen -> Frage 2"
otherEquipment: [String]
chainSwaps: [ChainSwap]
"Sticker State"
stickerBikeNameState: StickerBikeNameState
note: String
provider: Provider
}
enum Group{
KL
LI
SP
FK
MH
SZ
TS
TK
}
"""
The BikeModel can be used for instantiate new bikes with a given model.
It should only be used to fill in default values.
Even bikes of the same model can have different properties.
"""
type BikeModel {
id: ID!
name: String
dimensionsAndLoad: DimensionsAndLoad!
}
type ActiveMentor {
id: ID!
start: Date!
end: Date!
mentor: ContactInformation!
}
type Taxes {
costCenter: String
organizationArea: OrganizationArea
}
enum OrganizationArea {
IB
ZB
}
type ChainSwap {
id: ID!
"""
Test Message.
TODO why is this a string"
"""
testMessage: String!
}
mechanic: String
timeOfSwap: Date
keyNumberOldAXAChain: String
}
"""
This type represents a piece of equipment that represents a real physical object.
The object must be unique. So it is possible to tell it apart from similar objects by a serial number.
"""
type Equipment {
id: ID!
serialNo: String!
"""
TODO unclear what this means
"""
investable: Boolean
name: String
}
"An Event is a point in time, when the state of the bike somehow changed."
type BikeEvent {
id: ID!
type: BikeEventType
"""
TODO: An Event should have a date field (Leon).
"""
note: String
"""
Path to documents
"""
documents: [String]
}
"TODO: Some eventTypes are missing (und auf deutsch)"
enum BikeEventType {
"""
The enum EventType can also be represented as an enum in postgresQL.
It is possible to add items to an enum in postgresQL without changing the source code.
However, it not possible to change the graphQL schema.
Concluding we should not use an enum here, if users want to add EventTypes to the enum.
"""
KAUF
INBETRIEBNAHME
AUSFALL
WARTUNG
}
"How are the dimensions and how much weight can handle a bike."
type DimensionsAndLoad {
id: ID!
hasCoverBox: Boolean
lockable: Boolean
boxLenght: Float
boxWidth: Float
boxHeight: Float
maxWeightBox: Float
maxWeightLuggageRack: Float
maxWeightTotal: Float
bikeLength: Float
bikeWidth: Float
bikeHeight: Float
bikeWeight: Float
}
"""
Some Technical Info about the bike.
This should be 1-1 Relation with the CargoBike.
So no id needed for mutation. One Mutation for the CargoBike will be enough.
"""
type TechnicalEquipment {
bicycleShift: String
isEBike: Boolean
hasLightingSystem: Boolean
specialFeatures: String
}
"""
The Security Info about the bike.
his should be 1-1 Relation with the CargoBike.
So no id needed for mutation. One Mutation for the CargoBike will be enough.
"""
type Security {
frameNumber: String
keyNumberFrameLock: String
keyNumberAXAChain: String
policeCoding: String
adfcCoding: String
}
enum StickerBikeNameState {
OK
IMPROVE
PRODUCED
NONEED
MISSING
UNKNOWN
}
type Provider {
id: ID!
name: String!
formularName: String
address: String
"If Club, at what court registered"
registeredAt: String
registerNumber: String
providerContactPerson: [ContactInformation]
email: String
phone: String
isPrivatePerson: Boolean!
organisations: Organisation
cargoBikes: [CargoBike]!
}
type ContactInformation {
id: ID!
name: String!
firstName: String!
retiredAt: Date
phoneExtern: String
phone2Extern: String
phoneIntern: String
phone2Intern: String
emailExtern: String
emailIntern: String
usernamefLotte: String
usernameSlack: String
memberADFC: Boolean!
locationZIPs: [String]
roleCoreTeam: Boolean!
roleCoordinator: Boolean!
roleEmployeADFC: Boolean!
"""
Wahr, wenn die Person Pate ist.
"""
roleMentor: Boolean!
roleAmbulanz: Boolean!
roleBringer: Boolean!
"Date of workshop to become Mentor dt. Pate"
workshopMentor: Date
"Date of last Erste Hilfe Kurs?"
workshopAmbulance: Date
note: String
"""
Note the kommentierte Infodaten Tabelle.
This value is calculated form other values.
It is true, if the person is not on the black list and not retired
and is either Mentor dt. Pate or Partner Mentor dt. Partnerpate for at least one bike.
"""
distributedActiveBikeParte: Boolean!
reserve: String
}
type Organisation{
id: ID!
vereinsregisternr: Int
}
type Query {
cargobike: CargoBike
}
`;

@ -11,7 +11,6 @@
"no-conditional-assignment": true,
"no-consecutive-blank-lines": false,
"cyclomatic-complexity": true,
"brace-style": "1tbs",
"semicolon": true,
"indent": [true, "spaces", 4],
"no-shadowed-variable": true,

Loading…
Cancel
Save