How to use the pushd function from shelljs

Find comprehensive JavaScript shelljs.pushd code examples handpicked from public code repositorys.

21
22
23
24
25
26
27
28
29
30

require('dotenv').config({
  path: `./deployments/devnet-${nextDevnetId}/.env`
})

shell.pushd(`./deployments/devnet-${nextDevnetId}`)
shell.exec(`terraform workspace new devnet-${nextDevnetId}`)
shell.popd()

console.log('📍Executing terraform init...')
fork icon37
star icon39
watch icon0

98
99
100
101
102
103
104
105
106
107
  // if everything succeeded so far, we can launch Metro and the app
  // start the Metro server in a separate window
  launchPackagerInSeparateWindow();

  // launch the app on iOS simulator
  pushd('packages/rn-tester');
  exec('npx react-native run-ios --scheme RNTester --simulator "iPhone 14"');
  popd();
} else {
  // we do the android path here
fork icon2
star icon0
watch icon0

+ 3 other calls in file

86
87
88
89
90
91
92
93
94
95
96
  jsiFolder,
  hermesCoreSourceFolder,
  buildType,
  targetFolder,
) {
  pushd(`${hermesCoreSourceFolder}`);


  //Need to generate hermesc
  exec(
    `${hermesCoreSourceFolder}/utils/build-hermesc-xcode.sh ${hermesCoreSourceFolder}/build_host_hermesc`,
fork icon2
star icon0
watch icon0

78
79
80
81
82
83
84
85
86
87
88
 * Pushes a directory
 * @param {String} dir
 * @returns {Void}
 */
function pushd(dir) {
    Shell.pushd("-q", dir);
}


/**
 * Pushes a directory, if required
fork icon0
star icon3
watch icon0

+ 3 other calls in file

28
29
30
31
32
33
34
35
36
37
const tests = testTypes.map(type => {
  const {silent} = sh.config
  sh.config.silent = true
  const mocha = 'mocha --forbid-only'
  const base = path.join('test', 'commands')
  sh.pushd(base)
  let tests = _(sh.ls())
  .map(t => [t.split('.')[0], path.join(base, t)])
  .map(([t, s]) => {
    const mochaString = process.env.CIRCLECI ? `MOCHA_FILE=reports/mocha-${t}.xml ${mocha} --reporter mocha-junit-reporter ${s}` : `${mocha} ${s}`
fork icon1
star icon1
watch icon0

73
74
75
76
77
78
79
80
81
shell.rm("-rf", "./build");

// Cleanup any previous Rust builds, update deps, and compile
shell.exec("npm ci --ignore-scripts");
shell.exec("npm run clean-rs");
shell.pushd("./native");
shell.exec("cargo update");
shell.popd();
shell.exec("npm run compile");
fork icon0
star icon1
watch icon0

64
65
66
67
68
69
70
71
72
73
74
shelljs.rm('-f', 'sourcegraph-downloaded.zip')
shelljs.mv(`sourcegraph-${commitId}`, rootDirectoryNameForZip)
signale.success('Downloaded and unzipped sourcegraph/sourcegraph repository')


if (includeCodeIntelExtensions) {
  shelljs.pushd(rootDirectoryNameForZip)
  shelljs.exec('pnpm install')
  shelljs.exec('pnpm --filter @sourcegraph/browser run build-inline-extensions')
  shelljs.popd()
}
fork icon930
star icon0
watch icon0

132
133
134
135
136
137
138
139
140

shx.rm('-rf', buildFolder)
shx.mkdir('-p', buildFolder)

shx.config.silent = true
shx.pushd(buildFolder)
shx.config.silent = false

const executableAbsolutePath = path.join(__dirname, executableRelativePath)
fork icon0
star icon0
watch icon0

+ 4 other calls in file

5
6
7
8
9
10
11
12
13
14
15
16
17
async function main() {
  const buildDir = fs.mkdtempSync(path.join(shell.tempdir(), "nomad-openapi-ts-build"));


  shell.rm("-r", "src/*");


  shell.pushd(buildDir);
  shell.exec("wget https://raw.githubusercontent.com/hashicorp/nomad-openapi/main/v1/openapi.yaml");
  shell.popd()


  shell.exec(`$(npm bin)/openapi --input ${path.join(buildDir, "openapi.yaml")} --name NomadClient --output src`)
fork icon0
star icon0
watch icon0

84
85
86
87
88
89
90
91
92
93
94
95
        else throw err;
    }
}


async function main() {
    shell.pushd(path.join(__dirname, '..'));


    const argv = yargs(process.argv.slice(2))
        .option('network', {
            default: 'development',
fork icon0
star icon0
watch icon0