Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions apps/demos/utils/create-bundles/Angular/bundler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { exec } from 'child_process';
import { spawn } from 'child_process';
import { BuildOptions } from 'esbuild';
import { existsSync, mkdirSync, removeSync } from 'fs-extra';
import { Demo, Framework } from '../helper/types';
Expand Down Expand Up @@ -42,8 +42,10 @@ export default class AngularBundler implements Bundler {

createDemoLayout(demo, this.framework);

const ngBuildCommand = `npm run build-angular -- ${getProjectNameByDemo(demo)}`;
const ngBuildProcess = exec(ngBuildCommand);
const isWin = process.platform === 'win32';
const npmCmd = isWin ? 'npm.cmd' : 'npm';
const npmArgs = ['run', 'build-angular', '--', getProjectNameByDemo(demo)];
const ngBuildProcess = spawn(npmCmd, npmArgs);
Comment on lines +45 to +48
ngBuildProcess.stdout.on('data', (data) => {
Comment on lines +45 to 49
Comment on lines +45 to 49
console.log(`stdout: ${data}`);
Comment on lines +45 to 50
});
Comment on lines +48 to 51
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is not related to the current changes

Comment on lines +48 to 51
Expand Down
21 changes: 10 additions & 11 deletions apps/demos/utils/ts-to-js-converter/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,15 @@ const pipeSource = async (
}));
};

// eslint-disable-next-line require-await
const execTsc = async (directory: string, args: string): Promise<string> => new Promise((resolve, reject) => {
cps.exec(`tsc ${args}`, (error, stdout, stderr) => {
if (error != null) {
// eslint-disable-next-line prefer-promise-reject-errors
return reject(`${error}\n${stderr}\n${stdout}`);
}
return resolve(stdout);
});
});
const execTsc = async (directory: string, args: string[]): Promise<string> => {
const tscScript = require.resolve('typescript/bin/tsc');
const { stdout } = await promisify(cps.execFile)(
process.execPath,
[tscScript, ...args],
{ cwd: directory },
);
return stdout;
};

const compile = async (resolve: PathResolvers, log: Logger) => {
log.debug('compiling sources and unit tests');
Expand All @@ -110,7 +109,7 @@ const compile = async (resolve: PathResolvers, log: Logger) => {
),
);

await execTsc(resolve.source('./'), `--build ${tsconfigFile}`);
await execTsc(resolve.source('./'), ['--build', tsconfigFile]);
};

const copyAssets = async (resolve: PathResolvers, log: Logger) => {
Expand Down
Loading