Compare commits

...

22 Commits

Author SHA1 Message Date
6f3aab9232 1.0.39 2019-08-26 16:32:26 +02:00
de60087146 fix(core): update 2019-08-26 16:32:26 +02:00
b1730c0cc6 1.0.38 2019-08-25 16:35:22 +02:00
b39c928b1e fix(core): update 2019-08-25 16:35:22 +02:00
0a211e804e 1.0.37 2019-07-19 12:09:00 +02:00
41a886cfcf fix(core): update 2019-07-19 12:09:00 +02:00
62ad70ac6c 1.0.36 2019-07-19 10:52:28 +02:00
455e33488d fix(core): update 2019-07-19 10:52:27 +02:00
1af1908e1d 1.0.35 2019-07-18 18:15:25 +02:00
31967ab846 fix(core): update 2019-07-18 18:15:24 +02:00
93fda3944a 1.0.34 2019-07-17 13:50:24 +02:00
d0ce17299a 1.0.33 2019-07-17 12:55:26 +02:00
1b0fa5b465 1.0.32 2019-07-17 12:40:40 +02:00
7a6f9d9569 fix(core): update 2019-07-17 12:40:40 +02:00
ebcf89520a 1.0.31 2019-07-17 12:22:25 +02:00
ca6ef86c8c fix(core): update 2019-07-17 12:22:24 +02:00
a98471e914 1.0.30 2019-07-17 12:01:02 +02:00
7755286aab fix(core): update 2019-07-17 12:01:02 +02:00
8f17a3c92a 1.0.29 2019-07-17 12:00:04 +02:00
65221425ca fix(core): update 2019-07-17 12:00:04 +02:00
0bc8048ac5 1.0.28 2019-07-17 11:54:50 +02:00
65754d34bc fix(core): update 2019-07-17 11:54:49 +02:00
10 changed files with 1062 additions and 2238 deletions

View File

@ -1,5 +1,7 @@
# gitzone ci_default
image: hosttoday/ht-docker-node:npmci
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
variables:
GIT_STRATEGY: clone
cache:
paths:
@ -38,19 +40,7 @@ snyk:
# test stage
# ====================
testLTS:
stage: test
script:
- npmci npm prepare
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
testSTABLE:
testStable:
stage: test
script:
- npmci npm prepare
@ -60,12 +50,24 @@ testSTABLE:
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- priv
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install lts
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
release:
stage: release
script:
- npmci node install stable
- npmci node install lts
- npmci npm publish
only:
- tags
@ -98,7 +100,9 @@ trigger:
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
image: hosttoday/ht-docker-dbase:npmci
services:
- docker:18-dind
stage: metadata
script:
- npmci command npm install -g @gitzone/tsdoc

4
.snyk Normal file
View File

@ -0,0 +1,4 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.13.5
ignore: {}
patch: {}

3117
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@gitzone/tsbundle",
"version": "1.0.27",
"version": "1.0.39",
"private": false,
"description": "a bundler using rollup for painless bundling of web projects",
"main": "dist/index.js",
@ -19,9 +19,9 @@
"@gitzone/tsbuild": "^2.1.11",
"@gitzone/tsrun": "^1.2.6",
"@gitzone/tstest": "^1.0.15",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^11.13.8",
"tslint": "^5.11.0",
"@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.6.6",
"tslint": "^5.19.0",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
@ -35,22 +35,23 @@
"@pushrocks/smartcli": "^3.0.7",
"@pushrocks/smartfile": "^7.0.2",
"@pushrocks/smartlog": "^2.0.19",
"@pushrocks/smartlog-destination-local": "^7.0.5",
"@pushrocks/smartlog-destination-local": "^8.0.2",
"@types/html-minifier": "^3.5.3",
"html-minifier": "^4.0.0",
"rollup": "^1.10.1",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup-plugin-commonjs": "^10.0.1",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-terser": "^5.0.0",
"rollup-plugin-typescript2": "^0.21.0"
"rollup-plugin-typescript2": "^0.22.0"
},
"files": [
"ts/*",
"ts_web/*",
"dist/*",
"dist_web/*",
"dist_ts_web/*",
"assets/*",
"cli.js",
"npmextra.json",

View File

@ -30,6 +30,6 @@ tsbundle will bundle modern JavaScript websites in an Google Bot conformant way
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://gitzone.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -10,3 +10,6 @@ early.stop();
if (process.env.CLI_CALL) {
runCli();
}
// lets make this usable programmatically
export * from './tsbundle.class.tsbundle';

View File

@ -2,49 +2,18 @@ import * as plugins from './tsbundle.plugins';
import { logger } from './tsbundle.logging';
export class TsBundle {
public optionsTest: plugins.rollup.RollupOptions = this.getBaseOptions();
public optionsProduction: plugins.rollup.RollupOptions = (() => {
const productionOptions = this.getBaseOptions();
productionOptions.plugins.push(plugins.rollupTerser());
return productionOptions;
})();
constructor() {}
/**
* creates a bundle for the test enviroment
*/
public async buildTest() {
// create a bundle
logger.log('info', `bundling for TEST!`);
const bundle = await plugins.rollup.rollup(this.optionsTest);
bundle.generate(this.optionsTest.output);
await bundle.write(this.optionsTest.output);
logger.log('ok', `Successfully bundled files!`);
}
/**
* creates a bundle for the production environment
*/
public async buildProduction() {
// create a bundle
logger.log('info', `bundling for PRODUCTION!`);
const bundle = await plugins.rollup.rollup(this.optionsProduction);
bundle.generate(this.optionsProduction.output);
await bundle.write(this.optionsProduction.output);
logger.log('ok', `Successfully bundled files!`);
}
/**
* the basic default options for rollup
*/
public getBaseOptions() {
public getBaseOptions(fromArg: string = `ts_web/index.ts`, toArg: string = 'dist_web/bundle.js') {
logger.log('info', `from: ${fromArg}`);
logger.log('info', `to: ${toArg}`);
const baseOptions: plugins.rollup.RollupOptions = {
input: `ts_web/index.ts`,
input: fromArg,
output: {
name: 'tsbundle',
// file: 'dist_web/bundle.js',
file: 'dist_web/bundle.js',
file: toArg,
format: 'iife',
sourcemap: true
},
@ -81,8 +50,8 @@ export class TsBundle {
}),
// Resolve source maps to the original source
plugins.rollupSourceMaps(),
plugins.rollupBabel({
plugins.rollupSourceMaps()
/*plugins.rollupBabel({
runtimeHelpers: true,
extensions: ['.js', '.jsx', '.ts', '.tsx'],
babelrc: false,
@ -105,9 +74,49 @@ export class TsBundle {
}
]
]
})
})*/
]
};
return baseOptions;
}
public getOptionsTest(fromArg: string, toArg: string): plugins.rollup.RollupOptions {
return this.getBaseOptions(fromArg, toArg);
}
public getOptionsProduction(fromArg: string, toArg: string): plugins.rollup.RollupOptions {
const productionOptions = this.getBaseOptions(fromArg, toArg);
productionOptions.plugins.push(plugins.rollupTerser());
return productionOptions;
}
constructor() {
// Nothing here
}
/**
* creates a bundle for the test enviroment
*/
public async buildTest(fromArg: string, toArg: string) {
// create a bundle
logger.log('info', `bundling for TEST!`);
const buildOptions = this.getOptionsTest(fromArg, toArg);
const bundle = await plugins.rollup.rollup(buildOptions);
bundle.generate(buildOptions.output);
await bundle.write(buildOptions.output);
logger.log('ok', `Successfully bundled files!`);
}
/**
* creates a bundle for the production environment
*/
public async buildProduction(fromArg: string, toArg: string) {
// create a bundle
logger.log('info', `bundling for PRODUCTION!`);
const buildOptions = this.getOptionsProduction(fromArg, toArg);
const bundle = await plugins.rollup.rollup(buildOptions);
bundle.generate(buildOptions.output);
await bundle.write(buildOptions.output);
logger.log('ok', `Successfully bundled files!`);
}
}

View File

@ -9,13 +9,13 @@ export const runCli = async () => {
const tsbundle = new TsBundle();
const htmlHandler = new HtmlHandler();
switch (true) {
case (argvArg.production) || process.env.CI:
await tsbundle.buildProduction();
case argvArg.production || process.env.CI:
await tsbundle.buildProduction(argvArg.from, argvArg.to);
await htmlHandler.minifyHtml();
break;
case argvArg.test:
default:
await tsbundle.buildTest();
await tsbundle.buildTest(argvArg.from, argvArg.to);
await htmlHandler.copyHtml();
return;
}

View File

@ -5,16 +5,23 @@ export class HtmlHandler {
public sourceFilePath: string = plugins.path.join(paths.htmlDir, 'index.html');
public targetFilePath: string = plugins.path.join(paths.distWebDir, 'index.html');
public async checkIfExists() {
return plugins.smartfile.fs.fileExists(this.sourceFilePath);
}
// copies the html
public async copyHtml() {
await plugins.smartfile.fs.copy(
this.sourceFilePath,
this.targetFilePath
);
if (!(await this.checkIfExists())) {
return;
}
await plugins.smartfile.fs.copy(this.sourceFilePath, this.targetFilePath);
}
// copies and minifies the html
public async minifyHtml() {
if (!(await this.checkIfExists())) {
return;
}
const fileString = plugins.smartfile.fs.toStringSync(this.sourceFilePath);
const minifiedHtml = plugins.htmlMinifier.minify(fileString, {
minifyCSS: true,
@ -24,9 +31,8 @@ export class HtmlHandler {
removeAttributeQuotes: true,
collapseWhitespace: true,
collapseInlineTagWhitespace: true,
removeComments: true
removeComments: true
});
plugins.smartfile.memory.toFsSync(minifiedHtml, this.targetFilePath);
}
}
}

View File

@ -1,9 +1,7 @@
// node native
import * as path from 'path';
export {
path
};
export { path };
// pushrocks scope
import * as smartcli from '@pushrocks/smartcli';