From 85b55bcc9f884e52093cc0a23f420f4460136506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Fri, 11 Nov 2016 13:48:36 +0100 Subject: [PATCH 01/21] feat(doc): add doc-shaping tools --- src/doc-shape-defs.js | 74 +++++++++++++++++++++++++++++++++++++++++++ src/doc-shape.js | 38 ++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 src/doc-shape-defs.js create mode 100644 src/doc-shape.js diff --git a/src/doc-shape-defs.js b/src/doc-shape-defs.js new file mode 100644 index 0000000..c601af6 --- /dev/null +++ b/src/doc-shape-defs.js @@ -0,0 +1,74 @@ +"use strict"; + +const path = require('path'); +const fs = require('fs'); + +module.exports = { + shapeDefs: function shapeDefs(directory, targetDir) { + if (!directory) { + directory = process.cwd() + } + if (!targetDir) { + targetDir = 'dist/doc-temp' + } + if (!path.isAbsolute(targetDir)) { + targetDir = path.resolve(directory, targetDir) + } + + const packageJsonPath = path.resolve(directory, 'package.json'); + let packageName + try { + packageName = require(packageJsonPath).name; + } catch (e) { + console.error(`Unable to shape the find the package.json file.`); + console.error(e.message); + return process.exit(1); + } + try { + const dtsPath = path.join(targetDir, `${packageName}.d.ts`); + let defs = fs.readFileSync(dtsPath).toString(); + + // aggregate external imports + const packages = {}; + const importRegex = /^\s*import\s+\{([^}]+)\}\s*from\s*'([\w|-]+)'/gm; + let importMatch = importRegex.exec(defs); + while (importMatch) { + const packageName = importMatch[2]; + const imports = packages[packageName] || (packages[packageName] = []); + const bindings = importMatch[1].split(',').map(x => x.trim()); + for (let binding of bindings) { + if (imports.indexOf(binding) === -1) { + imports.push(binding); + } + } + importMatch = importRegex.exec(defs); + } + + // remove leading declare module + defs = defs.replace(/^declare module ".*" \{/, ''); + // remove "} declare module {" + defs = defs.replace(/\}\r?\ndeclare module ".*" \{/g, ''); + // remove closing "}" + defs = defs.replace(/\}\r?\n$/, ''); + // remove imports + defs = defs.replace(/^\s+import.*;$/gm, ''); + // remove "export *" + defs = defs.replace(/^\s+export \*.*;$/gm, ''); + + // write imports + for (let packageName in packages) { + if (packages.hasOwnProperty(packageName)) { + const imports = packages[packageName]; + defs = `import {${imports.sort()}} from '${packageName}';\n` + defs; + } + } + + fs.writeFileSync(dtsPath, defs); + console.log(`Shaped the ${packageName}.d.ts file.`); + } catch (e) { + console.error(`Unable to shape the ${packageName}.d.ts file.`); + console.error(e.message); + return process.exit(1); + } + } +} diff --git a/src/doc-shape.js b/src/doc-shape.js new file mode 100644 index 0000000..c8fbe72 --- /dev/null +++ b/src/doc-shape.js @@ -0,0 +1,38 @@ +"use strict"; + +const path = require('path'); +const fs = require('fs'); + +module.exports = { + shape: function shape(apiJsonPath, directory) { + if (!directory) { + directory = process.cwd() + } + if (!apiJsonPath) { + apiJsonPath = 'api.json' + } + if (!path.isAbsolute(apiJsonPath)) { + apiJsonPath = path.resolve(directory, apiJsonPath) + } + const packageJsonPath = path.resolve(directory, 'package.json'); + + try { + const packageName = require(packageJsonPath).name; + let json = require(apiJsonPath).children[0]; + + json = { + name: packageName, + children: json.children, + groups: json.groups + }; + + const str = JSON.stringify(json) + '\n'; + fs.writeFileSync(apiJsonPath, str); + console.log('Shaped the api.json file.'); + } catch (e) { + console.error('Unable to shape the api.json. The file probably has an incorrect format or doesn\'t exist.'); + console.error(e.message); + return process.exit(1); + } + } +} From 9a18881e1c2a3e29b257609dfc38f8ea0a6567cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Fri, 11 Nov 2016 13:49:05 +0100 Subject: [PATCH 02/21] feat(index): expose aurelia-tools as a CLI utility --- src/index.js | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 85336de..24938df 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,11 @@ +#!/usr/bin/env node +"use strict"; +process.title = 'aurelia-tools'; var doc = require('./doc'); var dev = require('./dev'); var build = require('./build'); +var docShape = require('./doc-shape'); +var docShapeDefs = require('./doc-shape-defs'); module.exports = { transformAPIModel:doc.transformAPIModel, @@ -10,5 +15,34 @@ module.exports = { extractImports:build.extractImports, createImportBlock:build.createImportBlock, sortFiles:build.sortFiles, - cleanGeneratedCode: build.cleanGeneratedCode + cleanGeneratedCode: build.cleanGeneratedCode, + docShapeDefs: docShapeDefs.shapeDefs, + docShape: docShape.shape }; + +var argv = require('yargs') + .command('doc-shape', 'Shape docs', {}, function(argv) { + docShape.shape(argv._[1], argv._[2]) + }) + .command('doc-shape-defs', 'Shape doc defs', {}, function(argv) { + docShapeDefs.shapeDefs(argv._[1], argv._[2]) + }) + .command('changelog', 'Generate changelog from commits', { + 'first-release': { + alias: 'f', + describe: 'Is this the first release?', + type: 'boolean', + default: false + } + }, function(argv) { + console.log(argv) + var standardVersion = require('standard-version'); + var path = require('path'); + standardVersion({ + infile: argv._[1] || path.resolve(process.cwd(), 'doc/CHANGELOG.md'), + message: 'chore(release): prepare release %s', + firstRelease: argv.firstRelease + }, function (err) { + process.exit(1) + }); + }).argv From cecd214ac71c89cb7fa37d1a40e3ee32db724036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Fri, 11 Nov 2016 13:49:26 +0100 Subject: [PATCH 03/21] chore(gitignore): ignore yarn.lock --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 784886a..a81ac10 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules jspm_packages bower_components .idea -.DS_STORE \ No newline at end of file +.DS_STORE +/yarn.lock From bf0a582b5e5e066fb3cbac8ef048ce551f75cee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Fri, 11 Nov 2016 13:50:39 +0100 Subject: [PATCH 04/21] chore(package): add dependencies and expose aurelia-tools bin --- package.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 66a4231..053da5f 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,17 @@ "type": "git", "url": "http://github.com/aurelia/tools" }, + "bin": { + "aurelia-tools": "src/index.js" + }, "dependencies": { "breeze-dag": "^0.1.0", - "through2": "^2.0.0" + "standard-version": "^3.0.0", + "through2": "^2.0.0", + "yargs": "^6.3.0" + }, + "devDependencies": { + "@types/node": "^6.0.46", + "@types/yargs": "^6.3.1" } } From d64cba019044bf5b12a6dd2c653af4ed9edf31cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Fri, 11 Nov 2016 15:11:33 +0100 Subject: [PATCH 05/21] feat(index): build-doc and typedoc commands --- package.json | 1 + src/doc-shape-defs.js | 8 +++--- src/doc-shape.js | 6 ++--- src/index.js | 63 +++++++++++++++++++++++++++++++++++++++---- 4 files changed, 66 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 053da5f..d4bf48d 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "breeze-dag": "^0.1.0", "standard-version": "^3.0.0", "through2": "^2.0.0", + "typedoc": "^0.5.1", "yargs": "^6.3.0" }, "devDependencies": { diff --git a/src/doc-shape-defs.js b/src/doc-shape-defs.js index c601af6..d58d516 100644 --- a/src/doc-shape-defs.js +++ b/src/doc-shape-defs.js @@ -6,17 +6,17 @@ const fs = require('fs'); module.exports = { shapeDefs: function shapeDefs(directory, targetDir) { if (!directory) { - directory = process.cwd() + directory = process.cwd(); } if (!targetDir) { - targetDir = 'dist/doc-temp' + targetDir = 'dist/doc-temp'; } if (!path.isAbsolute(targetDir)) { - targetDir = path.resolve(directory, targetDir) + targetDir = path.resolve(directory, targetDir); } const packageJsonPath = path.resolve(directory, 'package.json'); - let packageName + let packageName; try { packageName = require(packageJsonPath).name; } catch (e) { diff --git a/src/doc-shape.js b/src/doc-shape.js index c8fbe72..da04747 100644 --- a/src/doc-shape.js +++ b/src/doc-shape.js @@ -6,13 +6,13 @@ const fs = require('fs'); module.exports = { shape: function shape(apiJsonPath, directory) { if (!directory) { - directory = process.cwd() + directory = process.cwd(); } if (!apiJsonPath) { - apiJsonPath = 'api.json' + apiJsonPath = 'doc/api.json'; } if (!path.isAbsolute(apiJsonPath)) { - apiJsonPath = path.resolve(directory, apiJsonPath) + apiJsonPath = path.resolve(directory, apiJsonPath); } const packageJsonPath = path.resolve(directory, 'package.json'); diff --git a/src/index.js b/src/index.js index 24938df..d359537 100644 --- a/src/index.js +++ b/src/index.js @@ -6,6 +6,7 @@ var dev = require('./dev'); var build = require('./build'); var docShape = require('./doc-shape'); var docShapeDefs = require('./doc-shape-defs'); +var path = require('path'); module.exports = { transformAPIModel:doc.transformAPIModel, @@ -22,12 +23,65 @@ module.exports = { var argv = require('yargs') .command('doc-shape', 'Shape docs', {}, function(argv) { - docShape.shape(argv._[1], argv._[2]) + docShape.shape(argv._[1], argv._[2]); }) .command('doc-shape-defs', 'Shape doc defs', {}, function(argv) { - docShapeDefs.shapeDefs(argv._[1], argv._[2]) + docShapeDefs.shapeDefs(argv._[1], argv._[2]); }) - .command('changelog', 'Generate changelog from commits', { + .command('build-doc', 'Creates a single .d.ts from TS project', { + project: { + alias: 'p', + describe: 'TSC project file or folder', + type: 'string', + default: 'tsconfig.build.json' + }, + outDir: { + alias: 'out', + describe: 'Output for compilation', + type: 'string', + default: 'dist/doc-temp' + } + }, function(argv) { + const projectDir = process.cwd(); + const packageJsonPath = path.resolve(projectDir, 'package.json'); + try { + const packageName = require(packageJsonPath).name; + const spawn = require( 'child_process' ).spawnSync; + const rimraf = require('rimraf').sync; + rimraf([ 'doc/api.json', 'dist/doc-temp/**' ]); + const tsc = spawn( './node_modules/.bin/tsc', [ '--project', argv.project, '--outFile', path.join(argv.outDir, packageName + '.js') ] ); + } catch (e) { + console.error(e.message); + process.exit(1); + } + }) + .command('typedoc', 'Creates a typedoc file', {, + inDir: { + alias: 'in', + describe: 'Input d.ts files directory', + type: 'string', + default: 'dist/doc-temp' + } + outFile: { + alias: 'o', + describe: 'api.json output path', + type: 'string', + default: 'doc/api.json' + } + }, function(argv) { + const projectDir = process.cwd(); + const packageJsonPath = path.resolve(projectDir, 'package.json'); + try { + const packageName = require(packageJsonPath).name; + const typeDocPath = path.join(path.dirname(require.resolve('typedoc')), 'bin/typedoc'); + const spawn = require( 'child_process' ).spawnSync; + const typedoc = spawn( 'node', [ typeDocPath, '--json', argv.outFile, '--excludeExternals', '--includeDeclarations', '--mode', 'modules', '--target', 'ES6', '--name', packageName, '--ignoreCompilerErrors', argv.inDir ] ); + } catch (e) { + console.error(e.message); + process.exit(1); + } + }) + .command('changelog', 'Generate changelog from commits', { 'first-release': { alias: 'f', describe: 'Is this the first release?', @@ -37,12 +91,11 @@ var argv = require('yargs') }, function(argv) { console.log(argv) var standardVersion = require('standard-version'); - var path = require('path'); standardVersion({ infile: argv._[1] || path.resolve(process.cwd(), 'doc/CHANGELOG.md'), message: 'chore(release): prepare release %s', firstRelease: argv.firstRelease }, function (err) { - process.exit(1) + process.exit(1); }); }).argv From 58ef41744f5e60ec0103f4ea56cfd46fa031e9bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Fri, 11 Nov 2016 16:40:11 +0100 Subject: [PATCH 06/21] feat(tsconfig): added base config for extending --- tsc/tsconfig.json | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tsc/tsconfig.json diff --git a/tsc/tsconfig.json b/tsc/tsconfig.json new file mode 100644 index 0000000..79d7de8 --- /dev/null +++ b/tsc/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "module": "amd", + "moduleResolution": "node", + "target": "es5", + "lib": [ + "es2017", + "dom" + ], + "outDir": "dist/test", + "noImplicitAny": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "strictNullChecks": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "experimentalDecorators": true, + "noEmitHelpers": true + }, + "exclude": [ + ".vscode", + "dist", + "doc", + "node_modules", + "build", + "gulpfile.js" + ] +} From 6ef45d157c42a229805e48174f2d981c60741ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Fri, 11 Nov 2016 16:42:25 +0100 Subject: [PATCH 07/21] feat(index): ts-build-all CLI command --- src/cli-util.js | 25 ++++++++++++ src/index.js | 104 ++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 109 insertions(+), 20 deletions(-) create mode 100644 src/cli-util.js diff --git a/src/cli-util.js b/src/cli-util.js new file mode 100644 index 0000000..ce48cae --- /dev/null +++ b/src/cli-util.js @@ -0,0 +1,25 @@ +module.export = { + proxySpawned: function proxySpawned(spawned, outputPrefix, continueWhenFailed, onDone) { + if (outputPrefix) { + outputPrefix = '[' + outputPrefix + '] '; + } + spawned.stdout.on( 'data', data => { + const text = data.toString(); + if (text) + console.log( outputPrefix + data.toString() ); + }); + + spawned.stderr.on( 'data', data => { + const text = data.toString(); + if (text) + console.error( outputPrefix + data.toString() ); + }); + + spawned.on( 'close', code => { + if (onDone) onDone(code); + if (!continueWhenFailed && code > 0) { + process.exit(1); + } + }); + } +} diff --git a/src/index.js b/src/index.js index d359537..fd7e5c0 100644 --- a/src/index.js +++ b/src/index.js @@ -1,12 +1,16 @@ #!/usr/bin/env node "use strict"; process.title = 'aurelia-tools'; -var doc = require('./doc'); -var dev = require('./dev'); -var build = require('./build'); -var docShape = require('./doc-shape'); -var docShapeDefs = require('./doc-shape-defs'); -var path = require('path'); +const doc = require('./doc'); +const dev = require('./dev'); +const build = require('./build'); +const docShape = require('./doc-shape'); +const docShapeDefs = require('./doc-shape-defs'); +const path = require('path'); +const rimraf = require('rimraf').sync; +const spawn = require('child_process').spawn; +const tscPath = require.resolve('typescript/bin/tsc'); +const proxySpawned = require('./cli-util').proxySpawned; module.exports = { transformAPIModel:doc.transformAPIModel, @@ -21,17 +25,63 @@ module.exports = { docShape: docShape.shape }; -var argv = require('yargs') - .command('doc-shape', 'Shape docs', {}, function(argv) { +const argv = require('yargs') + .command('ts-build-all', 'Build multiple versions of the project', { + project: { + alias: 'p', + describe: 'TypeScript project file or folder', + type: 'string', + default: 'tsconfig.build.json' + }, + outDir: { + alias: 'out', + describe: 'Output directory for compilations', + type: 'string', + default: 'dist' + }, + 'continue-when-failed': { + describe: 'Do not bail when one compilation fails', + type: 'boolean', + default: false + }, + 'clean-before': { + describe: 'Clean outdir before compiling', + type: 'boolean', + default: false + } + }, + function(argv) { + if (argv.cleanBefore) { + rimraf(argv.outDir); + } + + const variations = [ + { module: "amd" }, + { module: "commonjs" }, + { module: "es2015", directory: "native-modules" }, + { module: "system" }, + { module: "es2015", target: "es2015" } + ]; + + variations.forEach(variation => { + const args = [ tscPath, '--project', argv.project, '--outDir', path.join(argv.outDir, variation.directory || variation.module), '--module', variation.module ]; + if (variation.target) { + args.push('--target', variation.target); + } + const tsc = spawn('node', args); + proxySpawned(tsc, variation.directory || variation.module, argv.continueWhenFailed); + }); + }) + .command('doc-jsonshape', 'Shape docs', {}, function(argv) { docShape.shape(argv._[1], argv._[2]); }) .command('doc-shape-defs', 'Shape doc defs', {}, function(argv) { docShapeDefs.shapeDefs(argv._[1], argv._[2]); }) - .command('build-doc', 'Creates a single .d.ts from TS project', { + .command('doc-build', 'Creates a single .d.ts from TS project', { project: { alias: 'p', - describe: 'TSC project file or folder', + describe: 'TypeScript project file or folder', type: 'string', default: 'tsconfig.build.json' }, @@ -46,36 +96,50 @@ var argv = require('yargs') const packageJsonPath = path.resolve(projectDir, 'package.json'); try { const packageName = require(packageJsonPath).name; - const spawn = require( 'child_process' ).spawnSync; - const rimraf = require('rimraf').sync; - rimraf([ 'doc/api.json', 'dist/doc-temp/**' ]); + rimraf('dist/doc-temp/**'); const tsc = spawn( './node_modules/.bin/tsc', [ '--project', argv.project, '--outFile', path.join(argv.outDir, packageName + '.js') ] ); + proxySpawned(tsc); } catch (e) { console.error(e.message); process.exit(1); } }) - .command('typedoc', 'Creates a typedoc file', {, + .command('typedoc', 'Creates a typedoc file', { inDir: { alias: 'in', describe: 'Input d.ts files directory', type: 'string', default: 'dist/doc-temp' - } + }, outFile: { alias: 'o', describe: 'api.json output path', type: 'string', default: 'doc/api.json' + }, + cleanUpInDir: { + alias: 'clean', + describe: 'removes the outdir', + type: 'boolean', + default: true } }, function(argv) { const projectDir = process.cwd(); const packageJsonPath = path.resolve(projectDir, 'package.json'); try { const packageName = require(packageJsonPath).name; - const typeDocPath = path.join(path.dirname(require.resolve('typedoc')), 'bin/typedoc'); - const spawn = require( 'child_process' ).spawnSync; - const typedoc = spawn( 'node', [ typeDocPath, '--json', argv.outFile, '--excludeExternals', '--includeDeclarations', '--mode', 'modules', '--target', 'ES6', '--name', packageName, '--ignoreCompilerErrors', argv.inDir ] ); + const typeDocPath = require.resolve('typedoc/bin/typedoc'); + rimraf('doc/api.json'); + + const spawn = require( 'child_process' ).spawn; + const typedoc = spawn( 'node', [ typeDocPath, '--json', argv.outFile, '--excludeExternals', '--includeDeclarations', '--mode', 'modules', '--target', 'ES6', '--name', packageName, '--ignoreCompilerErrors', '--tsconfig', 'tsconfig.base.json', argv.inDir ] ); + proxySpawned(typedoc, undefined, function(code) { + if (code === 0) { + if (argv.cleanUpInDir) { + rimraf(argv.inDir); + } + } + }); } catch (e) { console.error(e.message); process.exit(1); @@ -90,7 +154,7 @@ var argv = require('yargs') } }, function(argv) { console.log(argv) - var standardVersion = require('standard-version'); + const standardVersion = require('standard-version'); standardVersion({ infile: argv._[1] || path.resolve(process.cwd(), 'doc/CHANGELOG.md'), message: 'chore(release): prepare release %s', @@ -98,4 +162,4 @@ var argv = require('yargs') }, function (err) { process.exit(1); }); - }).argv + }).argv; From 0a28eaf4aad7b82d7dd3c0b0241b11945dc9a05e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Fri, 11 Nov 2016 16:43:02 +0100 Subject: [PATCH 08/21] chore(tsc): "noEmitHelpers": false --- tsc/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsc/tsconfig.json b/tsc/tsconfig.json index 79d7de8..f2d49b0 100644 --- a/tsc/tsconfig.json +++ b/tsc/tsconfig.json @@ -16,7 +16,7 @@ "declaration": true, "forceConsistentCasingInFileNames": true, "experimentalDecorators": true, - "noEmitHelpers": true + "noEmitHelpers": false }, "exclude": [ ".vscode", From 6d68e8150b05e91794f3b494daa98706a4f52e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Fri, 11 Nov 2016 16:49:32 +0100 Subject: [PATCH 09/21] fix(cli-util): typo --- src/cli-util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli-util.js b/src/cli-util.js index ce48cae..86f3377 100644 --- a/src/cli-util.js +++ b/src/cli-util.js @@ -1,4 +1,4 @@ -module.export = { +module.exports = { proxySpawned: function proxySpawned(spawned, outputPrefix, continueWhenFailed, onDone) { if (outputPrefix) { outputPrefix = '[' + outputPrefix + '] '; From cf8e1449d596913d6243bcda923d1b8a683c01c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Fri, 11 Nov 2016 16:54:36 +0100 Subject: [PATCH 10/21] feat(index): 'continue-when-failed' for typedoc --- src/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index fd7e5c0..076e3ec 100644 --- a/src/index.js +++ b/src/index.js @@ -90,6 +90,11 @@ const argv = require('yargs') describe: 'Output for compilation', type: 'string', default: 'dist/doc-temp' + }, + 'continue-when-failed': { + describe: 'Do not bail when one compilation fails', + type: 'boolean', + default: false } }, function(argv) { const projectDir = process.cwd(); @@ -133,7 +138,7 @@ const argv = require('yargs') const spawn = require( 'child_process' ).spawn; const typedoc = spawn( 'node', [ typeDocPath, '--json', argv.outFile, '--excludeExternals', '--includeDeclarations', '--mode', 'modules', '--target', 'ES6', '--name', packageName, '--ignoreCompilerErrors', '--tsconfig', 'tsconfig.base.json', argv.inDir ] ); - proxySpawned(typedoc, undefined, function(code) { + proxySpawned(typedoc, undefined, argv.continueWhenFailed, function(code) { if (code === 0) { if (argv.cleanUpInDir) { rimraf(argv.inDir); From 3e61b506e7f21f1ac1713a12b336c4c629a1a0e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Fri, 11 Nov 2016 16:57:24 +0100 Subject: [PATCH 11/21] feat(index): continue-when-failed for doc-temp --- src/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 076e3ec..9286e74 100644 --- a/src/index.js +++ b/src/index.js @@ -103,7 +103,7 @@ const argv = require('yargs') const packageName = require(packageJsonPath).name; rimraf('dist/doc-temp/**'); const tsc = spawn( './node_modules/.bin/tsc', [ '--project', argv.project, '--outFile', path.join(argv.outDir, packageName + '.js') ] ); - proxySpawned(tsc); + proxySpawned(tsc, undefined, argv.continueWhenFailed); } catch (e) { console.error(e.message); process.exit(1); @@ -127,6 +127,11 @@ const argv = require('yargs') describe: 'removes the outdir', type: 'boolean', default: true + }, + 'continue-when-failed': { + describe: 'Do not bail when one compilation fails', + type: 'boolean', + default: false } }, function(argv) { const projectDir = process.cwd(); From 6026bde6823025a796675b393a856c5c8bb4410f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Fri, 11 Nov 2016 17:00:23 +0100 Subject: [PATCH 12/21] feat(index): allow specifying project file for typedoc --- src/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 9286e74..a267cce 100644 --- a/src/index.js +++ b/src/index.js @@ -132,6 +132,12 @@ const argv = require('yargs') describe: 'Do not bail when one compilation fails', type: 'boolean', default: false + }, + project: { + alias: 'p', + describe: 'TypeScript project file', + type: 'string', + default: path.resolve(__dirname, 'tsc/tsconfig.json') } }, function(argv) { const projectDir = process.cwd(); @@ -142,7 +148,7 @@ const argv = require('yargs') rimraf('doc/api.json'); const spawn = require( 'child_process' ).spawn; - const typedoc = spawn( 'node', [ typeDocPath, '--json', argv.outFile, '--excludeExternals', '--includeDeclarations', '--mode', 'modules', '--target', 'ES6', '--name', packageName, '--ignoreCompilerErrors', '--tsconfig', 'tsconfig.base.json', argv.inDir ] ); + const typedoc = spawn( 'node', [ typeDocPath, '--json', argv.outFile, '--excludeExternals', '--includeDeclarations', '--mode', 'modules', '--target', 'ES6', '--name', packageName, '--ignoreCompilerErrors', '--tsconfig', argv.project, argv.inDir ] ); proxySpawned(typedoc, undefined, argv.continueWhenFailed, function(code) { if (code === 0) { if (argv.cleanUpInDir) { From 5f9547f73f91184bf7a6963af801c21959708d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Fri, 11 Nov 2016 17:02:06 +0100 Subject: [PATCH 13/21] fix(index): correct tsconfig path --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index a267cce..a9ec785 100644 --- a/src/index.js +++ b/src/index.js @@ -137,7 +137,7 @@ const argv = require('yargs') alias: 'p', describe: 'TypeScript project file', type: 'string', - default: path.resolve(__dirname, 'tsc/tsconfig.json') + default: path.resolve(__dirname, '../tsc/tsconfig.json') } }, function(argv) { const projectDir = process.cwd(); From 6b7283d6ef948e38f888bfbb6f0d3c3c00d0a601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Fri, 11 Nov 2016 17:04:54 +0100 Subject: [PATCH 14/21] fix(cli-util): better formatting of output --- src/cli-util.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cli-util.js b/src/cli-util.js index 86f3377..32318c8 100644 --- a/src/cli-util.js +++ b/src/cli-util.js @@ -4,15 +4,15 @@ module.exports = { outputPrefix = '[' + outputPrefix + '] '; } spawned.stdout.on( 'data', data => { - const text = data.toString(); + const text = data.toString().trim(); if (text) - console.log( outputPrefix + data.toString() ); + console.log( outputPrefix || '' + text ); }); spawned.stderr.on( 'data', data => { - const text = data.toString(); + const text = data.toString().trim(); if (text) - console.error( outputPrefix + data.toString() ); + console.error( outputPrefix || '' + text ); }); spawned.on( 'close', code => { From 6884e0dbcdc02bf88b3d3e6ec9b9b8b9f3b490d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Sun, 20 Nov 2016 12:07:44 +0100 Subject: [PATCH 15/21] chore(index): make index executable --- src/index.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 src/index.js diff --git a/src/index.js b/src/index.js old mode 100644 new mode 100755 From 3ba0ccf500f95a31118f4ed6ea87c00a7b82f53d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brzo=CC=81ska?= Date: Mon, 21 Nov 2016 23:08:22 +0100 Subject: [PATCH 16/21] feat(index): allow specifying variation --- src/cli-util.js | 6 ++++-- src/index.js | 33 ++++++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/cli-util.js b/src/cli-util.js index 32318c8..d433db5 100644 --- a/src/cli-util.js +++ b/src/cli-util.js @@ -2,17 +2,19 @@ module.exports = { proxySpawned: function proxySpawned(spawned, outputPrefix, continueWhenFailed, onDone) { if (outputPrefix) { outputPrefix = '[' + outputPrefix + '] '; + } else { + outputPrefix = '' } spawned.stdout.on( 'data', data => { const text = data.toString().trim(); if (text) - console.log( outputPrefix || '' + text ); + console.log( outputPrefix + text ); }); spawned.stderr.on( 'data', data => { const text = data.toString().trim(); if (text) - console.error( outputPrefix || '' + text ); + console.error( outputPrefix + text ); }); spawned.on( 'close', code => { diff --git a/src/index.js b/src/index.js index a9ec785..5344af9 100755 --- a/src/index.js +++ b/src/index.js @@ -9,8 +9,14 @@ const docShapeDefs = require('./doc-shape-defs'); const path = require('path'); const rimraf = require('rimraf').sync; const spawn = require('child_process').spawn; -const tscPath = require.resolve('typescript/bin/tsc'); const proxySpawned = require('./cli-util').proxySpawned; +const projectDir = process.cwd(); +let tscPath; +try { + tscPath = require.resolve(path.join(projectDir, 'node_modules', 'typescript/bin/tsc')); +} catch (_) { + tscPath = require.resolve('typescript/bin/tsc'); +} module.exports = { transformAPIModel:doc.transformAPIModel, @@ -48,6 +54,10 @@ const argv = require('yargs') describe: 'Clean outdir before compiling', type: 'boolean', default: false + }, + 'variation': { + describe: 'Which variation to compile (or all if not defined)', + type: 'array' } }, function(argv) { @@ -55,21 +65,32 @@ const argv = require('yargs') rimraf(argv.outDir); } - const variations = [ + let variations = [ { module: "amd" }, { module: "commonjs" }, { module: "es2015", directory: "native-modules" }, { module: "system" }, - { module: "es2015", target: "es2015" } + { module: "es2015", target: "es2015" }, + { module: "es2015", target: "es2017" } ]; + if (argv.variation && argv.variation.length) { + variations = variations.filter(v => + (v.target && argv.variation.includes(v.target)) || + (v.directory && argv.variation.includes(v.directory)) || + argv.variation.includes(v.module) + ) + } + variations.forEach(variation => { - const args = [ tscPath, '--project', argv.project, '--outDir', path.join(argv.outDir, variation.directory || variation.module), '--module', variation.module ]; + const outDir = variation.directory || variation.target || variation.module + const args = [ tscPath, '--project', argv.project, '--outDir', path.join(argv.outDir, outDir), '--module', variation.module ]; if (variation.target) { args.push('--target', variation.target); } + console.log(`Running TypeScript compiler: ${args.join(' ')}`) const tsc = spawn('node', args); - proxySpawned(tsc, variation.directory || variation.module, argv.continueWhenFailed); + proxySpawned(tsc, outDir, argv.continueWhenFailed); }); }) .command('doc-jsonshape', 'Shape docs', {}, function(argv) { @@ -97,7 +118,6 @@ const argv = require('yargs') default: false } }, function(argv) { - const projectDir = process.cwd(); const packageJsonPath = path.resolve(projectDir, 'package.json'); try { const packageName = require(packageJsonPath).name; @@ -169,7 +189,6 @@ const argv = require('yargs') default: false } }, function(argv) { - console.log(argv) const standardVersion = require('standard-version'); standardVersion({ infile: argv._[1] || path.resolve(process.cwd(), 'doc/CHANGELOG.md'), From 51180342f76ac637c61bbff57bc9b9ca45deac40 Mon Sep 17 00:00:00 2001 From: Christian Kotzbauer Date: Mon, 6 Feb 2017 19:56:11 +0100 Subject: [PATCH 17/21] feat(standard-version): make tagPrefix configurable --- package.json | 2 +- src/index.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d4bf48d..3b6ede0 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "dependencies": { "breeze-dag": "^0.1.0", - "standard-version": "^3.0.0", + "standard-version": "^4.0.0", "through2": "^2.0.0", "typedoc": "^0.5.1", "yargs": "^6.3.0" diff --git a/src/index.js b/src/index.js index 5344af9..76ebca8 100755 --- a/src/index.js +++ b/src/index.js @@ -193,7 +193,8 @@ const argv = require('yargs') standardVersion({ infile: argv._[1] || path.resolve(process.cwd(), 'doc/CHANGELOG.md'), message: 'chore(release): prepare release %s', - firstRelease: argv.firstRelease + firstRelease: argv.firstRelease, + tagPrefix: "" }, function (err) { process.exit(1); }); From 0ebe456b20ad131704548c791ab450d3e53976e3 Mon Sep 17 00:00:00 2001 From: Christian Kotzbauer Date: Mon, 6 Feb 2017 20:22:19 +0100 Subject: [PATCH 18/21] feat(cli): extract cli to own file --- package.json | 2 +- src/cli.js | 187 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/index.js | 183 +------------------------------------------------ 3 files changed, 189 insertions(+), 183 deletions(-) create mode 100644 src/cli.js diff --git a/package.json b/package.json index 3b6ede0..c2f638d 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "http://github.com/aurelia/tools" }, "bin": { - "aurelia-tools": "src/index.js" + "aurelia-tools": "src/cli.js" }, "dependencies": { "breeze-dag": "^0.1.0", diff --git a/src/cli.js b/src/cli.js new file mode 100644 index 0000000..2f2e79d --- /dev/null +++ b/src/cli.js @@ -0,0 +1,187 @@ +#!/usr/bin/env node +"use strict"; +process.title = 'aurelia-tools'; + +const path = require('path'); +const rimraf = require('rimraf').sync; +const spawn = require('child_process').spawn; +const proxySpawned = require('./cli-util').proxySpawned; +const projectDir = process.cwd(); +const docShape = require('./doc-shape'); +const docShapeDefs = require('./doc-shape-defs'); + +let tscPath; +try { + tscPath = require.resolve(path.join(projectDir, 'node_modules', 'typescript/bin/tsc')); +} catch (_) { + tscPath = require.resolve('typescript/bin/tsc'); +} + +const argv = require('yargs') + .command('ts-build-all', 'Build multiple versions of the project', { + project: { + alias: 'p', + describe: 'TypeScript project file or folder', + type: 'string', + default: 'tsconfig.build.json' + }, + outDir: { + alias: 'out', + describe: 'Output directory for compilations', + type: 'string', + default: 'dist' + }, + 'continue-when-failed': { + describe: 'Do not bail when one compilation fails', + type: 'boolean', + default: false + }, + 'clean-before': { + describe: 'Clean outdir before compiling', + type: 'boolean', + default: false + }, + 'variation': { + describe: 'Which variation to compile (or all if not defined)', + type: 'array' + } + }, + function(argv) { + if (argv.cleanBefore) { + rimraf(argv.outDir); + } + + let variations = [ + { module: "amd" }, + { module: "commonjs" }, + { module: "es2015", directory: "native-modules" }, + { module: "system" }, + { module: "es2015", target: "es2015" }, + { module: "es2015", target: "es2017" } + ]; + + if (argv.variation && argv.variation.length) { + variations = variations.filter(v => + (v.target && argv.variation.includes(v.target)) || + (v.directory && argv.variation.includes(v.directory)) || + argv.variation.includes(v.module) + ) + } + + variations.forEach(variation => { + const outDir = variation.directory || variation.target || variation.module; + const args = [ tscPath, '--project', argv.project, '--outDir', path.join(argv.outDir, outDir), '--module', variation.module ]; + if (variation.target) { + args.push('--target', variation.target); + } + console.log(`Running TypeScript compiler: ${args.join(' ')}`); + const tsc = spawn('node', args); + proxySpawned(tsc, outDir, argv.continueWhenFailed); + }); + }) + .command('doc-jsonshape', 'Shape docs', {}, function(argv) { + docShape.shape(argv._[1], argv._[2]); + }) + .command('doc-shape-defs', 'Shape doc defs', {}, function(argv) { + docShapeDefs.shapeDefs(argv._[1], argv._[2]); + }) + .command('doc-build', 'Creates a single .d.ts from TS project', { + project: { + alias: 'p', + describe: 'TypeScript project file or folder', + type: 'string', + default: 'tsconfig.build.json' + }, + outDir: { + alias: 'out', + describe: 'Output for compilation', + type: 'string', + default: 'dist/doc-temp' + }, + 'continue-when-failed': { + describe: 'Do not bail when one compilation fails', + type: 'boolean', + default: false + } + }, function(argv) { + const packageJsonPath = path.resolve(projectDir, 'package.json'); + try { + const packageName = require(packageJsonPath).name; + rimraf('dist/doc-temp/**'); + const tsc = spawn( './node_modules/.bin/tsc', [ '--project', argv.project, '--outFile', path.join(argv.outDir, packageName + '.js') ] ); + proxySpawned(tsc, undefined, argv.continueWhenFailed); + } catch (e) { + console.error(e.message); + process.exit(1); + } + }) + .command('typedoc', 'Creates a typedoc file', { + inDir: { + alias: 'in', + describe: 'Input d.ts files directory', + type: 'string', + default: 'dist/doc-temp' + }, + outFile: { + alias: 'o', + describe: 'api.json output path', + type: 'string', + default: 'doc/api.json' + }, + cleanUpInDir: { + alias: 'clean', + describe: 'removes the outdir', + type: 'boolean', + default: true + }, + 'continue-when-failed': { + describe: 'Do not bail when one compilation fails', + type: 'boolean', + default: false + }, + project: { + alias: 'p', + describe: 'TypeScript project file', + type: 'string', + default: path.resolve(__dirname, '../tsc/tsconfig.json') + } + }, function(argv) { + const projectDir = process.cwd(); + const packageJsonPath = path.resolve(projectDir, 'package.json'); + try { + const packageName = require(packageJsonPath).name; + const typeDocPath = require.resolve('typedoc/bin/typedoc'); + rimraf('doc/api.json'); + + const spawn = require( 'child_process' ).spawn; + const typedoc = spawn( 'node', [ typeDocPath, '--json', argv.outFile, '--excludeExternals', '--includeDeclarations', '--mode', 'modules', '--target', 'ES6', '--name', packageName, '--ignoreCompilerErrors', '--tsconfig', argv.project, argv.inDir ] ); + proxySpawned(typedoc, undefined, argv.continueWhenFailed, function(code) { + if (code === 0) { + if (argv.cleanUpInDir) { + rimraf(argv.inDir); + } + } + }); + } catch (e) { + console.error(e.message); + process.exit(1); + } + }) + .command('changelog', 'Generate changelog from commits', { + 'first-release': { + alias: 'f', + describe: 'Is this the first release?', + type: 'boolean', + default: false + } + }, function(argv) { + const standardVersion = require('standard-version'); + standardVersion({ + infile: argv._[1] || path.resolve(process.cwd(), 'doc/CHANGELOG.md'), + message: 'chore(release): prepare release %s', + firstRelease: argv.firstRelease, + tagPrefix: "" + }, function (err) { + process.exit(1); + }); + }).argv; diff --git a/src/index.js b/src/index.js index 76ebca8..deff835 100755 --- a/src/index.js +++ b/src/index.js @@ -1,22 +1,9 @@ -#!/usr/bin/env node -"use strict"; -process.title = 'aurelia-tools'; const doc = require('./doc'); const dev = require('./dev'); const build = require('./build'); const docShape = require('./doc-shape'); const docShapeDefs = require('./doc-shape-defs'); -const path = require('path'); -const rimraf = require('rimraf').sync; -const spawn = require('child_process').spawn; -const proxySpawned = require('./cli-util').proxySpawned; -const projectDir = process.cwd(); -let tscPath; -try { - tscPath = require.resolve(path.join(projectDir, 'node_modules', 'typescript/bin/tsc')); -} catch (_) { - tscPath = require.resolve('typescript/bin/tsc'); -} + module.exports = { transformAPIModel:doc.transformAPIModel, @@ -31,171 +18,3 @@ module.exports = { docShape: docShape.shape }; -const argv = require('yargs') - .command('ts-build-all', 'Build multiple versions of the project', { - project: { - alias: 'p', - describe: 'TypeScript project file or folder', - type: 'string', - default: 'tsconfig.build.json' - }, - outDir: { - alias: 'out', - describe: 'Output directory for compilations', - type: 'string', - default: 'dist' - }, - 'continue-when-failed': { - describe: 'Do not bail when one compilation fails', - type: 'boolean', - default: false - }, - 'clean-before': { - describe: 'Clean outdir before compiling', - type: 'boolean', - default: false - }, - 'variation': { - describe: 'Which variation to compile (or all if not defined)', - type: 'array' - } - }, - function(argv) { - if (argv.cleanBefore) { - rimraf(argv.outDir); - } - - let variations = [ - { module: "amd" }, - { module: "commonjs" }, - { module: "es2015", directory: "native-modules" }, - { module: "system" }, - { module: "es2015", target: "es2015" }, - { module: "es2015", target: "es2017" } - ]; - - if (argv.variation && argv.variation.length) { - variations = variations.filter(v => - (v.target && argv.variation.includes(v.target)) || - (v.directory && argv.variation.includes(v.directory)) || - argv.variation.includes(v.module) - ) - } - - variations.forEach(variation => { - const outDir = variation.directory || variation.target || variation.module - const args = [ tscPath, '--project', argv.project, '--outDir', path.join(argv.outDir, outDir), '--module', variation.module ]; - if (variation.target) { - args.push('--target', variation.target); - } - console.log(`Running TypeScript compiler: ${args.join(' ')}`) - const tsc = spawn('node', args); - proxySpawned(tsc, outDir, argv.continueWhenFailed); - }); - }) - .command('doc-jsonshape', 'Shape docs', {}, function(argv) { - docShape.shape(argv._[1], argv._[2]); - }) - .command('doc-shape-defs', 'Shape doc defs', {}, function(argv) { - docShapeDefs.shapeDefs(argv._[1], argv._[2]); - }) - .command('doc-build', 'Creates a single .d.ts from TS project', { - project: { - alias: 'p', - describe: 'TypeScript project file or folder', - type: 'string', - default: 'tsconfig.build.json' - }, - outDir: { - alias: 'out', - describe: 'Output for compilation', - type: 'string', - default: 'dist/doc-temp' - }, - 'continue-when-failed': { - describe: 'Do not bail when one compilation fails', - type: 'boolean', - default: false - } - }, function(argv) { - const packageJsonPath = path.resolve(projectDir, 'package.json'); - try { - const packageName = require(packageJsonPath).name; - rimraf('dist/doc-temp/**'); - const tsc = spawn( './node_modules/.bin/tsc', [ '--project', argv.project, '--outFile', path.join(argv.outDir, packageName + '.js') ] ); - proxySpawned(tsc, undefined, argv.continueWhenFailed); - } catch (e) { - console.error(e.message); - process.exit(1); - } - }) - .command('typedoc', 'Creates a typedoc file', { - inDir: { - alias: 'in', - describe: 'Input d.ts files directory', - type: 'string', - default: 'dist/doc-temp' - }, - outFile: { - alias: 'o', - describe: 'api.json output path', - type: 'string', - default: 'doc/api.json' - }, - cleanUpInDir: { - alias: 'clean', - describe: 'removes the outdir', - type: 'boolean', - default: true - }, - 'continue-when-failed': { - describe: 'Do not bail when one compilation fails', - type: 'boolean', - default: false - }, - project: { - alias: 'p', - describe: 'TypeScript project file', - type: 'string', - default: path.resolve(__dirname, '../tsc/tsconfig.json') - } - }, function(argv) { - const projectDir = process.cwd(); - const packageJsonPath = path.resolve(projectDir, 'package.json'); - try { - const packageName = require(packageJsonPath).name; - const typeDocPath = require.resolve('typedoc/bin/typedoc'); - rimraf('doc/api.json'); - - const spawn = require( 'child_process' ).spawn; - const typedoc = spawn( 'node', [ typeDocPath, '--json', argv.outFile, '--excludeExternals', '--includeDeclarations', '--mode', 'modules', '--target', 'ES6', '--name', packageName, '--ignoreCompilerErrors', '--tsconfig', argv.project, argv.inDir ] ); - proxySpawned(typedoc, undefined, argv.continueWhenFailed, function(code) { - if (code === 0) { - if (argv.cleanUpInDir) { - rimraf(argv.inDir); - } - } - }); - } catch (e) { - console.error(e.message); - process.exit(1); - } - }) - .command('changelog', 'Generate changelog from commits', { - 'first-release': { - alias: 'f', - describe: 'Is this the first release?', - type: 'boolean', - default: false - } - }, function(argv) { - const standardVersion = require('standard-version'); - standardVersion({ - infile: argv._[1] || path.resolve(process.cwd(), 'doc/CHANGELOG.md'), - message: 'chore(release): prepare release %s', - firstRelease: argv.firstRelease, - tagPrefix: "" - }, function (err) { - process.exit(1); - }); - }).argv; From b53136871dab9b8210c4c3a2d742b3906cb26998 Mon Sep 17 00:00:00 2001 From: Christian Kotzbauer Date: Mon, 6 Feb 2017 20:50:25 +0100 Subject: [PATCH 19/21] fix(cli): added rimraf to package.json because it's used in cli --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index c2f638d..6a70f74 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ }, "dependencies": { "breeze-dag": "^0.1.0", + "rimraf": "^2.5.4", "standard-version": "^4.0.0", "through2": "^2.0.0", "typedoc": "^0.5.1", From 04f42edb3d4dca754dbf803c8d6418a87aeb0c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brz=C3=B3ska?= Date: Wed, 8 Feb 2017 19:25:29 +0100 Subject: [PATCH 20/21] fix(index): add "use strict" --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index deff835..e7aea0d 100755 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,4 @@ +"use strict"; const doc = require('./doc'); const dev = require('./dev'); const build = require('./build'); @@ -17,4 +18,3 @@ module.exports = { docShapeDefs: docShapeDefs.shapeDefs, docShape: docShape.shape }; - From c98164cc14f6f875035350fe4382d5c2205c9a83 Mon Sep 17 00:00:00 2001 From: Christian Kotzbauer Date: Thu, 9 Feb 2017 21:21:05 +0100 Subject: [PATCH 21/21] fix(doc-build): fixed doc-build command for windows systems (#56) --- src/cli.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.js b/src/cli.js index 2f2e79d..6a56a63 100644 --- a/src/cli.js +++ b/src/cli.js @@ -108,7 +108,7 @@ const argv = require('yargs') try { const packageName = require(packageJsonPath).name; rimraf('dist/doc-temp/**'); - const tsc = spawn( './node_modules/.bin/tsc', [ '--project', argv.project, '--outFile', path.join(argv.outDir, packageName + '.js') ] ); + const tsc = spawn( 'node', [ './node_modules/typescript/bin/tsc', '--project', argv.project, '--outFile', path.join(argv.outDir, packageName + '.js') ] ); proxySpawned(tsc, undefined, argv.continueWhenFailed); } catch (e) { console.error(e.message);