Skip to content

Commit 7babbec

Browse files
committed
Working release
1 parent 808ce87 commit 7babbec

30 files changed

+1844
-4
lines changed

.gitignore

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# Snowpack dependency directory (https://snowpack.dev/)
45+
web_modules/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
.parcel-cache
78+
79+
# Next.js build output
80+
.next
81+
out
82+
83+
# Nuxt.js build / generate output
84+
.nuxt
85+
dist
86+
87+
# Gatsby files
88+
.cache/
89+
# Comment in the public line in if your project uses Gatsby and not Next.js
90+
# https://nextjs.org/blog/next-9-1#public-directory-support
91+
# public
92+
93+
# vuepress build output
94+
.vuepress/dist
95+
96+
# Serverless directories
97+
.serverless/
98+
99+
# FuseBox cache
100+
.fusebox/
101+
102+
# DynamoDB Local files
103+
.dynamodb/
104+
105+
# TernJS port file
106+
.tern-port
107+
108+
# Stores VSCode versions used for testing VSCode extensions
109+
.vscode-test
110+
111+
# yarn v2
112+
.yarn/cache
113+
.yarn/unplugged
114+
.yarn/build-state.yml
115+
.yarn/install-state.gz
116+
.pnp.*
117+
118+
input.json
119+
./developer-templates/input.json

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jsLibraryMappings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/react-componant-stater.iml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# react-componant-stater
1+
# React Component Templates, React Native Component Templates, Express Templates, Node Module Templates and Starters
22

33
## How to use NPM scripts to save time and automate tasks on React and other JS projects like React native, Angular or Express?
44

@@ -11,8 +11,51 @@ Imagine working on a project with more than 100s of react components. how good w
1111

1212
The way I see it is when you work with multiple different teams on different projects, it is always useful to have isolated project standers that can be easily adjustable for the whole team.
1313

14-
See [NPM script to automate tasks in React and other JS Projects](https://roshan.digital/npm-script-to-save-time-react-project/) post for more infomation.
15-
16-
Also feel free contribute to save time. :innocent: Happy Coding :heart: :muscle:
14+
See [NPM script to automate tasks in React and other JS Projects](https://roshan.digital/npm-script-to-save-time-react-project/) post for more information.
15+
16+
To Add a new Template
17+
1. Create a folder inside templates folder with the repo type ex:react
18+
2. Create child folder with the template files type ex: component,module
19+
3. Create user-input-map.json file indicating what are the values user should input and how they should get replaced.
20+
21+
`
22+
[
23+
{
24+
"label":"UserInput1",
25+
"replacements":[
26+
{
27+
"replacingText" : "ModuleName",
28+
"replacingCaseTypes": 1 ,
29+
"replacingLocations": [1,2,3]
30+
}
31+
]
32+
},
33+
{
34+
"label":"UserInput2",
35+
"replacements":[
36+
{
37+
"replacingText" : "ModuleName",
38+
"replacingCaseTypes": 1 ,
39+
"replacingLocations": [1,3]
40+
}
41+
]
42+
}
43+
]
44+
`
45+
46+
Supported `replacingCaseTypes`
47+
1. camelCase
48+
2. snake_case
49+
3. kebab-case
50+
4. PascalCase
51+
5. UPPER_CASE_SNAKE_CASE
52+
53+
Supported `replacingLocations`
54+
55+
1. file names
56+
2. folder names
57+
3. inside files
58+
59+
Also, feel free contribute to save time. :innocent: Happy Coding :heart: :muscle:
1760

1861

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import _resolvers from "./resolver";
2+
import { readFileSync } from "fs";
3+
export const ModuleNameModuleTypeDefs = {
4+
types: readFileSync(
5+
"./src/modules/module-name/types/graphql/types.graphql",
6+
"utf-8"
7+
),
8+
query: readFileSync(
9+
"./src/modules/module-name/types/graphql/query.graphql",
10+
"utf-8"
11+
),
12+
mutation: readFileSync(
13+
"./src/modules/module-name/types/graphql/mutation.graphql",
14+
"utf-8"
15+
),
16+
};
17+
export const ModuleNameModuleResolver = _resolvers;
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { Injector } from "graphql-modules";
2+
import { IContext } from "../../types/context.type";
3+
import { ModuleNameService } from "./services/ModuleName.service";
4+
5+
const resolver = {
6+
Query: {
7+
moduleNameSearch: (
8+
_: any,
9+
args: {
10+
moduleName_status: number;
11+
moduleName_type: number;
12+
keyword: string;
13+
limit: number;
14+
skip: number;
15+
},
16+
ctx: IContext
17+
) => {
18+
return (ctx.injector as Injector)
19+
.get(ModuleNameService)
20+
.SearchModuleNames(
21+
ctx.me.id,
22+
args.moduleName_status,
23+
args.moduleName_type,
24+
args.keyword,
25+
args.limit,
26+
args.skip
27+
);
28+
},
29+
moduleNameGet: (_: any, args: { moduleName_id: number }, ctx: IContext) => {
30+
return (ctx.injector as Injector)
31+
.get(ModuleNameService)
32+
.findById(ctx.me.id, args.moduleName_id);
33+
},
34+
moduleNameRecentList: (_: any, args: any, ctx: IContext) => {
35+
return (ctx.injector as Injector)
36+
.get(ModuleNameService)
37+
.listRecentModuleNames(ctx.me.id);
38+
},
39+
},
40+
Mutation: {
41+
moduleNameCreate: (_: any, args: { input: any }, ctx: IContext) => {
42+
console.log(ctx.me, args);
43+
return (ctx.injector as Injector)
44+
.get(ModuleNameService)
45+
.createItem(ctx.me.id, ctx.me.email, args.input);
46+
},
47+
ModuleNameUpdate: (
48+
_: any,
49+
args: { input: { itemId: number; item: any } },
50+
ctx: IContext
51+
) => {
52+
return (ctx.injector as Injector)
53+
.get(ModuleNameService)
54+
.update(ctx.me.id, args.input.itemId, args.input.item);
55+
},
56+
moduleNameDelete: (_: any, args: { itemId: number }, ctx: IContext) => {
57+
return (ctx.injector as Injector)
58+
.get(ModuleNameService)
59+
.delete(ctx.me.id, args.itemId);
60+
},
61+
},
62+
};
63+
64+
export default resolver;

0 commit comments

Comments
 (0)