Open GNUGradyn opened 1 month ago
Create a prepack script that does something notable (in the example above I used
mkdir itworked
)
yarn pack
does not pack empty directories into the .tgz
; this is consistent with npm pack
.
If you create a file in the prepack
script, that will be packed
"scripts": {
- "prepack": "mkdir itworked"
+ "prepack": "mkdir itworked && echo 'it worked' > itworked/itworked.txt"
}
> yarn pack --dry-run
➤ YN0036: Calling the "prepack" lifecycle script
➤ YN0000: README.md
➤ YN0000: itworked/itworked.txt
➤ YN0000: package.json
➤ YN0000: Done in 0s 59ms
I attempted to use this feature to generate the build output for a react native library in this repo, but no build output was produced and no errors were given
After installing that repo, I can see the lib
directory in that package which seems like is generated by the prepack
script?
> yarn init && yarn config set enableGlobalCache false
...
> yarn add react-native-google-auth@GNUGradyn/react-native-google-auth#commit=b001ca9adefb6e0d622dd2aaebb45f5fe1f85004
...
> unzip -l ./.yarn/cache/react-native-google-auth-https-bcf199d424-36239c4682.zip node_modules/react-native-google-auth/lib/**
Archive: ./.yarn/cache/react-native-google-auth-https-bcf199d424-36239c4682.zip
Length Date Time Name
--------- ---------- ----- ----
0 06-22-1984 21:50 node_modules/react-native-google-auth/lib/commonjs/
61 06-22-1984 21:50 node_modules/react-native-google-auth/lib/commonjs/AuthorizationResult.js
119 06-22-1984 21:50 node_modules/react-native-google-auth/lib/commonjs/AuthorizationResult.js.map
50 06-22-1984 21:50 node_modules/react-native-google-auth/lib/commonjs/UserInfo.js
108 06-22-1984 21:50 node_modules/react-native-google-auth/lib/commonjs/UserInfo.js.map
1354 06-22-1984 21:50 node_modules/react-native-google-auth/lib/commonjs/index.js
1412 06-22-1984 21:50 node_modules/react-native-google-auth/lib/commonjs/index.js.map
0 06-22-1984 21:50 node_modules/react-native-google-auth/lib/module/
48 06-22-1984 21:50 node_modules/react-native-google-auth/lib/module/AuthorizationResult.js
119 06-22-1984 21:50 node_modules/react-native-google-auth/lib/module/AuthorizationResult.js.map
37 06-22-1984 21:50 node_modules/react-native-google-auth/lib/module/UserInfo.js
108 06-22-1984 21:50 node_modules/react-native-google-auth/lib/module/UserInfo.js.map
1100 06-22-1984 21:50 node_modules/react-native-google-auth/lib/module/index.js
1318 06-22-1984 21:50 node_modules/react-native-google-auth/lib/module/index.js.map
0 06-22-1984 21:50 node_modules/react-native-google-auth/lib/typescript/
0 06-22-1984 21:50 node_modules/react-native-google-auth/lib/typescript/src/
183 06-22-1984 21:50 node_modules/react-native-google-auth/lib/typescript/src/AuthorizationResult.d.ts
260 06-22-1984 21:50 node_modules/react-native-google-auth/lib/typescript/src/AuthorizationResult.d.ts.map
152 06-22-1984 21:50 node_modules/react-native-google-auth/lib/typescript/src/UserInfo.d.ts
244 06-22-1984 21:50 node_modules/react-native-google-auth/lib/typescript/src/UserInfo.d.ts.map
358 06-22-1984 21:50 node_modules/react-native-google-auth/lib/typescript/src/index.d.ts
354 06-22-1984 21:50 node_modules/react-native-google-auth/lib/typescript/src/index.d.ts.map
--------- -------
7385 22 files
Self-service
Describe the bug
According to the lifecycle scripts section of the docs, the prepack script should be executed at the beginning of
yarn pack
, which should be executed when installing from git. I attempted to use this feature to generate the build output for a react native library in this repo, but no build output was produced and no errors were givenTo reproduce
Here is an example repo, but this is pretty easy to repro without it as well as described below:
1: Create a new yarn package with
yarn init
2: Create a prepack script that does something notable (in the example above I usedmkdir itworked
) and add it to thepackage.json
3: Test that this actually does what its supposed to withyarn prepack
4: Publish the package to GitHub (or another git provider) 5: Install the package to another yarn repo, e.g.yarn add yarn-mre@GNUGradyn/yarn-mre
6: Note that the result of prepack is not executedEnvironment
Additional context
No response