Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ node_modules
coverage/**/*
xunit.xml
test-reports.xml
!test-scripts/**
!scripts/**
5 changes: 4 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ test-reports.xml
*.tgz
.vscode
.npmignore

test/**/*
test-scripts/**/*
lib/common/test/**/*
lib/common/test-scripts/**/*
22 changes: 11 additions & 11 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,7 @@ module.exports = function(grunt) {
pkg: grunt.file.readJSON("package.json"),

ts: {
options: {
target: 'es5',
module: 'commonjs',
sourceMap: true,
declaration: false,
removeComments: false,
noImplicitAny: true,
experimentalDecorators: true,
emitDecoratorMetadata: true
},
options: grunt.file.readJSON("tsconfig.json").compilerOptions,

devlib: {
src: ["**/*.ts", "!node_modules/**/*.ts"],
Expand Down Expand Up @@ -124,7 +115,16 @@ module.exports = function(grunt) {
},

clean: {
src: ["test/**/*.js*", "**/*.js*", "!**/*.json", "!Gruntfile.js", "!node_modules/**/*", "!bin/common-lib.js", "!vendor/*.js", "*.tgz"]
src: ["test/**/*.js*",
"**/*.js*",
"!**/*.json",
"!Gruntfile.js",
"!node_modules/**/*",
"!bin/common-lib.js",
"!vendor/*.js",
"*.tgz",
"!test-scripts/**/*",
"!scripts/**/*"]
}
});

Expand Down
8 changes: 5 additions & 3 deletions appbuilder/services/npm-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ export class NpmService implements INpmService {
}).future<void>()();
}

public search(projectDir: string, keywords: string[], args: string[] = []): IFuture<IBasicPluginInformation[]> {
public search(projectDir: string, keywords: string[], args?: string[]): IFuture<IBasicPluginInformation[]> {
return ((): IBasicPluginInformation[] => {
args = args === undefined ? [] : args;
let result: IBasicPluginInformation[] = [];
let commandArguments = _.concat(["search"], args, keywords);
let spawnResult = this.executeNpmCommandCore(projectDir, commandArguments).wait();
Expand Down Expand Up @@ -296,7 +297,7 @@ export class NpmService implements INpmService {
let defs = _.map(definitionFiles, def => this.getReferenceLine(fromWindowsRelativePathToUnix(path.relative(projectDir, def))));

this.$logger.trace(`Adding lines for definition files: ${definitionFiles.join(", ")}`);
lines.push(...defs);
lines = lines.concat(defs);
}
});

Expand Down Expand Up @@ -333,7 +334,8 @@ export class NpmService implements INpmService {
return `/// <reference path="${pathToReferencedFile}" />`;
}

private getNpmArguments(command: string, npmArguments: string[] = []): string[] {
private getNpmArguments(command: string, npmArguments?: string[]): string[] {
npmArguments = npmArguments === undefined ? [] : npmArguments;
return npmArguments.concat([command]);
}

Expand Down
3 changes: 2 additions & 1 deletion codeGeneration/code-printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export class CodePrinter {
private static START_BLOCK_CHAR = "{";
private static END_BLOCK_CHAR = "}";

public composeBlock(block: CodeGeneration.IBlock, indentSize: number = 0): string {
public composeBlock(block: CodeGeneration.IBlock, indentSize?: number): string {
indentSize = indentSize === undefined ? 0 : indentSize;
let content = this.getIndentation(indentSize);

if(block.opener) {
Expand Down
19 changes: 13 additions & 6 deletions decorators.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as Promise from "bluebird";
import * as fiberBootstrap from "./fiber-bootstrap";
import * as assert from "assert";
import {isFuture} from "./helpers";
Expand Down Expand Up @@ -47,6 +46,18 @@ export function exportedPromise(moduleName: string, postAction?: () => void): an
}

function getPromise(originalValue: any, config?: { postActionMethod: () => void, shouldExecutePostAction?: boolean }): Promise<any> {
let postAction = (data: any) => {
if (config && config.postActionMethod && config.shouldExecutePostAction) {
config.postActionMethod();
}

if (data instanceof Error) {
throw data;
}

return data;
};

return new Promise((onFulfilled: Function, onRejected: Function) => {
if (isFuture(originalValue)) {
fiberBootstrap.run(function () {
Expand All @@ -60,11 +71,7 @@ function getPromise(originalValue: any, config?: { postActionMethod: () => void,
} else {
onFulfilled(originalValue);
}
}).lastly(() => {
if (config && config.postActionMethod && config.shouldExecutePostAction) {
config.postActionMethod();
}
});
}).then(postAction, postAction);
}

export function exported(moduleName: string): any {
Expand Down
Loading