Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
41ca4805e6 | |||
68dcf1cca9 | |||
53ba4a64b3 | |||
fa8dc2bec5 | |||
1ef8a502e3 | |||
bbcb8e6b3f | |||
fee2a60162 | |||
0a2fee42ca | |||
13827541c8 | |||
eeb6d6b963 | |||
bc6039e5ed | |||
58c783dc54 | |||
d4bebf2ed5 | |||
09cb6d258f | |||
dac1a19eb2 | |||
71565c0ce9 | |||
96b47cc2b4 | |||
52f5d5f099 |
@ -26,6 +26,7 @@ mirror:
|
||||
snyk:
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install -g snyk
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command snyk test
|
||||
@ -36,21 +37,11 @@ snyk:
|
||||
# ====================
|
||||
# test stage
|
||||
# ====================
|
||||
testLEGACY:
|
||||
stage: test
|
||||
script:
|
||||
- npmci node install legacy
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
allow_failure: true
|
||||
|
||||
testLTS:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install lts
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
@ -62,6 +53,7 @@ testLTS:
|
||||
testSTABLE:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
@ -118,6 +110,7 @@ pages:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci command npm install -g typedoc typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
||||
tags:
|
||||
@ -130,13 +123,3 @@ pages:
|
||||
paths:
|
||||
- public
|
||||
allow_failure: true
|
||||
|
||||
windowsCompatibility:
|
||||
image: stefanscherer/node-windows:10-build-tools
|
||||
stage: metadata
|
||||
script:
|
||||
- npm install & npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- windows
|
||||
allow_failure: true
|
||||
|
@ -1,8 +1,6 @@
|
||||
{
|
||||
"npmci": {
|
||||
"npmGlobalTools": [
|
||||
"typescript"
|
||||
],
|
||||
"npmGlobalTools": [],
|
||||
"npmAccessLevel": "public"
|
||||
}
|
||||
}
|
1126
package-lock.json
generated
1126
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
@ -1,10 +1,13 @@
|
||||
{
|
||||
"name": "tsn",
|
||||
"version": "2.0.16",
|
||||
"name": "@gitzone/tsbuild",
|
||||
"version": "2.1.2",
|
||||
"private": false,
|
||||
"description": "TypeScript nightly to easily make use of latest features",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"bin": {
|
||||
"tsbuild": "cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tsrun test/test.ts",
|
||||
"build": "node cli.ts.js"
|
||||
@ -23,15 +26,18 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/tsn#README",
|
||||
"dependencies": {
|
||||
"@pushrocks/smartfile": "^6.0.3",
|
||||
"@pushrocks/smartcli": "^3.0.6",
|
||||
"@pushrocks/smartfile": "^6.0.11",
|
||||
"@pushrocks/smartlog": "^2.0.9",
|
||||
"@pushrocks/smartpath": "^4.0.1",
|
||||
"@pushrocks/smartpromise": "^2.0.5",
|
||||
"smartlog": "^1.0.3",
|
||||
"typescript": "^2.9.2"
|
||||
"typescript": "^3.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsrun": "^1.1.9",
|
||||
"@pushrocks/tapbundle": "^3.0.1",
|
||||
"@types/node": "^10.5.3"
|
||||
"@gitzone/tsrun": "^1.1.13",
|
||||
"@pushrocks/tapbundle": "^3.0.7",
|
||||
"@types/node": "^10.12.12",
|
||||
"tslint": "^5.11.0",
|
||||
"tslint-config-prettier": "^1.17.0"
|
||||
}
|
||||
}
|
||||
|
3
test/assets/output/tocompile.d.ts
vendored
3
test/assets/output/tocompile.d.ts
vendored
@ -1,4 +1,5 @@
|
||||
declare class test {
|
||||
declare class test2 {
|
||||
test: string[];
|
||||
constructor();
|
||||
}
|
||||
declare const run: () => Promise<string>;
|
||||
|
@ -1,9 +1,20 @@
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
console.log('test');
|
||||
console.log('test2');
|
||||
class test {
|
||||
class test2 {
|
||||
constructor() {
|
||||
this.test = [];
|
||||
console.log('hi');
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9jb21waWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdG9jb21waWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sQ0FBQyxHQUFHLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDcEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztBQUNyQjtJQUVFO1FBREEsU0FBSSxHQUFhLEVBQUUsQ0FBQztRQUVsQixPQUFPLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ3BCLENBQUM7Q0FDRiJ9
|
||||
const run = () => __awaiter(this, void 0, void 0, function* () {
|
||||
return 'hi';
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9jb21waWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdG9jb21waWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBQUEsT0FBTyxDQUFDLEdBQUcsQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUNwQixPQUFPLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0FBQ3JCLE1BQU0sS0FBSztJQUVUO1FBREEsU0FBSSxHQUFhLEVBQUUsQ0FBQztRQUVsQixPQUFPLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ3BCLENBQUM7Q0FDRjtBQUVELE1BQU0sR0FBRyxHQUFHLEdBQTBCLEVBQUU7SUFDdEMsT0FBTyxJQUFJLENBQUM7QUFDZCxDQUFDLENBQUEsQ0FBQyJ9
|
@ -1,8 +1,12 @@
|
||||
console.log('test');
|
||||
console.log('test2');
|
||||
class test {
|
||||
class test2 {
|
||||
test: string[] = [];
|
||||
constructor() {
|
||||
console.log('hi');
|
||||
}
|
||||
}
|
||||
|
||||
const run = async (): Promise<string> => {
|
||||
return 'hi';
|
||||
};
|
||||
|
10
ts/index.ts
10
ts/index.ts
@ -1,9 +1,3 @@
|
||||
export * from "./tsbuild.exports";
|
||||
export * from './tsbuild.exports';
|
||||
|
||||
import * as tsbuild from './tsbuild.exports'
|
||||
|
||||
if (process.env.CLI_CALL_TSBUILD === "true") {
|
||||
tsbuild.compileGlobStringObject({
|
||||
"./ts/**/*.ts": "./dist"
|
||||
})
|
||||
}
|
||||
import './tsbuild.cli';
|
@ -11,24 +11,34 @@ export const compilerOptionsDefault: CompilerOptions = {
|
||||
emitDecoratorMetadata: true,
|
||||
experimentalDecorators: true,
|
||||
inlineSourceMap: true,
|
||||
noEmitOnError: false,
|
||||
noEmitOnError: true,
|
||||
outDir: 'dist/',
|
||||
module: plugins.typescript.ModuleKind.CommonJS,
|
||||
lib: [
|
||||
'es2016',
|
||||
'es2017'
|
||||
],
|
||||
lib: ['lib.es2016.d.ts', 'lib.es2017.d.ts'],
|
||||
noImplicitAny: false,
|
||||
target: plugins.typescript.ScriptTarget.ES2015
|
||||
};
|
||||
|
||||
export const compilerOptionsWebDefault: CompilerOptions = {
|
||||
...compilerOptionsDefault,
|
||||
lib: [...compilerOptionsDefault.lib, 'dom']
|
||||
};
|
||||
|
||||
/**
|
||||
* merges compilerOptions with the default compiler options
|
||||
*/
|
||||
export const mergeCompilerOptions = function(customTsOptions: CompilerOptions): CompilerOptions {
|
||||
export const mergeCompilerOptions = (customTsOptions: CompilerOptions, argvArg?: any): CompilerOptions => {
|
||||
const defaultOptionsToMerge = (() => {
|
||||
if (argvArg && argvArg.web) {
|
||||
return compilerOptionsWebDefault;
|
||||
} else {
|
||||
return compilerOptionsDefault;
|
||||
}
|
||||
})();
|
||||
|
||||
// create merged options
|
||||
let mergedOptions: CompilerOptions = {
|
||||
...compilerOptionsDefault,
|
||||
...defaultOptionsToMerge,
|
||||
...customTsOptions
|
||||
};
|
||||
|
||||
@ -40,9 +50,10 @@ export const mergeCompilerOptions = function(customTsOptions: CompilerOptions):
|
||||
*/
|
||||
export const compiler = (
|
||||
fileNames: string[],
|
||||
options: plugins.typescript.CompilerOptions
|
||||
options: plugins.typescript.CompilerOptions,
|
||||
argvArg?: any,
|
||||
): Promise<any[]> => {
|
||||
console.log(options);
|
||||
console.log(`Compiling ${fileNames.length} files...`);
|
||||
let done = plugins.smartpromise.defer<any[]>();
|
||||
let program = plugins.typescript.createProgram(fileNames, options);
|
||||
let emitResult = program.emit();
|
||||
@ -55,15 +66,17 @@ export const compiler = (
|
||||
let allDiagnostics = plugins.typescript
|
||||
.getPreEmitDiagnostics(program)
|
||||
.concat(emitResult.diagnostics);
|
||||
try {
|
||||
allDiagnostics.forEach(diagnostic => {
|
||||
let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
allDiagnostics.forEach(diagnostic => {
|
||||
if (diagnostic.file) {
|
||||
let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!);
|
||||
let message = plugins.typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
||||
console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
||||
});
|
||||
} catch (err) {
|
||||
// console.log(allDiagnostics)
|
||||
}
|
||||
} else {
|
||||
console.log(
|
||||
`${plugins.typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
let exitCode = emitResult.emitSkipped ? 1 : 0;
|
||||
if (exitCode === 0) {
|
||||
|
19
ts/tsbuild.cli.ts
Normal file
19
ts/tsbuild.cli.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import * as plugins from './tsbuild.plugins';
|
||||
import * as tsbuild from './tsbuild.exports';
|
||||
|
||||
const tsbuildCli = new plugins.smartcli.Smartcli();
|
||||
|
||||
tsbuildCli.standardTask().subscribe(argvArg => {
|
||||
if (process.env.CLI_CALL_TSBUILD === 'true') {
|
||||
tsbuild.compileGlobStringObject(
|
||||
{
|
||||
'./ts/**/*.ts': './dist'
|
||||
},
|
||||
{},
|
||||
process.cwd(),
|
||||
argvArg
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
tsbuildCli.startParse();
|
@ -8,9 +8,10 @@ export * from './tsbuild.classes.compiler';
|
||||
*/
|
||||
export let compileFileArray = (
|
||||
fileStringArrayArg: string[],
|
||||
compilerOptionsArg: CompilerOptions = {}
|
||||
compilerOptionsArg: CompilerOptions = {},
|
||||
argvArg?: any,
|
||||
): Promise<any[]> => {
|
||||
return compiler(fileStringArrayArg, mergeCompilerOptions(compilerOptionsArg));
|
||||
return compiler(fileStringArrayArg, mergeCompilerOptions(compilerOptionsArg, argvArg), argvArg);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -23,30 +24,33 @@ export let compileFileArray = (
|
||||
export let compileGlobStringObject = async (
|
||||
globStringObjectArg: any,
|
||||
tsOptionsArg: CompilerOptions = {},
|
||||
cwdArg: string = process.cwd()
|
||||
cwdArg: string = process.cwd(),
|
||||
argvArg?: any,
|
||||
) => {
|
||||
let compiledFiles = [];
|
||||
for (let keyArg in globStringObjectArg) {
|
||||
console.log(
|
||||
`TypeScript assignment: transpile from ${keyArg} to ${globStringObjectArg[keyArg]}`
|
||||
);
|
||||
const fileTreeArray = await plugins.smartfile.fs.listFileTree(cwdArg, keyArg);
|
||||
let absoluteFilePathArray: string[] = plugins.smartpath.transform.toAbsolute(
|
||||
fileTreeArray,
|
||||
cwdArg
|
||||
);
|
||||
let destDir: string = plugins.smartpath.transform.toAbsolute(
|
||||
globStringObjectArg[keyArg],
|
||||
cwdArg
|
||||
);
|
||||
tsOptionsArg = {
|
||||
...tsOptionsArg,
|
||||
outDir: destDir
|
||||
};
|
||||
compiledFiles = compiledFiles.concat(
|
||||
compiledFiles,
|
||||
await compileFileArray(absoluteFilePathArray, tsOptionsArg)
|
||||
);
|
||||
for (const keyArg in globStringObjectArg) {
|
||||
if(globStringObjectArg[keyArg]) {
|
||||
console.log(
|
||||
`TypeScript assignment: transpile from ${keyArg} to ${globStringObjectArg[keyArg]}`
|
||||
);
|
||||
const fileTreeArray = await plugins.smartfile.fs.listFileTree(cwdArg, keyArg);
|
||||
let absoluteFilePathArray: string[] = plugins.smartpath.transform.toAbsolute(
|
||||
fileTreeArray,
|
||||
cwdArg
|
||||
);
|
||||
let destDir: string = plugins.smartpath.transform.toAbsolute(
|
||||
globStringObjectArg[keyArg],
|
||||
cwdArg
|
||||
);
|
||||
tsOptionsArg = {
|
||||
...tsOptionsArg,
|
||||
outDir: destDir
|
||||
};
|
||||
compiledFiles = compiledFiles.concat(
|
||||
compiledFiles,
|
||||
await compileFileArray(absoluteFilePathArray, tsOptionsArg, argvArg)
|
||||
);
|
||||
}
|
||||
}
|
||||
return compiledFiles;
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
import * as smartcli from '@pushrocks/smartcli';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartpath from '@pushrocks/smartpath';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as typescript from 'typescript';
|
||||
|
||||
export { smartfile, smartpath, smartpromise, typescript };
|
||||
export { smartcli, smartfile, smartpath, smartpromise, typescript };
|
||||
|
18
tslint.json
18
tslint.json
@ -1,3 +1,17 @@
|
||||
{
|
||||
"extends": "tslint-config-standard"
|
||||
}
|
||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||
"rules": {
|
||||
"semicolon": [true, "always"],
|
||||
"no-console": false,
|
||||
"ordered-imports": false,
|
||||
"object-literal-sort-keys": false,
|
||||
"member-ordering": {
|
||||
"options":{
|
||||
"order": [
|
||||
"static-method"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultSeverity": "warning"
|
||||
}
|
||||
|
Reference in New Issue
Block a user