-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
3b3d193
commit d595f76
Showing
32 changed files
with
920 additions
and
112 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -27,3 +27,10 @@ yalc.lock | |
package-lock.json | ||
|
||
docs/ | ||
|
||
|
||
|
||
.nx/cache | ||
.nx/workspace-data | ||
nx-cloud.env | ||
dep-graph.json |
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const { execSync } = require('child_process'); | ||
const fs = require('fs'); | ||
|
||
if (process.argv.length < 4) { | ||
console.error('Please provide a changed project name and the current project.'); | ||
process.exit(1); | ||
} | ||
|
||
const changedProject = process.argv[2]; | ||
const currentProject = process.argv[3]; | ||
|
||
try { | ||
console.log('changedProject:', changedProject); | ||
// Generate the focused dependency graph JSON | ||
execSync(`nx graph --file=dep-graph.json --focus=${currentProject}`, { stdio: 'inherit' }); | ||
|
||
// Read and parse the dependency graph JSON | ||
const depGraph = JSON.parse(fs.readFileSync('dep-graph.json', 'utf-8')); | ||
|
||
// Check if the changed project is in the dependencies of the current project | ||
const dependencies = depGraph.graph.dependencies[currentProject] || []; | ||
const isDependent = dependencies.some((dep) => dep.target === changedProject); | ||
|
||
if (isDependent || changedProject === currentProject) { | ||
// Rebuild the current project | ||
const command = `nx run-many --target=d --projects=${currentProject} --parallel=5`; | ||
|
||
console.log(`Running command: ${command}`); | ||
execSync(command, { stdio: 'inherit' }); | ||
|
||
console.log(`Rebuilt the ${currentProject} project successfully.`); | ||
} else { | ||
console.log(`No need to build anything as changes to ${changedProject} do not affect ${currentProject}.`); | ||
} | ||
} catch (error) { | ||
console.error('Error rebuilding projects:', error); | ||
process.exit(1); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
# Check if an argument was provided | ||
if [ -z "$1" ]; then | ||
echo "No package specified." | ||
echo "" | ||
echo "Fetching package list..." | ||
# This command might change based on your nx setup. It assumes you can list projects like this. | ||
nx show projects | grep @ | sort | awk '{print NR-1 " " $1}' > /tmp/nx_projects | ||
cat /tmp/nx_projects | ||
echo "" | ||
echo "Enter the number of the project you want to select:" | ||
read project_number | ||
project_name=$(awk -v num="$project_number" '$1 == num {print $2}' /tmp/nx_projects) | ||
echo "" | ||
echo "You selected: $project_name" | ||
echo "" | ||
rm /tmp/nx_projects | ||
PACKAGE_NAME=$project_name | ||
else | ||
PACKAGE_NAME=$1 | ||
fi | ||
|
||
# Run nx commands with the selected or provided package name | ||
echo "Running commands for package: $PACKAGE_NAME" | ||
nx run $PACKAGE_NAME:d --parallel=5 | ||
nx watch --all -- node ./build-dependents.js \$NX_PROJECT_NAME $(echo $PACKAGE_NAME) |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Create a file named nx-cloud.env in the root of the repo and obtain the contents from the Platform Engineering Shared 1Password vault | ||
# By default the token set in the nx.json cloud access token field will only allow for read, while the token in the nx-cloud.env file will allow for read/write | ||
# This is typically needed when you want to save the cache remotely from your local machine. | ||
|
||
NX_CLOUD_ACCESS_TOKEN=<TOKEN> |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"$schema": "./node_modules/nx/schemas/nx-schema.json", | ||
"targetDefaults": { | ||
"d": { | ||
"dependsOn": [ | ||
"^d" | ||
], | ||
"outputs": [ | ||
"{projectRoot}/dist" | ||
], | ||
"cache": true | ||
}, | ||
"lint": { | ||
"cache": true | ||
}, | ||
"test": { | ||
"cache": true | ||
}, | ||
"build": { | ||
"dependsOn": [ | ||
"^build" | ||
], | ||
"outputs": [ | ||
"{projectRoot}/dist" | ||
], | ||
"cache": true | ||
} | ||
}, | ||
"defaultBase": "main", | ||
"parallel": 5, | ||
"nxCloudAccessToken": "Mzg3ZGY1MWUtYmYyNy00ZmE4LTkyNDAtYjYxZmJmYmE4NWQ3fHJlYWQ=" | ||
} |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.