Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
ebcf89520a | |||
ca6ef86c8c | |||
a98471e914 | |||
7755286aab | |||
8f17a3c92a | |||
65221425ca | |||
0bc8048ac5 | |||
65754d34bc | |||
c4a276ebf3 | |||
3db075b795 | |||
f90f391e87 | |||
31d886a48a |
@ -1,5 +1,5 @@
|
|||||||
# gitzone ci_default
|
# gitzone ci_default
|
||||||
image: hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
@ -49,14 +49,14 @@ testLTS:
|
|||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
|
|
||||||
testSTABLE:
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci node install stable
|
- npmci node install lts
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci command npm run build
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
@ -65,7 +65,7 @@ testSTABLE:
|
|||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
script:
|
script:
|
||||||
- npmci node install stable
|
- npmci node install lts
|
||||||
- npmci npm publish
|
- npmci npm publish
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
|
4
.snyk
Normal file
4
.snyk
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
||||||
|
version: v1.13.5
|
||||||
|
ignore: {}
|
||||||
|
patch: {}
|
3062
package-lock.json
generated
3062
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@gitzone/tsbundle",
|
"name": "@gitzone/tsbundle",
|
||||||
"version": "1.0.25",
|
"version": "1.0.31",
|
||||||
"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/index.js",
|
||||||
@ -20,7 +20,7 @@
|
|||||||
"@gitzone/tsrun": "^1.2.6",
|
"@gitzone/tsrun": "^1.2.6",
|
||||||
"@gitzone/tstest": "^1.0.15",
|
"@gitzone/tstest": "^1.0.15",
|
||||||
"@pushrocks/tapbundle": "^3.0.7",
|
"@pushrocks/tapbundle": "^3.0.7",
|
||||||
"@types/node": "^11.13.8",
|
"@types/node": "^12.6.6",
|
||||||
"tslint": "^5.11.0",
|
"tslint": "^5.11.0",
|
||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.15.0"
|
||||||
},
|
},
|
||||||
@ -35,16 +35,16 @@
|
|||||||
"@pushrocks/smartcli": "^3.0.7",
|
"@pushrocks/smartcli": "^3.0.7",
|
||||||
"@pushrocks/smartfile": "^7.0.2",
|
"@pushrocks/smartfile": "^7.0.2",
|
||||||
"@pushrocks/smartlog": "^2.0.19",
|
"@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",
|
"@types/html-minifier": "^3.5.3",
|
||||||
"html-minifier": "^4.0.0",
|
"html-minifier": "^4.0.0",
|
||||||
"rollup": "^1.10.1",
|
"rollup": "^1.10.1",
|
||||||
"rollup-plugin-babel": "^4.3.2",
|
"rollup-plugin-babel": "^4.3.2",
|
||||||
"rollup-plugin-commonjs": "^9.3.4",
|
"rollup-plugin-commonjs": "^10.0.1",
|
||||||
"rollup-plugin-node-resolve": "^4.2.3",
|
"rollup-plugin-node-resolve": "^5.2.0",
|
||||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||||
"rollup-plugin-terser": "^5.0.0",
|
"rollup-plugin-terser": "^5.0.0",
|
||||||
"rollup-plugin-typescript2": "^0.21.0"
|
"rollup-plugin-typescript2": "^0.22.0"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/*",
|
"ts/*",
|
||||||
|
@ -19,7 +19,7 @@ export class TsBundle {
|
|||||||
logger.log('info', `bundling for TEST!`);
|
logger.log('info', `bundling for TEST!`);
|
||||||
const bundle = await plugins.rollup.rollup(this.optionsTest);
|
const bundle = await plugins.rollup.rollup(this.optionsTest);
|
||||||
bundle.generate(this.optionsTest.output);
|
bundle.generate(this.optionsTest.output);
|
||||||
bundle.write(this.optionsTest.output);
|
await bundle.write(this.optionsTest.output);
|
||||||
logger.log('ok', `Successfully bundled files!`);
|
logger.log('ok', `Successfully bundled files!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ export class TsBundle {
|
|||||||
logger.log('info', `bundling for PRODUCTION!`);
|
logger.log('info', `bundling for PRODUCTION!`);
|
||||||
const bundle = await plugins.rollup.rollup(this.optionsProduction);
|
const bundle = await plugins.rollup.rollup(this.optionsProduction);
|
||||||
bundle.generate(this.optionsProduction.output);
|
bundle.generate(this.optionsProduction.output);
|
||||||
bundle.write(this.optionsProduction.output);
|
await bundle.write(this.optionsProduction.output);
|
||||||
logger.log('ok', `Successfully bundled files!`);
|
logger.log('ok', `Successfully bundled files!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,16 +9,14 @@ export const runCli = async () => {
|
|||||||
const tsbundle = new TsBundle();
|
const tsbundle = new TsBundle();
|
||||||
const htmlHandler = new HtmlHandler();
|
const htmlHandler = new HtmlHandler();
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case argvArg.production:
|
case argvArg.production || process.env.CI:
|
||||||
await tsbundle.buildProduction();
|
await tsbundle.buildProduction();
|
||||||
await htmlHandler.minifyHtml();
|
await htmlHandler.minifyHtml();
|
||||||
break;
|
break;
|
||||||
case argvArg.test:
|
case argvArg.test:
|
||||||
|
default:
|
||||||
await tsbundle.buildTest();
|
await tsbundle.buildTest();
|
||||||
await htmlHandler.copyHtml();
|
await htmlHandler.copyHtml();
|
||||||
break;
|
|
||||||
default:
|
|
||||||
logger.log('error', `Can not determine build target environement. Please specify via --production or --test`)
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -5,24 +5,34 @@ export class HtmlHandler {
|
|||||||
public sourceFilePath: string = plugins.path.join(paths.htmlDir, 'index.html');
|
public sourceFilePath: string = plugins.path.join(paths.htmlDir, 'index.html');
|
||||||
public targetFilePath: string = plugins.path.join(paths.distWebDir, '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
|
// copies the html
|
||||||
public async copyHtml() {
|
public async copyHtml() {
|
||||||
await plugins.smartfile.fs.copy(
|
if (!(await this.checkIfExists)) {
|
||||||
this.sourceFilePath,
|
return;
|
||||||
this.targetFilePath
|
}
|
||||||
);
|
await plugins.smartfile.fs.copy(this.sourceFilePath, this.targetFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copies and minifies the html
|
// copies and minifies the html
|
||||||
public async minifyHtml() {
|
public async minifyHtml() {
|
||||||
|
if (!(await this.checkIfExists)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const fileString = plugins.smartfile.fs.toStringSync(this.sourceFilePath);
|
const fileString = plugins.smartfile.fs.toStringSync(this.sourceFilePath);
|
||||||
const minifiedHtml = plugins.htmlMinifier.minify(fileString, {
|
const minifiedHtml = plugins.htmlMinifier.minify(fileString, {
|
||||||
minifyCSS: true,
|
minifyCSS: true,
|
||||||
minifyJS: true,
|
minifyJS: true,
|
||||||
sortAttributes: true,
|
sortAttributes: true,
|
||||||
sortClassName: true,
|
sortClassName: true,
|
||||||
removeAttributeQuotes: true
|
removeAttributeQuotes: true,
|
||||||
|
collapseWhitespace: true,
|
||||||
|
collapseInlineTagWhitespace: true,
|
||||||
|
removeComments: true
|
||||||
});
|
});
|
||||||
plugins.smartfile.memory.toFsSync(minifiedHtml, this.targetFilePath);
|
plugins.smartfile.memory.toFsSync(minifiedHtml, this.targetFilePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
// node native
|
// node native
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export {
|
export { path };
|
||||||
path
|
|
||||||
};
|
|
||||||
|
|
||||||
// pushrocks scope
|
// pushrocks scope
|
||||||
import * as smartcli from '@pushrocks/smartcli';
|
import * as smartcli from '@pushrocks/smartcli';
|
||||||
|
Reference in New Issue
Block a user