Skip to content

Commit 771c43a

Browse files
chore(release): 2.0.0 (#6)
1 parent 26a64bd commit 771c43a

File tree

6 files changed

+320
-13
lines changed

6 files changed

+320
-13
lines changed

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
language: node_js
2+
3+
cache:
4+
directories:
5+
- "node_modules"
6+
27
node_js:
38
- "6"
9+
- "8"
10+
- "10"

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = function createGenerator(pattern, options) {
1515
options = options || {};
1616
var context = options && typeof options.context === 'string'
1717
? options.context
18-
: '';
18+
: process.cwd();
1919
var hashPrefix = options && typeof options.hashPrefix === 'string'
2020
? options.hashPrefix
2121
: '';
@@ -30,6 +30,7 @@ module.exports = function createGenerator(pattern, options) {
3030
var loaderContext = {
3131
resourcePath: filepath
3232
};
33+
3334
var loaderOptions = {
3435
content: util.format('%s%s+%s',
3536
hashPrefix,

package-lock.json

Lines changed: 297 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "generic-names",
3-
"version": "1.0.2",
3+
"version": "2.0.0",
44
"description": "Helper for building generic names, similar to webpack",
55
"main": "index.js",
66
"types": "index.d.ts",
@@ -26,6 +26,6 @@
2626
"tape": "^4.6.2"
2727
},
2828
"dependencies": {
29-
"loader-utils": "^0.2.16"
29+
"loader-utils": "^1.1.0"
3030
}
3131
}

test/cssspec.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const genericNames = require('../index');
44
const test = require('tape');
5+
const path = require('path');
56

67
// According to the CSS spec, identifiers cannot
78
// start with a digit, two hyphens, or a hyphen
@@ -12,34 +13,34 @@ const test = require('tape');
1213
test('identity', t => {
1314
const generate = genericNames('[local]');
1415

15-
t.equal(generate('foo', '/test/case/source.css'), 'foo');
16+
t.equal(generate('foo', path.join(__dirname, 'test/case/source.css')), 'foo');
1617
t.end();
1718
});
1819

1920
test('leading digit', t => {
2021
const generate = genericNames('0[local]');
2122

22-
t.equal(generate('foo', '/test/case/source.css'), '_0foo');
23+
t.equal(generate('foo', path.join(__dirname, 'test/case/source.css')), '_0foo');
2324
t.end();
2425
});
2526

2627
test('leading digit in the token', t => {
2728
const generate = genericNames('[local]');
2829

29-
t.equal(generate('0foo', '/test/case/source.css'), '_0foo');
30+
t.equal(generate('0foo', path.join(__dirname, 'test/case/source.css')), '_0foo');
3031
t.end();
3132
});
3233

3334
test('leading two hyphens', t => {
3435
const generate = genericNames('--[local]');
3536

36-
t.equal(generate('foo', '/test/case/source.css'), '_--foo');
37+
t.equal(generate('foo', path.join(__dirname, 'test/case/source.css')), '_--foo');
3738
t.end();
3839
});
3940

4041
test('leading hyphen and digit', t => {
4142
const generate = genericNames('-0[local]');
4243

43-
t.equal(generate('foo', '/test/case/source.css'), '_-0foo');
44+
t.equal(generate('foo', path.join(__dirname, 'test/case/source.css')), '_-0foo');
4445
t.end();
4546
});

0 commit comments

Comments
 (0)