How to use the ensureSymlink function from fs-extra

Find comprehensive JavaScript fs-extra.ensureSymlink code examples handpicked from public code repositorys.

237
238
239
240
241
242
243
244
245
await npmInstall(installDirectory, [kitDependency, 'govuk-frontend', '@govuk-prototype-kit/common-templates'])

if ((argv.options.version || argv.options.v) === 'local-symlink') {
  const dependencyInstallLocation = path.join(installDirectory, 'node_modules', kitProjectName)
  await fs.remove(dependencyInstallLocation)
  await fs.ensureSymlink(kitDependency, dependencyInstallLocation)
}

let runningWithinCreateScriptFlag = '--running-within-create-script'
fork icon234
star icon281
watch icon77

+ 14 other calls in file

54
55
56
57
58
59
60
61
62
63
function linkPlatform(sourceFolder) {
   const nodeModulesPath = path.join(dirname, '../node_modules');
   fs.ensureDirSync(sourceFolder);
   return Promise.all([
      fs.ensureSymlink(path.join(nodeModulesPath, 'sbis3-ws/WS.Core'), path.join(sourceFolder, 'WS.Core'), 'dir'),
      fs.ensureSymlink(path.join(nodeModulesPath, 'sbis3-ws/View'), path.join(sourceFolder, 'View'), 'dir'),
      fs.ensureSymlink(path.join(nodeModulesPath, 'sbis3-ws/Vdom'), path.join(sourceFolder, 'Vdom'), 'dir'),
      fs.ensureSymlink(path.join(nodeModulesPath, 'Router/Router'), path.join(sourceFolder, 'Router'), 'dir'),
      fs.ensureSymlink(path.join(nodeModulesPath, 'saby-inferno/Inferno'), path.join(sourceFolder, 'Inferno'), 'dir'),
      fs.ensureSymlink(path.join(nodeModulesPath, 'saby-types/Types'), path.join(sourceFolder, 'Types'), 'dir'),
fork icon0
star icon0
watch icon0

+ 43 other calls in file

32
33
34
35
36
37
38
39
40
41
42
43
         }
      } catch (e) {
         // nothing to do
      }


      await fs.ensureSymlink(compiledPath, moduleOutput);
   };
}


/**
fork icon0
star icon0
watch icon0

50
51
52
53
54
55
56
57
58
await fs.outputFile(
   taskParameters.typescriptConfigPath,
   JSON.stringify(config, null, 3)
);

await fs.ensureSymlink(
   path.join(taskParameters.sabyTypescriptDir, 'tslib.d.ts'),
   path.join(taskParameters.config.sourcesDirectory, 'tslib.d.ts')
);
fork icon0
star icon0
watch icon0

+ 3 other calls in file

71
72
73
74
75
76
77
78
79
80
81
82
    }
  }


  // Switch the tag to our new version
  await fs.remove(tagPath);
  await fs.ensureSymlink(path.join('..', 'releases', version), tagPath);
}


main().catch(error => {
  console.error(error.stack);
fork icon0
star icon0
watch icon0

188
189
190
191
192
193
194
195
196
197
opts.derefSymlinks = false

const src = path.join(opts.dir, 'main.js')
const dest = path.join(opts.dir, 'main-link.js')

await fs.ensureSymlink(src, dest)
const finalPath = (await packager(opts))[0]
const destLink = path.join(finalPath, 'resources', 'app', 'main-link.js')
await util.assertSymlink(t, destLink, 'The expected file should still be a symlink')
await fs.remove(dest)
fork icon0
star icon0
watch icon0

function icon

fs-extra.readFileSync is the most popular function in fs-extra (9724 examples)