Socket
Socket
Sign inDemoInstall

@angular-custom-builders/lite-serve

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular-custom-builders/lite-serve - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

4

collection.json

@@ -6,8 +6,8 @@ {

"schematics": {
"liteServe": {
"setup": {
"factory": "./src/schematics/lite-serve/schematic",
"schema": "./src/schematics/lite-serve/schema.json",
"description": "lite-serve schematic"
"description": "Add the lite-serve to a specific app"
}
}
}
{
"name": "@angular-custom-builders/lite-serve",
"version": "0.1.2",
"version": "0.1.3",
"description": "Custom builder to run lite-server with options",

@@ -17,3 +17,6 @@ "main": "src/index.js",

},
"dependencies": {
"browser-sync": "^2.26.7"
},
"typings": "src/index.d.ts"
}

@@ -94,1 +94,55 @@ # lite-serve

## Quick-start using Nx <a name="quickstart"></a>
1. Create a new project with the nx cli.
```sh
npx create-nx-workspace@latest workspace --preset="angular" --appName="myapp" --style="css"
cd myapp
```
1. Add `lite-serve` dependency
```sh
yarn add -D @angular-custom-builders/lite-serve
```
1. Add a new section on the app
```json
"lite-serve": {
"builder": "@angular-custom-builders/lite-serve:dist-serve",
"options": {
"browserTarget": "myapp:build"
}
}
```
1. Change the e2e to use the lit-serve
In case of Cypress
```json
"e2e": {
"builder": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/myapp-e2e/cypress.json",
"tsConfig": "apps/myapp-e2e/tsconfig.e2e.json",
"devServerTarget": "myapp:lite-serve"
}
},
```
In case of Protractor
```json
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "apps/admin-ee-e2e/protractor.conf.js",
"devServerTarget": "myapp:lite-serve"
}
},
```
1. Run the e2e with an existing dist folder
```sh
ng run myapp-e2e:e2e
```

@@ -6,22 +6,28 @@ "use strict";

const rxjs_1 = require("rxjs");
const operators_1 = require("rxjs/operators");
const browserSync = require("browser-sync");
browserSync.create();
function runBuilder(options, context) {
return rxjs_1.of({ success: true }).pipe(operators_1.tap(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
let outputPath = 'dist';
if (options.browserTarget) {
const browserTarget = architect_1.targetFromTargetString(options.browserTarget);
const rawBrowserOptions = yield context.getTargetOptions(browserTarget);
outputPath = rawBrowserOptions.outputPath;
return rxjs_1.Observable.create((observer) => tslib_1.__awaiter(this, void 0, void 0, function* () {
try {
let outputPath = 'dist';
if (options.browserTarget) {
const browserTarget = architect_1.targetFromTargetString(options.browserTarget);
const rawBrowserOptions = yield context.getTargetOptions(browserTarget);
outputPath = rawBrowserOptions.outputPath;
}
browserSync.init({
port: options.port,
server: outputPath,
watch: false,
open: options.open,
logLevel: options.logLevel
});
context.logger.info(`lite-serve serving folder ${outputPath} on port ${options.port}`);
observer.next({ success: true });
observer.complete();
}
browserSync.init({
port: options.port,
server: outputPath,
watch: false,
open: options.open,
logLevel: options.logLevel
});
context.logger.info(`lite-serve serving folder ${outputPath} on port ${options.port}`);
})));
catch (e) {
observer.error(`ERROR: Something went wrong in @angular-custom-builders/lite-serve - ${e.message}`);
}
}));
}

@@ -28,0 +34,0 @@ exports.runBuilder = runBuilder;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc