40 Commits

Author SHA1 Message Date
Mariusz Nowak
3808471972 test: Move unit tests to "test/unit" folder 2020-11-30 16:53:52 +01:00
Matthieu Napoli
2fdeb51174
fix(Variables): Ensure no collisions with AWS CloudFormation variables
(PR #8279)
2020-09-24 15:31:02 +02:00
Mariusz Nowak
ee3b519425 refactor(Print): Improve variables handling 2020-09-24 10:01:24 +02:00
Mariusz Nowak
b53716a64c refactor(Print): Read provider values from provider 2020-09-24 10:01:24 +02:00
Nguyễn Việt Đức
20cef81555
refactor: Replace _.isUndefined with native checks (#7826) 2020-06-12 09:54:00 +02:00
Wing-Kam
9f3ee94a74
refactor: Replace _.isString(value) with typeof value === 'string'
(PR #7812)
2020-06-03 16:17:04 +02:00
TATSUNO Yasuhiro
3fe2e98f15
refactor: Replace _.isArray with native Array.isArray (#7703) 2020-05-11 10:24:41 +02:00
Arben Bakiu
7310782294
fix(Variables): Relax pattern to allow non-ascii defaults (#7431) 2020-03-08 09:43:16 +13:00
kdnakt
12cad14dce Make question mark available as variables fallback 2019-10-09 09:10:32 +09:00
Mariusz Nowak
4944f471b1
Prettify 2019-06-26 12:43:01 +02:00
Daniel Schep
970a1cc3f8 refactor getServerlessConfigFile to simply accept a serverless object 2019-06-10 11:19:14 -04:00
Daniel Schep
94bf5a4382 delint 2019-06-10 11:19:14 -04:00
Daniel Schep
2b81303370 --config option.
closes #5589
closes #4485
closes #4473
closes #4124
closes #5822
2019-06-10 11:19:14 -04:00
Mariusz Nowak
2f6be36f36
Ensure needed tooling for test 2019-05-15 17:56:35 +02:00
Philipp Muens
5cba21730c Merge branch 'master' into sls-5225 2019-03-22 10:47:11 +01:00
Daniel Schep
73990e316f sls print depends on the config of course! 2019-02-22 09:22:46 -05:00
Daniel Schep
10d1207bca follow up fixes for #5840 breaking sls print & autocomplete 2019-02-22 09:03:11 -05:00
Daniel Schep
d837e9baae Merge remote-tracking branch 'origin/master' into sls-5225 2019-01-07 13:25:57 -05:00
Daniel Schep
0896f311b1
Merge pull request #5312 from Limess/4496/handle-scoped-packages
Handle scoped npm packages in ${file()} variables
2019-01-07 10:56:25 -05:00
Daniel Schep
1a496a5d7b update print.js too 2019-01-03 08:53:22 -05:00
Daniel Schep
298d39c8c9 add variableSyntax change to print tests 2019-01-03 08:46:52 -05:00
Erik Erikson
553e6cf0da Provide Consistent Service Path
Fix #5242

Do this by first supplying the `servicePath` in `~/lib/plugins/lib/validate.js` and `~/lib/plugins/print.js` in a consistent manner with the code in `~/lib/classes/PluginManager.js`.  Then, provide a default of `process.cwd()` for `servicePath` in `getCacheFilePath` and `getServerlessConfigFile`.
2018-09-19 17:03:29 -07:00
Charlie Briggs
93ad842bfe Update variable syntax in aws docs and print tests 2018-09-19 20:46:50 +01:00
Charlie Briggs
8f8c27ae7e Handle scoped packages in ${file()} variables
Currently @ is not a valid variable character, so it doesn't get parsed
as one.
When it does get parsed, @ is not considered valid as part of a file path
- we add a blacklist as per https://github.com/serverless/serverless/pull/4528 to
handle this case.
2018-09-19 17:26:50 +01:00
Ron Korving
0fd4235aeb Add print options to allow digging, filtering and formatting 2018-06-18 15:14:02 +09:00
Erik Erikson
dc3a4aa6af Fix print, clean pre-population, fix cyclic bug
Fix `print`
The print command is highly linked to the `Variables` and `Service` codebases, keep those in sync and leave reminders about the link.  Made these explicit and separately implemented to avoid complexity.
Additionally, the print command re-populates an object with the *very similar* content as the previously pre-populated service (just not augmented as just mentioned).  This can lead to cross contamination between the two.  As such, all caches must be cleared per unique invocation of service/object/property population.
Add tests for some expected but previously unverified behaviors.

Clean pre-population
The previous implementation worked okay but was unnecessary and would have been a maintenance problem.  Instead, just knock out the population of variables depending on those config dependent services and use the standard means of resolution.

Fix cyclic bug (resulting from running print against a self-referencing serverless.yml)
The caching of values could lead to a cyclic object remaining in the caches for variable population.  This causes crashes and pain.  Solved by the cache cleaning logic.
2018-02-22 16:30:04 -08:00
Erik Erikson
13ae54cacc Fix Cycles Crash (#4556)
Replace the existing service and clear the cache (which references the ammended service)
Remove cycles in that service using json-cycle.
Dump the decycled object as YAML to console.
2017-12-13 16:39:06 -08:00
Rafal Wilinski
cf8e15778d Fix linter issue 2017-10-12 00:55:20 +02:00
Alex DeBrie
fb2fb3d14d Expand refs in YAML 2017-10-04 18:53:06 +00:00
Alex DeBrie
45c8ade73c Show custom variableSyntax in output 2017-09-27 15:56:23 +00:00
Alex DeBrie
00d05244cc And now the linter works! 2017-09-22 20:50:41 +00:00
Alex DeBrie
c8b6de516f The tests are passing!!! 2017-09-22 20:23:28 +00:00
Alex DeBrie
059d690cdc Continued work on print tests 2017-09-22 15:50:01 +00:00
Alex DeBrie
e4be10f48f Begin better tests for print command 2017-09-21 15:29:14 +00:00
Alex DeBrie
c419c5b451 Handle user-provided variableSyntax 2017-09-20 18:40:19 +00:00
Alex DeBrie
ee958d891c Add test for print 2017-09-01 20:35:33 +00:00
Eslam A. Hefnawy
ba2728fbd1 added use strict to print plugin 2017-09-01 21:45:45 +07:00
Alex DeBrie
abe818f5c3 Set options before populating config object 2017-08-31 13:15:15 +00:00
Alex DeBrie
6f256404c5 Fix lint issues 2017-08-29 13:01:04 +00:00
Alex DeBrie
d95e192cde Add print command 2017-08-29 12:45:29 +00:00