Skip to content

Commit 2098772

Browse files
authored
Merge pull request #55 from bikecoders/add-scripts-workspace
chore: create scripts to generate workspaces
2 parents 5b8e426 + 624b24f commit 2098772

File tree

5 files changed

+85
-56
lines changed

5 files changed

+85
-56
lines changed

.github/pull_request_template.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
## PR Checklist
2+
23
Please check if your PR fulfills the following requirements:
34

45
- [ ] The commit message follows our guidelines: https://www.conventionalcommits.org/en/v1.0.0/
5-
- [ ] Tests for the changes have been added (for bug fixes / features)
6-
- [ ] Docs have been added / updated (for bug fixes / features)
6+
- [ ] Tests for the changes have been added (for bug fixes/features)
7+
- [ ] Docs have been added/updated (for bug fixes/features)
8+
- [ ] Both workspaces were tested Angular an Nx
79

810
## PR Type
11+
912
What kind of change does this PR introduce?
1013

1114
<!-- Please check the one that applies to this PR using "x". -->
@@ -19,6 +22,7 @@ What kind of change does this PR introduce?
1922
- [ ] Other... Please describe:
2023

2124
## What is the current behavior?
25+
2226
<!-- Please describe the current behavior that you are modifying or link to a relevant issue. -->
2327

2428
Issue Number: N/A

docs/README_contributors.md

Lines changed: 15 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -173,66 +173,28 @@ Questions 🤔? Drop your message on our [discord server](https://discord.gg/cPa
173173

174174
## Creating a Workspace to test your library
175175

176-
You may want to test your changes in a real life scenario so
177-
there is some scripts that you can execute to create your workspace
176+
You may want to test your changes in a real life scenario.
177+
We have some scripts that you can execute to create your workspace
178+
and test your flaming changes 🔥
178179

179-
### Nx
180-
181-
```sh
182-
# Generate the Workspace
183-
npm init nx-workspace nx-workspace --preset empty --nx-cloud false
184-
cd nx-workspace
185-
186-
# Install some deps
187-
npm install -D @nrwl/angular && \
188-
npm install -D @nrwl/nest && \
189-
npm install -D @nrwl/react && \
190-
npm install -D @nrwl/node
191-
192-
# Generate all kind of libs
193-
npx nx generate @nrwl/angular:lib --name angular-lib --publishable --importPath angular-lib --style scss && \
194-
npx nx generate @nrwl/react:lib --name react-lib --publishable --importPath react-lib --style scss && \
195-
npx nx generate @nrwl/nest:lib --name nest-lib --publishable --importPath nest-lib && \
196-
npx nx generate @nrwl/node:lib --name node-lib --publishable --importPath node-lib
197-
198-
# Save your changes to easily differ the changes made on the workspace.json
199-
git add . && git commit -m "chore: create boiler plate"
200-
201-
# Link the project
202-
npm link ngx-deploy-npm
203-
204-
# Add it to the workspace
205-
npx nx generate ngx-deploy-npm:ng-add
206-
207-
# Test the build
208-
npx nx deploy react-lib --dry-run
209-
npx nx deploy angular-lib --dry-run
210-
npx nx deploy nest-lib --dry-run
211-
npx nx deploy node-lib --dry-run
212-
```
213-
214-
### Angular
180+
> The creation of a new workspace will delete the previous one
215181
216-
```sh
217-
# Generate the Workspace
218-
npx @angular/cli new --name angular-workspace --strict --routing --style scss
219-
cd angular-workspace
182+
### Nx
220183

221-
# Generate lib
222-
npx ng generate library angular-lib
184+
`yarn run create-workspace:nx` will create a `nx-workspace` folder with a Nx workspace with
185+
4 publishable libraries to make your test on whatever lib you want
223186

224-
# Save your changes to easily differ the changes made on the angular.json
225-
git add . && git commit -m "chore: create boiler plate"
187+
- react-lib
188+
- angular-lib
189+
- nest-lib
190+
- node-lib
226191

227-
# Link the project
228-
npm link ngx-deploy-npm
192+
### Angular
229193

230-
# Add it to the workspace
231-
npx ng add ngx-deploy-npm
194+
`yarn run create-workspace:angular` will create a `angular-workspace` folder with an Angular workspace with
195+
1 publishable libraries to make your test
232196

233-
# Test the build
234-
npx ng deploy angular-lib --dry-run
235-
```
197+
- angular-lib
236198

237199
## Publish to NPM
238200

src/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
"test": "jest",
1818
"test:cov": "jest --coverage",
1919
"test:debug": "node --inspect-brk=0.0.0.0 node_modules/.bin/jest --runInBand",
20-
"release": "standard-version --infile ../CHANGELOG.md"
20+
"release": "standard-version --infile ../CHANGELOG.md",
21+
"create-workspace:angular": "../tools/create-workspace-angular.sh",
22+
"create-workspace:nx": "../tools/create-workspace-nx.sh"
2123
},
2224
"schematics": "./collection.json",
2325
"builders": "./builders.json",

tools/create-workspace-angular.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
cd ../..
4+
5+
# Delete the previous workspace
6+
rm -Rif angular-workspace
7+
8+
npx @angular/cli new --name angular-workspace --strict --routing --style scss
9+
cd angular-workspace
10+
11+
# Generate lib
12+
npx ng generate library angular-lib
13+
14+
# Save your changes to easily differ the changes made on the angular.json
15+
git add . && git commit -m "chore: create boiler plate"
16+
17+
# Link the project
18+
yarn link ngx-deploy-npm
19+
20+
# Add it to the workspace
21+
npx ng add ngx-deploy-npm
22+
23+
# Test the build
24+
npx ng deploy angular-lib --dry-run

tools/create-workspace-nx.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
cd ../..
4+
5+
# Delete the previous workspace
6+
rm -Rif nx-workspace
7+
8+
# Generate the Workspace
9+
npm init nx-workspace nx-workspace --preset empty --nx-cloud false
10+
cd nx-workspace
11+
12+
# Install some deps
13+
npm install -D @nrwl/angular \
14+
@nrwl/nest \
15+
@nrwl/react \
16+
@nrwl/node
17+
18+
# Generate all kind of libs
19+
npx nx generate @nrwl/angular:lib --name angular-lib --publishable --importPath angular-lib --style scss &&
20+
npx nx generate @nrwl/react:lib --name react-lib --publishable --importPath react-lib --style scss &&
21+
npx nx generate @nrwl/nest:lib --name nest-lib --publishable --importPath nest-lib &&
22+
npx nx generate @nrwl/node:lib --name node-lib --publishable --importPath node-lib
23+
24+
# Save your changes to easily differ the changes made on the workspace.json
25+
git add . && git commit -m "chore: create boiler plate"
26+
27+
# Link the project
28+
yarn link ngx-deploy-npm
29+
30+
# Add it to the workspace
31+
npx nx generate ngx-deploy-npm:ng-add
32+
33+
# Test the build
34+
npx nx deploy react-lib --dry-run
35+
npx nx deploy angular-lib --dry-run
36+
npx nx deploy nest-lib --dry-run
37+
npx nx deploy node-lib --dry-run

0 commit comments

Comments
 (0)