feat(cli options): now support --web for web compilations targeting Google Chrome
This commit is contained in:
parent
fee2a60162
commit
bbcb8e6b3f
@ -26,6 +26,7 @@ mirror:
|
|||||||
snyk:
|
snyk:
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
- npmci command npm install -g snyk
|
- npmci command npm install -g snyk
|
||||||
- npmci command npm install --ignore-scripts
|
- npmci command npm install --ignore-scripts
|
||||||
- npmci command snyk test
|
- npmci command snyk test
|
||||||
@ -36,21 +37,11 @@ snyk:
|
|||||||
# ====================
|
# ====================
|
||||||
# test stage
|
# test stage
|
||||||
# ====================
|
# ====================
|
||||||
testLEGACY:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci node install legacy
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
testLTS:
|
testLTS:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
- npmci node install lts
|
- npmci node install lts
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
@ -62,6 +53,7 @@ testLTS:
|
|||||||
testSTABLE:
|
testSTABLE:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
@ -118,6 +110,7 @@ pages:
|
|||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g typedoc typescript
|
- npmci command npm install -g typedoc typescript
|
||||||
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
||||||
tags:
|
tags:
|
||||||
@ -130,13 +123,3 @@ pages:
|
|||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
windowsCompatibility:
|
|
||||||
image: stefanscherer/node-windows:10-build-tools
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npm install & npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- windows
|
|
||||||
allow_failure: true
|
|
||||||
|
952
package-lock.json
generated
952
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
15
package.json
15
package.json
@ -26,15 +26,18 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/tsn#README",
|
"homepage": "https://gitlab.com/pushrocks/tsn#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartfile": "^6.0.6",
|
"@pushrocks/smartcli": "^3.0.6",
|
||||||
"@pushrocks/smartlog": "^2.0.1",
|
"@pushrocks/smartfile": "^6.0.11",
|
||||||
|
"@pushrocks/smartlog": "^2.0.9",
|
||||||
"@pushrocks/smartpath": "^4.0.1",
|
"@pushrocks/smartpath": "^4.0.1",
|
||||||
"@pushrocks/smartpromise": "^2.0.5",
|
"@pushrocks/smartpromise": "^2.0.5",
|
||||||
"typescript": "^3.0.1"
|
"typescript": "^3.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsrun": "^1.1.11",
|
"@gitzone/tsrun": "^1.1.13",
|
||||||
"@pushrocks/tapbundle": "^3.0.1",
|
"@pushrocks/tapbundle": "^3.0.7",
|
||||||
"@types/node": "^10.5.7"
|
"@types/node": "^10.12.12",
|
||||||
|
"tslint": "^5.11.0",
|
||||||
|
"tslint-config-prettier": "^1.17.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,4 @@ export * from './tsbuild.exports';
|
|||||||
|
|
||||||
import * as tsbuild from './tsbuild.exports';
|
import * as tsbuild from './tsbuild.exports';
|
||||||
|
|
||||||
if (process.env.CLI_CALL_TSBUILD === 'true') {
|
import './tsbuild.cli';
|
||||||
tsbuild.compileGlobStringObject({
|
|
||||||
'./ts/**/*.ts': './dist'
|
|
||||||
});
|
|
||||||
}
|
|
@ -19,13 +19,26 @@ export const compilerOptionsDefault: CompilerOptions = {
|
|||||||
target: plugins.typescript.ScriptTarget.ES2015
|
target: plugins.typescript.ScriptTarget.ES2015
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const compilerOptionsWebDefault: CompilerOptions = {
|
||||||
|
...compilerOptionsDefault,
|
||||||
|
lib: [...compilerOptionsDefault.lib, 'dom']
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* merges compilerOptions with the default compiler options
|
* merges compilerOptions with the default compiler options
|
||||||
*/
|
*/
|
||||||
export const mergeCompilerOptions = function(customTsOptions: CompilerOptions): CompilerOptions {
|
export const mergeCompilerOptions = (customTsOptions: CompilerOptions, argvArg?: any): CompilerOptions => {
|
||||||
|
const defaultOptionsToMerge = (() => {
|
||||||
|
if (argvArg && argvArg.web) {
|
||||||
|
return compilerOptionsWebDefault;
|
||||||
|
} else {
|
||||||
|
return compilerOptionsDefault;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
// create merged options
|
// create merged options
|
||||||
let mergedOptions: CompilerOptions = {
|
let mergedOptions: CompilerOptions = {
|
||||||
...compilerOptionsDefault,
|
...defaultOptionsToMerge,
|
||||||
...customTsOptions
|
...customTsOptions
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -37,7 +50,8 @@ export const mergeCompilerOptions = function(customTsOptions: CompilerOptions):
|
|||||||
*/
|
*/
|
||||||
export const compiler = (
|
export const compiler = (
|
||||||
fileNames: string[],
|
fileNames: string[],
|
||||||
options: plugins.typescript.CompilerOptions
|
options: plugins.typescript.CompilerOptions,
|
||||||
|
argvArg?: any,
|
||||||
): Promise<any[]> => {
|
): Promise<any[]> => {
|
||||||
console.log(`Compiling ${fileNames.length} files...`);
|
console.log(`Compiling ${fileNames.length} files...`);
|
||||||
let done = plugins.smartpromise.defer<any[]>();
|
let done = plugins.smartpromise.defer<any[]>();
|
||||||
|
17
ts/tsbuild.cli.ts
Normal file
17
ts/tsbuild.cli.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import * as plugins from './tsbuild.plugins';
|
||||||
|
import * as tsbuild from './tsbuild.exports';
|
||||||
|
|
||||||
|
const tsbuildCli = new plugins.smartcli.Smartcli();
|
||||||
|
|
||||||
|
tsbuildCli.standardTask().subscribe(argvArg => {
|
||||||
|
if (process.env.CLI_CALL_TSBUILD === 'true') {
|
||||||
|
tsbuild.compileGlobStringObject(
|
||||||
|
{
|
||||||
|
'./ts/**/*.ts': './dist'
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
process.cwd(),
|
||||||
|
argvArg
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
@ -8,9 +8,10 @@ export * from './tsbuild.classes.compiler';
|
|||||||
*/
|
*/
|
||||||
export let compileFileArray = (
|
export let compileFileArray = (
|
||||||
fileStringArrayArg: string[],
|
fileStringArrayArg: string[],
|
||||||
compilerOptionsArg: CompilerOptions = {}
|
compilerOptionsArg: CompilerOptions = {},
|
||||||
|
argvArg?: any,
|
||||||
): Promise<any[]> => {
|
): Promise<any[]> => {
|
||||||
return compiler(fileStringArrayArg, mergeCompilerOptions(compilerOptionsArg));
|
return compiler(fileStringArrayArg, mergeCompilerOptions(compilerOptionsArg, argvArg), argvArg);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,30 +24,33 @@ export let compileFileArray = (
|
|||||||
export let compileGlobStringObject = async (
|
export let compileGlobStringObject = async (
|
||||||
globStringObjectArg: any,
|
globStringObjectArg: any,
|
||||||
tsOptionsArg: CompilerOptions = {},
|
tsOptionsArg: CompilerOptions = {},
|
||||||
cwdArg: string = process.cwd()
|
cwdArg: string = process.cwd(),
|
||||||
|
argvArg?: any,
|
||||||
) => {
|
) => {
|
||||||
let compiledFiles = [];
|
let compiledFiles = [];
|
||||||
for (let keyArg in globStringObjectArg) {
|
for (const keyArg in globStringObjectArg) {
|
||||||
console.log(
|
if(globStringObjectArg[keyArg]) {
|
||||||
`TypeScript assignment: transpile from ${keyArg} to ${globStringObjectArg[keyArg]}`
|
console.log(
|
||||||
);
|
`TypeScript assignment: transpile from ${keyArg} to ${globStringObjectArg[keyArg]}`
|
||||||
const fileTreeArray = await plugins.smartfile.fs.listFileTree(cwdArg, keyArg);
|
);
|
||||||
let absoluteFilePathArray: string[] = plugins.smartpath.transform.toAbsolute(
|
const fileTreeArray = await plugins.smartfile.fs.listFileTree(cwdArg, keyArg);
|
||||||
fileTreeArray,
|
let absoluteFilePathArray: string[] = plugins.smartpath.transform.toAbsolute(
|
||||||
cwdArg
|
fileTreeArray,
|
||||||
);
|
cwdArg
|
||||||
let destDir: string = plugins.smartpath.transform.toAbsolute(
|
);
|
||||||
globStringObjectArg[keyArg],
|
let destDir: string = plugins.smartpath.transform.toAbsolute(
|
||||||
cwdArg
|
globStringObjectArg[keyArg],
|
||||||
);
|
cwdArg
|
||||||
tsOptionsArg = {
|
);
|
||||||
...tsOptionsArg,
|
tsOptionsArg = {
|
||||||
outDir: destDir
|
...tsOptionsArg,
|
||||||
};
|
outDir: destDir
|
||||||
compiledFiles = compiledFiles.concat(
|
};
|
||||||
compiledFiles,
|
compiledFiles = compiledFiles.concat(
|
||||||
await compileFileArray(absoluteFilePathArray, tsOptionsArg)
|
compiledFiles,
|
||||||
);
|
await compileFileArray(absoluteFilePathArray, tsOptionsArg, argvArg)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return compiledFiles;
|
return compiledFiles;
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
import * as smartcli from '@pushrocks/smartcli';
|
||||||
import * as smartfile from '@pushrocks/smartfile';
|
import * as smartfile from '@pushrocks/smartfile';
|
||||||
import * as smartpath from '@pushrocks/smartpath';
|
import * as smartpath from '@pushrocks/smartpath';
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
import * as typescript from 'typescript';
|
import * as typescript from 'typescript';
|
||||||
|
|
||||||
export { smartfile, smartpath, smartpromise, typescript };
|
export { smartcli, smartfile, smartpath, smartpromise, typescript };
|
||||||
|
16
tslint.json
16
tslint.json
@ -1,3 +1,17 @@
|
|||||||
{
|
{
|
||||||
"extends": "tslint-config-standard"
|
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||||
|
"rules": {
|
||||||
|
"semicolon": [true, "always"],
|
||||||
|
"no-console": false,
|
||||||
|
"ordered-imports": false,
|
||||||
|
"object-literal-sort-keys": false,
|
||||||
|
"member-ordering": {
|
||||||
|
"options":{
|
||||||
|
"order": [
|
||||||
|
"static-method"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultSeverity": "warning"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user