Skip to content

Commit

Permalink
chore(build) share tsconfig, add 'clean' and npmignore
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Oct 6, 2018
1 parent 04fe22b commit 0e71949
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 165 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ lerna-debug.log
npm-debug.log
yarn-error.log
/**/npm-debug.log
/packages/**/.npmignore
/packages/**/LICENSE

# example
/quick-start
Expand Down
9 changes: 9 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# source
**/*.ts
*.ts

# configuration
package-lock.json
tslint.json
tsconfig.json
.prettierrc
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/bundle
packages/**/*.d.ts
packages/**/*.js
22 changes: 13 additions & 9 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const gulp = require('gulp');
const ts = require('gulp-typescript');
const sourcemaps = require('gulp-sourcemaps');
const clean = require('gulp-clean');
const deleteEmpty = require('delete-empty');

const packages = {
common: ts.createProject('packages/common/tsconfig.json'),
Expand All @@ -26,24 +27,31 @@ gulp.task('default', function() {
});
});

gulp.task('copy-docs', function() {
gulp.task('copy-misc', function() {
return gulp
.src('Readme.md')
.src(['Readme.md', 'LICENSE', '.npmignore'])
.pipe(gulp.dest('packages/common'))
.pipe(gulp.dest('packages/core'))
.pipe(gulp.dest('packages/microservices'))
.pipe(gulp.dest('packages/websockets'))
.pipe(gulp.dest('packages/testing'));
});

gulp.task('clean:bundle', function() {
gulp.task('clean:output', function() {
return gulp
.src(['packages/**/*.js.map'], {
.src(['packages/**/*.js', 'packages/**/*.d.ts'], {
read: false,
})
.pipe(clean());
});

gulp.task('clean:dirs', function(done) {
deleteEmpty.sync('packages/');
done();
});

gulp.task('clean:bundle', gulp.series('clean:output', 'clean:dirs'));

modules.forEach(module => {
gulp.task(module, () => {
return packages[module]
Expand All @@ -67,12 +75,8 @@ modules.forEach(module => {
});
});

gulp.task('common', gulp.series(modules));

gulp.task('common:dev', gulp.series(modules.map(module => module + ':dev')));

gulp.task('build', gulp.series('common'));

gulp.task('build', gulp.series(modules));

This comment has been minimized.

Copy link
@NareshBHT

NareshBHT May 27, 2020

gulp task process on the repository.

gulp.task('build:dev', gulp.series('common:dev'));

function getFolders(dir) {
Expand Down
4 changes: 1 addition & 3 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"lerna": "2.4.0",
"packages": [
"bundle/*"
],
"packages": ["packages/*"],
"version": "5.3.11"
}
62 changes: 62 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 31 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,21 @@
"scripts": {
"coverage": "nyc report --reporter=text-lcov | coveralls",
"precommit": "lint-staged",
"test":
"nyc --require ts-node/register mocha packages/**/*.spec.ts --reporter spec --require 'node_modules/reflect-metadata/Reflect.js'",
"integration-test":
"mocha integration/**/*.spec.ts --reporter spec --require ts-node/register --require 'node_modules/reflect-metadata/Reflect.js'",
"lint":
"tslint -p tsconfig.json -c tslint.json \"packages/**/*.ts\" -e \"*.spec.ts\"",
"format":
"prettier **/**/*.ts --ignore-path ./.prettierignore --write && git status",
"test": "nyc --require ts-node/register mocha packages/**/*.spec.ts --reporter spec --require 'node_modules/reflect-metadata/Reflect.js'",
"integration-test": "mocha integration/**/*.spec.ts --reporter spec --require ts-node/register --require 'node_modules/reflect-metadata/Reflect.js'",
"lint": "tslint -p tsconfig.json -c tslint.json \"packages/**/*.ts\" -e \"*.spec.ts\"",
"format": "prettier **/**/*.ts --ignore-path ./.prettierignore --write && git status",
"clean": "gulp clean:bundle",
"build": "gulp build && gulp move",
"build:lib": "gulp clean:bundle && gulp build --dist packages",
"build:lib": "npm run clean && gulp build --dist packages",
"postinstall": "opencollective",
"copy-docs": "gulp copy-docs",
"prepare:npm": "npm run build:lib && npm run copy-docs",
"publish":
"npm run prepare:npm && ./node_modules/.bin/lerna publish --exact -m \"chore(@nestjs) publish %s release\"",
"publish:rc":
"npm run prepare:npm && ./node_modules/.bin/lerna publish --npm-tag=rc -m \"chore(@nestjs) publish %s release\"",
"publish:next":
"npm run prepare:npm && ./node_modules/.bin/lerna publish --npm-tag=next --skip-git -m \"chore(@nestjs) publish %s release\"",
"publish:beta":
"npm run prepare:npm && ./node_modules/.bin/lerna publish --npm-tag=beta -m \"chore(@nestjs) publish %s release\"",
"publish:test":
"npm run prepare:npm && ./node_modules/.bin/lerna publish --npm-tag=test --skip-git -m \"chore(@nestjs) publish %s release\""

This comment has been minimized.

Copy link
@NareshBHT

NareshBHT May 27, 2020

//HTTP Server error //

Server not connecting to repository

"copy-misc": "gulp copy-misc",
"prepare:npm": "npm run build:lib && npm run copy-misc",
"publish": "npm run prepare:npm && ./node_modules/.bin/lerna publish --exact -m \"chore(@nestjs) publish %s release\"",
"publish:rc": "npm run prepare:npm && ./node_modules/.bin/lerna publish --npm-tag=rc -m \"chore(@nestjs) publish %s release\"",
"publish:next": "npm run prepare:npm && ./node_modules/.bin/lerna publish --npm-tag=next --skip-git -m \"chore(@nestjs) publish %s release\"",
"publish:beta": "npm run prepare:npm && ./node_modules/.bin/lerna publish --npm-tag=beta -m \"chore(@nestjs) publish %s release\"",
"publish:test": "npm run prepare:npm && ./node_modules/.bin/lerna publish --npm-tag=test --skip-git -m \"chore(@nestjs) publish %s release\""
},
"engines": {
"node": ">= 8.9.0"
Expand Down Expand Up @@ -103,6 +95,7 @@
"conventional-changelog": "^1.1.15",
"core-js": "^2.4.1",
"coveralls": "^2.11.16",
"delete-empty": "^2.0.0",
"fastify-static": "^0.8.0",
"gulp": "^4.0.0",
"gulp-clang-format": "^1.0.23",
Expand Down Expand Up @@ -136,7 +129,9 @@
}
},
"nyc": {
"include": ["packages/**/*.ts"],
"include": [
"packages/**/*.ts"
],
"exclude": [
"node_modules/",
"packages/**/*.spec.ts",
Expand All @@ -155,13 +150,23 @@
"packages/common/serializer/**/*",
"packages/common/services/logger.service.ts"
],
"extension": [".ts"],
"require": ["ts-node/register"],
"reporter": ["text-summary", "html"],
"extension": [
".ts"
],
"require": [
"ts-node/register"
],
"reporter": [
"text-summary",
"html"
],
"sourceMap": true,
"instrument": true
},
"lint-staged": {
"packages/**/*.{ts,json}": ["npm run format", "git add"]
"packages/**/*.{ts,json}": [
"npm run format",
"git add"
]
}
}
File renamed without changes.
27 changes: 4 additions & 23 deletions packages/common/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,8 @@
{
"extends": "./../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"noImplicitAny": false,
"noUnusedLocals": false,
"removeComments": false,
"noLib": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2017",
"sourceMap": false,
"allowJs": false,
"rootDir": "./",
"strict": true,
"strictNullChecks": false,
"outDir": "../../node_modules/@nestjs/common"
"baseUrl": "./"
},
"include": [
"*.ts",
"**/*.ts"
],
"exclude": [
"../../node_modules",
"./**/*.spec.ts"
]
}
"include": ["*.ts", "**/*.ts"]
}
12 changes: 6 additions & 6 deletions packages/core/middleware/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isFunction } from '@nestjs/common/utils/shared.utils';
import { Type } from '@nestjs/common/interfaces';
import { isFunction } from '@nestjs/common/utils/shared.utils';

export const filterMiddleware = middleware => {
return []
Expand All @@ -9,7 +9,7 @@ export const filterMiddleware = middleware => {
};

export const mapToClass = middleware => {
if (this.isClass(middleware)) {
if (isClass(middleware)) {
return middleware;
}
return assignToken(
Expand All @@ -19,12 +19,12 @@ export const mapToClass = middleware => {
);
};

export const isClass = middleware => {
export function isClass(middleware: any) {
return middleware.toString().substring(0, 5) === 'class';
};
}

export const assignToken = (metatype): Type<any> => {
export function assignToken(this: any, metatype): Type<any> {
this.id = this.id || 1;
Object.defineProperty(metatype, 'name', { value: ++this.id });
return metatype;
};
}
30 changes: 4 additions & 26 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
{
"extends": "./../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"noImplicitAny": false,
"noUnusedLocals": false,
"removeComments": false,
"noLib": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2017",
"sourceMap": false,
"allowJs": false,
"rootDir": "./",
"baseUrl": "../../",
"strict": true,
"strictNullChecks": false,
"noImplicitThis": false,
"outDir": "../../node_modules/@nestjs/core"
"baseUrl": "./"
},
"include": [
"*.ts",
"**/*.ts"
],
"exclude": [
"node_modules/reflect-metadata",
"node_modules/@types/reflect-metadata",
"./**/*.spec.ts"
]
}
"include": ["*.ts", "**/*.ts"]
}
Loading

0 comments on commit 0e71949

Please sign in to comment.