Comments (8)
Ah glad you found it! I will add a check on the stdout result to see if it is a filepath, and if not log it and throw an error
from isolate-package.
@capybarahero That looks to me like it might be a JSON parsing error. Could you share your config file? As the error suggests, property names in JSON have to use double quotes.
from isolate-package.
Hi @0x80, here is how my folder structure look like:
monorepo
|_pnpm-workspace.yaml
|_firebase-project
|___functions/
|___package.json (includes "isolate-package": "^1.0.1" and "shared-library": "workspace:*")
|___other files and folders/
|___firebase.json
|___other files and folders/
|_packages
|___shared-library/
|_other apps/files
As I have the firebase.json
file with the "functions" source code, I haven't created any isolate.config.json
myself. I will experiment creating it and see if it works.
ps.: Thanks for taking a look at this.
from isolate-package.
Hi @0x80, quick update here:
I'm afraid the issue I was experiencing comes from here:
const configDefaults: IsolateConfigResolved = {
buildDirName: undefined,
includeDevDependencies: false,
isolateDirName: "isolate",
logLevel: "info",
targetPackagePath: undefined,
tsconfigPath: "./tsconfig.json",
workspacePackages: undefined,
workspaceRoot: "../..",
};
The issue seems to be solved when I created a isolate.config.ts
as below:
{
"buildDirName": "lib",
"includeDevDependencies": false,
"isolateDirName": "isolate",
"logLevel": "debug",
"tsconfigPath": "./tsconfig.json",
"workspaceRoot": "../.."
}
and ran npx isolate
from the 'functions' folder.
Quick note: Afterwards, I came across two different issues:
-
Error: Command failed: pnpm pack --pack-destination <path>
. This was solved by adding"version": “1.0.0”
to my firebase/functions package.json. -
Error: ENOENT: no such file or directory
after line 38 from "/pack.ts" (while running /pack-dependencies.ts) as below. I will investigate this at some point today.
debug Using pnpm to pack dependencies
debug Packed shared-library-1.0.0.tgz
debug Unpacked shared-library-1.0.0.tgz
debug Moved package files to isolate ./packages/shared-library
debug Packed functions-1.0.0.tgz
Error: ENOENT: no such file or directory
from isolate-package.
@capybarahero Thanks for reporting. I haven't been able to reproduce the issue. I suspect the JSON parse error might come from your tsconfig file. If isolate.config.json
is not found, the process will look for tsconfig.json
to figure out what your build output directory is.
Could you share the contents of your tsconfig file?
The other options you are setting are the same as the defaults, so you could leave them out. This should be enough for your setup:
{
"buildDirName": "lib",
"logLevel": "debug"
}
I added to the readme that a version string is required in order for pnpm pack
to work. It makes sense since it uses the version string as part of the filename. I woudn't be surprised if npm pack
had a similar requirement.
The Error: ENOENT: no such file or directory
is likely because the system can not find the packed file somehow. I have changed the debug logging to print absolute paths for the pack/unpack parts, so we can see where it is trying to read from.
The changes are published as 1.0.2 so please give that a try.
If an error occurs, the __tmp directory is not cleaned up, so you could inspect it.
from isolate-package.
In 1.0.3 I have added clear errors for any failure of reading json or yaml files.
from isolate-package.
Hi
@0x80, I managed it identify the source of the issue above and it comes from here:
exec(`pnpm pack --pack-destination ${destDir}`, (err, stdout2) => { ... }
As I am using a different version of Node from my package.json, I receive the "warning" below before the path is printed, something like this:
"WARN Unsupported engine: wanted: {"node":"18"} (current: {"node":"v19.2.0"}) /Users/<path>"
Hence, I had to add a regex to remove it before this: const packedFilePath = stdout.trim();
Thanks again!
from isolate-package.
Amazing! Just a quick note: The package is working well now. Thanks for creating it! ❤️
from isolate-package.
Related Issues (20)
- Deploy multiple functions codebases from root HOT 5
- Isolation processed triggered twice
- Strip forceNpm option for sake of simplicity
- Reintroduce excludeLockfile
- Add support for pnpm v9 HOT 4
- trouble shooting some problems HOT 3
- Consistently use pnpm pack if suitable
- Adopt packageManager field from root manifest
- Add flag to omit packageManager field
- Define config using a typed function
- Option to prevent move of node_modules for NPM HOT 3
- Will fail if pnpm-workspace.yaml is empty HOT 2
- Handle non-monorepo setups
- Isolated pnpm lockfile is missing overrides HOT 4
- Having some problems isolating a package HOT 5
- Improve support for Windows
- Isolate fails due to missing pnpm HOT 5
- Isolate fails due to missing pnpm on Windows
- Detect for all packages if they have a files field in manifest
- PNPM prune fails to read 'specifiers' HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from isolate-package.