Giter VIP home page Giter VIP logo

Comments (1)

ljluestc avatar ljluestc commented on July 17, 2024
#!/usr/bin/env node

const fs = require('fs');
const path = require('path');
const program = require('commander');

program
  .option('--with-package-json <path>', 'Specify an override package.json file')
  .parse(process.argv);

// Function to load the package.json file
function loadPackageJson(packageJsonPath) {
  try {
    return JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
  } catch (error) {
    console.error(`Error reading ${packageJsonPath}: ${error.message}`);
    process.exit(1);
  }
}

// Main logic
if (program.withPackageJson) {
  // If the --with-package-json option is provided, load the override package.json
  const overridePackageJsonPath = path.resolve(process.cwd(), program.withPackageJson);
  const overridePackageJson = loadPackageJson(overridePackageJsonPath);

  console.log('Loaded override package.json:', overridePackageJson);
} else {
  console.error('Please specify the --with-package-json option to load an override package.json');
  process.exit(1);
}

from volo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.