Skip to content

Commit b70cdd0

Browse files
authored
Merge pull request #3 from epranka/improvement#change-templates-and-prompts
Improvement#change templates and prompts
2 parents 372b4bb + 4f64f6e commit b70cdd0

File tree

10 files changed

+72
-16849
lines changed

10 files changed

+72
-16849
lines changed

prompts.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const getRepositoryURL = require("./utils/repository");
12
const { random } = require("superb");
23

34
module.exports = [
@@ -33,8 +34,17 @@ module.exports = [
3334
type: "confirm",
3435
default: true
3536
},
37+
{
38+
name: "travis",
39+
message: "Use Travis ?",
40+
type: "confirm",
41+
default: true
42+
},
3643
{
3744
name: "repository",
38-
message: "Respository URL (required if semantic release enabled)"
45+
message: "Respository URL",
46+
default: async () => {
47+
return await getRepositoryURL();
48+
}
3949
}
4050
];

saofile.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ const rootDir = __dirname;
88
module.exports = {
99
prompts: require("./prompts"),
1010
templateData() {
11+
const tsconfig = {
12+
includes: ['\t\t"./src"']
13+
};
1114
const scripts = [
12-
'\t\t"build": "rm -rf ./dist/** && tsc"',
15+
'\t\t"build": "rm -rf ./lib/** && tsc"',
1316
'\t\t"watch": "tsc -- --watch"'
1417
];
1518
if (this.answers.tests) {
16-
scripts.push('\t\t"test": "jest && npm run build"');
19+
tsconfig.includes.push('\t\t"./__tests__"');
20+
scripts.push('\t\t"test": "jest"');
1721
} else {
1822
scripts.push(
1923
'\t\t"test": "echo \\"Warn: No test specified\\" && exit 0"'
@@ -86,6 +90,9 @@ module.exports = {
8690
const pmRun = this.answers.pm === "yarn" ? "yarn" : "npm run";
8791

8892
return {
93+
tsconfig: {
94+
includes: tsconfig.includes.join(",\n")
95+
},
8996
scripts: scripts.join(",\n"),
9097
devDependencies: devDependencies.join(",\n"),
9198
peerDependencies: peerDependencies.join(",\n"),
@@ -114,26 +121,24 @@ module.exports = {
114121
"__tests__/**": "tests",
115122
jest_config_js: "tests",
116123
travis_yml: "semanticrelease",
117-
releaserc: "semanticrelease",
118-
_yarn_lock: 'pm=="yarn"',
119-
_package_lock_json: 'pm=="npm"'
124+
releaserc: "semanticrelease"
120125
}
121126
}
122127
];
123128

124129
actions.push({
125130
type: "move",
126131
patterns: {
132+
"src/index_tsx": "src/index.tsx",
133+
"__tests__/index_spec_tsx": "__tests__/index.spec.tsx",
127134
gitignore: ".gitignore",
128135
babelrc: ".babelrc",
129136
travis_yml: ".travis.yml",
130137
jest_config_js: "jest.config.js",
131138
releaserc: ".releaserc",
132139
_package_json: "package.json",
133140
_tsconfig_json: "tsconfig.json",
134-
_tslint_json: "tslint.json",
135-
_yarn_lock: "yarn.lock",
136-
_package_lock_json: "package-lock.json"
141+
_tslint_json: "tslint.json"
137142
}
138143
});
139144

templates/__tests__/index.spec.tsx

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

templates/__tests__/index_spec_tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from "react";
2+
import Enzyme, { mount } from "enzyme";
3+
import Adapter from "enzyme-adapter-react-16";
4+
import App from "../src";
5+
6+
Enzyme.configure({ adapter: new Adapter() });
7+
8+
describe("Test starter kit", () => {
9+
it("App contains 'Hello world'", () => {
10+
const app = mount(<App />);
11+
expect(app.text()).toEqual("Hello World");
12+
});
13+
});

0 commit comments

Comments
 (0)