fix(core): update

This commit is contained in:
Philipp Kunz 2022-03-18 15:46:11 +01:00
parent d6d1b063af
commit 1530f0ad74
9 changed files with 101 additions and 187 deletions

181
package-lock.json generated
View File

@ -42,9 +42,9 @@
"tsbundle": "cli.js"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.56",
"@gitzone/tsbuild": "^2.1.59",
"@gitzone/tsrun": "^1.2.31",
"@gitzone/tstest": "^1.0.67",
"@gitzone/tstest": "^1.0.69",
"@pushrocks/tapbundle": "^5.0.2",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
@ -1747,13 +1747,14 @@
}
},
"node_modules/@gitzone/tsbuild": {
"version": "2.1.56",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.56.tgz",
"integrity": "sha512-kqdevz61PeD3pmxQbTt1FU8bN7Vc7OIxlc7V8WXrWhhCDdA5yTqj42yC1sZA1w6a1QIh9rPTyaiEtNfUqQjBlw==",
"version": "2.1.59",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.59.tgz",
"integrity": "sha512-x0ava10YA7ue+P+5vJOy8zn6u9Kal/6uVGd83/j0fqJFxg5k5iPyotQaXAuHNKLZ+DDLK8ljl3yvUat0pjRobw==",
"license": "MIT",
"dependencies": {
"@pushrocks/early": "^3.0.6",
"@pushrocks/smartcli": "^3.0.14",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartfile": "^9.0.6",
"@pushrocks/smartlog": "^2.0.44",
"@pushrocks/smartpath": "^5.0.4",
@ -1765,24 +1766,25 @@
}
},
"node_modules/@gitzone/tsbundle": {
"version": "1.0.91",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbundle/-/tsbundle-1.0.91.tgz",
"integrity": "sha512-J4RcXcinkIlY6d2jbgAXasczr9UhTm9+MZhajnanUMFb6jAGc9a0exaPruCblGPSEnDZ3lBs4iLLUN93dglXRw==",
"version": "1.0.99",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbundle/-/tsbundle-1.0.99.tgz",
"integrity": "sha512-pF16inMC4ENR/F/8yrGkiyI/Hr3OWlShGIJdHeK9DwvdryMa/JF8JQZwKHsL0cxFA6GLyN/bcqoqxso3O+VT/g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/core": "^7.17.5",
"@babel/core": "^7.17.7",
"@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-proposal-decorators": "^7.17.2",
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11",
"@babel/runtime": "^7.17.2",
"@babel/runtime": "^7.17.7",
"@pushrocks/early": "^3.0.6",
"@pushrocks/smartcli": "^3.0.14",
"@pushrocks/smartfile": "^9.0.5",
"@pushrocks/smartfile": "^9.0.6",
"@pushrocks/smartlog": "^2.0.44",
"@pushrocks/smartlog-destination-local": "^8.0.8",
"@pushrocks/smartparcel": "^1.0.13",
"@pushrocks/smartpath": "^5.0.5",
"@pushrocks/smartpromise": "^3.1.7",
"@pushrocks/smartspawn": "^2.0.9",
"@rollup/plugin-commonjs": "^21.0.2",
@ -1791,12 +1793,13 @@
"@rollup/plugin-typescript": "^8.3.1",
"@types/html-minifier": "^4.0.2",
"@types/node": "^17.0.21",
"esbuild": "^0.14.27",
"html-minifier": "^4.0.0",
"rollup": "^2.70.0",
"rollup": "^2.70.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-terser": "^7.0.2",
"typescript": "^4.6.2"
"typescript": "4.7.0"
},
"bin": {
"tsbundle": "cli.js"
@ -1819,13 +1822,13 @@
}
},
"node_modules/@gitzone/tstest": {
"version": "1.0.67",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.67.tgz",
"integrity": "sha512-szaUuDa5RR4ErPObjB036ZKKNy35vEtpnANnbE1WFuqazjUlBN2GniOMWY8SULDryefrWCyaIbDAOJjtk62vNw==",
"version": "1.0.69",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.69.tgz",
"integrity": "sha512-rfD31jhlZw3TkT8yb+EluMkVngftyG380fRrnnijlVjWvo2jI0fCwl+GzaOaLRZRZgUMm8aZLJI31in3L8upOw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@gitzone/tsbundle": "^1.0.91",
"@gitzone/tsbundle": "^1.0.99",
"@gitzone/tsrun": "^1.2.31",
"@pushrocks/consolecolor": "^2.0.1",
"@pushrocks/smartbrowser": "^1.0.22",
@ -1835,7 +1838,7 @@
"@pushrocks/smartlog": "^2.0.44",
"@pushrocks/smartpromise": "^3.1.7",
"@pushrocks/smartshell": "^2.0.30",
"@pushrocks/tapbundle": "^4.0.8",
"@pushrocks/tapbundle": "^5.0.2",
"@types/figures": "^3.0.1",
"figures": "^4.0.0"
},
@ -1843,61 +1846,6 @@
"tstest": "cli.js"
}
},
"node_modules/@gitzone/tstest/node_modules/@open-wc/scoped-elements": {
"version": "1.3.4",
"resolved": "https://verdaccio.lossless.one/@open-wc%2fscoped-elements/-/scoped-elements-1.3.4.tgz",
"integrity": "sha512-WD+ObocdzcFCpBxnc8bQa7NoATeA+tJrK0/c/yV1Nx4leV+1PmJNNu+WCcuckBEGd0Op6FP8w1TidoqmVVba6g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@open-wc/dedupe-mixin": "^1.3.0",
"lit-html": "^1.0.0"
}
},
"node_modules/@gitzone/tstest/node_modules/@open-wc/testing-helpers": {
"version": "1.8.12",
"resolved": "https://verdaccio.lossless.one/@open-wc%2ftesting-helpers/-/testing-helpers-1.8.12.tgz",
"integrity": "sha512-+4exEHYvnFqI1RGDDIKFHPZ7Ws5NK1epvEku3zLaOYN3zc+huX19SndNc5+X++v8A+quN/iXbHlh80ROyNaYDA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@open-wc/scoped-elements": "^1.2.4",
"lit-element": "^2.2.1",
"lit-html": "^1.0.0"
}
},
"node_modules/@gitzone/tstest/node_modules/@pushrocks/tapbundle": {
"version": "4.0.8",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-4.0.8.tgz",
"integrity": "sha512-iQFmsVuq4N9vN9YE/MbGnhEKDzlKSL8CwSzC2NBI60O8mEXE+QS5uJUbBbCPm/Rh3zHCZxfjXfC0w2V46asIiQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@open-wc/testing-helpers": "^1.8.12",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartenv": "^4.0.16",
"@pushrocks/smartexpect": "^1.0.12",
"@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smarttime": "^3.0.45"
}
},
"node_modules/@gitzone/tstest/node_modules/lit-element": {
"version": "2.5.1",
"resolved": "https://verdaccio.lossless.one/lit-element/-/lit-element-2.5.1.tgz",
"integrity": "sha512-ogu7PiJTA33bEK0xGu1dmaX5vhcRjBXCFexPja0e7P7jqLhTpNKYRPmE+GmiCaRVAbiQKGkUgkh/i6+bh++dPQ==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"lit-html": "^1.1.1"
}
},
"node_modules/@gitzone/tstest/node_modules/lit-html": {
"version": "1.4.1",
"resolved": "https://verdaccio.lossless.one/lit-html/-/lit-html-1.4.1.tgz",
"integrity": "sha512-B9btcSgPYb1q4oSOb/PrOT6Z/H+r6xuNzfH4lFli/AWhYwdtrgQkQWBbIc6mdnf6E2IL3gDXdkkqNktpU0OZQA==",
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/@jridgewell/resolve-uri": {
"version": "3.0.5",
"resolved": "https://verdaccio.lossless.one/@jridgewell%2fresolve-uri/-/resolve-uri-3.0.5.tgz",
@ -11880,12 +11828,13 @@
}
},
"@gitzone/tsbuild": {
"version": "2.1.56",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.56.tgz",
"integrity": "sha512-kqdevz61PeD3pmxQbTt1FU8bN7Vc7OIxlc7V8WXrWhhCDdA5yTqj42yC1sZA1w6a1QIh9rPTyaiEtNfUqQjBlw==",
"version": "2.1.59",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.59.tgz",
"integrity": "sha512-x0ava10YA7ue+P+5vJOy8zn6u9Kal/6uVGd83/j0fqJFxg5k5iPyotQaXAuHNKLZ+DDLK8ljl3yvUat0pjRobw==",
"requires": {
"@pushrocks/early": "^3.0.6",
"@pushrocks/smartcli": "^3.0.14",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartfile": "^9.0.6",
"@pushrocks/smartlog": "^2.0.44",
"@pushrocks/smartpath": "^5.0.4",
@ -11894,23 +11843,24 @@
}
},
"@gitzone/tsbundle": {
"version": "1.0.91",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbundle/-/tsbundle-1.0.91.tgz",
"integrity": "sha512-J4RcXcinkIlY6d2jbgAXasczr9UhTm9+MZhajnanUMFb6jAGc9a0exaPruCblGPSEnDZ3lBs4iLLUN93dglXRw==",
"version": "1.0.99",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbundle/-/tsbundle-1.0.99.tgz",
"integrity": "sha512-pF16inMC4ENR/F/8yrGkiyI/Hr3OWlShGIJdHeK9DwvdryMa/JF8JQZwKHsL0cxFA6GLyN/bcqoqxso3O+VT/g==",
"dev": true,
"requires": {
"@babel/core": "^7.17.5",
"@babel/core": "^7.17.7",
"@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-proposal-decorators": "^7.17.2",
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11",
"@babel/runtime": "^7.17.2",
"@babel/runtime": "^7.17.7",
"@pushrocks/early": "^3.0.6",
"@pushrocks/smartcli": "^3.0.14",
"@pushrocks/smartfile": "^9.0.5",
"@pushrocks/smartfile": "^9.0.6",
"@pushrocks/smartlog": "^2.0.44",
"@pushrocks/smartlog-destination-local": "^8.0.8",
"@pushrocks/smartparcel": "^1.0.13",
"@pushrocks/smartpath": "^5.0.5",
"@pushrocks/smartpromise": "^3.1.7",
"@pushrocks/smartspawn": "^2.0.9",
"@rollup/plugin-commonjs": "^21.0.2",
@ -11919,12 +11869,13 @@
"@rollup/plugin-typescript": "^8.3.1",
"@types/html-minifier": "^4.0.2",
"@types/node": "^17.0.21",
"esbuild": "^0.14.27",
"html-minifier": "^4.0.0",
"rollup": "^2.70.0",
"rollup": "^2.70.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-terser": "^7.0.2",
"typescript": "^4.6.2"
"typescript": "4.7.0"
}
},
"@gitzone/tsrun": {
@ -11940,12 +11891,12 @@
}
},
"@gitzone/tstest": {
"version": "1.0.67",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.67.tgz",
"integrity": "sha512-szaUuDa5RR4ErPObjB036ZKKNy35vEtpnANnbE1WFuqazjUlBN2GniOMWY8SULDryefrWCyaIbDAOJjtk62vNw==",
"version": "1.0.69",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.69.tgz",
"integrity": "sha512-rfD31jhlZw3TkT8yb+EluMkVngftyG380fRrnnijlVjWvo2jI0fCwl+GzaOaLRZRZgUMm8aZLJI31in3L8upOw==",
"dev": true,
"requires": {
"@gitzone/tsbundle": "^1.0.91",
"@gitzone/tsbundle": "^1.0.99",
"@gitzone/tsrun": "^1.2.31",
"@pushrocks/consolecolor": "^2.0.1",
"@pushrocks/smartbrowser": "^1.0.22",
@ -11955,61 +11906,9 @@
"@pushrocks/smartlog": "^2.0.44",
"@pushrocks/smartpromise": "^3.1.7",
"@pushrocks/smartshell": "^2.0.30",
"@pushrocks/tapbundle": "^4.0.8",
"@pushrocks/tapbundle": "^5.0.2",
"@types/figures": "^3.0.1",
"figures": "^4.0.0"
},
"dependencies": {
"@open-wc/scoped-elements": {
"version": "1.3.4",
"resolved": "https://verdaccio.lossless.one/@open-wc%2fscoped-elements/-/scoped-elements-1.3.4.tgz",
"integrity": "sha512-WD+ObocdzcFCpBxnc8bQa7NoATeA+tJrK0/c/yV1Nx4leV+1PmJNNu+WCcuckBEGd0Op6FP8w1TidoqmVVba6g==",
"dev": true,
"requires": {
"@open-wc/dedupe-mixin": "^1.3.0",
"lit-html": "^1.0.0"
}
},
"@open-wc/testing-helpers": {
"version": "1.8.12",
"resolved": "https://verdaccio.lossless.one/@open-wc%2ftesting-helpers/-/testing-helpers-1.8.12.tgz",
"integrity": "sha512-+4exEHYvnFqI1RGDDIKFHPZ7Ws5NK1epvEku3zLaOYN3zc+huX19SndNc5+X++v8A+quN/iXbHlh80ROyNaYDA==",
"dev": true,
"requires": {
"@open-wc/scoped-elements": "^1.2.4",
"lit-element": "^2.2.1",
"lit-html": "^1.0.0"
}
},
"@pushrocks/tapbundle": {
"version": "4.0.8",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-4.0.8.tgz",
"integrity": "sha512-iQFmsVuq4N9vN9YE/MbGnhEKDzlKSL8CwSzC2NBI60O8mEXE+QS5uJUbBbCPm/Rh3zHCZxfjXfC0w2V46asIiQ==",
"dev": true,
"requires": {
"@open-wc/testing-helpers": "^1.8.12",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartenv": "^4.0.16",
"@pushrocks/smartexpect": "^1.0.12",
"@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smarttime": "^3.0.45"
}
},
"lit-element": {
"version": "2.5.1",
"resolved": "https://verdaccio.lossless.one/lit-element/-/lit-element-2.5.1.tgz",
"integrity": "sha512-ogu7PiJTA33bEK0xGu1dmaX5vhcRjBXCFexPja0e7P7jqLhTpNKYRPmE+GmiCaRVAbiQKGkUgkh/i6+bh++dPQ==",
"dev": true,
"requires": {
"lit-html": "^1.1.1"
}
},
"lit-html": {
"version": "1.4.1",
"resolved": "https://verdaccio.lossless.one/lit-html/-/lit-html-1.4.1.tgz",
"integrity": "sha512-B9btcSgPYb1q4oSOb/PrOT6Z/H+r6xuNzfH4lFli/AWhYwdtrgQkQWBbIc6mdnf6E2IL3gDXdkkqNktpU0OZQA==",
"dev": true
}
}
},
"@jridgewell/resolve-uri": {

View File

@ -16,9 +16,9 @@
"tsbundle": "cli.js"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.56",
"@gitzone/tsbuild": "^2.1.59",
"@gitzone/tsrun": "^1.2.31",
"@gitzone/tstest": "^1.0.67",
"@gitzone/tstest": "^1.0.69",
"@pushrocks/tapbundle": "^5.0.2",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"

View File

@ -9,5 +9,5 @@ early.stop();
// lets make this usable programmatically
export * from './tsbundle.class.tsbundle.js';
export * from './mod_rollup/htmlhandler.js';
export * from './mod_html/index.js';
export { runCli };

43
ts/mod_html/index.ts Normal file
View File

@ -0,0 +1,43 @@
import * as plugins from './plugins.js';
import * as paths from '../paths.js';
export class HtmlHandler {
public defaultFromPath: string = plugins.path.join(paths.htmlDir, 'index.html');
public defaultToPath: string = plugins.path.join(paths.distServeDir, 'index.html');
public async checkIfExists() {
return plugins.smartfile.fs.fileExists(this.defaultFromPath);
}
// copies the html
public async copyHtml(fromArg: string = this.defaultFromPath, toArg: string = this.defaultToPath) {
if (!(await this.checkIfExists())) {
console.log(`${fromArg} replaces file at ${toArg}`);
}
fromArg = plugins.smartpath.transform.toAbsolute(fromArg, paths.cwd) as string;
toArg = plugins.smartpath.transform.toAbsolute(toArg, paths.cwd) as string;
await plugins.smartfile.fs.copy(fromArg, toArg);
console.log(`html copy replacement succeeded`);
}
// copies and minifies the html
public async minifyHtml(fromArg: string = this.defaultFromPath, toArg: string = this.defaultToPath) {
if (!(await this.checkIfExists())) {
console.log(`${fromArg} replaces file at ${toArg}`);
}
fromArg = plugins.smartpath.transform.toAbsolute(fromArg, paths.cwd) as string;
toArg = plugins.smartpath.transform.toAbsolute(toArg, paths.cwd) as string;
const fileString = plugins.smartfile.fs.toStringSync(fromArg);
const minifiedHtml = plugins.htmlMinifier.minify(fileString, {
minifyCSS: true,
minifyJS: true,
sortAttributes: true,
sortClassName: true,
removeAttributeQuotes: true,
collapseWhitespace: true,
collapseInlineTagWhitespace: true,
removeComments: true,
});
await plugins.smartfile.memory.toFs(minifiedHtml, toArg);
}
}

7
ts/mod_html/plugins.ts Normal file
View File

@ -0,0 +1,7 @@
export * from '../plugins.js';
import * as htmlMinifier from 'html-minifier';
export {
htmlMinifier
}

View File

@ -1,38 +0,0 @@
import * as plugins from './plugins.js';
import * as paths from '../paths.js';
export class HtmlHandler {
public sourceFilePath: string = plugins.path.join(paths.htmlDir, 'index.html');
public targetFilePath: string = plugins.path.join(paths.distServeDir, 'index.html');
public async checkIfExists() {
return plugins.smartfile.fs.fileExists(this.sourceFilePath);
}
// copies the html
public async copyHtml(targetPathArg = this.targetFilePath) {
if (!(await this.checkIfExists())) {
return;
}
await plugins.smartfile.fs.copy(this.sourceFilePath, targetPathArg);
}
// copies and minifies the html
public async minifyHtml(targetPathArg = this.targetFilePath) {
if (!(await this.checkIfExists())) {
return;
}
const fileString = plugins.smartfile.fs.toStringSync(this.sourceFilePath);
const minifiedHtml = plugins.htmlMinifier.minify(fileString, {
minifyCSS: true,
minifyJS: true,
sortAttributes: true,
sortClassName: true,
removeAttributeQuotes: true,
collapseWhitespace: true,
collapseInlineTagWhitespace: true,
removeComments: true,
});
plugins.smartfile.memory.toFsSync(minifiedHtml, targetPathArg);
}
}

View File

@ -10,8 +10,6 @@ import rollupSourceMaps from 'rollup-plugin-sourcemaps';
import { terser as rollupTerser } from 'rollup-plugin-terser';
import rollupTypescript from '@rollup/plugin-typescript';
import * as htmlMinifier from 'html-minifier';
export {
rollup,
rollupBabel,
@ -21,5 +19,4 @@ export {
rollupSourceMaps,
rollupTerser,
rollupTypescript,
htmlMinifier,
};

View File

@ -28,8 +28,9 @@ export class TsBundle {
from: fromArg,
to: toArg,
mode: argvArg && argvArg.production ? 'production' : 'test',
argv: argvArg ? argvArg : {
bundler: 'esbuild'
argv: {
bundler: 'esbuild',
...argvArg
}
}
const threadsimple = new plugins.smartspawn.ThreadSimple(

View File

@ -1,5 +1,6 @@
import * as plugins from './plugins.js';
import { TsBundle } from './tsbundle.class.tsbundle.js';
import { HtmlHandler } from './mod_html/index.js';
import { logger } from './tsbundle.logging.js';
export const runCli = async () => {
@ -12,6 +13,7 @@ export const runCli = async () => {
tsBundleCli.addCommand('element').subscribe(async (argvArg) => {
const tsbundle = new TsBundle();
const htmlHandler = new HtmlHandler();
// const htmlHandler = new HtmlHandler();
await tsbundle.build(
process.cwd(),
@ -23,6 +25,7 @@ export const runCli = async () => {
tsBundleCli.addCommand('npm').subscribe(async (argvArg) => {
const tsbundle = new TsBundle();
const htmlHandler = new HtmlHandler();
await tsbundle.build(
process.cwd(),
'./ts/index.ts',
@ -33,12 +36,14 @@ export const runCli = async () => {
tsBundleCli.addCommand('website').subscribe(async (argvArg) => {
const tsbundle = new TsBundle();
const htmlHandler = new HtmlHandler();
await tsbundle.build(
process.cwd(),
'./ts_web/index.ts',
'./dist_serve/bundle.js',
argvArg
);
await htmlHandler.minifyHtml('./html/index.html', './dist_serve/index.html')
});
tsBundleCli.startParse();