Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
eeeac6cb7f | |||
c0d05bab7f | |||
0cceb23987 | |||
1b91c7a46c | |||
bd9ec3b313 | |||
ada2ae72ee | |||
ceaabe35c8 | |||
0b0c36da1b | |||
3a53cd5405 | |||
623438e1d1 | |||
8bf19d55c7 | |||
b1952365bc | |||
753225053b | |||
715b7a89ad | |||
166dd28ad3 | |||
ca039552ba |
@ -24,13 +24,14 @@ mirror:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
snyk:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk
|
||||
audit:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- 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:
|
||||
- lossless
|
||||
- docker
|
||||
|
2
cli.js
2
cli.js
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
process.env.CLI_CALL = 'true';
|
||||
const cliTool = require('./dist/index');
|
||||
const cliTool = require('./dist_ts/index');
|
||||
cliTool.runCli();
|
||||
|
40
package-lock.json
generated
40
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@gitzone/tsbundle",
|
||||
"version": "1.0.58",
|
||||
"version": "1.0.66",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -854,9 +854,9 @@
|
||||
}
|
||||
},
|
||||
"@gitzone/tsbuild": {
|
||||
"version": "2.1.20",
|
||||
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.20.tgz",
|
||||
"integrity": "sha512-st/PkULIw6ZSuqIBJPRY7/ioHNb98RSWuLPxA3irunAUmd/5LZm04+WyT8bL6ubc/0yKogxSxUbYuYm3VurNfA==",
|
||||
"version": "2.1.22",
|
||||
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.22.tgz",
|
||||
"integrity": "sha512-2rSRo2STq3wKKcKF/uKWh75vz4kA1dc/JT7ihfMZmEVlHMUKCj7oA1djaPI+K4MvKKWP7e1r+PVE2HaZdtqHDA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/smartcli": "^3.0.7",
|
||||
@ -1013,9 +1013,9 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartfile": {
|
||||
"version": "7.0.9",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.9.tgz",
|
||||
"integrity": "sha512-DDRoHZxD8do4UVVYRBoGUdQXPQEFhgpZG7lCvr4FUYaBaU/R5zW23AUtUEgednW4SCbEESg4mBtKDyTpmlr/3g==",
|
||||
"version": "7.0.11",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.11.tgz",
|
||||
"integrity": "sha512-vY5V+6rEfXa481icwGlWh6iPxk6a9VNtrEPF7aELVOfJYEHJS2GoZat3pLayy2Ab3UP6QV9eImx9UtI1ksfYhw==",
|
||||
"requires": {
|
||||
"@pushrocks/smarthash": "^2.1.6",
|
||||
"@pushrocks/smartmime": "^1.0.3",
|
||||
@ -1223,14 +1223,14 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/tapbundle": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.2.0.tgz",
|
||||
"integrity": "sha512-xnKIGe7NJqxWBaFeKIEXShDjV2wap1XJqmlp3m1MKqmIF62vRpZnkzpyE1ZAoNwiYQmIsXIpvP/PDv+iPevPfw==",
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.2.1.tgz",
|
||||
"integrity": "sha512-D3o205SE+Viu8sukm+6CvGkXEwOiQiEEcga9eWyvjWS4vDx6FWwrO0pNZkQq6GqsKQ9xRpCmBtI7F3KsJR0+PA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/early": "^3.0.3",
|
||||
"@pushrocks/smartdelay": "^2.0.3",
|
||||
"@pushrocks/smartfile": "^7.0.6",
|
||||
"@pushrocks/smartfile": "^7.0.9",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"smartchai": "^2.0.1"
|
||||
},
|
||||
@ -1285,9 +1285,9 @@
|
||||
}
|
||||
},
|
||||
"@types/chai": {
|
||||
"version": "4.2.10",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.10.tgz",
|
||||
"integrity": "sha512-TlWWgb21+0LdkuFqEqfmy7NEgfB/7Jjux15fWQAh3P93gbmXuwTM/vxEdzW89APIcI2BgKR48yjeAkdeH+4qvQ==",
|
||||
"version": "4.2.11",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.11.tgz",
|
||||
"integrity": "sha512-t7uW6eFafjO+qJ3BIV2gGUyZs27egcNRkUdalkud+Qa3+kg//f129iuOFivHDXQ+vnU3fDXuwgv0cqMCbcE8sw==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/chai-as-promised": {
|
||||
@ -2463,9 +2463,9 @@
|
||||
}
|
||||
},
|
||||
"rollup": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://verdaccio.lossless.one/rollup/-/rollup-2.0.6.tgz",
|
||||
"integrity": "sha512-P42IlI6a/bxh52ed8hEXXe44LcHfep2f26OZybMJPN1TTQftibvQEl3CWeOmJrzqGbFxOA000QXDWO9WJaOQpA==",
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/rollup/-/rollup-2.1.0.tgz",
|
||||
"integrity": "sha512-gfE1455AEazVVTJoeQtcOq/U6GSxwoj4XPSWVsuWmgIxj7sBQNLDOSA82PbdMe+cP8ql8fR1jogPFe8Wg8g4SQ==",
|
||||
"requires": {
|
||||
"fsevents": "~2.1.2"
|
||||
}
|
||||
@ -2666,9 +2666,9 @@
|
||||
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="
|
||||
},
|
||||
"terser": {
|
||||
"version": "4.6.6",
|
||||
"resolved": "https://verdaccio.lossless.one/terser/-/terser-4.6.6.tgz",
|
||||
"integrity": "sha512-4lYPyeNmstjIIESr/ysHg2vUPRGf2tzF9z2yYwnowXVuVzLEamPN1Gfrz7f8I9uEPuHcbFlW4PLIAsJoxXyJ1g==",
|
||||
"version": "4.6.7",
|
||||
"resolved": "https://verdaccio.lossless.one/terser/-/terser-4.6.7.tgz",
|
||||
"integrity": "sha512-fmr7M1f7DBly5cX2+rFDvmGBAaaZyPrHYK4mMdHEDAdNTqXSZgSOfqsfGq2HqPGT/1V0foZZuCZFx8CHKgAk3g==",
|
||||
"requires": {
|
||||
"commander": "^2.20.0",
|
||||
"source-map": "~0.6.1",
|
||||
|
16
package.json
16
package.json
@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "@gitzone/tsbundle",
|
||||
"version": "1.0.58",
|
||||
"version": "1.0.66",
|
||||
"private": false,
|
||||
"description": "a bundler using rollup for painless bundling of web projects",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"author": "Lossless GmbH",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
@ -16,10 +16,10 @@
|
||||
"tsbundle": "cli.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.20",
|
||||
"@gitzone/tsbuild": "^2.1.22",
|
||||
"@gitzone/tsrun": "^1.2.8",
|
||||
"@gitzone/tstest": "^1.0.28",
|
||||
"@pushrocks/tapbundle": "^3.2.0",
|
||||
"@pushrocks/tapbundle": "^3.2.1",
|
||||
"tslint": "^6.1.0",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
@ -32,7 +32,7 @@
|
||||
"@babel/runtime": "^7.8.7",
|
||||
"@pushrocks/early": "^3.0.3",
|
||||
"@pushrocks/smartcli": "^3.0.9",
|
||||
"@pushrocks/smartfile": "^7.0.9",
|
||||
"@pushrocks/smartfile": "^7.0.11",
|
||||
"@pushrocks/smartlog": "^2.0.21",
|
||||
"@pushrocks/smartlog-destination-local": "^8.0.2",
|
||||
"@rollup/plugin-commonjs": "^11.0.2",
|
||||
@ -41,11 +41,11 @@
|
||||
"@types/html-minifier": "^3.5.3",
|
||||
"@types/node": "^13.9.1",
|
||||
"html-minifier": "^4.0.0",
|
||||
"rollup": "^2.0.6",
|
||||
"rollup": "^2.1.0",
|
||||
"rollup-plugin-babel": "^4.4.0",
|
||||
"rollup-plugin-sourcemaps": "^0.5.0",
|
||||
"rollup-plugin-terser": "^5.3.0",
|
||||
"terser": "^4.6.6"
|
||||
"terser": "^4.6.7"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
|
36
readme.md
36
readme.md
@ -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.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
tsbundle supports two modes of usage: CLI and API usage.
|
||||
|
||||
[](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
|
||||
|
||||
|
@ -28,6 +28,7 @@ export class TsBundle {
|
||||
plugins: [
|
||||
// Compile TypeScript files
|
||||
plugins.rollupTypescript({
|
||||
include: plugins.path.parse(fromArg).dir ? plugins.path.parse(fromArg).dir + '/**/*.ts' : '**/*.ts',
|
||||
declaration: false,
|
||||
emitDecoratorMetadata: true,
|
||||
experimentalDecorators: true,
|
||||
@ -35,7 +36,8 @@ export class TsBundle {
|
||||
noEmitOnError: true,
|
||||
lib: ['esnext', 'dom', 'es2017.object'],
|
||||
noImplicitAny: false,
|
||||
target: 'es2018'
|
||||
target: 'es2018',
|
||||
allowSyntheticDefaultImports: true
|
||||
}),
|
||||
// Allow node_modules resolution, so you can use 'external' to control
|
||||
// which external modules to include in the bundle
|
||||
|
@ -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 => {
|
||||
const tsbundle = new TsBundle();
|
||||
const htmlHandler = new HtmlHandler();
|
||||
|
Reference in New Issue
Block a user