https://serverless-stack.com/ logo
#sst
Title
# sst
d

Dan Van Brunt

09/25/2021, 4:03 PM
Any thoughts on chances of moving SST to support
yarn v2
? We’re thinking of making the move and I think in order to support it, there may only need to be some changes to how SST implements packages like eslint internally. They may not be a need to actually use yarn v2 in SST itself. Also, lots of great things in it if you did.
o

Omi Chowdhury

09/25/2021, 5:06 PM
I upgraded my project to yarn V2 temporarily and it worked fine with SST. Ended up downgrading it because the SLS builds ended up being slower
d

Dan Van Brunt

09/25/2021, 5:10 PM
@Omi Chowdhury Oh ya? You weren't using CDK / Typescript though? Cause I think that is where things are going wrong with me. Something to do with eslint that SST is running programmatically
Copy code
Using stage: dev
Preparing your SST app
Detected tsconfig.json
Transpiling source
Linting source
Error: spawnSync node ENOTDIR
    at Object.spawnSync (internal/child_process.js:1067:20)
    at Object.spawnSync (child_process.js:602:24)
    at Function.spawnSync [as sync] (/Users/me/Projects/projectx/.yarn/cache/cross-spawn-npm-7.0.3-e4ff3e65b3-671cc7c728.zip/node_modules/cross-spawn/index.js:26:23)
    at lint (/Users/me/Projects/projectx/.yarn/cache/@serverless-stack-cli-npm-0.43.4-6ba0eee993-d3e9fee8d7.zip/node_modules/@serverless-stack/cli/scripts/util/cdkHelpers.js:328:26)
    at runChecks (/Users/me/Projects/projectx/.yarn/cache/@serverless-stack-cli-npm-0.43.4-6ba0eee993-d3e9fee8d7.zip/node_modules/@serverless-stack/cli/scripts/util/cdkHelpers.js:310:19)
    at prepareCdk (/Users/me/Projects/projectx/.yarn/cache/@serverless-stack-cli-npm-0.43.4-6ba0eee993-d3e9fee8d7.zip/node_modules/@serverless-stack/cli/scripts/util/cdkHelpers.js:223:9)
    at Object.module.exports [as start] (/Users/me/Projects/projectx/.yarn/cache/@serverless-stack-cli-npm-0.43.4-6ba0eee993-d3e9fee8d7.zip/node_modules/@serverless-stack/cli/scripts/start.js:79:41) {
  errno: -20,
  code: 'ENOTDIR',
  syscall: 'spawnSync node',
  path: 'node',
  spawnargs: [
    '/Users/me/Projects/projectx/.build/eslint.js',
    '--color',
    '/Users/me/Projects/projectx/lib/MyStack.ts',
    '/Users/me/Projects/projectx/lib/index.ts'
  ]
}
Running type checker
There was a problem linting the source.
o

Omi Chowdhury

09/25/2021, 5:17 PM
Yeah using typescript, I do remember needing to upgrade my eslint version (+plugins, presets etc) and it took quite a while to get everything working)
Does the .build directory not exist where it's expected to above? Had issues with .build placement when trying to have stacks and lambda code in sibling directories, worked when I reverted to following the recommended directory structure
d

Dan Van Brunt

09/25/2021, 7:36 PM
this is default ts template app directory structure. @Omi Chowdhury any chance you have a working repo that you could share some of the config?
Not sure if SST can even work with Yarn 2 as-is right now. Seems there are quite a few node_module related references in the various SST CLI src.
s

Simon Reilly

09/25/2021, 8:52 PM
Have played around converting exist sls mono-repo built with yarn 2. You can specify the nodelinker as node modules, and I believe yarn 2 will unpack everything from the .yarn cache into node modules.
d

Dan Van Brunt

09/25/2021, 10:37 PM
@Simon Reilly Yup, that may work too. But I think you end up missing out on a lot of great features of Yarn 2 that way.
s

Simon Reilly

09/26/2021, 6:25 AM
Yeah, it's basically saying no to plug and play, and all the performance benefits, you are correct 👍
o

Omi Chowdhury

09/26/2021, 10:00 AM
Ah yes yeah that’s what I did - set the nodelinker
d

Dan Van Brunt

09/26/2021, 5:26 PM
Ya, not something we want to do with all our projects (we have a lot) that could be using with SST. That's the plan, to move everything to SST/CDK
t

thdxr

09/26/2021, 7:41 PM
I believe yarn2 works with sst if you change the linker to nodelinker
that said we do need to update our stuff to find packages in a more best practice way so we play nice with yarn2 and pnpm
d

Dan Van Brunt

09/26/2021, 8:40 PM
@thdxr looking at some of the places in the cli, feels like this could be refactored to work.
t

thdxr

09/26/2021, 8:43 PM
I also wonder if we can just use the typescript compiler api here instead of calling the cli
d

Dan Van Brunt

09/26/2021, 8:45 PM
Ya, sounds like that would be more extensible, but I’ve not much experience with that. Sorry, I also just noticed this is already a ticket you created.