Skip to content

Commit

Permalink
nit #10757
Browse files Browse the repository at this point in the history
  • Loading branch information
chrabyrd committed Apr 15, 2024
1 parent 92e9c75 commit 01c9798
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions arches/management/commands/updateproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,18 @@ def update_to_v7(self):
if os.path.exists(project_webpack_path):
shutil.rmtree(project_webpack_path)

shutil.copytree(os.path.join(settings.ROOT_DIR, "install", "arches-templates", "project_name", "webpack"), project_webpack_path)
arches_template_webpack_path = os.path.join(settings.ROOT_DIR, "install", "arches-templates", "project_name", "webpack")

if os.path.exists(arches_template_webpack_path):
shutil.copytree(arches_template_webpack_path, project_webpack_path)

# copy dotfiles
for dotfile in [".eslintrc.js", ".eslintignore", ".babelrc", ".browserslistrc", ".stylelintrc.json"]:
print("Copying {} to project root directory".format(dotfile))
shutil.copy2(os.path.join(settings.ROOT_DIR, "install", "arches-templates", "project_name", dotfile), settings.APP_ROOT)
dotfile_path = os.path.join(settings.ROOT_DIR, "install", "arches-templates", "project_name", dotfile)
if os.path.exists(arches_template_webpack_path):

print("Copying {} to project root directory".format(dotfile))
shutil.copy2(dotfile_path, settings.APP_ROOT)

# ensure project has a `media/img` directory
if not os.path.isdir(os.path.join(settings.APP_ROOT, "media", "img")):
Expand Down Expand Up @@ -88,10 +94,10 @@ def update_to_v7_5(self):
def update_to_v7_6(self):
# ensure project has a `messages.pot` file
for dotfile in [
"nodemon.json", "tsconfig.json", ".babelrc", ".browerslistrc", ".eslintignore", ".eslintrc.js", "stylelintrc.json", "LICENSE", "MANIFEST.in", "pyproject.toml"
"nodemon.json", "tsconfig.json", ".babelrc", ".browserslistrc", ".eslintignore", ".eslintrc.js", ".stylelintrc.json", "LICENSE", "MANIFEST.in", "pyproject.toml"
]:
print("Copying {} to project root directory".format(dotfile))
shutil.copy2(os.path.join(settings.ROOT_DIR, "install", "arches-templates", "project_name", dotfile), os.join(settings.APP_ROOT, '..'))
shutil.copy2(os.path.join(settings.ROOT_DIR, "install", "arches-templates", dotfile), os.path.join(settings.APP_ROOT, '..'))

if not os.path.isfile(os.path.join(settings.APP_ROOT, "src", "declarations.d.ts")):
print("Creating /src/declarations.d.ts")
Expand All @@ -109,10 +115,12 @@ def update_to_v7_6(self):

if not os.path.isfile(os.path.join(settings.APP_ROOT, "gettext.config.js")):
print("Copying gettext config to project root directory")
shutil.copy2(os.path.join(settings.ROOT_DIR, "install", "arches-templates", "project_name", "gettext.config.js"), os.join(settings.APP_ROOT, '..'))
shutil.copy2(os.path.join(settings.ROOT_DIR, "install", "arches-templates", "gettext.config.js"), os.path.join(settings.APP_ROOT, '..'))

if os.path.isdir(os.path.join(settings.APP_ROOT, 'webpack')):
print("Removing previous webpack directory")
shutil.rmtree(os.path.join(settings.APP_ROOT, 'webpack'), ignore_errors=True)

print("Removing previous webpack directory")
shutil.rmtree(os.path.join(settings.APP_ROOT, 'webpack'), ignore_errors=True)
if os.path.isdir(os.path.join(settings.APP_ROOT, '..', 'webpack')):
print("Root-level webpack directory detected! Removing...")
shutil.rmtree(os.path.join(settings.APP_ROOT, '..', 'webpack'), ignore_errors=True)
Expand Down

0 comments on commit 01c9798

Please sign in to comment.