Compare commits

...

14 Commits

Author SHA1 Message Date
ceaabe35c8 1.0.63 2020-05-05 12:29:24 +00:00
0b0c36da1b fix(core): update 2020-05-05 12:29:23 +00:00
3a53cd5405 1.0.62 2020-03-20 06:01:42 +00:00
623438e1d1 fix(core): update 2020-03-20 06:01:41 +00:00
8bf19d55c7 1.0.61 2020-03-20 05:39:53 +00:00
b1952365bc fix(core): update 2020-03-20 05:39:52 +00:00
753225053b 1.0.60 2020-03-20 05:34:06 +00:00
715b7a89ad fix(core): update 2020-03-20 05:34:05 +00:00
166dd28ad3 1.0.59 2020-03-18 16:39:39 +00:00
ca039552ba fix(core): update 2020-03-18 16:39:39 +00:00
d435c0fdf9 1.0.58 2020-03-18 16:32:34 +00:00
911523dc6a fix(core): update 2020-03-18 16:32:33 +00:00
1f6917ed45 1.0.57 2020-03-14 22:41:26 +00:00
d92edd60d9 fix(core): update 2020-03-14 22:41:25 +00:00
11 changed files with 195 additions and 95 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,12 +1,10 @@
# 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
@ -22,17 +20,20 @@ mirror:
script: script:
- npmci git mirror - npmci git mirror
tags: tags:
- lossless
- docker - docker
- notpriv - 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:
- lossless
- docker - docker
- notpriv - notpriv
@ -49,6 +50,7 @@ testStable:
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- priv - priv
@ -56,22 +58,24 @@ 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:
- lossless
- docker - docker
- notpriv - 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:
- lossless
- docker - docker
- notpriv - notpriv
@ -83,9 +87,11 @@ 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:
- lossless
- docker - docker
- priv - priv
@ -96,20 +102,20 @@ trigger:
only: only:
- tags - tags
tags: tags:
- lossless
- docker - docker
- notpriv - 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:

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"]
}
}
}
}
}
}
]
}

2
cli.js
View File

@ -1,4 +1,4 @@
#!/usr/bin/env node #!/usr/bin/env node
process.env.CLI_CALL = 'true'; process.env.CLI_CALL = 'true';
const cliTool = require('./dist/index'); const cliTool = require('./dist_ts/index');
cliTool.runCli(); cliTool.runCli();

View File

@ -1,5 +1,6 @@
{ {
"gitzone": { "gitzone": {
"projectType": "npm",
"module": { "module": {
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "gitzone", "gitscope": "gitzone",

40
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@gitzone/tsbundle", "name": "@gitzone/tsbundle",
"version": "1.0.56", "version": "1.0.63",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -854,9 +854,9 @@
} }
}, },
"@gitzone/tsbuild": { "@gitzone/tsbuild": {
"version": "2.1.20", "version": "2.1.22",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.20.tgz", "resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.22.tgz",
"integrity": "sha512-st/PkULIw6ZSuqIBJPRY7/ioHNb98RSWuLPxA3irunAUmd/5LZm04+WyT8bL6ubc/0yKogxSxUbYuYm3VurNfA==", "integrity": "sha512-2rSRo2STq3wKKcKF/uKWh75vz4kA1dc/JT7ihfMZmEVlHMUKCj7oA1djaPI+K4MvKKWP7e1r+PVE2HaZdtqHDA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@pushrocks/smartcli": "^3.0.7", "@pushrocks/smartcli": "^3.0.7",
@ -1013,9 +1013,9 @@
} }
}, },
"@pushrocks/smartfile": { "@pushrocks/smartfile": {
"version": "7.0.9", "version": "7.0.11",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.9.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.11.tgz",
"integrity": "sha512-DDRoHZxD8do4UVVYRBoGUdQXPQEFhgpZG7lCvr4FUYaBaU/R5zW23AUtUEgednW4SCbEESg4mBtKDyTpmlr/3g==", "integrity": "sha512-vY5V+6rEfXa481icwGlWh6iPxk6a9VNtrEPF7aELVOfJYEHJS2GoZat3pLayy2Ab3UP6QV9eImx9UtI1ksfYhw==",
"requires": { "requires": {
"@pushrocks/smarthash": "^2.1.6", "@pushrocks/smarthash": "^2.1.6",
"@pushrocks/smartmime": "^1.0.3", "@pushrocks/smartmime": "^1.0.3",
@ -1223,14 +1223,14 @@
} }
}, },
"@pushrocks/tapbundle": { "@pushrocks/tapbundle": {
"version": "3.2.0", "version": "3.2.1",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.2.0.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.2.1.tgz",
"integrity": "sha512-xnKIGe7NJqxWBaFeKIEXShDjV2wap1XJqmlp3m1MKqmIF62vRpZnkzpyE1ZAoNwiYQmIsXIpvP/PDv+iPevPfw==", "integrity": "sha512-D3o205SE+Viu8sukm+6CvGkXEwOiQiEEcga9eWyvjWS4vDx6FWwrO0pNZkQq6GqsKQ9xRpCmBtI7F3KsJR0+PA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@pushrocks/early": "^3.0.3", "@pushrocks/early": "^3.0.3",
"@pushrocks/smartdelay": "^2.0.3", "@pushrocks/smartdelay": "^2.0.3",
"@pushrocks/smartfile": "^7.0.6", "@pushrocks/smartfile": "^7.0.9",
"@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smartpromise": "^3.0.2",
"smartchai": "^2.0.1" "smartchai": "^2.0.1"
}, },
@ -1285,9 +1285,9 @@
} }
}, },
"@types/chai": { "@types/chai": {
"version": "4.2.10", "version": "4.2.11",
"resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.10.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.11.tgz",
"integrity": "sha512-TlWWgb21+0LdkuFqEqfmy7NEgfB/7Jjux15fWQAh3P93gbmXuwTM/vxEdzW89APIcI2BgKR48yjeAkdeH+4qvQ==", "integrity": "sha512-t7uW6eFafjO+qJ3BIV2gGUyZs27egcNRkUdalkud+Qa3+kg//f129iuOFivHDXQ+vnU3fDXuwgv0cqMCbcE8sw==",
"dev": true "dev": true
}, },
"@types/chai-as-promised": { "@types/chai-as-promised": {
@ -2463,9 +2463,9 @@
} }
}, },
"rollup": { "rollup": {
"version": "2.0.6", "version": "2.1.0",
"resolved": "https://verdaccio.lossless.one/rollup/-/rollup-2.0.6.tgz", "resolved": "https://verdaccio.lossless.one/rollup/-/rollup-2.1.0.tgz",
"integrity": "sha512-P42IlI6a/bxh52ed8hEXXe44LcHfep2f26OZybMJPN1TTQftibvQEl3CWeOmJrzqGbFxOA000QXDWO9WJaOQpA==", "integrity": "sha512-gfE1455AEazVVTJoeQtcOq/U6GSxwoj4XPSWVsuWmgIxj7sBQNLDOSA82PbdMe+cP8ql8fR1jogPFe8Wg8g4SQ==",
"requires": { "requires": {
"fsevents": "~2.1.2" "fsevents": "~2.1.2"
} }
@ -2666,9 +2666,9 @@
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="
}, },
"terser": { "terser": {
"version": "4.6.6", "version": "4.6.7",
"resolved": "https://verdaccio.lossless.one/terser/-/terser-4.6.6.tgz", "resolved": "https://verdaccio.lossless.one/terser/-/terser-4.6.7.tgz",
"integrity": "sha512-4lYPyeNmstjIIESr/ysHg2vUPRGf2tzF9z2yYwnowXVuVzLEamPN1Gfrz7f8I9uEPuHcbFlW4PLIAsJoxXyJ1g==", "integrity": "sha512-fmr7M1f7DBly5cX2+rFDvmGBAaaZyPrHYK4mMdHEDAdNTqXSZgSOfqsfGq2HqPGT/1V0foZZuCZFx8CHKgAk3g==",
"requires": { "requires": {
"commander": "^2.20.0", "commander": "^2.20.0",
"source-map": "~0.6.1", "source-map": "~0.6.1",

View File

@ -1,10 +1,10 @@
{ {
"name": "@gitzone/tsbundle", "name": "@gitzone/tsbundle",
"version": "1.0.56", "version": "1.0.63",
"private": false, "private": false,
"description": "a bundler using rollup for painless bundling of web projects", "description": "a bundler using rollup for painless bundling of web projects",
"main": "dist/index.js", "main": "dist_ts/index.js",
"typings": "dist/index.d.ts", "typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
@ -16,10 +16,10 @@
"tsbundle": "cli.js" "tsbundle": "cli.js"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.20", "@gitzone/tsbuild": "^2.1.22",
"@gitzone/tsrun": "^1.2.8", "@gitzone/tsrun": "^1.2.8",
"@gitzone/tstest": "^1.0.28", "@gitzone/tstest": "^1.0.28",
"@pushrocks/tapbundle": "^3.2.0", "@pushrocks/tapbundle": "^3.2.1",
"tslint": "^6.1.0", "tslint": "^6.1.0",
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
}, },
@ -32,7 +32,7 @@
"@babel/runtime": "^7.8.7", "@babel/runtime": "^7.8.7",
"@pushrocks/early": "^3.0.3", "@pushrocks/early": "^3.0.3",
"@pushrocks/smartcli": "^3.0.9", "@pushrocks/smartcli": "^3.0.9",
"@pushrocks/smartfile": "^7.0.9", "@pushrocks/smartfile": "^7.0.11",
"@pushrocks/smartlog": "^2.0.21", "@pushrocks/smartlog": "^2.0.21",
"@pushrocks/smartlog-destination-local": "^8.0.2", "@pushrocks/smartlog-destination-local": "^8.0.2",
"@rollup/plugin-commonjs": "^11.0.2", "@rollup/plugin-commonjs": "^11.0.2",
@ -41,19 +41,20 @@
"@types/html-minifier": "^3.5.3", "@types/html-minifier": "^3.5.3",
"@types/node": "^13.9.1", "@types/node": "^13.9.1",
"html-minifier": "^4.0.0", "html-minifier": "^4.0.0",
"rollup": "^2.0.6", "rollup": "^2.1.0",
"rollup-plugin-babel": "^4.4.0", "rollup-plugin-babel": "^4.4.0",
"rollup-plugin-sourcemaps": "^0.5.0", "rollup-plugin-sourcemaps": "^0.5.0",
"rollup-plugin-terser": "^5.3.0", "rollup-plugin-terser": "^5.3.0",
"terser": "^4.6.6" "terser": "^4.6.7"
}, },
"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"

View File

@ -8,7 +8,7 @@ a bundler using rollup for painless bundling of web projects
* [docs (typedoc)](https://gitzone.gitlab.io/tsbundle/) * [docs (typedoc)](https://gitzone.gitlab.io/tsbundle/)
## Status for master ## Status for master
[![build status](https://gitlab.com/gitzone/tsbundle/badges/master/build.svg)](https://gitlab.com/gitzone/tsbundle/commits/master) [![pipeline status](https://gitlab.com/gitzone/tsbundle/badges/master/pipeline.svg)](https://gitlab.com/gitzone/tsbundle/commits/master)
[![coverage report](https://gitlab.com/gitzone/tsbundle/badges/master/coverage.svg)](https://gitlab.com/gitzone/tsbundle/commits/master) [![coverage report](https://gitlab.com/gitzone/tsbundle/badges/master/coverage.svg)](https://gitlab.com/gitzone/tsbundle/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@gitzone/tsbundle.svg)](https://www.npmjs.com/package/@gitzone/tsbundle) [![npm downloads per month](https://img.shields.io/npm/dm/@gitzone/tsbundle.svg)](https://www.npmjs.com/package/@gitzone/tsbundle)
[![Known Vulnerabilities](https://snyk.io/test/npm/@gitzone/tsbundle/badge.svg)](https://snyk.io/test/npm/@gitzone/tsbundle) [![Known Vulnerabilities](https://snyk.io/test/npm/@gitzone/tsbundle/badge.svg)](https://snyk.io/test/npm/@gitzone/tsbundle)
@ -22,10 +22,45 @@ Use TypeScript for best in class intellisense.
tsbundle will bundle modern JavaScript websites in an Google Bot conformant way so things like AdSense do work. tsbundle will bundle modern JavaScript websites in an Google Bot conformant way so things like AdSense do work.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) tsbundle supports two modes of usage: CLI and API usage.
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://gitzone.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com) ### CLI
```shell
# Note: This is code that belongs into your terminal ;)
# Install the tool for cli usage
# Globally
npm install -g @gitzone/tsbundle
# Locally for use in your pacakge.json
npm install --save-dev @gitzone/tsbundle
# then use it
tsbundle --from="./ts/index.ts" --to="dist/bundle.js"
## note you can call tsbundle without arguments. Default values are --from="./ts_web/index.ts" --to="dist_bundle/bundle.js"
## You can use --production to enable minification using terser
```
## API
You are using TypeScript, aren't you? Most of the stuff is apparent from the IDE intellisense.
```typescript
import { TsBundle } from '@gitozne/tsbundle';
const myTsBundleInstance = new TsBundle();
const run = async () => {
await myTsBundleInstance.buildTest('./from/my.ts', './to/mybundle.js')
// OR
await myTsBundleInstance.buildProduction('./from/my.ts', './to/mybundle.js')
}
```
## 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.

View File

@ -10,6 +10,4 @@ early.stop();
// lets make this usable programmatically // lets make this usable programmatically
export * from './tsbundle.class.tsbundle'; export * from './tsbundle.class.tsbundle';
export * from './tsbundle.htmlhandler'; export * from './tsbundle.htmlhandler';
export { export { runCli };
runCli
};

View File

@ -5,7 +5,10 @@ export class TsBundle {
/** /**
* the basic default options for rollup * the basic default options for rollup
*/ */
public getBaseOptions(fromArg: string = `ts_web/index.ts`, toArg: string = 'dist_bundle/bundle.js') { public getBaseOptions(
fromArg: string = `ts_web/index.ts`,
toArg: string = 'dist_bundle/bundle.js'
) {
logger.log('info', `from: ${fromArg}`); logger.log('info', `from: ${fromArg}`);
logger.log('info', `to: ${toArg}`); logger.log('info', `to: ${toArg}`);
@ -25,12 +28,13 @@ export class TsBundle {
plugins: [ plugins: [
// Compile TypeScript files // Compile TypeScript files
plugins.rollupTypescript({ plugins.rollupTypescript({
include: plugins.path.parse(fromArg).dir ? plugins.path.parse(fromArg).dir + '/**/*.ts' : '**/*.ts',
declaration: false, declaration: false,
emitDecoratorMetadata: true, emitDecoratorMetadata: true,
experimentalDecorators: true, experimentalDecorators: true,
inlineSourceMap: true, inlineSourceMap: true,
noEmitOnError: true, noEmitOnError: true,
lib: ['esnext', 'dom'], lib: ['esnext', 'dom', 'es2017.object'],
noImplicitAny: false, noImplicitAny: false,
target: 'es2018' target: 'es2018'
}), }),
@ -81,11 +85,13 @@ export class TsBundle {
public getOptionsProduction(fromArg: string, toArg: string): plugins.rollup.RollupOptions { public getOptionsProduction(fromArg: string, toArg: string): plugins.rollup.RollupOptions {
const productionOptions = this.getBaseOptions(fromArg, toArg); const productionOptions = this.getBaseOptions(fromArg, toArg);
productionOptions.plugins.push(plugins.rollupTerser({ productionOptions.plugins.push(
plugins.rollupTerser({
compress: true, compress: true,
mangle: true, mangle: true,
sourcemap: true sourcemap: true
})); })
);
return productionOptions; return productionOptions;
} }