Compare commits

...

10 Commits

Author SHA1 Message Date
e9ca5147f3 1.0.67 2020-05-25 17:01:43 +00:00
b418ccd10a fix(core): update 2020-05-25 17:01:43 +00:00
eeeac6cb7f 1.0.66 2020-05-25 16:43:58 +00:00
c0d05bab7f fix(core): update 2020-05-25 16:43:58 +00:00
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
5 changed files with 586 additions and 307 deletions

799
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@gitzone/tsbundle", "name": "@gitzone/tsbundle",
"version": "1.0.62", "version": "1.0.67",
"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_ts/index.js", "main": "dist_ts/index.js",
@ -16,36 +16,36 @@
"tsbundle": "cli.js" "tsbundle": "cli.js"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.22", "@gitzone/tsbuild": "^2.1.24",
"@gitzone/tsrun": "^1.2.8", "@gitzone/tsrun": "^1.2.8",
"@gitzone/tstest": "^1.0.28", "@gitzone/tstest": "^1.0.28",
"@pushrocks/tapbundle": "^3.2.1", "@pushrocks/tapbundle": "^3.2.1",
"tslint": "^6.1.0", "tslint": "^6.1.2",
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@babel/core": "^7.8.7", "@babel/core": "^7.9.6",
"@babel/plugin-proposal-class-properties": "^7.8.3", "@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-decorators": "^7.8.3", "@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.8.3", "@babel/plugin-transform-runtime": "^7.9.6",
"@babel/preset-env": "^7.8.7", "@babel/preset-env": "^7.9.6",
"@babel/runtime": "^7.8.7", "@babel/runtime": "^7.9.6",
"@pushrocks/early": "^3.0.3", "@pushrocks/early": "^3.0.3",
"@pushrocks/smartcli": "^3.0.9", "@pushrocks/smartcli": "^3.0.11",
"@pushrocks/smartfile": "^7.0.11", "@pushrocks/smartfile": "^7.0.12",
"@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": "^12.0.0",
"@rollup/plugin-node-resolve": "^7.1.1", "@rollup/plugin-node-resolve": "^8.0.0",
"@rollup/plugin-typescript": "^4.0.0", "@rollup/plugin-typescript": "^4.1.2",
"@types/html-minifier": "^3.5.3", "@types/html-minifier": "^3.5.3",
"@types/node": "^13.9.1", "@types/node": "^14.0.5",
"html-minifier": "^4.0.0", "html-minifier": "^4.0.0",
"rollup": "^2.1.0", "rollup": "^2.10.9",
"rollup-plugin-babel": "^4.4.0", "rollup-plugin-babel": "^4.4.0",
"rollup-plugin-sourcemaps": "^0.5.0", "rollup-plugin-sourcemaps": "^0.6.2",
"rollup-plugin-terser": "^5.3.0", "rollup-plugin-terser": "^5.3.0",
"terser": "^4.6.7" "terser": "^4.7.0"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",

View File

@ -22,10 +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

@ -36,17 +36,14 @@ export class TsBundle {
noEmitOnError: true, noEmitOnError: true,
lib: ['esnext', 'dom', 'es2017.object'], lib: ['esnext', 'dom', 'es2017.object'],
noImplicitAny: false, noImplicitAny: false,
target: 'es2018' target: 'es2018',
allowSyntheticDefaultImports: true
}), }),
// Allow node_modules resolution, so you can use 'external' to control // Allow node_modules resolution, so you can use 'external' to control
// which external modules to include in the bundle // which external modules to include in the bundle
// https://github.com/rollup/rollup-plugin-node-resolve#usage // https://github.com/rollup/rollup-plugin-node-resolve#usage
plugins.rollupResolve(), plugins.rollupResolve(),
plugins.rollupCommonjs({ plugins.rollupCommonjs({}),
namedExports: {
'node_modules/@pushrocks/smartstate/dist/index.js': ['Smartstate']
}
}),
// Resolve source maps to the original source // Resolve source maps to the original source
plugins.rollupSourceMaps() plugins.rollupSourceMaps()

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