Skip to content

Commit f22be17

Browse files
add resolve-imports plugin (#101)
1 parent 6036877 commit f22be17

10 files changed

+61
-23
lines changed

.babelrc

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
{
22
"presets": [
3-
"es2015"
4-
]
3+
[
4+
"env",
5+
{
6+
"loose": true,
7+
"modules": "commonjs",
8+
"targets": {
9+
"node": 4,
10+
},
11+
},
12+
],
13+
],
514
}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.DS_Store
22
.npm
3+
lib
34
node_modules
45
npm-debug.log*
56
yarn.lock

.npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66
coverage
77
demo
88
release.sh
9+
scripts
10+
src
911
test

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ language: node_js
22
node_js:
33
- "4"
44
- "6"
5+
- "8"

package.json

+22-21
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,7 @@
44
"description": "A require hook to compile CSS Modules on the fly",
55
"main": "lib/index.js",
66
"engines": {
7-
"node": ">=0.12"
8-
},
9-
"scripts": {
10-
"lint": "eslint lib/**/*.js",
11-
"test": "npm run test:babel",
12-
"test:babel": "NODE_PATH=$(pwd)/test/tokens/node_modules $npm_package_scripts_test_unit --compilers js:babel-register",
13-
"test:coverage": "NODE_PATH=$(pwd)/test/tokens/node_modules babel-node --presets es2015 `npm bin`/isparta cover --report text --report html `npm bin`/_mocha -- --require test/setup.js --ui tdd test/*/*.js",
14-
"test:node": "NODE_PATH=$(pwd)/test/tokens/node_modules $npm_package_scripts_test_unit",
15-
"test:watch": "NODE_PATH=$(pwd)/test/tokens/node_modules $npm_package_scripts_test_unit --watch",
16-
"test:unit": "mocha --require test/setup.js --ui tdd test/*/*.js"
7+
"node": ">= 4"
178
},
189
"repository": {
1910
"type": "git",
@@ -45,6 +36,20 @@
4536
"pre-commit": [
4637
"lint"
4738
],
39+
"devDependencies": {
40+
"@sullenor/eslint-config": "next",
41+
"babel-preset-env": "^1.6.0",
42+
"babel-register": "^6.26.0",
43+
"eslint": "^4.6.1",
44+
"gulp": "^3.9.1",
45+
"gulp-babel": "^7.0.0",
46+
"gulp-debug": "^3.1.0",
47+
"jest": "^21.0.2",
48+
"mocha": "^3.5.1",
49+
"postcss-less": "^1.1.0",
50+
"pre-commit": "^1.2.2",
51+
"sinon": "^3.2.1"
52+
},
4853
"dependencies": {
4954
"debug": "^2.2.0",
5055
"generic-names": "^1.0.1",
@@ -55,20 +60,16 @@
5560
"postcss-modules-extract-imports": "^1.0.0",
5661
"postcss-modules-local-by-default": "^1.0.1",
5762
"postcss-modules-parser": "^1.1.0",
63+
"postcss-modules-resolve-imports": "next",
5864
"postcss-modules-scope": "^1.0.0",
5965
"postcss-modules-values": "^1.1.1",
6066
"seekout": "^1.0.1"
6167
},
62-
"devDependencies": {
63-
"@sullenor/eslint-config": "^1.1.0",
64-
"babel-cli": "^6.5.1",
65-
"babel-preset-es2015": "^6.5.0",
66-
"babel-register": "^6.5.2",
67-
"eslint": "^4.6.1",
68-
"isparta": "^4.0.0",
69-
"mocha": "^3.4.2",
70-
"postcss-less": "^1.0.1",
71-
"pre-commit": "^1.2.2",
72-
"sinon": "^2.3.2"
68+
"scripts": {
69+
"lint": "eslint src/**/*.js",
70+
"prepublish": "npm run transpile",
71+
"pretest": "npm run transpile",
72+
"test": "NODE_PATH=$(pwd)/test/tokens/node_modules mocha --require test/setup.js --ui tdd test/*/*.js --compilers js:babel-register",
73+
"transpile": "gulp --cwd . --gulpfile scripts/gulpfile.js transpile"
7374
}
7475
}

scripts/gulpfile.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
const babel = require('gulp-babel');
4+
const debug = require('gulp-debug');
5+
const gulp = require('gulp');
6+
7+
gulp.task('transpile', () =>
8+
gulp.src('src/*.js')
9+
.pipe(babel({
10+
presets: [
11+
[
12+
'env',
13+
{
14+
loose: true,
15+
modules: 'commonjs',
16+
targets: {
17+
node: 4,
18+
},
19+
},
20+
],
21+
],
22+
}))
23+
.pipe(debug({title: 'transpiled'}))
24+
.pipe(gulp.dest('lib')));
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)