Skip to content

Commit 041a69b

Browse files
simplr-mvdir tool.
1 parent 0268761 commit 041a69b

File tree

11 files changed

+137
-96
lines changed

11 files changed

+137
-96
lines changed

packages/simplr-forms-core/src/abstractions/base-field.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export abstract class BaseField<TProps extends FieldProps, TState extends BaseFi
3737
extends React.Component<TProps, TState> {
3838
public context: ParentContext;
3939

40-
static contextTypes: React.ValidationMap<ParentContext> = {
40+
static contextTypes: PropTypes.ValidationMap<ParentContext> = {
4141
FormId: PropTypes.string,
4242
FormProps: PropTypes.object,
4343
FieldsGroupId: PropTypes.string,

packages/simplr-forms-dom/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@
1616
"test": "jest",
1717
"test-watch": "jest --watchAll",
1818
"test-coverage": "npm test -- --coverage",
19-
"prepublishOnly": "npm run build && node tools/postbuild.js",
19+
"prepublishOnly": "npm run build && node ../simplr-forms-publish/dist/cli.js --from dist --to .",
2020
"postpublish": "git clean -fd"
2121
},
2222
"license": "AGPL-3.0",
2323
"files": [
2424
"**/*.md",
2525
"*.js",
2626
"*.d.ts",
27-
"!*.config.js",
28-
"!tools"
27+
"!*.config.js"
2928
],
3029
"devDependencies": {
3130
"@types/enzyme": "^2.7.7",
@@ -37,13 +36,13 @@
3736
"mkdirp": "^0.5.1",
3837
"mv": "^2.1.1",
3938
"mz": "^2.6.0",
39+
"simplr-mvdir": "0.0.1-beta.6",
4040
"sinon": "^2.1.0",
4141
"ts-jest": "^19.0.8",
4242
"ts-loader": "^2.0.3",
4343
"tslint": "^5.0.0",
4444
"typescript": "2.3.0",
45-
"webpack": "^2.4.1",
46-
"simplr-forms-publish": "0.0.0-dev"
45+
"webpack": "^2.4.1"
4746
},
4847
"dependencies": {
4948
"@types/react": "^15.0.21",

packages/simplr-forms-dom/tools/postbuild.js

Lines changed: 0 additions & 62 deletions
This file was deleted.

packages/simplr-forms-publish/package.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/simplr-mvdir/package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "simplr-mvdir",
3+
"version": "0.0.1-beta.6",
4+
"description": "A simple tool for moving files from one directory to another.",
5+
"repository": "SimplrJS/simplr-forms",
6+
"homepage": "https://github.com/SimplrJS/simplr-forms",
7+
"main": "dist/index.js",
8+
"types": "dist/index.d.ts",
9+
"scripts": {
10+
"build": "tsc -p . && npm run tslint",
11+
"watch": "tsc -p . -w",
12+
"tslint": "tslint --config ./tslint.json --project . --exclude __tests__/**/* && echo TsLint test successfully passed."
13+
},
14+
"license": "AGPL-3.0",
15+
"files": [
16+
"dist",
17+
"@types",
18+
"**/*.md",
19+
"*.js",
20+
"!*.config.js"
21+
],
22+
"dependencies": {
23+
"@types/mkdirp": "^0.3.29",
24+
"@types/mz": "0.0.31",
25+
"@types/node": "^7.0.13",
26+
"@types/yargs": "^6.6.0",
27+
"yargs": "^7.1.0"
28+
},
29+
"devDependencies": {
30+
"mkdirp": "^0.5.1",
31+
"mz": "^2.6.0",
32+
"tslint": "^5.1.0",
33+
"typescript": "^2.3.0"
34+
},
35+
"bin": {
36+
"simplr-mvdir": "dist/cli.js"
37+
}
38+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import * as yargs from "yargs";
2+
3+
import * as Contracts from "./contracts";
4+
5+
export let argv = yargs
6+
.help("h", "Show help.")
7+
.alias("h", "help")
8+
.version(() => {
9+
return `Current version: ${require("../package.json").version}.`;
10+
})
11+
.alias("v", "version")
12+
.config("config")
13+
.alias("c", "config")
14+
.options("from", {
15+
describe: "Move files from this directory.",
16+
type: "string"
17+
})
18+
.options("to", {
19+
describe: "Move files to this directory.",
20+
type: "string"
21+
})
22+
.usage("Usage: scss-bundle [options]")
23+
.string(["c", "e", "d"])
24+
.argv as Contracts.ArgumentsValues;

packages/simplr-mvdir/src/cli.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env node
2+
3+
import * as Contracts from "./contracts";
4+
import { argv } from "./arguments";
5+
import * as mvDir from "./index";
6+
7+
class Cli {
8+
constructor(argumentValues: Contracts.ArgumentsValues) {
9+
this.mvDir(argumentValues);
10+
}
11+
12+
private async mvDir(argumentValues: Contracts.ArgumentsValues) {
13+
const from = argumentValues.from;
14+
const to = argumentValues.to;
15+
await mvDir.move(from, to, true, true);
16+
}
17+
}
18+
19+
new Cli(argv);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface ArgumentsValues {
2+
config?: string;
3+
from: string;
4+
to: string;
5+
}

packages/simplr-forms-publish/src/index.ts renamed to packages/simplr-mvdir/src/index.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as path from "path";
33
import * as process from "process";
44
import * as mkdirp from "mkdirp";
55

6-
async function move(
6+
export async function move(
77
from: string,
88
to: string,
99
recursively: boolean = true,
@@ -57,11 +57,3 @@ async function mkdirpAsync(dir: string) {
5757
});
5858
});
5959
}
60-
61-
async function run() {
62-
const from = "./dist";
63-
const to = ".";
64-
await move(from, to, true);
65-
}
66-
67-
run();

0 commit comments

Comments
 (0)