build/builder.js
function build(pkgName, pkgVersion) {
    clean();

    // Update framework name/version/build date in Runtime class
    updateRuntimeInfo(Date.now(), pkgName, pkgVersion);

    const buildDir = "./build";

    fse.readdirSync(buildDir).forEach(file => {
        if (file.match(/tsconfig\..+\.json/gi)) {
            const tsconfigPath = path.resolve(buildDir, file);
            const opts = require(tsconfigPath).compilerOptions;
            const target = opts.target + "-" + opts.module;
            const targetDir = "./dist/" + target + "/";

            logInfo("Build distribution package " + target);

            // First, bring the desired tsconfig file into place
            fse.copySync(tsconfigPath, "./" + TS_TARGETDIR + "/tsconfig.json");

            // Transpile TS into JS code, using TS compiler in local typescript npm package.
            // Remove all comments except copy-right header comments, and do not
            // generate corresponding .d.ts files (see next step below).
            childProcess.execSync(path.resolve("./node_modules/.bin/tsc") +
                " --project " + TS_TARGETDIR +
                " --outDir " + targetDir +
                " --removeComments true --declaration false",
                // redirect child output to parent's stdin, stdout and stderr
                { stdio: "inherit" });

            // Only emit .d.ts files, using TS compiler in local typescript npm package.
            // The generated declaration files include all comments so that
            // IDEs can provide this information to developers.
            childProcess.execSync(path.resolve("./node_modules/.bin/tsc") +
            " --project " + TS_TARGETDIR +
            " --outDir " + targetDir +
            " --removeComments false --declaration true --emitDeclarationOnly true",
            // redirect child output to parent's stdin, stdout and stderr
            { stdio: "inherit" });

            // Copy scripts folder into distribution package
            fse.copySync("./scripts", targetDir + "scripts");

            // Copy readme into distribution package
            fse.copySync("./README.md", targetDir + "README.md");

            // Copy license into distribution package
            fse.copySync("./LICENSE", targetDir + "LICENSE");

            // Copy tslint.json into distribution package (for use by Coaty projects)
            fse.copySync("./build/tslint.json", targetDir + "tslint-config.json");

            // Copy .npmignore into distribution package
            fse.copySync("./.npmignore", targetDir + ".npmignore");

            // Copy package.json into distribution package
            fse.copySync("./package.json", targetDir + "package.json");

            // Update package.json to include distribution as prerelease in version
            updatePackageInfo(target, targetDir + "package.json", file !== "tsconfig.es5-commonjs.json");
        }
    });
}
function build(pkgName, pkgVersion) {
    clean();

    // Update framework name/version/build date in Runtime class
    updateRuntimeInfo(Date.now(), pkgName, pkgVersion);

    const buildDir = "./build";

    fse.readdirSync(buildDir).forEach(file => {
        if (file.match(/tsconfig\..+\.json/gi)) {
            const tsconfigPath = path.resolve(buildDir, file);
            const opts = require(tsconfigPath).compilerOptions;
            const target = opts.target + "-" + opts.module;
            const targetDir = "./dist/" + target + "/";

            logInfo("Build distribution package " + target);

            // First, bring the desired tsconfig file into place
            fse.copySync(tsconfigPath, "./" + TS_TARGETDIR + "/tsconfig.json");

            // Transpile TS into JS code, using TS compiler in local typescript npm package.
            // Remove all comments except copy-right header comments, and do not
            // generate corresponding .d.ts files (see next step below).
            childProcess.execSync(path.resolve("./node_modules/.bin/tsc") +
                " --project " + TS_TARGETDIR +
                " --outDir " + targetDir +
                " --removeComments true --declaration false",
                // redirect child output to parent's stdin, stdout and stderr
                { stdio: "inherit" });

            // Only emit .d.ts files, using TS compiler in local typescript npm package.
            // The generated declaration files include all comments so that
            // IDEs can provide this information to developers.
            childProcess.execSync(path.resolve("./node_modules/.bin/tsc") +
            " --project " + TS_TARGETDIR +
            " --outDir " + targetDir +
            " --removeComments false --declaration true --emitDeclarationOnly true",
            // redirect child output to parent's stdin, stdout and stderr
            { stdio: "inherit" });

            // Copy scripts folder into distribution package
            fse.copySync("./scripts", targetDir + "scripts");

            // Copy readme into distribution package
            fse.copySync("./README.md", targetDir + "README.md");

            // Copy license into distribution package
            fse.copySync("./LICENSE", targetDir + "LICENSE");

            // Copy tslint.json into distribution package (for use by Coaty projects)
            fse.copySync("./build/tslint.json", targetDir + "tslint-config.json");

            // Copy .npmignore into distribution package
            fse.copySync("./.npmignore", targetDir + ".npmignore");

            // Copy package.json into distribution package
            fse.copySync("./package.json", targetDir + "package.json");

            // Update package.json to include distribution as prerelease in version
            updatePackageInfo(target, targetDir + "package.json", file !== "tsconfig.es5-commonjs.json");
        }
    });
}
function build ( pkgName , pkgVersion ) { clean ( ) ; // Update framework name/version/build date in Runtime class updateRuntimeInfo ( Date . now ( ) , pkgName , pkgVersion ) ; const buildDir = "./build" ; fse . readdirSync ( buildDir ) . forEach ( file => { if ( file . match ( / tsconfig\..+\.json / gi ) ) { const tsconfigPath = path . resolve ( buildDir , file ) ; const opts = require ( tsconfigPath ) . compilerOptions ; const target = opts . target + "-" + opts . module ; const targetDir = "./dist/" + target + "/" ; logInfo ( "Build distribution package " + target ) ; // First, bring the desired tsconfig file into place fse . copySync ( tsconfigPath , "./" + TS_TARGETDIR + "/tsconfig.json" ) ; // Transpile TS into JS code, using TS compiler in local typescript npm package. // Remove all comments except copy-right header comments, and do not // generate corresponding .d.ts files (see next step below). childProcess . execSync ( path . resolve ( "./node_modules/.bin/tsc" ) + " --project " + TS_TARGETDIR + " --outDir " + targetDir + " --removeComments true --declaration false" , // redirect child output to parent's stdin, stdout and stderr { stdio : "inherit" } ) ; // Only emit .d.ts files, using TS compiler in local typescript npm package. // The generated declaration files include all comments so that // IDEs can provide this information to developers. childProcess . execSync ( path . resolve ( "./node_modules/.bin/tsc" ) + " --project " + TS_TARGETDIR + " --outDir " + targetDir + " --removeComments false --declaration true --emitDeclarationOnly true" , // redirect child output to parent's stdin, stdout and stderr { stdio : "inherit" } ) ; // Copy scripts folder into distribution package fse . copySync ( "./scripts" , targetDir + "scripts" ) ; // Copy readme into distribution package fse . copySync ( "./README.md" , targetDir + "README.md" ) ; // Copy license into distribution package fse . copySync ( "./LICENSE" , targetDir + "LICENSE" ) ; // Copy tslint.json into distribution package (for use by Coaty projects) fse . copySync ( "./build/tslint.json" , targetDir + "tslint-config.json" ) ; // Copy .npmignore into distribution package fse . copySync ( "./.npmignore" , targetDir + ".npmignore" ) ; // Copy package.json into distribution package fse . copySync ( "./package.json" , targetDir + "package.json" ) ; // Update package.json to include distribution as prerelease in version updatePackageInfo ( target , targetDir + "package.json" , file !== "tsconfig.es5-commonjs.json" ) ; } } ) ; }
Build distribution packages with modules and test specs for all defined
ECMAScript versions and module formats.
Build distribution packages with modules and test specs for all defined ECMAScript versions and module formats .