fix(core): update

This commit is contained in:
Philipp Kunz 2020-03-13 19:23:01 +00:00
parent 6bbfd8b8a5
commit d35cff7135
11 changed files with 134 additions and 143 deletions

4
.gitignore vendored
View File

@ -15,8 +15,6 @@ node_modules/
# builds # builds
dist/ dist/
dist_web/ dist_*/
dist_serve/
dist_ts_web/
# custom # custom

View File

@ -1,18 +1,16 @@
# gitzone ci_default # gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
variables:
GIT_STRATEGY: clone
cache: cache:
paths: paths:
- .npmci_cache/ - .npmci_cache/
key: "$CI_BUILD_STAGE" key: '$CI_BUILD_STAGE'
stages: stages:
- security - security
- test - test
- release - release
- metadata - metadata
# ==================== # ====================
# security stage # security stage
@ -20,21 +18,23 @@ stages:
mirror: mirror:
stage: security stage: security
script: script:
- npmci git mirror - npmci git mirror
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
snyk: snyk:
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk
stage: security stage: security
script: script:
- npmci npm prepare - npmci npm prepare
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts - npmci command npm install --ignore-scripts
- npmci command snyk test - npmci command snyk test
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
# ==================== # ====================
# test stage # test stage
@ -43,37 +43,40 @@ snyk:
testStable: testStable:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install stable - npmci node install stable
- npmci npm install - npmci npm install
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - lossless
- priv - docker
- priv
testBuild: testBuild:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install lts - npmci node install stable
- npmci npm install - npmci npm install
- npmci command npm run build - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
release: release:
stage: release stage: release
script: script:
- npmci node install lts - npmci node install stable
- npmci npm publish - npmci npm publish
only: only:
- tags - tags
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
# ==================== # ====================
# metadata stage # metadata stage
@ -83,33 +86,35 @@ codequality:
allow_failure: true allow_failure: true
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install - npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts" - npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags: tags:
- docker - lossless
- priv - docker
- priv
trigger: trigger:
stage: metadata stage: metadata
script: script:
- npmci trigger - npmci trigger
only: only:
- tags - tags
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
pages: pages:
image: hosttoday/ht-docker-dbase:npmci
services:
- docker:18-dind
stage: metadata stage: metadata
script: script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc - npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command tsdoc - npmci command tsdoc
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
only: only:
@ -117,5 +122,5 @@ pages:
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
paths: paths:
- public - public
allow_failure: true allow_failure: true

29
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"request": "launch",
"args": [
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm"]
}
}
}
}
}
}
]
}

View File

@ -1,75 +0,0 @@
# @gitzone/tsbuild
TypeScript nightly to easily make use of latest features
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@gitzone/tsbuild)
* [gitlab.com (source)](https://gitlab.com/gitzone/tsbuild)
* [github.com (source mirror)](https://github.com/gitzone/tsbuild)
* [docs (typedoc)](https://gitzone.gitlab.io/tsbuild/)
## Status for master
[![build status](https://gitlab.com/gitzone/tsbuild/badges/master/build.svg)](https://gitlab.com/gitzone/tsbuild/commits/master)
[![coverage report](https://gitlab.com/gitzone/tsbuild/badges/master/coverage.svg)](https://gitlab.com/gitzone/tsbuild/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@gitzone/tsbuild.svg)](https://www.npmjs.com/package/@gitzone/tsbuild)
[![Known Vulnerabilities](https://snyk.io/test/npm/@gitzone/tsbuild/badge.svg)](https://snyk.io/test/npm/@gitzone/tsbuild)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
## Usage
Tsn uses the **next** tagged npm version of typescript
```typescript
import * as tsn from 'tsn';
let myGlobStringObject = {
'./myTsFolder/**/*.ts': './myDestinationFolder/',
'./someOtherTsFolder/**/*.ts': './myOtherDestinationFolder/'
};
let tsOptions = {
target: tsn.ScriptTarget.ES2015,
module: tsn.ModuleKind.CommonJS
};
/*
note: since this only works in code, here are the target numbers
enum ScriptTarget {
ES3 = 0,
ES5 = 1,
ES2015 = 2,
ES2016 = 3,
ES2017 = 4,
ESNext = 5,
Latest = 5,
}
and here are the module kinds
enum ModuleKind {
None = 0,
CommonJS = 1,
AMD = 2,
UMD = 3,
System = 4,
ES2015 = 5,
}
*/
let myCwd = process.cwd();
tsn.compileGlobStringObject(
myGlobStringObject, // the glob string object describing from where to compile what to where
tsOptions, // the options for TypeScript
myCwd // a custom cwd, optional, defaults to process.cwd()
);
```
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -4,6 +4,7 @@
"npmAccessLevel": "public" "npmAccessLevel": "public"
}, },
"gitzone": { "gitzone": {
"projectType": "npm",
"module": { "module": {
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "gitzone", "gitscope": "gitzone",

View File

@ -3,7 +3,7 @@
"version": "2.1.20", "version": "2.1.20",
"private": false, "private": false,
"description": "TypeScript nightly to easily make use of latest features", "description": "TypeScript nightly to easily make use of latest features",
"main": "dist/index.js", "main": "dist_ts/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
"bin": { "bin": {
"tsbuild": "cli.js" "tsbuild": "cli.js"
@ -42,14 +42,16 @@
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"files": [ "files": [
"ts/*", "ts/**/*",
"ts_web/*", "ts_web/**/*",
"dist/*", "dist/**/*",
"dist_web/*", "dist_bundle/**/*",
"dist_ts_web/*", "dist_web/**/*",
"assets/*", "dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
] ]
} }

View File

@ -1,5 +1,5 @@
declare class test2 { declare class test2 {
test: string[]; test: string[];
constructor(); constructor();
} }
declare const run: () => Promise<string>; declare const run: () => Promise<string>;

View File

@ -12,7 +12,7 @@ export const compilerOptionsDefault: CompilerOptions = {
experimentalDecorators: true, experimentalDecorators: true,
inlineSourceMap: true, inlineSourceMap: true,
noEmitOnError: true, noEmitOnError: true,
outDir: 'dist/', outDir: 'dist_ts/',
module: plugins.typescript.ModuleKind.CommonJS, module: plugins.typescript.ModuleKind.CommonJS,
lib: ['lib.es2017.d.ts'], lib: ['lib.es2017.d.ts'],
noImplicitAny: false, noImplicitAny: false,
@ -41,7 +41,7 @@ export const mergeCompilerOptions = (
})(); })();
// create merged options // create merged options
let mergedOptions: CompilerOptions = { const mergedOptions: CompilerOptions = {
...defaultOptionsToMerge, ...defaultOptionsToMerge,
...customTsOptions ...customTsOptions
}; };
@ -58,22 +58,22 @@ export const compiler = (
argvArg?: any argvArg?: any
): Promise<any[]> => { ): Promise<any[]> => {
console.log(`Compiling ${fileNames.length} files...`); console.log(`Compiling ${fileNames.length} files...`);
let done = plugins.smartpromise.defer<any[]>(); const done = plugins.smartpromise.defer<any[]>();
let program = plugins.typescript.createProgram(fileNames, options); const program = plugins.typescript.createProgram(fileNames, options);
let emitResult = program.emit(); const emitResult = program.emit();
// implement check only // implement check only
/*let emitResult = program.emit(undefined,(args) => { /*let emitResult = program.emit(undefined,(args) => {
console.log(args) console.log(args)
});*/ });*/
let allDiagnostics = plugins.typescript const allDiagnostics = plugins.typescript
.getPreEmitDiagnostics(program) .getPreEmitDiagnostics(program)
.concat(emitResult.diagnostics); .concat(emitResult.diagnostics);
allDiagnostics.forEach(diagnostic => { allDiagnostics.forEach(diagnostic => {
if (diagnostic.file) { if (diagnostic.file) {
let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!); const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!);
let message = plugins.typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); const message = plugins.typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
} else { } else {
console.log( console.log(
@ -82,7 +82,7 @@ export const compiler = (
} }
}); });
let exitCode = emitResult.emitSkipped ? 1 : 0; const exitCode = emitResult.emitSkipped ? 1 : 0;
if (exitCode === 0) { if (exitCode === 0) {
console.log('TypeScript emit succeeded!'); console.log('TypeScript emit succeeded!');
done.resolve(emitResult.emittedFiles); done.resolve(emitResult.emittedFiles);

View File

@ -10,7 +10,7 @@ tsbuildCli.standardTask().subscribe(async argvArg => {
if (process.env.CLI_CALL_TSBUILD === 'true') { if (process.env.CLI_CALL_TSBUILD === 'true') {
tsbuild.compileGlobStringObject( tsbuild.compileGlobStringObject(
{ {
'./ts/**/*.ts': './dist' './ts/**/*.ts': './dist_ts'
}, },
{}, {},
process.cwd(), process.cwd(),
@ -33,9 +33,14 @@ tsbuildCli.addCommand('custom').subscribe(async argvArg => {
}); });
tsbuildCli.addCommand('element').subscribe(async argvArg => { tsbuildCli.addCommand('element').subscribe(async argvArg => {
await tsbuild.compileGlobStringObject({ await tsbuild.compileGlobStringObject(
"./ts_web/**/*.ts": "dist_ts_web" {
}, {}, process.cwd(), {web: true}); './ts_web/**/*.ts': 'dist_ts_web'
},
{},
process.cwd(),
{ web: true }
);
}); });
tsbuildCli.startParse(); tsbuildCli.startParse();

View File

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"outDir": "dist/", "outDir": "dist_ts/",
"module": "commonjs", "module": "commonjs",
"target": "es2015", "target": "es2015",
"lib":[ "lib":[