hoosat-create 1.3.1 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +17 -0
- package/README.md +3 -0
- package/index.js +32 -32
- package/package.json +1 -1
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright 2023 Hoosat Oy
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software
|
|
6
|
+
for any purpose with or without fee is hereby granted, provided
|
|
7
|
+
that the above copyright notice and this permission notice appear
|
|
8
|
+
in all copies.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
|
11
|
+
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
|
12
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
|
13
|
+
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
|
14
|
+
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
15
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
|
16
|
+
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
17
|
+
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -20,19 +20,18 @@ async function run() {
|
|
|
20
20
|
const license = await askQuestion('Enter project license: ');
|
|
21
21
|
const keywords = await askQuestion('Enter project keywords (comma-separated): ');
|
|
22
22
|
const keywordList = keywords.split(',').map(k => k.trim()).filter(k => k !== '');
|
|
23
|
-
|
|
23
|
+
const gitInit = await askYesNoQuestion('Do you want to install initialize git repository? [Y/n] ');
|
|
24
|
+
let installHoosatUI = undefined;
|
|
25
|
+
if(gitInit) {
|
|
26
|
+
installHoosatUI = await askYesNoQuestion('Do you want to install HoosatUI? [Y/n] ');
|
|
27
|
+
}
|
|
24
28
|
try {
|
|
29
|
+
// Download git repository.
|
|
25
30
|
await promisifiedDownload(repository, destination);
|
|
26
31
|
console.log('Project downloaded successfully');
|
|
27
|
-
|
|
28
32
|
// Change directory to the project directory
|
|
29
33
|
process.chdir(destination);
|
|
30
|
-
|
|
31
|
-
console.log('Running npm install...');
|
|
32
|
-
const install = spawn('npm', ['install'], { stdio: 'inherit' });
|
|
33
|
-
await new Promise(resolve => install.on('close', resolve));
|
|
34
|
-
console.log('npm install completed');
|
|
35
|
-
|
|
34
|
+
// Modify the package.json
|
|
36
35
|
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
37
36
|
const packageJson = require(packageJsonPath);
|
|
38
37
|
packageJson.name = destination;
|
|
@@ -42,30 +41,31 @@ async function run() {
|
|
|
42
41
|
packageJson.keywords = keywordList;
|
|
43
42
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
44
43
|
console.log('Project package.json has been modified.');
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
44
|
+
// Do NPM install for dependancies.
|
|
45
|
+
const install = spawn('npm', ['install'], { stdio: 'inherit' });
|
|
46
|
+
await new Promise(resolve => install.on('close', resolve));
|
|
47
|
+
console.log('npm install completed');
|
|
48
|
+
if (gitInit) {
|
|
49
|
+
// Initialize git repository
|
|
50
|
+
const gitInit = spawn('git', ['init']);
|
|
51
|
+
await new Promise(resolve => gitInit.on('close', resolve));
|
|
52
|
+
console.log('Git repository initialized.');
|
|
53
|
+
if (installHoosatUI) {
|
|
54
|
+
// Change directory to the client directory
|
|
55
|
+
process.chdir('src/client');
|
|
56
|
+
// Install HoosatUI as a git submodule
|
|
57
|
+
const gitSubmodule = spawn('git', ['submodule', 'add', 'https://github.com/hoosat-oy/HoosatUI'], { stdio: 'inherit' });
|
|
58
|
+
await new Promise(resolve => gitSubmodule.on('close', resolve));
|
|
59
|
+
console.log('HoosatUI installed successfully.');
|
|
60
|
+
// Install necessary dev-dependencies
|
|
61
|
+
const installHoosatUIDevDeps = spawn('npm', ['install', '--save-dev', '@testing-library/jest-dom', '@testing-library/react'], { stdio: 'inherit' });
|
|
62
|
+
await new Promise(resolve => installHoosatUIDevDeps.on('close', resolve));
|
|
63
|
+
console.log('npm HoosatUI devDependencies installed successfully.');
|
|
64
|
+
// Install necessary dependancies.
|
|
65
|
+
const installHoosatUIDeps = spawn('npm', ['install', 'react-markdown', 'rehype-highlight', 'remark-gfm'], { stdio: 'inherit' });
|
|
66
|
+
await new Promise(resolve => installHoosatUIDeps.on('close', resolve));
|
|
67
|
+
console.log('npm HoosatUI dependencies installed successfully.');
|
|
68
|
+
}
|
|
69
69
|
}
|
|
70
70
|
} catch (err) {
|
|
71
71
|
console.error(`Failed to download project: ${err}`);
|