Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git/
build/
dist/
over_react_codemod.egg-info/
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/build/
/dist/
/over_react_codemod.egg-info/
/over_react_migrate_to_dart1_and_dart2.spec
23 changes: 10 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM drydock-prod.workiva.net/workiva/smithy-runner-generator:355624 as build
FROM python:2.7.15 as build

# Build Environment Vars
ARG BUILD_ID
Expand All @@ -11,18 +11,15 @@ ARG GIT_COMMIT_RANGE
ARG GIT_HEAD_URL
ARG GIT_MERGE_HEAD
ARG GIT_MERGE_BRANCH

WORKDIR /build/
ADD . /build/
ENV TERM=linux
ENV TERMINFO=/etc/terminfo
RUN echo "Install codemod" && \
pip install git+https://github.com/georgelesica-wf/codemod@dart-convert && \
echo "done"
RUN echo "Starting the script sections" && \
dart --version && \
pub get && \
pub run dart_dev test && \
echo "Script sections completed"
ARG BUILD_ARTIFACTS_DART-DEPENDENCIES=/build/pubspec.lock
ARG BUILD_ARTIFACTS_BUILD=/build/pubspec.lock

RUN make install
RUN make test
RUN make dist

ARG BUILD_ARTIFACTS_EXE_DART1_AND_DART2=/build/dist/over_react_migrate_to_dart1_and_dart2
# ARG BUILD_ARTIFACTS_EXE_DART2=/build/dist/over_react_migrate_to_dart2

FROM scratch
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Copyright 2018 Workiva Inc. All rights reserved.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
install:
pip install -r requirements_dev.txt

test:
nosetests tests

dist:
pyinstaller --onefile bin/over_react_migrate_to_dart1_and_dart2.py
# pyinstaller --onefile bin/over_react_migrate_to_dart2.py

.PHONY: install test dist
Empty file added bin/__init__.py
Empty file.
46 changes: 46 additions & 0 deletions bin/over_react_migrate_to_dart1_and_dart2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from sys import exit

import codemod

from over_react_codemod.suggestors.component_default_props import component_default_props_suggestor
from over_react_codemod.suggestors.dollar_props import dollar_props_suggestor
from over_react_codemod.suggestors.factories import factories_suggestor
from over_react_codemod.suggestors.generated_parts import collect_libraries_suggestor
from over_react_codemod.suggestors.generated_parts import generated_parts_suggestor
from over_react_codemod.suggestors.props_and_state_classes import props_and_state_classes_accompanying_public_class_suggestor
from over_react_codemod.suggestors.props_and_state_classes import props_and_state_classes_rename_suggestor
from over_react_codemod.suggestors.props_and_state_mixins import props_and_state_mixins_meta_suggestor
from over_react_codemod.suggestors.with_props_or_state_mixins import with_props_and_state_mixins_suggestor
from over_react_codemod.util import is_dart_file

suggestors = [
factories_suggestor,
dollar_props_suggestor,
component_default_props_suggestor,
props_and_state_classes_accompanying_public_class_suggestor,
props_and_state_classes_rename_suggestor,
props_and_state_mixins_meta_suggestor,
with_props_and_state_mixins_suggestor,
collect_libraries_suggestor,
generated_parts_suggestor,
]


def main(check=False):
num_changes_needed = 0

global suggestors
for suggestor in suggestors:
query = codemod.Query(suggestor, path_filter=is_dart_file)

if check:
num_changes_needed += len(query.generate_patches())
else:
codemod.run_interactive(query)

if check and num_changes_needed > 0:
print('Failed: %d changes needed.' % num_changes_needed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:nice:

exit(1)

if __name__ == '__main__':
main()
Empty file.
Loading