BREAKING CHANGE(scope): update scope to @pushrocks

This commit is contained in:
Philipp Kunz 2018-09-20 00:47:15 +02:00
parent 42573648b9
commit 581bae156e
16 changed files with 2134 additions and 1407 deletions

View File

@ -3,69 +3,140 @@ image: hosttoday/ht-docker-node:npmci
cache: cache:
paths: paths:
- .yarn/ - .npmci_cache/
key: "$CI_BUILD_STAGE" key: "$CI_BUILD_STAGE"
stages: stages:
- security
- test - test
- release - release
- trigger - metadata
- pages
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci git mirror
tags:
- docker
- notpriv
snyk:
stage: security
script:
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
tags:
- docker
- notpriv
# ====================
# test stage
# ====================
testLEGACY: testLEGACY:
stage: test stage: test
script: script:
- npmci test legacy - npmci node install legacy
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
allow_failure: true allow_failure: true
testLTS: testLTS:
stage: test stage: test
script: script:
- npmci test lts - npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
testSTABLE: testSTABLE:
stage: test stage: test
script: script:
- npmci test stable - npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
release: release:
stage: release stage: release
script: script:
- npmci publish - npmci node install stable
- npmci npm publish
only: only:
- tags - tags
tags: tags:
- docker - docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
image: docker:stable
allow_failure: true
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [codeclimate.json]
tags:
- docker
- priv
trigger: trigger:
stage: trigger stage: metadata
script: script:
- npmci trigger - npmci trigger
only: only:
- tags - tags
tags: tags:
- docker - docker
- notpriv
pages: pages:
image: hosttoday/ht-docker-node:npmci image: hosttoday/ht-docker-node:npmci
stage: pages stage: metadata
script: script:
- npmci commadn yarn global add npmpage - npmci command npm install -g typedoc typescript
- npmci command npmpage --publish gitlab - npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
tags: tags:
- docker - docker
- notpriv
only: only:
- tags - tags
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
paths: paths:
- public - public
allow_failure: true
windowsCompatibility:
image: stefanscherer/node-windows:10-build-tools
stage: metadata
script:
- npm install & npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- windows
allow_failure: true

View File

@ -1,13 +1,16 @@
# smartsass # smartsass
smart wrapper for sass smart wrapper for sass
## Availabililty ## Availabililty
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartsass) [![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartsass)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartsass) [![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartsass)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartsass) [![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartsass)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartsass/) [![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartsass/)
## Status for master ## Status for master
[![build status](https://GitLab.com/pushrocks/smartsass/badges/master/build.svg)](https://GitLab.com/pushrocks/smartsass/commits/master) [![build status](https://GitLab.com/pushrocks/smartsass/badges/master/build.svg)](https://GitLab.com/pushrocks/smartsass/commits/master)
[![coverage report](https://GitLab.com/pushrocks/smartsass/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartsass/commits/master) [![coverage report](https://GitLab.com/pushrocks/smartsass/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartsass/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/smartsass.svg)](https://www.npmjs.com/package/smartsass) [![npm downloads per month](https://img.shields.io/npm/dm/smartsass.svg)](https://www.npmjs.com/package/smartsass)
@ -19,6 +22,7 @@ smart wrapper for sass
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage ## Usage
Use TypeScript for best in class instellisense. Use TypeScript for best in class instellisense.
```javascript ```javascript
@ -39,6 +43,6 @@ let renderedString = mySmartsass.render()
For further information read the linked docs at the top of this README. For further information read the linked docs at the top of this README.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) > | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks) [![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)

22
dist/index.d.ts vendored
View File

@ -1,22 +0,0 @@
import { Result } from 'node-sass';
export interface ISmartsassConstructorOptions {
entryFilePath: string;
includePaths?: string[];
}
export declare class Smartsass {
includePaths: any[];
entryFilePath: string;
constructor(optionsArg: ISmartsassConstructorOptions);
/**
* add further include paths
*/
addIncludePaths(includePathsArray: string[]): void;
/**
* renders the Smartsass classes' entryfile and returns result as string
*/
render(): Promise<Result>;
/**
* renders and stores
*/
renderAndStore(outputFilePath: string): Promise<void>;
}

58
dist/index.js vendored
View File

@ -1,58 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartsass.plugins");
class Smartsass {
constructor(optionsArg) {
this.includePaths = [];
this.entryFilePath = optionsArg.entryFilePath;
if (optionsArg.includePaths) {
for (let includePath of optionsArg.includePaths) {
this.includePaths.push(includePath);
}
}
}
/**
* add further include paths
*/
addIncludePaths(includePathsArray) {
for (let includePath of includePathsArray) {
this.includePaths.push(includePath);
}
}
/**
* renders the Smartsass classes' entryfile and returns result as string
*/
render() {
let done = plugins.smartq.defer();
plugins.sass.render({
file: this.entryFilePath,
includePaths: this.includePaths
}, function (err, result) {
if (err) {
console.log(err);
done.reject(err);
}
done.resolve(result);
});
return done.promise;
}
/**
* renders and stores
*/
renderAndStore(outputFilePath) {
return __awaiter(this, void 0, void 0, function* () {
let result = yield this.render();
yield plugins.smartfile.memory.toFs(result.css.toString(), outputFilePath);
});
}
}
exports.Smartsass = Smartsass;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsK0NBQThDO0FBVTlDO0lBR0UsWUFBWSxVQUF3QztRQUZwRCxpQkFBWSxHQUFHLEVBQUUsQ0FBQTtRQUdmLElBQUksQ0FBQyxhQUFhLEdBQU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UMsQ0FBQTtRQUNGLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0lBQ3JCLENBQUM7SUFFRDs7T0FFRztJQUNHLGNBQWMsQ0FBRSxjQUFzQjs7WUFDMUMsSUFBSSxNQUFNLEdBQUcsTUFBTSxJQUFJLENBQUMsTUFBTSxFQUFFLENBQUE7WUFDaEMsTUFBTSxPQUFPLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxRQUFRLEVBQUUsRUFBRSxjQUFjLENBQUMsQ0FBQTtRQUM1RSxDQUFDO0tBQUE7Q0FDRjtBQTlDRCw4QkE4Q0MifQ==

View File

@ -1,3 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzYXNzLmluY2x1ZGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzYXNzLmluY2x1ZGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==

View File

@ -1,5 +0,0 @@
import 'typings-global';
import * as sass from 'node-sass';
import * as smartfile from 'smartfile';
import * as smartq from 'smartq';
export { sass, smartfile, smartq };

View File

@ -1,10 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global");
const sass = require("node-sass");
exports.sass = sass;
const smartfile = require("smartfile");
exports.smartfile = smartfile;
const smartq = require("smartq");
exports.smartq = smartq;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzYXNzLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHNhc3MucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2QixrQ0FBaUM7QUFLL0Isb0JBQUk7QUFKTix1Q0FBc0M7QUFLcEMsOEJBQVM7QUFKWCxpQ0FBZ0M7QUFLOUIsd0JBQU0ifQ==

View File

@ -1,7 +1,6 @@
{ {
"npmci": { "npmci": {
"globalNpmTools": [ "npmGlobalTools": [],
"npmts" "npmAccessLevel": "public"
]
} }
} }

1978
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,13 @@
{ {
"name": "smartsass", "name": "@pushrocks/smartsass",
"version": "1.0.5", "version": "1.0.5",
"private": false,
"description": "smart wrapper for sass", "description": "smart wrapper for sass",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
"scripts": { "scripts": {
"test": "(npmts)" "test": "(tstest test/)",
"build": "(tsbuild)"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -23,10 +25,16 @@
}, },
"homepage": "https://gitlab.com/pushrocks/smartsass#README", "homepage": "https://gitlab.com/pushrocks/smartsass#README",
"dependencies": { "dependencies": {
"@pushrocks/smartfile": "^6.0.8",
"@pushrocks/smartpromise": "^2.0.5",
"@types/node-sass": "^3.10.32", "@types/node-sass": "^3.10.32",
"node-sass": "^4.5.0", "node-sass": "^4.9.3"
"smartfile": "^4.1.7", },
"smartq": "^1.1.1", "devDependencies": {
"typings-global": "^1.0.14" "@gitzone/tsbuild": "^2.0.22",
"@gitzone/tsrun": "^1.1.12",
"@gitzone/tstest": "^1.0.15",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^10.10.1"
} }
} }

12
test/test.ts Normal file
View File

@ -0,0 +1,12 @@
import { tap, expect } from '@pushrocks/tapbundle';
import * as smartsass from '../ts/index';
tap.test('should create a valid instance of smartsass', async () => {
const testsmartSass = new smartsass.Smartsass({
data: 'hello'
})
expect(testsmartSass).to.be.instanceof(smartsass.Smartsass);
});
tap.start();

View File

@ -1,21 +1,22 @@
import * as plugins from './smartsass.plugins' import * as plugins from './smartsass.plugins';
// interfaces // interfaces
import { Result } from 'node-sass' import { Result } from 'node-sass';
export interface ISmartsassConstructorOptions { export interface ISmartsassConstructorOptions {
entryFilePath: string, data?: string;
includePaths?: string[] entryFilePath?: string;
includePaths?: string[];
} }
export class Smartsass { export class Smartsass {
includePaths = [] includePaths = [];
entryFilePath: string entryFilePath: string;
constructor(optionsArg: ISmartsassConstructorOptions) { constructor(optionsArg: ISmartsassConstructorOptions) {
this.entryFilePath = optionsArg.entryFilePath this.entryFilePath = optionsArg.entryFilePath;
if (optionsArg.includePaths) { if (optionsArg.includePaths) {
for (let includePath of optionsArg.includePaths) { for (let includePath of optionsArg.includePaths) {
this.includePaths.push(includePath) this.includePaths.push(includePath);
} }
} }
} }
@ -23,9 +24,9 @@ export class Smartsass {
/** /**
* add further include paths * add further include paths
*/ */
addIncludePaths (includePathsArray: string[]) { addIncludePaths(includePathsArray: string[]) {
for (let includePath of includePathsArray) { for (let includePath of includePathsArray) {
this.includePaths.push(includePath) this.includePaths.push(includePath);
} }
} }
@ -33,25 +34,28 @@ export class Smartsass {
* renders the Smartsass classes' entryfile and returns result as string * renders the Smartsass classes' entryfile and returns result as string
*/ */
render() { render() {
let done = plugins.smartq.defer<plugins.sass.Result>() let done = plugins.smartpromise.defer<plugins.sass.Result>();
plugins.sass.render({ plugins.sass.render(
{
file: this.entryFilePath, file: this.entryFilePath,
includePaths: this.includePaths includePaths: this.includePaths
}, function (err, result) { },
function(err, result) {
if (err) { if (err) {
console.log(err) console.log(err);
done.reject(err) done.reject(err);
} }
done.resolve(result) done.resolve(result);
}) }
return done.promise );
return done.promise;
} }
/** /**
* renders and stores * renders and stores
*/ */
async renderAndStore (outputFilePath: string) { async renderAndStore(outputFilePath: string) {
let result = await this.render() let result = await this.render();
await plugins.smartfile.memory.toFs(result.css.toString(), outputFilePath) await plugins.smartfile.memory.toFs(result.css.toString(), outputFilePath);
} }
} }

View File

@ -1 +1 @@
import * as plugins from './smartsass.plugins' import * as plugins from './smartsass.plugins';

View File

@ -1,10 +1,5 @@
import 'typings-global' import * as sass from 'node-sass';
import * as sass from 'node-sass' import * as smartfile from '@pushrocks/smartfile';
import * as smartfile from 'smartfile' import * as smartpromise from '@pushrocks/smartpromise';
import * as smartq from 'smartq'
export { export { sass, smartfile, smartpromise };
sass,
smartfile,
smartq
}

1246
yarn.lock

File diff suppressed because it is too large Load Diff