NPM部署软件

时间:2016-08-02 13:25:04

标签: node.js npm

我想使用NPM部署我的NodeJS + ExpressJS网站(API rest + front)。

我现在在做什么:

  1. 我设置了私人NPM存储库
  2. 我将我的软件作为NPM包推送到此存储库
  3. 我做npm install mysoftware
  4. 现在,我要做的问题是:node node_modules / mysoftware / bin.js
  5. 在第4步之后。我有以下文件树:

    my-software
    ├── bin.js
    ├── package.json
    ├── src
    └── node_modules
        ├── some-required-module
        │   ├── HISTORY.md
        │   ├── index.js
        │   ├── LICENSE
        │   ├── package.json
        │   └── README.md
    

    我不喜欢这个文件树,因为一切都是同一级别:我的软件及其依赖性,它使它非常混乱。 我喜欢这样:

    protected void onStart() {
            super.onStart();
            //Build resources if null
            if (settings == null) {
                settings = getSharedPreferences(PREFS_NAME, 0);
            }
    
            Boolean RequestingLU = settings.getBoolean("RequestingLU", true);
            if (!RequestingLU) {
                StoppedMessage();
            }
            if (RequestingLU) {
                if (mLocationClient == null)
                {
                    buildLocationClient();
                }
                mLocationClient.connect();
    
            }
    
        }
    
    public void onConnected(Bundle connectionHint) {
        Toast.makeText(this, "You have connected", Toast.LENGTH_LONG).show();
        mLocationRequest = new LocationRequest();
        mLocationRequest.setInterval(UPDATE_INTERVAL);
        mLocationRequest.setFastestInterval(UPDATE_INTERVAL);
        mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
        PendingResult<LocationSettingsResult> result =
                LocationServices.SettingsApi.checkLocationSettings(mLocationClient, mLocationSettingsRequest
                );
        result.setResultCallback(ViewingWindow.this);
    
        if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
            LocationServices.FusedLocationApi.requestLocationUpdates(mLocationClient, mLocationRequest, this);
            OldLocation = LocationServices.FusedLocationApi.getLastLocation(mLocationClient);
        }
    }
    
    public void onLocationChanged(Location location) {
        Toast.makeText(this, "Location Changed", Toast.LENGTH_SHORT).show();
        if (settings == null) {
            settings = getSharedPreferences(PREFS_NAME, 0);
        }
    
        double speed = OldLocation.distanceTo(location);
    
        OldLocation = location;
    }
    

    有没有办法将npm软件包安装为项目,因此有文件树我喜欢?

0 个答案:

没有答案