diff --git a/.gitignore b/.gitignore index 91c0db0..ef13c79 100644 --- a/.gitignore +++ b/.gitignore @@ -15,8 +15,6 @@ node_modules/ # builds dist/ -dist_web/ -dist_serve/ -dist_ts_web/ +dist_*/ # custom \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a6159b7..a95dfb6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,18 +1,16 @@ # gitzone ci_default image: registry.gitlab.com/hosttoday/ht-docker-node:npmci -variables: - GIT_STRATEGY: clone cache: paths: - - .npmci_cache/ - key: "$CI_BUILD_STAGE" + - .npmci_cache/ + key: '$CI_BUILD_STAGE' stages: -- security -- test -- release -- metadata + - security + - test + - release + - metadata # ==================== # security stage @@ -20,21 +18,23 @@ stages: mirror: stage: security script: - - npmci git mirror + - npmci git mirror tags: - - docker - - notpriv + - lossless + - docker + - notpriv snyk: + image: registry.gitlab.com/hosttoday/ht-docker-node:snyk stage: security script: - npmci npm prepare - - npmci command npm install -g snyk - npmci command npm install --ignore-scripts - npmci command snyk test tags: - - docker - - notpriv + - lossless + - docker + - notpriv # ==================== # test stage @@ -43,37 +43,40 @@ snyk: testStable: stage: test script: - - npmci npm prepare - - npmci node install stable - - npmci npm install - - npmci npm test + - npmci npm prepare + - npmci node install stable + - npmci npm install + - npmci npm test coverage: /\d+.?\d+?\%\s*coverage/ tags: - - docker - - priv + - lossless + - docker + - priv testBuild: stage: test script: - - npmci npm prepare - - npmci node install lts - - npmci npm install - - npmci command npm run build + - npmci npm prepare + - npmci node install stable + - npmci npm install + - npmci command npm run build coverage: /\d+.?\d+?\%\s*coverage/ tags: - - docker - - notpriv + - lossless + - docker + - notpriv release: stage: release script: - - npmci node install lts - - npmci npm publish + - npmci node install stable + - npmci npm publish only: - - tags + - tags tags: - - docker - - notpriv + - lossless + - docker + - notpriv # ==================== # metadata stage @@ -83,33 +86,35 @@ codequality: allow_failure: true script: - npmci command npm install -g tslint typescript + - npmci npm prepare - npmci npm install - npmci command "tslint -c tslint.json ./ts/**/*.ts" tags: - - docker - - priv + - lossless + - docker + - priv trigger: stage: metadata script: - - npmci trigger + - npmci trigger only: - - tags + - tags tags: - - docker - - notpriv + - lossless + - docker + - notpriv pages: - image: hosttoday/ht-docker-dbase:npmci - services: - - docker:18-dind stage: metadata script: + - npmci node install lts - npmci command npm install -g @gitzone/tsdoc - npmci npm prepare - npmci npm install - npmci command tsdoc tags: + - lossless - docker - notpriv only: @@ -117,5 +122,5 @@ pages: artifacts: expire_in: 1 week paths: - - public + - public allow_failure: true diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..112db52 --- /dev/null +++ b/.vscode/launch.json @@ -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" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..01d2b8d --- /dev/null +++ b/.vscode/settings.json @@ -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"] + } + } + } + } + } + } + ] +} diff --git a/README.md b/README.md deleted file mode 100644 index 0580aec..0000000 --- a/README.md +++ /dev/null @@ -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) diff --git a/npmextra.json b/npmextra.json index fc2f527..9e360ba 100644 --- a/npmextra.json +++ b/npmextra.json @@ -4,6 +4,7 @@ "npmAccessLevel": "public" }, "gitzone": { + "projectType": "npm", "module": { "githost": "gitlab.com", "gitscope": "gitzone", diff --git a/package.json b/package.json index 8a6a263..d31df56 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "2.1.20", "private": false, "description": "TypeScript nightly to easily make use of latest features", - "main": "dist/index.js", + "main": "dist_ts/index.js", "typings": "dist/index.d.ts", "bin": { "tsbuild": "cli.js" @@ -42,14 +42,16 @@ "tslint-config-prettier": "^1.18.0" }, "files": [ - "ts/*", - "ts_web/*", - "dist/*", - "dist_web/*", - "dist_ts_web/*", - "assets/*", + "ts/**/*", + "ts_web/**/*", + "dist/**/*", + "dist_bundle/**/*", + "dist_web/**/*", + "dist_ts/**/*", + "dist_ts_web/**/*", + "assets/**/*", "cli.js", "npmextra.json", "readme.md" ] -} +} \ No newline at end of file diff --git a/test/assets/output/tocompile.d.ts b/test/assets/output/tocompile.d.ts index 82c0231..4a26d2d 100644 --- a/test/assets/output/tocompile.d.ts +++ b/test/assets/output/tocompile.d.ts @@ -1,5 +1,5 @@ declare class test2 { - test: string[]; - constructor(); + test: string[]; + constructor(); } declare const run: () => Promise; diff --git a/ts/tsbuild.classes.compiler.ts b/ts/tsbuild.classes.compiler.ts index 499d21a..ef691a5 100644 --- a/ts/tsbuild.classes.compiler.ts +++ b/ts/tsbuild.classes.compiler.ts @@ -12,7 +12,7 @@ export const compilerOptionsDefault: CompilerOptions = { experimentalDecorators: true, inlineSourceMap: true, noEmitOnError: true, - outDir: 'dist/', + outDir: 'dist_ts/', module: plugins.typescript.ModuleKind.CommonJS, lib: ['lib.es2017.d.ts'], noImplicitAny: false, @@ -41,7 +41,7 @@ export const mergeCompilerOptions = ( })(); // create merged options - let mergedOptions: CompilerOptions = { + const mergedOptions: CompilerOptions = { ...defaultOptionsToMerge, ...customTsOptions }; @@ -58,22 +58,22 @@ export const compiler = ( argvArg?: any ): Promise => { console.log(`Compiling ${fileNames.length} files...`); - let done = plugins.smartpromise.defer(); - let program = plugins.typescript.createProgram(fileNames, options); - let emitResult = program.emit(); + const done = plugins.smartpromise.defer(); + const program = plugins.typescript.createProgram(fileNames, options); + const emitResult = program.emit(); // implement check only /*let emitResult = program.emit(undefined,(args) => { console.log(args) });*/ - let allDiagnostics = plugins.typescript + const allDiagnostics = plugins.typescript .getPreEmitDiagnostics(program) .concat(emitResult.diagnostics); allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { - let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!); - let message = plugins.typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); + const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!); + const message = plugins.typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); } else { console.log( @@ -82,7 +82,7 @@ export const compiler = ( } }); - let exitCode = emitResult.emitSkipped ? 1 : 0; + const exitCode = emitResult.emitSkipped ? 1 : 0; if (exitCode === 0) { console.log('TypeScript emit succeeded!'); done.resolve(emitResult.emittedFiles); diff --git a/ts/tsbuild.cli.ts b/ts/tsbuild.cli.ts index e7f8c08..36b6efb 100644 --- a/ts/tsbuild.cli.ts +++ b/ts/tsbuild.cli.ts @@ -10,7 +10,7 @@ tsbuildCli.standardTask().subscribe(async argvArg => { if (process.env.CLI_CALL_TSBUILD === 'true') { tsbuild.compileGlobStringObject( { - './ts/**/*.ts': './dist' + './ts/**/*.ts': './dist_ts' }, {}, process.cwd(), @@ -33,9 +33,14 @@ tsbuildCli.addCommand('custom').subscribe(async argvArg => { }); tsbuildCli.addCommand('element').subscribe(async argvArg => { - await tsbuild.compileGlobStringObject({ - "./ts_web/**/*.ts": "dist_ts_web" - }, {}, process.cwd(), {web: true}); + await tsbuild.compileGlobStringObject( + { + './ts_web/**/*.ts': 'dist_ts_web' + }, + {}, + process.cwd(), + { web: true } + ); }); tsbuildCli.startParse(); diff --git a/tsconfig.json b/tsconfig.json index 17c6eb1..538150b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "outDir": "dist/", + "outDir": "dist_ts/", "module": "commonjs", "target": "es2015", "lib":[