Closed fayez-nazzal closed 1 year ago
@hammady Will that work for the first step of #20 ?
@fayez-nazzal will definitely give it a try!
@hammady I updated the PR description to add one missing detail. What is the node version are you using?
nodejs18.x I'm not sure if it will work on AWS Lambda because we don't install requirements manually so we have no control over the command to run.
@hammady Can you tell me what commands are run automatically by lambda?
@fayez-nazzal wait, I thought you meant we need to invoke the npm install
by specifying the workspace name. I didn't realize npm will pick it up automatically! I just realized that you were referring to the npm run
commands if we want to invoke scripts in the svelte
directory!
So I refactored the generation to build the workspace from the root directory, please check the commits.
I am still unable to get it to work on aws. Local build still works after these refactorings.
I think the next step is to replace the npm build
command by the JS API building?
So to make it clear, npm install
picked up the nested dependencies but the build command failed with the below:
Generating data into /tmp/dist...
npm verb cli /var/lang/bin/node /var/lang/bin/npm
npm info using npm@9.6.7
npm info using node@v18.17.1
npm verb title npm run build
npm verb argv "run" "build" "--workspace" "svelte" "--cache" "/tmp/cache" "--loglevel" "verbose"
npm verb logfile logs-max:10 dir:/tmp/cache/_logs/2023-10-18T04_58_28_987Z-
npm verb logfile /tmp/cache/_logs/2023-10-18T04_58_28_987Z-debug-0.log
> svelte@0.0.1 build
> vite build
npm http fetch GET 200 https://registry.npmjs.org/npm 337ms (cache miss)
(node:34) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/tmp/generator/node_modules/.bin/vite:2
import { performance } from 'node:perf_hooks'
^^^^^^
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1178:20)
at Module._compile (node:internal/modules/cjs/loader:1220:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Node.js v18.17.1
npm ERR! Lifecycle script `build` failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: svelte@0.0.1
npm ERR! at location: /tmp/generator/svelte
npm notice
npm notice New major version of npm available! 9.6.7 -> 10.2.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.2.0>
npm notice Run `npm install -g npm@10.2.0` to update!
npm notice
npm verb exit 1
npm verb code 1
@hammady Can you tell me what commands are run automatically by lambda?
It is just the npm install
. This passes. Now we are in the build stage and it fails.
@hammady JS build is made in #37, it's based on this PR
Add
svelte
package to the workspace property ofwwpray-generator
package.json file. This way:npm install
inside the rootgenerator
directory will install dependencies for all generator node packages (wwpray-generator
andsvelte
).node_modules
directories. We will have only one inside thegenerator
directory.svelte
project is now possible directly from thegenerator
directory, by running this command:Any other command within the
svelte
project can be run similarly.Made as the first step for #20