diff --git a/.circleci/config.yml b/.circleci/config.yml index c57fa888b..b2dec1bc7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,17 +10,18 @@ defaults: &defaults working_directory: /mnt/ramdisk/repo version: 2.1 -orbs: - # https://circleci.com/developer/orbs/orb/cmgriffing/bun-orb - bun-orb: cmgriffing/bun-orb@0.0.26 jobs: tests: <<: *defaults resource_class: large steps: - checkout - - bun-orb/setup: - version: 1.0.3 + - run: + name: Install bun + command: curl -fsSL https://bun.sh/install | bash -s -- bun-v1.0.10 + - run: + name: Link bun + command: sudo ln -s ~/.bun/bin/bun /usr/local/bin/ - restore_cache: name: Restore node modules keys: diff --git a/docs/Ignite-CLI.md b/docs/Ignite-CLI.md index 0f2178d49..1dc69609a 100644 --- a/docs/Ignite-CLI.md +++ b/docs/Ignite-CLI.md @@ -111,6 +111,7 @@ Starts the interactive prompt for generating a new Ignite project. Any options n - `--targetPath` string, specify a target directory where the project should be created - `--removeDemo` will remove the boilerplate demo code after project creation - `--useCache` flag specifying to use dependency cache for quicker installs +- `--no-timeout` flag to disable the timeout protection (useful for slow internet connections) - `--yes` accept all prompt defaults ### Issue diff --git a/src/commands/new.ts b/src/commands/new.ts index c83c22389..dbe2bd1e6 100644 --- a/src/commands/new.ts +++ b/src/commands/new.ts @@ -135,6 +135,12 @@ export interface Options { * Input Source: `prompt.ask`| `parameter.option` */ workflow?: Workflow + /** + * Whether or not to timeout if the app creation takes too long + * Input Source: `parameter.option` + * @default false + */ + noTimeout?: boolean } module.exports = { @@ -148,11 +154,22 @@ module.exports = { const options: Options = parameters.options const yname = boolFlag(options.y) || boolFlag(options.yes) + const noTimeout = options.noTimeout ?? false const useDefault = (option: unknown) => yname && option === undefined const CMD_INDENT = " " const command = (cmd: string) => p2(white(CMD_INDENT + cmd)) + // Absolute maximum that an app can take after inputs + // is 10 minutes ... otherwise we've hung up somewhere and need to exit. + const MAX_APP_CREATION_TIME = 10 * 60 * 1000 + const timeoutExit = () => { + p() + p(yellow("Error: App creation timed out.")) + if (!debug) p(gray("Run again with --debug to see what's going on.")) + process.exit(1) + } + // #endregion // debug? @@ -444,6 +461,9 @@ module.exports = { // start tracking performance const perfStart = new Date().getTime() + // add a timeout to make sure we don't hang on any errors + const timeout = noTimeout ? undefined : setTimeout(timeoutExit, MAX_APP_CREATION_TIME) + // #region Print Welcome // welcome everybody! const terminalWidth = process.stdout.columns ?? 80 @@ -753,6 +773,9 @@ module.exports = { // we're done! round performance stats to .xx digits const perfDuration = Math.round((new Date().getTime() - perfStart) / 10) / 100 + // no need to timeout, we're done! + clearTimeout(timeout) + /** Add just a _little_ more spacing to match with spinners and heading */ const p2 = (m = "") => p(` ${m}`) @@ -775,6 +798,7 @@ module.exports = { useCache, y: yname, yes: yname, + noTimeout, }, projectName, toolbox,