Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #13 from WhitigolProd/chore/pnpm-migration
Browse files Browse the repository at this point in the history
🧹 pnpm migration
  • Loading branch information
whitigol authored Aug 31, 2023
2 parents afb9d7a + 272d275 commit 0aeb322
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/partials/requirements.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<ul class="mx-3">
<li>GIT: <code class="rqGit" aria-busy="true"></code></li>
<li>NodeJS: <code class="rqNode" aria-busy="true"></code></li>
<li>Yarn: <code class="rqYarn" aria-busy="true"></code></li>
<li>PostgreSQL: <code class="rqPsql" aria-busy="true"></code></li>
<li>pnpm: <code class="rqPnpm" aria-busy="true"></code></li>
<!-- <li>PostgreSQL: <code class="rqPsql" aria-busy="true"></code></li> -->
</ul>
</article>

Expand Down
8 changes: 4 additions & 4 deletions src/scripts/utils/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ appAPI.post('/start', async (req: any, res: any) => {

if (keys.shift) {
cadProcess = spawn(
`yarn run concurrently "yarn workspace @snailycad/client start" "yarn workspace @snailycad/api generate && yarn workspace @snailycad/api start"`,
"pnpm run start",
[],
{ shell: true, cwd: storage('cadDir').read() }
);
} else {
cadProcess = spawn(
`node scripts/copy-env.mjs --client --api && yarn turbo run build --filter=@snailycad/client && yarn run concurrently "yarn workspace @snailycad/client start" "yarn workspace @snailycad/api generate && yarn workspace @snailycad/api start"`,
`node scripts/copy-env.mjs --client --api && pnpm turbo run build --filter=@snailycad/client && pnpm run start`,
[],
{ shell: true, cwd: storage('cadDir').read() }
);
Expand Down Expand Up @@ -109,7 +109,7 @@ appAPI.post('/install', (req: any, res: any) => {
message: 'Starting Installation',
});
const installScript = spawn(
'echo Downloading Repository && git clone https://github.com/SnailyCAD/snaily-cadv4.git && echo Opening Directory && cd snaily-cadv4 && echo Installing Dependencies (This may take a while) && yarn && echo Copying ENV && copy .env.example .env && echo Moving ENV && node scripts/copy-env.mjs --client --api && echo Building CAD (This might take a while) && yarn turbo run build --filter="{packages/**/**}" && yarn turbo run build --filter="{apps/**/**}" && echo Installation Complete',
'echo Downloading Repository && git clone https://github.com/SnailyCAD/snaily-cadv4.git && echo Opening Directory && cd snaily-cadv4 && echo Installing Dependencies (This may take a while) && pnpm install && echo Copying ENV && copy .env.example .env && echo Moving ENV && node scripts/copy-env.mjs --client --api && echo Building CAD (This might take a while) && pnpm turbo run build --filter="{packages/**/**}" && pnpm turbo run build --filter="{apps/**/**}" && echo Installation Complete',
[],
{
shell: true,
Expand Down Expand Up @@ -227,7 +227,7 @@ appAPI.post('/update', (req: any, res: any) => {

appAPI.post('/reset', (req: any, res: any) => {
const resetScript = spawn(
'echo Resetting Node Modules && rmdir /s /q "node_modules" && echo Installing Dependencies (This may take a while) && yarn && echo Node Modules Reset',
'echo Resetting Node Modules && rmdir /s /q "node_modules" && echo Installing Dependencies (This may take a while) && pnpm install && echo Node Modules Reset',
[],
{
shell: true,
Expand Down
36 changes: 8 additions & 28 deletions src/scripts/utils/requirements.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
let requirements = {
git: false,
node: false,
yarn: false,
pnpm: false,
psql: false,
complete: false,
};

const checkComplete = setInterval(async () => {
if (
requirements.git &&
requirements.node &&
requirements.yarn &&
requirements.psql
) {
if (requirements.git && requirements.node && requirements.pnpm) {
clearInterval(checkComplete);

requirements.complete = true;
Expand Down Expand Up @@ -71,35 +66,20 @@ const checkRequirements = async () => {
.css('color', 'orange');
log('Requirement NODE Failed', 'warning');
});
await commandExists('yarn', (err: string, exists: boolean) => {
await commandExists('pnpm', (err: string, exists: boolean) => {
if (err) throw new Error(err);
if (exists) {
$('.rqYarn')
$('.rqPnpm')
.text('PASSED')
.attr('aria-busy', 'false')
.css('color', 'lime');
log('Requirement Yarn Passed', 'success');
return (requirements.yarn = true);
log('Requirement pnpm Passed', 'success');
return (requirements.pnpm = true);
}
$('.rqYarn')
$('.rqPnpm')
.text('FAILED')
.attr('aria-busy', 'false')
.css('color', 'orange');
log('Requirement YARN Failed', 'warning');
});
await isPostgres((db: any) => {
if (db.running) {
$('.rqPsql')
.text('PASSED')
.attr('aria-busy', 'false')
.css('color', 'lime');
log('Requirement PSQL Passed', 'success');
return (requirements.psql = true);
}
$('.rqPsql')
.text('FAILED (Verify that Postgres is running)')
.attr('aria-busy', 'false')
.css('color', 'orange');
log('Requirement PSQL Failed', 'warning');
log('Requirement pnpm Failed', 'warning');
});
};

0 comments on commit 0aeb322

Please sign in to comment.