Skip to content

Commit 05697ac

Browse files
authored
feat: Remove esbuild flag (#383)
* Removed esbuild flag * Removed test checking for feature flag * Pass empty list for experiement_flags to remain consistent
1 parent c9e601f commit 05697ac

5 files changed

Lines changed: 28 additions & 81 deletions

File tree

aws_lambda_builders/workflows/nodejs_npm_esbuild/utils.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

aws_lambda_builders/workflows/nodejs_npm_esbuild/workflow.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
EsbuildBundleAction,
2020
EsbuildCheckVersionAction,
2121
)
22-
from .utils import is_experimental_esbuild_scope
2322
from .esbuild import SubprocessEsbuild, EsbuildExecutionError
2423
from ..nodejs_npm import NodejsNpmWorkflow
2524
from ..nodejs_npm.npm import SubprocessNpm
@@ -67,9 +66,6 @@ def __init__(self, source_dir, artifacts_dir, scratch_dir, manifest_path, runtim
6766
]
6867
return
6968

70-
if not is_experimental_esbuild_scope(self.experimental_flags):
71-
raise EsbuildExecutionError(message="Feature flag must be enabled to use this workflow")
72-
7369
self.actions = self.actions_with_bundler(
7470
source_dir, scratch_dir, artifacts_dir, bundler_config, osutils, subprocess_npm, subprocess_esbuild
7571
)

tests/integration/workflows/nodejs_npm_esbuild/test_nodejs_npm_with_esbuild.py

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from aws_lambda_builders.workflows.nodejs_npm.npm import SubprocessNpm
1010
from aws_lambda_builders.workflows.nodejs_npm.utils import OSUtils
1111
from aws_lambda_builders.workflows.nodejs_npm_esbuild.esbuild import EsbuildExecutionError
12-
from aws_lambda_builders.workflows.nodejs_npm_esbuild.utils import EXPERIMENTAL_FLAG_ESBUILD
1312
from parameterized import parameterized
1413

1514

@@ -39,20 +38,6 @@ def tearDown(self):
3938
shutil.rmtree(self.artifacts_dir)
4039
shutil.rmtree(self.scratch_dir)
4140

42-
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",)])
43-
def test_doesnt_build_without_feature_flag(self, runtime):
44-
source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-esbuild")
45-
46-
with self.assertRaises(EsbuildExecutionError) as context:
47-
self.builder.build(
48-
source_dir,
49-
self.artifacts_dir,
50-
self.scratch_dir,
51-
os.path.join(source_dir, "package.json"),
52-
runtime=runtime,
53-
)
54-
self.assertEqual(str(context.exception), "Esbuild Failed: Feature flag must be enabled to use this workflow")
55-
5641
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",)])
5742
def test_builds_javascript_project_with_dependencies(self, runtime):
5843
source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-esbuild")
@@ -66,8 +51,8 @@ def test_builds_javascript_project_with_dependencies(self, runtime):
6651
os.path.join(source_dir, "package.json"),
6752
runtime=runtime,
6853
options=options,
54+
experimental_flags=[],
6955
executable_search_paths=[self.binpath],
70-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
7156
)
7257

7358
expected_files = {"included.js"}
@@ -87,8 +72,8 @@ def test_builds_javascript_project_with_multiple_entrypoints(self, runtime):
8772
os.path.join(source_dir, "package.json"),
8873
runtime=runtime,
8974
options=options,
75+
experimental_flags=[],
9076
executable_search_paths=[self.binpath],
91-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
9277
)
9378

9479
expected_files = {"included.js", "included2.js"}
@@ -108,8 +93,8 @@ def test_builds_typescript_projects(self, runtime):
10893
os.path.join(source_dir, "package.json"),
10994
runtime=runtime,
11095
options=options,
96+
experimental_flags=[],
11197
executable_search_paths=[self.binpath],
112-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
11398
)
11499

115100
expected_files = {"included.js"}
@@ -128,8 +113,8 @@ def test_builds_with_external_esbuild(self, runtime):
128113
os.path.join(source_dir, "package.json"),
129114
runtime=runtime,
130115
options=options,
116+
experimental_flags=[],
131117
executable_search_paths=[self.binpath],
132-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
133118
)
134119

135120
expected_files = {"included.js"}
@@ -147,8 +132,8 @@ def test_no_options_passed_to_esbuild(self, runtime):
147132
self.scratch_dir,
148133
os.path.join(source_dir, "package.json"),
149134
runtime=runtime,
135+
experimental_flags=[],
150136
executable_search_paths=[self.binpath],
151-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
152137
)
153138

154139
self.assertEqual(str(context.exception), "NodejsNpmEsbuildBuilder:EsbuildBundle - entry_points not set ({})")
@@ -166,8 +151,8 @@ def test_bundle_with_implicit_file_types(self, runtime):
166151
os.path.join(source_dir, "package.json"),
167152
runtime=runtime,
168153
options=options,
154+
experimental_flags=[],
169155
executable_search_paths=[self.binpath],
170-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
171156
)
172157

173158
expected_files = {"implicit.js", "included.js"}
@@ -192,7 +177,7 @@ def test_bundles_project_without_dependencies(self, runtime):
192177
os.path.join(source_dir, "package.json"),
193178
runtime=runtime,
194179
options=options,
195-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
180+
experimental_flags=[],
196181
executable_search_paths=[binpath],
197182
)
198183

@@ -220,7 +205,7 @@ def test_builds_project_with_remote_dependencies_without_download_dependencies_w
220205
runtime=runtime,
221206
dependencies_dir=self.dependencies_dir,
222207
download_dependencies=False,
223-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
208+
experimental_flags=[],
224209
executable_search_paths=[binpath],
225210
)
226211

@@ -242,8 +227,8 @@ def test_builds_project_with_remote_dependencies_with_download_dependencies_and_
242227
options=options,
243228
dependencies_dir=self.dependencies_dir,
244229
download_dependencies=True,
230+
experimental_flags=[],
245231
executable_search_paths=[self.binpath],
246-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
247232
)
248233

249234
expected_files = {"included.js"}
@@ -273,8 +258,8 @@ def test_builds_project_with_remote_dependencies_without_download_dependencies_w
273258
runtime=runtime,
274259
dependencies_dir=None,
275260
download_dependencies=False,
261+
experimental_flags=[],
276262
executable_search_paths=[self.binpath],
277-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
278263
)
279264

280265
self.assertEqual(
@@ -298,8 +283,8 @@ def test_builds_project_without_combine_dependencies(self, runtime):
298283
dependencies_dir=self.dependencies_dir,
299284
download_dependencies=True,
300285
combine_dependencies=False,
286+
experimental_flags=[],
301287
executable_search_paths=[self.binpath],
302-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
303288
)
304289

305290
expected_files = {"included.js"}
@@ -327,8 +312,8 @@ def test_builds_javascript_project_with_external(self, runtime):
327312
os.path.join(source_dir, "package.json"),
328313
runtime=runtime,
329314
options=options,
315+
experimental_flags=[],
330316
executable_search_paths=[self.binpath],
331-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
332317
)
333318

334319
expected_files = {"included.js"}
@@ -353,8 +338,8 @@ def test_builds_javascript_project_with_loader(self, runtime):
353338
os.path.join(source_dir, "package.json"),
354339
runtime=runtime,
355340
options=options,
341+
experimental_flags=[],
356342
executable_search_paths=[self.binpath],
357-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
358343
)
359344

360345
expected_files = {"included.js"}
@@ -394,8 +379,8 @@ def test_includes_sourcemap_if_requested(self, runtime):
394379
os.path.join(source_dir, "package.json"),
395380
runtime=runtime,
396381
options=options,
382+
experimental_flags=[],
397383
executable_search_paths=[self.binpath],
398-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
399384
)
400385

401386
expected_files = {"included.js", "included.js.map"}

tests/unit/workflows/nodejs_npm_esbuild/test_utils.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

tests/unit/workflows/nodejs_npm_esbuild/test_workflow.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from aws_lambda_builders.workflows.nodejs_npm_esbuild import NodejsNpmEsbuildWorkflow
1515
from aws_lambda_builders.workflows.nodejs_npm_esbuild.actions import EsbuildBundleAction, EsbuildCheckVersionAction
1616
from aws_lambda_builders.workflows.nodejs_npm_esbuild.esbuild import SubprocessEsbuild
17-
from aws_lambda_builders.workflows.nodejs_npm_esbuild.utils import EXPERIMENTAL_FLAG_ESBUILD
1817

1918

2019
class FakePopen:
@@ -53,7 +52,7 @@ def test_workflow_sets_up_npm_actions_with_bundler_if_manifest_requests_it(self)
5352
"scratch_dir",
5453
"manifest",
5554
osutils=self.osutils,
56-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
55+
experimental_flags=[],
5756
)
5857

5958
self.assertEqual(len(workflow.actions), 3)
@@ -74,7 +73,7 @@ def test_sets_up_esbuild_search_path_from_npm_bin(self):
7473
"scratch_dir",
7574
"manifest",
7675
osutils=self.osutils,
77-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
76+
experimental_flags=[],
7877
)
7978

8079
self.osutils.popen.assert_called_with(["npm", "bin"], stdout="PIPE", stderr="PIPE", cwd="scratch_dir")
@@ -94,7 +93,7 @@ def test_sets_up_esbuild_search_path_with_workflow_executable_search_paths_after
9493
"manifest",
9594
osutils=self.osutils,
9695
executable_search_paths=["other/bin"],
97-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
96+
experimental_flags=[],
9897
)
9998

10099
self.osutils.popen.assert_called_with(["npm", "bin"], stdout="PIPE", stderr="PIPE", cwd="scratch_dir")
@@ -112,7 +111,7 @@ def test_workflow_uses_npm_ci_if_lockfile_exists(self):
112111
"scratch_dir",
113112
"manifest",
114113
osutils=self.osutils,
115-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
114+
experimental_flags=[],
116115
options={"use_npm_ci": True},
117116
)
118117

@@ -132,7 +131,7 @@ def test_workflow_uses_npm_ci_if_shrinkwrap_exists(self):
132131
"scratch_dir",
133132
"manifest",
134133
osutils=self.osutils,
135-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
134+
experimental_flags=[],
136135
options={"use_npm_ci": True},
137136
)
138137

@@ -154,7 +153,7 @@ def test_workflow_doesnt_use_npm_ci_no_options_config(self):
154153
"scratch_dir",
155154
"manifest",
156155
osutils=self.osutils,
157-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
156+
experimental_flags=[],
158157
)
159158

160159
self.assertEqual(len(workflow.actions), 3)
@@ -176,7 +175,7 @@ def test_must_validate_architecture(self):
176175
"manifest",
177176
options={"artifact_executable_name": "foo"},
178177
osutils=self.osutils,
179-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
178+
experimental_flags=[],
180179
)
181180

182181
workflow_with_arm = NodejsNpmEsbuildWorkflow(
@@ -186,7 +185,7 @@ def test_must_validate_architecture(self):
186185
"manifest",
187186
architecture=ARM64,
188187
osutils=self.osutils,
189-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
188+
experimental_flags=[],
190189
)
191190

192191
self.assertEqual(workflow.architecture, "x86_64")
@@ -201,7 +200,7 @@ def test_workflow_sets_up_esbuild_actions_with_download_dependencies_without_dep
201200
"scratch_dir",
202201
"manifest",
203202
osutils=self.osutils,
204-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
203+
experimental_flags=[],
205204
)
206205

207206
self.assertEqual(len(workflow.actions), 3)
@@ -221,7 +220,7 @@ def test_workflow_sets_up_esbuild_actions_without_download_dependencies_with_dep
221220
download_dependencies=False,
222221
combine_dependencies=True,
223222
osutils=self.osutils,
224-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
223+
experimental_flags=[],
225224
)
226225

227226
self.assertEqual(len(workflow.actions), 3)
@@ -241,7 +240,7 @@ def test_workflow_sets_up_esbuild_actions_without_download_dependencies_with_dep
241240
download_dependencies=False,
242241
combine_dependencies=False,
243242
osutils=self.osutils,
244-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
243+
experimental_flags=[],
245244
)
246245

247246
self.assertEqual(len(workflow.actions), 4)
@@ -262,7 +261,7 @@ def test_workflow_sets_up_esbuild_actions_with_download_dependencies_and_depende
262261
dependencies_dir="dep",
263262
download_dependencies=True,
264263
osutils=self.osutils,
265-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
264+
experimental_flags=[],
266265
)
267266

268267
self.assertEqual(len(workflow.actions), 6)
@@ -284,7 +283,7 @@ def test_workflow_sets_up_esbuild_actions_with_download_dependencies_and_depende
284283
download_dependencies=True,
285284
combine_dependencies=False,
286285
osutils=self.osutils,
287-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
286+
experimental_flags=[],
288287
)
289288

290289
self.assertEqual(len(workflow.actions), 6)
@@ -307,7 +306,7 @@ def test_workflow_uses_production_npm_version(self, get_workflow_mock):
307306
download_dependencies=True,
308307
combine_dependencies=False,
309308
osutils=self.osutils,
310-
experimental_flags=[EXPERIMENTAL_FLAG_ESBUILD],
309+
experimental_flags=[],
311310
)
312311

313312
self.assertEqual(len(workflow.actions), 3)

0 commit comments

Comments
 (0)