Compare commits

...

14 Commits

Author SHA1 Message Date
0cceb23987 1.0.65 2020-05-25 16:40:34 +00:00
1b91c7a46c fix(core): update 2020-05-25 16:40:33 +00:00
bd9ec3b313 1.0.64 2020-05-25 16:29:23 +00:00
ada2ae72ee fix(core): update 2020-05-25 16:29:22 +00:00
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
7 changed files with 83 additions and 35 deletions

View File

@ -24,13 +24,14 @@ mirror:
- docker - docker
- notpriv - notpriv
snyk: audit:
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk 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 --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 - lossless
- docker - docker

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();

40
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@gitzone/tsbundle", "name": "@gitzone/tsbundle",
"version": "1.0.58", "version": "1.0.65",
"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.58", "version": "1.0.65",
"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,11 +41,11 @@
"@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/**/*",

View File

@ -22,11 +22,41 @@ 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 ## Contribution

View File

@ -28,6 +28,7 @@ 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,

View File

@ -37,6 +37,22 @@ export const runCli = async () => {
} }
}); });
tsBundleCli.addCommand('npm').subscribe(async argvArg => {
const tsbundle = new TsBundle();
// const htmlHandler = new HtmlHandler();
switch (true) {
case argvArg.production || process.env.CI:
await tsbundle.buildProduction('./ts/index.ts', './dist_bundle/bundle.js');
// await htmlHandler.minifyHtml();
break;
case argvArg.test:
default:
await tsbundle.buildTest('./ts/index.ts', './dist_bundle/bundle.js');
// await htmlHandler.copyHtml();
return;
}
});
tsBundleCli.addCommand('website').subscribe(async argvArg => { tsBundleCli.addCommand('website').subscribe(async argvArg => {
const tsbundle = new TsBundle(); const tsbundle = new TsBundle();
const htmlHandler = new HtmlHandler(); const htmlHandler = new HtmlHandler();