Advertisement
AtomicOs

init.js

May 28th, 2021
2,512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Copyright (c) 2019 The Brave Authors. All rights reserved.
  2. // This Source Code Form is subject to the terms of the Mozilla Public
  3. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  4. // you can obtain one at http://mozilla.org/MPL/2.0/.
  5.  
  6. const fs = require('fs')
  7. const Log = require('../lib/logging')
  8. const path = require('path')
  9. const { spawnSync } = require('child_process')
  10. const util = require('../lib/util')
  11.  
  12. Log.progress('Performing initial checkout of brave-core')
  13.  
  14. const braveCoreDir = path.resolve(__dirname, '..', 'src', 'brave')
  15. const braveCoreRef = util.getProjectVersion('brave-core')
  16.  
  17. if (!fs.existsSync(path.join(braveCoreDir, '.git'))) {
  18.   Log.status(`Cloning brave-core [${braveCoreRef}] into ${braveCoreDir}...`)
  19.   fs.mkdirSync(braveCoreDir)
  20.   util.runGit(braveCoreDir, ['clone', util.getNPMConfig(['projects', 'brave-core', 'repository', 'url']), '.'])
  21.   util.runGit(braveCoreDir, ['checkout', braveCoreRef])
  22. }
  23.  
  24. let npmCommand = 'npm'
  25. if (process.platform === 'win32') {
  26.   npmCommand += '.cmd'
  27. }
  28.  
  29. util.run(npmCommand, ['install'], { cwd: braveCoreDir })
  30.  
  31. util.run(npmCommand, ['run', 'sync' ,'--', '--init'].concat(process.argv.slice(2)), {
  32.   cwd: braveCoreDir,
  33.   env: process.env,
  34.   stdio: 'inherit',
  35.   shell: true,
  36.   git_cwd: '.', })
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement