Skip to content

Commit 1cd6a5a

Browse files
authored
Merge pull request #1 from collabo-community/ts-migrate
Migrate create-collabo-app [formerly "node-mongo-cli"] to Typescript
2 parents bc959f8 + a855d94 commit 1cd6a5a

24 files changed

+1950
-6123
lines changed

.all-contributorsrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@
129129
]
130130
}
131131
],
132-
"projectName": "node-mongo-cli",
133-
"projectOwner": "code-collabo",
132+
"projectName": "create-collabo-app",
133+
"projectOwner": "collabo-community",
134134
"repoType": "github",
135135
"repoHost": "https://github.com",
136136
"skipCi": true,

.github/ISSUE_TEMPLATE/api-user-error-report.md

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

.github/ISSUE_TEMPLATE/cli-user-error-report.md

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

.github/pull_request_template.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
**This pull request makes the following changes:**
2-
* Fixes code-collabo/put-repo-name-where-the-issue-is-located-here#putTheIssueNumberHere
2+
* Fixes collabo-community/put-repo-name-where-the-issue-is-located-here#putTheIssueNumberHere
33

44
**General checklist**
55
- [ ] File or folder now contains changes as specified in the issue i worked on
@@ -9,4 +9,3 @@
99

1010
Replace this text with the testing checklist from the issue this pull request fixes.
1111

12-
Ping @code-collabo/node-mongo-cli

.github/workflows/node.js.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Node.js CI
55

66
on:
77
push:
8-
branches: [ main, develop ]
8+
branches: [ develop, main/**, release/** ]
99
pull_request:
10-
branches: [ main, develop ]
10+
branches: [ develop, main/**, release/** ]
1111

1212
jobs:
1313
build:
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env node
22

33
require = require('esm')(module /*, options */);
4-
require('../src/cli').cli(process.argv);
4+
require('../dist/src/cli').cli(process.argv);

dev/cleanup.js

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
import { readdirSync, rmdirSync } from 'fs';
2-
import chalk from 'chalk';
32
import { repo } from './developer';
43
const { cwd, chdir } = process;
5-
6-
// -------------------------------------------------------------------------------------------------
7-
// TODO 1 (after CLI upgrade): Configure cleanup to run using node-mongo command i.e. "node-mongo cleanup" not "npm run cleanup"
8-
// TODO 2 (if possible): (I don't think you will need this TODO when this is done using the "node-mongo cleanup" command - or it might need slight modification)
9-
// update package.json cleanup script dynamically with the cleanup file path.
10-
// This means you will have to get the cleanup file name/path dynamically too...
11-
// Or... (instead) should cleanup script be handled a pre-commit hook or pre-push hook or something? - We'll see...
12-
// -------------------------------------------------------------------------------------------------
4+
import { success, warning, error, consoleLog } from '../lib/helpers';
135

146
// cd into repo root
157
chdir('../');
168

179
// use repo root
1810
const rootDir = cwd();
1911

20-
// return all files and folders in repo root i.e. original + node-mongo generated
12+
// return all files and folders in repo root i.e. original + create-collabo-app generated
2113
const repoContent = readdirSync(rootDir, (err, filesAndFolders) => {
2214
if (err) {
2315
throw err;
@@ -37,20 +29,14 @@ const filterContentToGetTheOnesGeneratedByCLI = repoContent.reduce((acc, curr) =
3729
if (filterContentToGetTheOnesGeneratedByCLI.length) {
3830
try {
3931
filterContentToGetTheOnesGeneratedByCLI.map(folder => {
40-
console.log(chalk.green(`✔ ${folder} folder deleted successfully`));
32+
success(`✔ ${folder} folder deleted successfully`);
4133
return rmdirSync(folder, { recursive: true, force: true });
4234
});
43-
console.log('');
35+
consoleLog('');
4436
} catch (err) {
45-
console.log(chalk.red(err));
37+
error(err);
4638
}
4739
} else {
48-
console.log(chalk.yellowBright('ℹ There are no folders to delete yet. Generate folder(s) using the "node-mongo" command, then run the cleanup script after you are done developing, and are ready to add and push your changes/fixes.\n'));
40+
warning('ℹ There are no project folders to delete yet. Generate project folder(s) using the "collabo-be" command, then run the cleanup script after you are done developing, and are ready to add and push your changes/fixes to GitHub.\n');
4941
}
5042

51-
// ------------------------------------
52-
// TODO: Write another script at the end of this file
53-
// that updates this repoContent list back when done.
54-
// Is this TODO even needed? - We'll see. For now the
55-
// solution ending here works fine.
56-
// ------------------------------------

dev/customize/startMessage.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { success } from '../../lib/helpers';
2+
3+
success('\nℹ create-collabo-app: running in dev mode...\n');

dev/customize/testMessage.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { cyanBrightLog } from '../../lib/helpers';
2+
3+
cyanBrightLog('\nℹ create-collabo-app: running jasmine tests...\n');

dev/developer.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ const developerJsFileName = basename(__filename/*, extname(__filename)*/);
1010
const currentFileUrl = import.meta.url;
1111

1212
let newUrl;
13-
if (process.platform === "darwin" || process.platform === "linux") {
13+
if (process.platform === 'darwin' || process.platform === 'linux') {
1414
newUrl = new URL(currentFileUrl).pathname;
15-
} else
16-
newUrl = new URL(currentFileUrl).pathname.substring(
17-
new URL(currentFileUrl).pathname.indexOf("/") + 1
18-
);
15+
} else {
16+
newUrl = new URL(currentFileUrl).pathname.substring(new URL(currentFileUrl).pathname.indexOf("/") + 1);
17+
}
1918

20-
const cleanupFolderPath = dirname(newUrl);
19+
const cleanupFolderPath = dirname(newUrl);
2120
// Change directory into the dynamically gotten parent folder, then extract folder name from path
2221
chdir(cleanupFolderPath);
2322
const cleanupFolderName = basename(resolve());
@@ -44,8 +43,10 @@ export const repo = {
4443
'package.json',
4544
'spec',
4645
'src',
47-
'templates'
46+
'lib',
47+
'templates',
48+
'tsconfig.json'
4849
],
4950
developerJsFileName,
5051
cleanupFolderName,
51-
}
52+
};

0 commit comments

Comments
 (0)