asset-pipe-css-writer
Advanced tools
Comparing version 1.0.0-alpha.1 to 1.0.0
@@ -11,3 +11,3 @@ 'use strict'; | ||
module.exports.identifyCssModule = async function identifyCssModule (filePath) { | ||
module.exports.identifyCssModule = async function identifyCssModule(filePath) { | ||
const { pkg: { name, version }, path: packagePath } = await readPkgUp({ | ||
@@ -22,3 +22,3 @@ normalize: false, | ||
module.exports.bundleCssModule = async function bundleCssModule (filePath) { | ||
module.exports.bundleCssModule = async function bundleCssModule(filePath) { | ||
const fileContents = await readFile(filePath, 'utf8'); | ||
@@ -25,0 +25,0 @@ const { css } = await postcss() |
@@ -11,3 +11,3 @@ 'use strict'; | ||
module.exports = class Writer extends Readable { | ||
constructor (files = []) { | ||
constructor(files = []) { | ||
super({ objectMode: true }); | ||
@@ -21,9 +21,18 @@ | ||
for (const file of this.files) { | ||
assert(typeof file === 'string', `Expected 'file' (${file}) to be of type 'string', instead got '${typeof file}'`); | ||
assert(isAbsolute(file), `Expected 'file' (${file}) to be an absolute path to a file but it was not`); | ||
assert(existsSync(file), `Expected 'file' (${file}) to exist on file system but it did not`); | ||
assert( | ||
typeof file === 'string', | ||
`Expected 'file' (${file}) to be of type 'string', instead got '${typeof file}'` | ||
); | ||
assert( | ||
isAbsolute(file), | ||
`Expected 'file' (${file}) to be an absolute path to a file but it was not` | ||
); | ||
assert( | ||
existsSync(file), | ||
`Expected 'file' (${file}) to exist on file system but it did not` | ||
); | ||
} | ||
} | ||
async _read () { | ||
async _read() { | ||
const file = this.files.shift(); | ||
@@ -36,4 +45,9 @@ if (!file) { | ||
try { | ||
const [css, meta] = await Promise.all([bundleCssModule(file), identifyCssModule(file)]); | ||
meta.id = hasher(`${meta.name}|${meta.version}|${meta.file}|${css}`); | ||
const [css, meta] = await Promise.all([ | ||
bundleCssModule(file), | ||
identifyCssModule(file), | ||
]); | ||
meta.id = hasher( | ||
`${meta.name}|${meta.version}|${meta.file}|${css}` | ||
); | ||
meta.content = css; | ||
@@ -40,0 +54,0 @@ this.push(meta); |
@@ -1,54 +0,1 @@ | ||
{ | ||
"name": "asset-pipe-css-writer", | ||
"version": "1.0.0-alpha.1", | ||
"author": { | ||
"name": "Richard Walker", | ||
"email": "digitalsadhu@gmail.com" | ||
}, | ||
"description": "CSS asset feed writer", | ||
"main": "./lib/writer.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:asset-pipe/asset-pipe-css-writer.git" | ||
}, | ||
"keywords": ["css", "assets"], | ||
"contributors": [ | ||
{ | ||
"name": "Richard Walker", | ||
"email": "digitalsadhu@gmail.com" | ||
} | ||
], | ||
"bugs": { | ||
"url": "https://github.com/asset-pipe/asset-pipe-css-writer/issues" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"asset-pipe-common": "1.0.0-beta.6", | ||
"postcss": "^6.0.13", | ||
"postcss-import": "^11.0.0", | ||
"read-pkg-up": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^4.1.1", | ||
"eslint-config-finn": "^3.0.0", | ||
"jest": "^21.2.1", | ||
"prettier": "^1.7.4" | ||
}, | ||
"scripts": { | ||
"format": | ||
"prettier --write --single-quote --trailing-comma=all --tab-width=4 lib/**/*.js test/**/*.js", | ||
"lint": "eslint .", | ||
"test": "jest --coverage" | ||
}, | ||
"files": ["lib"], | ||
"jest": { | ||
"coverageThreshold": { | ||
"global": { | ||
"branches": 100, | ||
"functions": 100, | ||
"lines": 100, | ||
"statements": 100 | ||
} | ||
} | ||
} | ||
} | ||
{"name":"asset-pipe-css-writer","version":"1.0.0","author":"Richard Walker <digitalsadhu@gmail.com>","description":"CSS asset feed writer","main":"./lib/writer.js","repository":{"type":"git","url":"https://github.com/asset-pipe/asset-pipe-css-writer"},"keywords":["css","assets"],"contributors":["Richard Walker <digitalsadhu@gmail.com>","Richard Walker (https://github.com/digitalsadhu)"],"bugs":{"url":"https://github.com/asset-pipe/asset-pipe-css-writer/issues"},"license":"MIT","dependencies":{"asset-pipe-common":"1.0.0-beta.6","postcss":"^6.0.13","postcss-import":"^11.0.0","read-pkg-up":"^3.0.0"},"devDependencies":{"commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint":"^4.9.0","eslint-config-finn":"^3.0.0","eslint-config-finn-prettier":"^3.0.1","husky":"^0.14.3","jest":"^21.2.1","lint-staged":"^5.0.0","prettier":"^1.7.4","projectz":"^1.4.0","semantic-release":"^8.2.0"},"scripts":{"format":"prettier --write --single-quote --trailing-comma=all --tab-width=4 lib/**/*.js test/**/*.js","lint":"eslint .","test":"jest --coverage","lint:format":"eslint --fix .","precommit":"lint-staged","cm":"git-cz","readme":"projectz compile","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"files":["lib"],"jest":{"coverageThreshold":{"global":{"branches":100,"functions":100,"lines":100,"statements":100}},"clearMocks":true},"lint-staged":{"*.js":["eslint --fix --config ./.eslintrc","git add"],"{package.json,README.md,LICENSE.md}":["projectz compile","git add"]},"config":{"commitizen":{"path":"cz-conventional-changelog"}},"badges":{"list":["travisci","npmversion","daviddm","daviddmdev"]},"maintainers":[]} |
@@ -1,3 +0,20 @@ | ||
# asset-pipe-css-writer | ||
<!-- TITLE/ --> | ||
<h1>asset-pipe-css-writer</h1> | ||
<!-- /TITLE --> | ||
<!-- BADGES/ --> | ||
<span class="badge-travisci"><a href="http://travis-ci.org/asset-pipe/asset-pipe-css-writer" title="Check this project's build status on TravisCI"><img src="https://img.shields.io/travis/asset-pipe/asset-pipe-css-writer/master.svg" alt="Travis CI Build Status" /></a></span> | ||
<span class="badge-npmversion"><a href="https://npmjs.org/package/asset-pipe-css-writer" title="View this project on NPM"><img src="https://img.shields.io/npm/v/asset-pipe-css-writer.svg" alt="NPM version" /></a></span> | ||
<span class="badge-daviddm"><a href="https://david-dm.org/asset-pipe/asset-pipe-css-writer" title="View the status of this project's dependencies on DavidDM"><img src="https://img.shields.io/david/asset-pipe/asset-pipe-css-writer.svg" alt="Dependency Status" /></a></span> | ||
<span class="badge-daviddmdev"><a href="https://david-dm.org/asset-pipe/asset-pipe-css-writer#info=devDependencies" title="View the status of this project's development dependencies on DavidDM"><img src="https://img.shields.io/david/dev/asset-pipe/asset-pipe-css-writer.svg" alt="Dev Dependency Status" /></a></span> | ||
<!-- /BADGES --> | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/asset-pipe/asset-pipe-css-writer.svg)](https://greenkeeper.io/) | ||
A module that takes any number of css file entry points and packages them together with meta data before providing them as a readable stream. | ||
@@ -80,2 +97,2 @@ | ||
writer.pipe(consumer) | ||
``` | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
9251
5
74
1
98
11
+ Addedjson-parse-better-errors@1.0.2(transitive)
+ Addedload-json-file@4.0.0(transitive)
+ Addedparse-json@4.0.0(transitive)
+ Addedpath-type@3.0.0(transitive)
+ Addedpify@3.0.0(transitive)
+ Addedread-pkg@3.0.0(transitive)
+ Addedread-pkg-up@3.0.0(transitive)
- Removedload-json-file@2.0.0(transitive)
- Removedparse-json@2.2.0(transitive)
- Removedpath-type@2.0.0(transitive)
- Removedread-pkg@2.0.0(transitive)
- Removedread-pkg-up@2.0.0(transitive)
Updatedread-pkg-up@^3.0.0