Skip to content

feat(create-waku): install dependencies automatically when creating a new waku project #808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 36 commits into from
Oct 1, 2024
Merged
Changes from 12 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b915f15
feat: install dependencies automattically when creating the waku project
Rec0iL99 May 28, 2024
55e5206
dynamic package manager
Rec0iL99 May 28, 2024
26eb8ba
removed cross-spawn and used spawn from node:child_process
Rec0iL99 Jun 25, 2024
6e1dddf
process is a global env
Rec0iL99 Jun 26, 2024
1751fce
fix: change "pipe" to "inherit" as the value of stdio option
ojj1123 Jul 28, 2024
bfb5ee9
Merge branch 'main' into install-deps
ojj1123 Jul 28, 2024
f5da208
prettier --write
ojj1123 Jul 28, 2024
ff3527d
Merge branch 'main' into install-deps
ojj1123 Aug 9, 2024
b8a73b0
comment process.chdir
ojj1123 Aug 9, 2024
6fe120f
add cwd option of spawn
ojj1123 Aug 9, 2024
e69a0f1
remove test-result file
ojj1123 Aug 9, 2024
bb908ad
it can be fixed?
ojj1123 Aug 9, 2024
4ed9d80
Update packages/create-waku/src/index.ts
dai-shi Aug 10, 2024
f1a7a6d
make it fail?
ojj1123 Aug 10, 2024
33affcc
shell option to true on win32 only
ojj1123 Aug 11, 2024
ab93fee
change comment to code
ojj1123 Aug 13, 2024
bae3a6b
Merge branch 'main' into install-deps
ojj1123 Aug 13, 2024
a9bf252
use shell on all platforms
ojj1123 Aug 17, 2024
dd6cf66
Merge branch 'main' into install-deps
ojj1123 Aug 17, 2024
6f47780
remove unused console logs
ojj1123 Aug 17, 2024
76558bd
remove the unused test code with default setup work
ojj1123 Aug 17, 2024
52aacf0
Merge branch 'main' into install-deps
ojj1123 Aug 18, 2024
0ebab43
revert shell option (only win32)
ojj1123 Aug 19, 2024
242a390
Merge branch 'main' into install-deps
ojj1123 Aug 19, 2024
b30499d
revert test code
ojj1123 Aug 21, 2024
c176384
Merge branch 'main' into install-deps
ojj1123 Aug 21, 2024
08c1872
Merge branch 'main' into install-deps
ojj1123 Sep 14, 2024
c4ec596
add cross-spawn
ojj1123 Sep 14, 2024
7097873
add rm -rf .cache/*
ojj1123 Sep 14, 2024
843ec06
remove cross-spawn
ojj1123 Sep 14, 2024
03d65ab
Merge branch 'main' into install-deps
ojj1123 Sep 14, 2024
4b48535
add shell option to true on win32
ojj1123 Sep 14, 2024
1ad5c5d
remove process.chdir
ojj1123 Sep 15, 2024
2176e8f
Merge branch 'main' into install-deps
ojj1123 Sep 15, 2024
1c134df
remove terminate
ojj1123 Oct 1, 2024
4efb8bd
Merge branch 'main' into install-deps
ojj1123 Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions packages/create-waku/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
parseExampleOption,
downloadAndExtract,
} from './helpers/example-option.js';
// import { spawn } from 'node:child_process';

const userAgent = process.env.npm_config_user_agent || '';
const packageManager = /pnpm/.test(userAgent)
Expand Down Expand Up @@ -202,15 +203,37 @@ async function init() {
await installTemplate(root, packageName, templateRoot, templateName);
}

// TODO automatically installing dependencies
// 1. check packageManager
// 2. and then install dependencies

console.log(`\nDone. Now run:\n`);
console.log(`${bold(green(`cd ${targetDir}`))}`);
console.log(`${bold(green(commands.install))}`);
console.log(`${bold(green(commands.dev))}`);
console.log();
// console.log(`Installing dependencies by running ${commands.install}...`);

// process.chdir(targetDir);

// const installProcess = spawn(packageManager, ['install'], {
// cwd: targetDir,
// stdio: 'inherit',
// });

// installProcess.on('close', (code) => {
// // process exit code
// if (code !== 0) {
// console.error(`Could not execute ${commands.install}. Please run`);
// console.log(`${bold(green(`cd ${targetDir}`))}`);
// console.log(`${bold(green(commands.install))}`);
// console.log(`${bold(green(commands.dev))}`);
// console.log();
// } else {
// console.log(`\nDone. Now run:\n`);
// console.log(`${bold(green(`cd ${targetDir}`))}`);
// console.log(`${bold(green(commands.dev))}`);
// console.log();
// }
// });
}

init()
Expand Down
Loading