Skip to content

Commit

Permalink
Merge pull request #49 from eddeee888/make-nx-dev-tools-safer
Browse files Browse the repository at this point in the history
QOL updates for nx-dev-tools scripts
  • Loading branch information
eddeee888 authored Jun 26, 2022
2 parents cd3af92 + 348b685 commit 2256f5b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-hornets-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eddeee888/nx-dev-tools': patch
---

Simplify and fix nx-dev-tools scripts
2 changes: 1 addition & 1 deletion packages/nx-dev-tools-e2e/tests/nx-dev-tools.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('nx-dev-tools e2e', () => {
await runNxCommandAsync(`generate @eddeee888/nx-dev-tools:init --projectName bam --commandName bb --devDomain vm`);

// root files
checkFilesExist('.env.docker-compose', '.env.local', 'docker-compose.yml');
checkFilesExist('.env.docker-compose', 'docker-compose.yml');

// main folders and files
expect(exists(tmpProjPath('dev-tools/bin/core.sh'))).toBe(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ PRISMA_BINARY_TARGET=[\\"native\\",\\"linux-musl\\"]
"
`;

exports[`nx-dev-tools generator Files generation .env.local content 1`] = `
"PRIMARY_DOMAIN=bam.fakecom
"
`;

exports[`nx-dev-tools generator Files generation dev-tools/bin/core.sh content 1`] = `
"#!/bin/bash
Expand Down Expand Up @@ -309,6 +304,12 @@ CURRENT_DIR=\\"$( cd \\"$( dirname \\"\${BASH_SOURCE[0]}\\" )\\" >/dev/null && p
REVERSE_PROXY_CERTIFICATE_DIR=\\"\${CURRENT_DIR}/../reverse-proxy/certificates\\"
source $CURRENT_DIR/utils-constants.sh
function update_file_permissions {
echo \\"=> Updating script permissions...\\"
chmod +x $CURRENT_DIR/*.sh
echo \\"=> Successfully updated script permissions ...\\"
}
function remove_old_symlink {
if [ -f $USR_BIN/$CORE_CMD_NAME ]; then
echo \\"=> Removing old command...\\"
Expand All @@ -333,6 +334,7 @@ function main {
echo -e \\"Welcome to \\\\\\"$CORE_CMD_NAME\\\\\\" setup!\\"
echo -e \\"======== **** ========\\\\n\\"
update_file_permissions
remove_old_symlink
setup_symlink_permission
symlink
Expand All @@ -341,7 +343,7 @@ function main {
echo -e \\"\\\\n=> Successfully set up \\\\\\"$CORE_CMD_NAME\\\\\\"!\\\\n\\"
echo -e \\"Run the following command to initialize the project:\\\\n\\"
echo -e \\"$CORE_CMD_NAME vm-up && $CORE_CMD_NAME build-dev-image && $CORE_CMD_NAME up && nx init-database main-prisma\\\\n\\"
echo -e \\"$CORE_CMD_NAME vm-up && $CORE_CMD_NAME build-dev-images && $CORE_CMD_NAME up && nx init-database main-prisma\\\\n\\"
}
main
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
REVERSE_PROXY_CERTIFICATE_DIR="${CURRENT_DIR}/../reverse-proxy/certificates"
source $CURRENT_DIR/utils-constants.sh

function update_file_permissions {
echo "=> Updating script permissions..."
chmod +x $CURRENT_DIR/*.sh
echo "=> Successfully updated script permissions ..."
}

function remove_old_symlink {
if [ -f $USR_BIN/$CORE_CMD_NAME ]; then
echo "=> Removing old command..."
Expand All @@ -30,6 +36,7 @@ function main {
echo -e "Welcome to \"$CORE_CMD_NAME\" setup!"
echo -e "======== **** ========\n"

update_file_permissions
remove_old_symlink
setup_symlink_permission
symlink
Expand All @@ -38,7 +45,7 @@ function main {

echo -e "\n=> Successfully set up \"$CORE_CMD_NAME\"!\n"
echo -e "Run the following command to initialize the project:\n"
echo -e "$CORE_CMD_NAME vm-up && $CORE_CMD_NAME build-dev-image && $CORE_CMD_NAME up && nx init-database main-prisma\n"
echo -e "$CORE_CMD_NAME vm-up && $CORE_CMD_NAME build-dev-images && $CORE_CMD_NAME up && nx init-database main-prisma\n"
}

main
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ describe('nx-dev-tools generator', () => {
['dev-tools/reverse-proxy/proxy.conf'],
['dev-tools/reverse-proxy/ws.conf'],
['.env.docker-compose'],
['.env.local'],
['docker-compose.yml'],
])('%s content', (file) => {
const content = tree.read(file, 'utf-8');
Expand Down
2 changes: 1 addition & 1 deletion packages/nx-dev-tools/src/generators/init/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { NxDevToolsGeneratorSchema } from './schema';

type NormalizedSchema = NxDevToolsGeneratorSchema;

function normalizeOptions(tree: Tree, options: NxDevToolsGeneratorSchema): NormalizedSchema {
function normalizeOptions(_tree: Tree, options: NxDevToolsGeneratorSchema): NormalizedSchema {
return {
...options,
};
Expand Down

0 comments on commit 2256f5b

Please sign in to comment.