-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
working refactor, make project:sync ignore more
- Loading branch information
Showing
5 changed files
with
415 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,31 @@ | ||
#!/usr/bin/env node | ||
/* eslint-env node */ | ||
// @ts-check | ||
|
||
import path from 'node:path' | ||
|
||
import { addDependenciesToPackageJson } from './lib/project.mjs' | ||
|
||
const projectPath = process.argv?.[2] ?? process.env.RWJS_CWD | ||
function main() { | ||
const projectPath = process.argv?.[2] ?? process.env.RWJS_CWD | ||
|
||
if (!projectPath) { | ||
console.log('Error: Please specify the path to your Redwood Project') | ||
console.log(`Usage: ${process.argv?.[1]} /path/to/rwjs/proect`) | ||
process.exit(1) | ||
} | ||
if (!projectPath) { | ||
process.exitCode = 1 | ||
console.error([ | ||
'Error: Please specify the path to your Redwood project', | ||
`Usage: ${process.argv?.[1]} ./path/to/rw/project`, | ||
]) | ||
return | ||
} | ||
|
||
try { | ||
const packageJsonPath = path.join(projectPath, 'package.json') | ||
addDependenciesToPackageJson(packageJsonPath) | ||
console.log('Done. Now run `yarn install`.') | ||
} catch (e) { | ||
console.log('Error:', e.message) | ||
process.exit(1) | ||
try { | ||
const packageJsonPath = path.join(projectPath, 'package.json') | ||
addDependenciesToPackageJson(packageJsonPath) | ||
console.log('Done. Now run `yarn install`.') | ||
} catch (e) { | ||
console.log('Error:', e.message) | ||
process.exitCode = 1 | ||
} | ||
} | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
#!/usr/bin/env node | ||
/* eslint-env node */ | ||
// @ts-check | ||
|
||
import { copyFrameworkFilesToProject } from './lib/project.mjs' | ||
|
||
const projectPath = process.argv?.[2] ?? process.env.RWJS_CWD | ||
async function main() { | ||
const redwoodProjectPath = process.argv?.[2] ?? process.env.RWJS_CWD | ||
|
||
if (!projectPath) { | ||
console.log('Error: Please specify the path to your Redwood Project') | ||
console.log(`Usage: ${process.argv?.[1]} /path/to/rwjs/proect`) | ||
process.exit(1) | ||
} | ||
// Mostly just making TS happy with the second condition. | ||
if (!redwoodProjectPath || typeof redwoodProjectPath !== 'string') { | ||
process.exitCode = 1 | ||
console.error([ | ||
'Error: Please specify the path to your Redwood project', | ||
`Usage: ${process.argv?.[1]} ./path/to/rw/project`, | ||
]) | ||
return | ||
} | ||
|
||
try { | ||
await copyFrameworkFilesToProject(projectPath) | ||
} catch (e) { | ||
console.error('Error:', e.message) | ||
process.exit(1) | ||
try { | ||
await copyFrameworkFilesToProject(redwoodProjectPath) | ||
} catch (e) { | ||
console.error('Error:', e.message) | ||
process.exitCode = 1 | ||
} | ||
} | ||
|
||
main() |
Oops, something went wrong.