Skip to content

Commit aa915e5

Browse files
committed
Separate packages
1 parent fb8efed commit aa915e5

File tree

18 files changed

+1118
-337
lines changed

18 files changed

+1118
-337
lines changed

example/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const reactSvgLoader = require.resolve("../");
1+
const reactSvgLoader = require.resolve("../packages/react-svg-loader");
22
const path = require("path");
33

44
module.exports = {

gulpfile.babel.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
const through = require("through2");
2+
const chalk = require("chalk");
3+
const newer = require("gulp-newer");
4+
const babel = require("gulp-babel");
5+
const gutil = require("gulp-util");
6+
const gulp = require("gulp");
7+
const path = require("path");
8+
9+
const scripts = "./packages/*/src/**/*.js";
10+
const dest = "packages";
11+
12+
let srcEx, libFragment;
13+
14+
if (path.win32 === path) {
15+
srcEx = /(packages\\[^\\]+)\\src\\/;
16+
libFragment = "$1\\lib\\";
17+
} else {
18+
srcEx = new RegExp("(packages/[^/]+)/src/");
19+
libFragment = "$1/lib/";
20+
}
21+
22+
export function build() {
23+
return gulp
24+
.src(scripts)
25+
.pipe(
26+
through.obj((file, enc, callback) => {
27+
file._path = file.path;
28+
file.path = file.path.replace(srcEx, libFragment);
29+
callback(null, file);
30+
})
31+
)
32+
.pipe(newer(dest))
33+
.pipe(
34+
through.obj((file, enc, callback) => {
35+
gutil.log("Compiling", "'" + chalk.cyan(file._path) + "'...");
36+
callback(null, file);
37+
})
38+
)
39+
.pipe(babel())
40+
.pipe(gulp.dest(dest));
41+
}
42+
43+
export const watch = gulp.series(build, () => {
44+
gulp.watch(scripts, { debounceDelay: 200 }, build).on("error", () => {});
45+
});
46+
47+
export default build;

package.json

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "react-svg-loader",
33
"version": "2.0.0-alpha.3",
4+
"private": true,
45
"description": "Optimize svg and load it as a React Component",
56
"keywords": [
67
"loader",
@@ -29,25 +30,14 @@
2930
"url": "git+https://github.com/boopathi/react-svg-loader.git"
3031
},
3132
"scripts": {
32-
"build": "babel src --out-dir lib --copy-files",
33+
"build": "gulp build",
3334
"clean": "rm -rf lib",
3435
"cover": "babel-node `npm bin`/isparta cover test/index.js",
3536
"eslint": "eslint .",
3637
"flow": "flow",
3738
"lint": "yarn flow && yarn eslint",
3839
"test": "tape -r babel-register test/index.js | faucet",
39-
"watch": "babel src --out-dir lib --copy-files --watch"
40-
},
41-
"dependencies": {
42-
"babel-core": "^6.25.0",
43-
"babel-plugin-syntax-jsx": "^6.18.0",
44-
"babel-plugin-transform-object-rest-spread": "^6.26.0",
45-
"babel-preset-react": "^6.24.1",
46-
"js-yaml": "^3.9.0",
47-
"loader-utils": "^1.0.2",
48-
"lodash.isplainobject": "^4.0.4",
49-
"svgo": "^0.7.2",
50-
"yargs": "^9.0.1"
40+
"watch": "gulp watch"
5141
},
5242
"devDependencies": {
5343
"babel-cli": "^6.24.1",
@@ -56,17 +46,26 @@
5646
"babel-preset-env": "^1.6.0",
5747
"babel-preset-flow": "^6.23.0",
5848
"babel-register": "^6.24.1",
49+
"chalk": "^2.0.1",
5950
"eslint": "^4.1.0",
6051
"eslint-plugin-flowtype": "^2.36.0",
6152
"eslint-plugin-prettier": "^2.3.1",
6253
"eslint-plugin-react": "^7.0.1",
6354
"faucet": "0.0.1",
6455
"flow-bin": "^0.56.0",
56+
"gulp": "github:gulpjs/gulp#4.0",
57+
"gulp-babel": "^7.0.0",
58+
"gulp-newer": "^1.3.0",
59+
"gulp-util": "^3.0.8",
6560
"isparta": "^4.0.0",
6661
"prettier": "^1.7.2",
6762
"react": "^16.0.0",
6863
"react-dom": "^16.0.0",
6964
"react-test-renderer": "^16.0.0",
70-
"tape": "^4.7.0"
71-
}
65+
"tape": "^4.7.0",
66+
"through2": "^2.0.3"
67+
},
68+
"workspaces": [
69+
"packages/*"
70+
]
7271
}

packages/babel-plugin-react-svg/README.md

Whitespace-only changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "babel-plugin-react-svg",
3+
"version": "2.0.0-alpha.3",
4+
"description": "Babel plugin to transform svg to react component",
5+
"keywords": [
6+
"babel",
7+
"babel-plugin",
8+
"react",
9+
"react-svg-loader",
10+
"svg",
11+
"webpack",
12+
"webpack-loader"
13+
],
14+
"homepage": "https://github.com/boopathi/react-svg-loader#readme",
15+
"bugs": {
16+
"url": "https://github.com/boopathi/react-svg-loader/issues"
17+
},
18+
"license": "MIT",
19+
"author": "boopathi",
20+
"files": [
21+
"lib",
22+
"README.md"
23+
],
24+
"main": "lib/index.js",
25+
"repository": {
26+
"type": "git",
27+
"url": "git+https://github.com/boopathi/react-svg-loader.git"
28+
},
29+
"peerDependencies": {
30+
"babel-plugin-syntax-jsx": "^6.18.0"
31+
}
32+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/react-svg-loader/README.md

Whitespace-only changes.

0 commit comments

Comments
 (0)