Skip to content

Commit 38d00e1

Browse files
committed
Stage create template
1 parent 05909f8 commit 38d00e1

File tree

11 files changed

+170
-3
lines changed

11 files changed

+170
-3
lines changed

packages/create-react-dependency/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ if (typeof projectName === "undefined") {
3131
const root = path.resolve(projectName);
3232

3333
fs.mkdirSync(projectName);
34+
3435
createPackageJson(root, projectName);
35-
// await installTemplate(root, type, verbose);
36+
await installTemplate(root);
3637

3738
// installDependencies(root, type, verbose);
38-
// setVariables(root, type, name, verbose);
3939
// initializeGit(name, verbose);
4040
}

packages/create-react-dependency/stages/createProject.js

Whitespace-only changes.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"use strict";
2+
3+
const fs = require("fs");
4+
5+
const installTemplate = async dir => {
6+
const folder = `${__dirname}/../template`;
7+
try {
8+
const promisses = [];
9+
promisses.push(fs.copyFile(`${folder}/gitignore`, `${dir}/.gitignore`));
10+
promisses.push(fs.copyFile(`${folder}/README.md`, `${dir}/README.md`));
11+
promisses.push(fs.copyFile(`${folder}src`, `${dir}/src`));
12+
13+
await Promise.all(promisses);
14+
} catch (err) {
15+
console.log(`\x1b[31m${err}\x1b[0m`);
16+
}
17+
};
18+
19+
module.exports = installTemplate;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# My Library - Created from [Create React Dependency](https://github.com/andrelmlins/create-react-dependency)
2+
3+
## start the project
4+
5+
Using [webpack](https://webpack.js.org/) with reference to folder `src/dev`.
6+
7+
```
8+
npm start
9+
// OR
10+
yarn start
11+
```
12+
13+
## build the project
14+
15+
Using [babel](https://babeljs.io/) with reference to folder `src/lib`.
16+
17+
```
18+
npm build
19+
// OR
20+
yarn build
21+
```
22+
23+
## test the project
24+
25+
Using [jest](https://jestjs.io/) with reference to folder `src/lib`. Is possible edit the test config in `package.json`.
26+
27+
```
28+
npm test
29+
// OR
30+
yarn test
31+
```
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/bower_componets
6+
/.pnp
7+
.pnp.js
8+
9+
# TypeScript v1 declaration files
10+
typings/
11+
12+
# TypeScript cache
13+
*.tsbuildinfo
14+
15+
# Optional npm cache directory
16+
.npm
17+
18+
# Optional eslint cache
19+
.eslintcache
20+
21+
# Optional REPL history
22+
.node_repl_history
23+
24+
# Output of 'npm pack'
25+
*.tgz
26+
27+
# Yarn Integrity file
28+
.yarn-integrity
29+
30+
# testing
31+
/coverage
32+
33+
# production
34+
/dist
35+
36+
# next.js build output
37+
.next
38+
39+
# dotenv environment variables file
40+
.env
41+
.env.test
42+
43+
# misc
44+
.DS_*
45+
**/*.backup.*
46+
**/*.back.*
47+
.env.local
48+
.env.development.local
49+
.env.test.local
50+
.env.production.local
51+
52+
# Logs
53+
logs
54+
*.log
55+
npm-debug.log*
56+
yarn-debug.log*
57+
yarn-error.log*
58+
lerna-debug.log*
59+
60+
# Runtime data
61+
pids
62+
*.pid
63+
*.seed
64+
*.pid.lock
65+
66+
# DynamoDB Local files
67+
.dynamodb/
68+
69+
# FuseBox cache
70+
.fusebox/
71+
72+
# parcel-bundler cache (https://parceljs.org/)
73+
.cache
74+
75+
# Other
76+
.idea/
77+
*.sublime*
78+
psd
79+
thumb
80+
sketch
81+
Thumbs.db
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from "react";
2+
import Library from "../lib";
3+
4+
const App = () => <Library />;
5+
6+
export default App;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
3+
<html lang="pt, en, es">
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta
7+
name="viewport"
8+
content="width=device-width, initial-scale=1, shrink-to-fit=no"
9+
/>
10+
<title>Library</title>
11+
</head>
12+
13+
<body>
14+
<noscript>You need to enable JavaScript to run this app.</noscript>
15+
16+
<div id="root"></div>
17+
</body>
18+
</html>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from "react";
2+
import ReactDOM from "react-dom";
3+
4+
import App from "./App";
5+
6+
ReactDOM.render(<App />, document.getElementById("root"));
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from "react";
2+
3+
export const Lib = () => <div>My React Dependency</div>;
4+
5+
export default Lib;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from "./Lib";

0 commit comments

Comments
 (0)