@vnejs/build 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@vnejs/build",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Build tools for @vnejs",
5
- "source": "src/index.js",
6
- "main": "dist/index.js",
5
+ "main": "src/index.js",
7
6
  "bin": {
8
- "@vnejs/build": "./src/index.js"
7
+ "@vnejs/build": "./src/cli.js"
9
8
  },
10
9
  "scripts": {
11
10
  "test": "echo \"Error: no test specified\" && exit 1",
package/src/cli.js ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { Command } = require("commander");
4
+
5
+ const dataAction = require("./data");
6
+
7
+ const packageJson = require("../package.json");
8
+
9
+ const program = new Command();
10
+
11
+ program.name(packageJson.name).description(packageJson.description).version(packageJson.version);
12
+
13
+ program
14
+ .command("data")
15
+ .option("-w, --watch", "watch mode", false)
16
+ .option("-q, --quiet", "no console mode", false)
17
+ .action(dataAction(process.env.PWD));
18
+
19
+ program
20
+ .command("bundle")
21
+ .option("-w, --watch", "watch mode", false)
22
+ .option("-q, --quiet", "no console mode", false)
23
+ .action(dataAction(process.env.PWD));
24
+
25
+ program.parse();
package/src/data/index.js CHANGED
@@ -5,10 +5,10 @@ const { runBuildData } = require("./utils");
5
5
 
6
6
  let result = {};
7
7
 
8
- const gameDir = path.join(process.env.PWD, "game");
9
- const distDir = path.join(process.env.PWD, "dist");
8
+ module.exports = (rootDir) => (options) => {
9
+ const gameDir = path.join(rootDir, "game");
10
+ const distDir = path.join(rootDir, "dist");
10
11
 
11
- module.exports = (options) => {
12
12
  !options.watch && fs.rmSync(distDir, { recursive: true, force: true });
13
13
  !options.watch && fs.mkdirSync(distDir);
14
14
 
package/src/index.js CHANGED
@@ -1,25 +1,3 @@
1
- #!/usr/bin/env node
2
-
3
- const { Command } = require("commander");
4
-
5
- const dataAction = require("./data");
6
-
7
- const packageJson = require("../package.json");
8
-
9
- const program = new Command();
10
-
11
- program.name(packageJson.name).description(packageJson.description).version(packageJson.version);
12
-
13
- program
14
- .command("data")
15
- .option("-w, --watch", "watch mode", false)
16
- .option("-q, --quiet", "no console mode", false)
17
- .action(dataAction);
18
-
19
- program
20
- .command("bundle")
21
- .option("-w, --watch", "watch mode", false)
22
- .option("-q, --quiet", "no console mode", false)
23
- .action(dataAction);
24
-
25
- program.parse();
1
+ module.exports = {
2
+ buildData: (rootDir, watch = false) => require("./data")(rootDir)({ watch }),
3
+ };