Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INVE-361] [INVE-362] Reduced dependencies by not using yarn or rsync #2

Merged
merged 2 commits into from
Jan 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
## Installation

First, install [Yeoman](http://yeoman.io) and generator-web-service using [Yarn](https://yarnpkg.com/) or [npm](https://www.npmjs.com/).
Please ensure that you have a relatively recent version of NodeJs installed:
```bash
node --version
//
```

First, install [Yeoman](http://yeoman.io) and generator-web-service [npm](https://www.npmjs.com/).

```bash
yarn global add yo @sirensolutions/generator-web-service
# OR
npm install -g yo @sirensolutions/generator-web-service
```

Expand All @@ -16,10 +20,10 @@ yo @sirensolutions/web-service


## For Developers
To use a generator that exists as a local repository, run `yarn link` in the repository, then generate your new project the same way:
To use a generator that exists as a local repository, run `npm link` in the repository, then generate your new project the same way:

```bash
yo @sirensolutions/web-service
```

If you make additional changes to the repository, you don't have to rerun `yarn link`.
If you make additional changes to the repository, you don't have to rerun `npm link`.
4 changes: 2 additions & 2 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ module.exports = class extends Generator {

install() {
this.log('\nInstalling dependencies...');
this.yarnInstall(undefined, undefined, { stdio: ['inherit', 'ignore', 'pipe'] });
this.npmInstall(undefined, undefined, { stdio: ['inherit', 'ignore', 'pipe'] });
}

end() {
this.log(`\n\nDirectory '${this.props.group}' has been created!`);
this.log(`\nTo add your web service to Investigate, run ${chalk.yellow('yarn package')} and install the generated zip:`);
this.log(`\nTo add your web service to Investigate, run ${chalk.yellow('npm run package')} and install the generated zip:`);
this.log(chalk.yellow(` bin/investigate-plugin install file:///${this.destinationPath(`target/${this.props.group}.zip`)}\n`));
}
};
2 changes: 1 addition & 1 deletion app/templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This web service driver consists of one service, `<%= service %>`, registered by

# Installation
To install these services into Investigate:
1. Run `yarn package` to create a zip
1. Run `npm run package` to create a zip
1. Run `bin/investigate-plugin install file:////path/to/<%= group %>/target/<%= group %>.zip`

This project was generated with Siren's [generator for web service drivers](https://www.npmjs.com/package/@sirensolutions/generator-web-service).
15 changes: 7 additions & 8 deletions app/templates/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { src, dest, series, parallel } = require('gulp');
const { exec } = require('shelljs');
const mkdirp = require('mkdirp');
const rsync = require('gulp-rsync');
const fs = require('fs-extra');
const rimraf = require('rimraf');
const zip = require('gulp-zip');
const ts = require('gulp-typescript');
Expand All @@ -10,16 +10,15 @@ const cache = require('gulp-cached');

const PACKAGE_NAME = require('./package.json').name;

function copyFiles(destination) {
return function copyServerFiles() {
return src(['dist/**', '!dist/tsconfig.tsbuildinfo'])
.pipe(rsync({ root: 'dist', destination, archive: true, update: true, clean: true }));
};
function copyFiles(source, destination) {
return function copyFiles() {
return fs.copy(source, destination);
}
}

function install(location) {
return async function install() {
const process = exec(`yarn --production`, { cwd: location, silent: true });
const process = exec(`npm install --only=production`, { cwd: location, silent: true });
if (process.code) {
console.log(process.stdout);
throw new Error(process.stderr);
Expand Down Expand Up @@ -65,7 +64,7 @@ const build = series(
exports.clean,
exports.compile,
mkdir(`build/kibana/${PACKAGE_NAME}`),
copyFiles(`build/kibana/${PACKAGE_NAME}`),
copyFiles('dist', `build/kibana/${PACKAGE_NAME}`),
install(`build/kibana/${PACKAGE_NAME}`)
);

Expand Down
2 changes: 1 addition & 1 deletion app/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"axios": "^0.19.0"
},
"devDependencies": {
"fs-extra": "^8.1.0",
"gulp": "^4.0.2",
"gulp-cached": "^1.1.1",
"gulp-rsync": "^0.0.8",
"gulp-sourcemaps": "^2.6.5",
"gulp-typescript": "^5.0.1",
"gulp-zip": "^5.0.1",
Expand Down
Loading