Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
7ee9935a9a | |||
5128d450bc | |||
8708b1442d | |||
0e39dfecba | |||
b4e8accad6 | |||
1415d66ffb | |||
38e3eed003 | |||
466095ed26 | |||
3d8041fdde | |||
f021525f9e | |||
63fa2e84d4 | |||
af66bd8ff1 | |||
53f4e402f5 | |||
2f57c26b87 | |||
3e05c116f3 | |||
d2dbe40b50 | |||
835fba3452 | |||
d35cff7135 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -15,8 +15,6 @@ node_modules/
|
|||||||
|
|
||||||
# builds
|
# builds
|
||||||
dist/
|
dist/
|
||||||
dist_web/
|
dist_*/
|
||||||
dist_serve/
|
|
||||||
dist_ts_web/
|
|
||||||
|
|
||||||
# custom
|
# custom
|
@ -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,24 @@ stages:
|
|||||||
mirror:
|
mirror:
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci git mirror
|
- npmci git mirror
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- notpriv
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
snyk:
|
audit:
|
||||||
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
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 npm config set registry https://registry.npmjs.org
|
||||||
|
- npmci command npm audit --audit-level=high
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- notpriv
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# test stage
|
# test stage
|
||||||
@ -43,37 +44,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 +87,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 +123,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
29
.vscode/launch.json
vendored
Normal 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
26
.vscode/settings.json
vendored
Normal 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"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
5
cli.js
5
cli.js
@ -1,3 +1,4 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
process.env.CLI_CALL_TSBUILD = 'true'
|
process.env.CLI_CALL = 'true';
|
||||||
var index = require("./dist/index.js");
|
const cliTool = require('./dist_ts/index');
|
||||||
|
cliTool.runCli();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
process.env.CLI_CALL_TSBUILD = 'true';
|
process.env.CLI_CALL = 'true';
|
||||||
require('@gitzone/tsrun');
|
require('@gitzone/tsrun');
|
||||||
require('./ts/index');
|
const cliTool = require('./ts/index');
|
||||||
|
cliTool.runCli();
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
},
|
},
|
||||||
"gitzone": {
|
"gitzone": {
|
||||||
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "gitzone",
|
"gitscope": "gitzone",
|
||||||
|
3402
package-lock.json
generated
3402
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
44
package.json
44
package.json
@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "@gitzone/tsbuild",
|
"name": "@gitzone/tsbuild",
|
||||||
"version": "2.1.20",
|
"version": "2.1.29",
|
||||||
"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_ts/index.d.ts",
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsbuild": "cli.js"
|
"tsbuild": "./cli.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "tsrun test/test.ts",
|
"test": "tsrun test/test.ts",
|
||||||
"testCustom": "node cli.ts.js custom ts_web",
|
"testCustom": "node cli.ts.js custom ts_web",
|
||||||
"build": "node cli.ts.js"
|
"build": "node cli.ts.js --web"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -27,27 +27,29 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/tsn#README",
|
"homepage": "https://gitlab.com/pushrocks/tsn#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartcli": "^3.0.7",
|
"@pushrocks/early": "^3.0.6",
|
||||||
"@pushrocks/smartfile": "^7.0.2",
|
"@pushrocks/smartcli": "^3.0.14",
|
||||||
"@pushrocks/smartlog": "^2.0.19",
|
"@pushrocks/smartfile": "^8.0.10",
|
||||||
"@pushrocks/smartpath": "^4.0.1",
|
"@pushrocks/smartlog": "^2.0.44",
|
||||||
"@pushrocks/smartpromise": "^3.0.2",
|
"@pushrocks/smartpath": "^4.0.3",
|
||||||
"typescript": "^3.5.2"
|
"@pushrocks/smartpromise": "^3.1.6",
|
||||||
|
"typescript": "^4.4.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsrun": "^1.2.8",
|
"@gitzone/tsrun": "^1.2.17",
|
||||||
"@pushrocks/tapbundle": "^3.0.13",
|
"@pushrocks/tapbundle": "^3.2.14",
|
||||||
"@types/node": "^12.7.2",
|
"@types/node": "^16.7.13",
|
||||||
"tslint": "^5.19.0",
|
"tslint": "^6.1.3",
|
||||||
"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_*/**/*",
|
||||||
"dist_ts_web/*",
|
"dist_ts/**/*",
|
||||||
"assets/*",
|
"dist_ts_web/**/*",
|
||||||
|
"assets/**/*",
|
||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
|
@ -8,7 +8,7 @@ TypeScript nightly to easily make use of latest features
|
|||||||
* [docs (typedoc)](https://gitzone.gitlab.io/tsbuild/)
|
* [docs (typedoc)](https://gitzone.gitlab.io/tsbuild/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
[](https://gitlab.com/gitzone/tsbuild/commits/master)
|
[](https://gitlab.com/gitzone/tsbuild/commits/master)
|
||||||
[](https://gitlab.com/gitzone/tsbuild/commits/master)
|
[](https://gitlab.com/gitzone/tsbuild/commits/master)
|
||||||
[](https://www.npmjs.com/package/@gitzone/tsbuild)
|
[](https://www.npmjs.com/package/@gitzone/tsbuild)
|
||||||
[](https://snyk.io/test/npm/@gitzone/tsbuild)
|
[](https://snyk.io/test/npm/@gitzone/tsbuild)
|
||||||
@ -67,6 +67,10 @@ tsn.compileGlobStringObject(
|
|||||||
|
|
||||||
[](https://push.rocks)
|
[](https://push.rocks)
|
||||||
|
|
||||||
|
## Contribution
|
||||||
|
|
||||||
|
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
6
test/assets/output/tocompile.d.ts
vendored
6
test/assets/output/tocompile.d.ts
vendored
@ -1,5 +1 @@
|
|||||||
declare class test2 {
|
export {};
|
||||||
test: string[];
|
|
||||||
constructor();
|
|
||||||
}
|
|
||||||
declare const run: () => Promise<string>;
|
|
||||||
|
@ -1,5 +1,31 @@
|
|||||||
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
console.log('test');
|
console.log('test');
|
||||||
console.log('test2');
|
console.log('test2');
|
||||||
|
const early = __importStar(require("@pushrocks/early"));
|
||||||
|
early.start();
|
||||||
|
early.stop();
|
||||||
|
const tocompile2_1 = require("./tocompile2");
|
||||||
|
console.log(tocompile2_1.anExportedString);
|
||||||
class test2 {
|
class test2 {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.test = [];
|
this.test = [];
|
||||||
@ -9,4 +35,4 @@ class test2 {
|
|||||||
const run = async () => {
|
const run = async () => {
|
||||||
return 'hi';
|
return 'hi';
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9jb21waWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdG9jb21waWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sQ0FBQyxHQUFHLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDcEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztBQUNyQixNQUFNLEtBQUs7SUFFVDtRQURBLFNBQUksR0FBYSxFQUFFLENBQUM7UUFFbEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUNwQixDQUFDO0NBQ0Y7QUFFRCxNQUFNLEdBQUcsR0FBRyxLQUFLLElBQXFCLEVBQUU7SUFDdEMsT0FBTyxJQUFJLENBQUM7QUFDZCxDQUFDLENBQUMifQ==
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9jb21waWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdG9jb21waWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLE9BQU8sQ0FBQyxHQUFHLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDcEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztBQUVyQix3REFBMEM7QUFFMUMsS0FBSyxDQUFDLEtBQUssRUFBRSxDQUFDO0FBQ2QsS0FBSyxDQUFDLElBQUksRUFBRSxDQUFDO0FBRWIsNkNBQThDO0FBQzlDLE9BQU8sQ0FBQyxHQUFHLENBQUMsNkJBQWdCLENBQUMsQ0FBQztBQUU5QixNQUFNLEtBQUs7SUFFVDtRQURBLFNBQUksR0FBYSxFQUFFLENBQUM7UUFFbEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUNwQixDQUFDO0NBQ0Y7QUFFRCxNQUFNLEdBQUcsR0FBRyxLQUFLLElBQXFCLEVBQUU7SUFDdEMsT0FBTyxJQUFJLENBQUM7QUFDZCxDQUFDLENBQUMifQ==
|
1
test/assets/output/tocompile2.d.ts
vendored
1
test/assets/output/tocompile2.d.ts
vendored
@ -0,0 +1 @@
|
|||||||
|
export declare const anExportedString = "exported string";
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.anExportedString = void 0;
|
||||||
console.log('hello');
|
console.log('hello');
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9jb21waWxlMi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RvY29tcGlsZTIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQyJ9
|
exports.anExportedString = 'exported string';
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9jb21waWxlMi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RvY29tcGlsZTIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztBQUNSLFFBQUEsZ0JBQWdCLEdBQUcsaUJBQWlCLENBQUMifQ==
|
@ -1,5 +1,14 @@
|
|||||||
console.log('test');
|
console.log('test');
|
||||||
console.log('test2');
|
console.log('test2');
|
||||||
|
|
||||||
|
import * as early from '@pushrocks/early';
|
||||||
|
|
||||||
|
early.start();
|
||||||
|
early.stop();
|
||||||
|
|
||||||
|
import {anExportedString} from './tocompile2';
|
||||||
|
console.log(anExportedString);
|
||||||
|
|
||||||
class test2 {
|
class test2 {
|
||||||
test: string[] = [];
|
test: string[] = [];
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -1 +1,2 @@
|
|||||||
console.log('hello');
|
console.log('hello');
|
||||||
|
export const anExportedString = 'exported string';
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import * as early from '@pushrocks/early';
|
||||||
|
early.start('tsbuild');
|
||||||
export * from './tsbuild.exports';
|
export * from './tsbuild.exports';
|
||||||
|
export * from './tsbuild.cli';
|
||||||
import './tsbuild.cli';
|
early.stop();
|
@ -12,12 +12,13 @@ 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,
|
||||||
esModuleInterop: true,
|
esModuleInterop: true,
|
||||||
target: plugins.typescript.ScriptTarget.ES2017
|
target: plugins.typescript.ScriptTarget.ES2017,
|
||||||
|
importsNotUsedAsValues: plugins.typescript.ImportsNotUsedAsValues.Preserve
|
||||||
};
|
};
|
||||||
|
|
||||||
export const compilerOptionsWebDefault: CompilerOptions = {
|
export const compilerOptionsWebDefault: CompilerOptions = {
|
||||||
@ -41,9 +42,12 @@ export const mergeCompilerOptions = (
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
// create merged options
|
// create merged options
|
||||||
let mergedOptions: CompilerOptions = {
|
const mergedOptions: CompilerOptions = {
|
||||||
...defaultOptionsToMerge,
|
...defaultOptionsToMerge,
|
||||||
...customTsOptions
|
...customTsOptions,
|
||||||
|
...argvArg && argvArg.skiplibcheck ? {
|
||||||
|
skipLibCheck: true
|
||||||
|
} : {},
|
||||||
};
|
};
|
||||||
|
|
||||||
return mergedOptions;
|
return mergedOptions;
|
||||||
@ -58,22 +62,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 +86,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);
|
||||||
|
@ -1,41 +1,46 @@
|
|||||||
import * as plugins from './tsbuild.plugins';
|
import * as plugins from './tsbuild.plugins';
|
||||||
import * as tsbuild from './tsbuild.exports';
|
import * as tsbuild from './tsbuild.exports';
|
||||||
|
|
||||||
const tsbuildCli = new plugins.smartcli.Smartcli();
|
export const runCli = async () => {
|
||||||
|
const tsbuildCli = new plugins.smartcli.Smartcli();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the standard task compiles anything in ts/ directory to dist directory
|
* the standard task compiles anything in ts/ directory to dist directory
|
||||||
*/
|
*/
|
||||||
tsbuildCli.standardTask().subscribe(async argvArg => {
|
tsbuildCli.standardTask().subscribe(async (argvArg) => {
|
||||||
if (process.env.CLI_CALL_TSBUILD === 'true') {
|
|
||||||
tsbuild.compileGlobStringObject(
|
tsbuild.compileGlobStringObject(
|
||||||
{
|
{
|
||||||
'./ts/**/*.ts': './dist'
|
'./ts/**/*.ts': './dist_ts',
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
process.cwd(),
|
process.cwd(),
|
||||||
argvArg
|
argvArg
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the custom command compiles any customDir to dist_customDir
|
* the custom command compiles any customDir to dist_customDir
|
||||||
*/
|
*/
|
||||||
tsbuildCli.addCommand('custom').subscribe(async argvArg => {
|
tsbuildCli.addCommand('custom').subscribe(async (argvArg) => {
|
||||||
const listedDirectories = argvArg._;
|
const listedDirectories = argvArg._;
|
||||||
listedDirectories.shift();
|
listedDirectories.shift();
|
||||||
const compilationCommandObject: { [key: string]: string } = {};
|
const compilationCommandObject: { [key: string]: string } = {};
|
||||||
for (const directory of listedDirectories) {
|
for (const directory of listedDirectories) {
|
||||||
compilationCommandObject[`./${directory}/**/*.ts`] = `./dist_${directory}`;
|
compilationCommandObject[`./${directory}/**/*.ts`] = `./dist_${directory}`;
|
||||||
}
|
}
|
||||||
await tsbuild.compileGlobStringObject(compilationCommandObject, {}, process.cwd(), argvArg);
|
await tsbuild.compileGlobStringObject(compilationCommandObject, {}, process.cwd(), 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();
|
||||||
|
};
|
||||||
|
@ -27,18 +27,18 @@ export let compileGlobStringObject = async (
|
|||||||
cwdArg: string = process.cwd(),
|
cwdArg: string = process.cwd(),
|
||||||
argvArg?: any
|
argvArg?: any
|
||||||
) => {
|
) => {
|
||||||
let compiledFiles = [];
|
let compiledFiles: plugins.smartfile.Smartfile[] = [];
|
||||||
for (const keyArg in globStringObjectArg) {
|
for (const keyArg in globStringObjectArg) {
|
||||||
if (globStringObjectArg[keyArg]) {
|
if (globStringObjectArg[keyArg]) {
|
||||||
console.log(
|
console.log(
|
||||||
`TypeScript assignment: transpile from ${keyArg} to ${globStringObjectArg[keyArg]}`
|
`TypeScript assignment: transpile from ${keyArg} to ${globStringObjectArg[keyArg]}`
|
||||||
);
|
);
|
||||||
const fileTreeArray = await plugins.smartfile.fs.listFileTree(cwdArg, keyArg);
|
const fileTreeArray = await plugins.smartfile.fs.listFileTree(cwdArg, keyArg);
|
||||||
let absoluteFilePathArray: string[] = plugins.smartpath.transform.toAbsolute(
|
const absoluteFilePathArray: string[] = plugins.smartpath.transform.toAbsolute(
|
||||||
fileTreeArray,
|
fileTreeArray,
|
||||||
cwdArg
|
cwdArg
|
||||||
);
|
);
|
||||||
let destDir: string = plugins.smartpath.transform.toAbsolute(
|
const destDir: string = plugins.smartpath.transform.toAbsolute(
|
||||||
globStringObjectArg[keyArg],
|
globStringObjectArg[keyArg],
|
||||||
cwdArg
|
cwdArg
|
||||||
);
|
);
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "dist/",
|
|
||||||
"module": "commonjs",
|
|
||||||
"target": "es2015",
|
|
||||||
"lib":[
|
|
||||||
"es2016",
|
|
||||||
"es2017"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"ts/**/*.ts"
|
|
||||||
]
|
|
||||||
}
|
|
Reference in New Issue
Block a user