Rename package.json.orig to package.json

- This allows 3rd party tools like Dependabot to inspect our dependencies
This commit is contained in:
Pedro Pombeiro 2019-09-12 14:38:16 +02:00
parent cc79cf3b3a
commit 8209bf260c
No known key found for this signature in database
GPG Key ID: C4A24185B2AA48A1
8 changed files with 16 additions and 14 deletions

View File

@ -1,5 +1,5 @@
{
"name": "StatusIm",
"name": "StatusIm-Desktop",
"version": "0.0.1",
"private": true,
"scripts": {

View File

@ -1,5 +1,5 @@
{
"name": "StatusIm",
"name": "StatusIm-Mobile",
"version": "0.0.1",
"private": true,
"scripts": {

View File

@ -14,7 +14,7 @@ let
react-native-deps = callPackage ./maven/reactnative-android-native-deps.nix { inherit stdenvNoCC; };
createMobileFilesSymlinks = root: ''
ln -sf ${root}/mobile_files/package.json.orig ${root}/package.json
ln -sf ${root}/mobile_files/package.json ${root}/package.json
ln -sf ${root}/mobile_files/metro.config.js ${root}/metro.config.js
ln -sf ${root}/mobile_files/yarn.lock ${root}/yarn.lock
'';

View File

@ -20,7 +20,7 @@ let
optional platform.targetAndroid androidPlatform ++
optional platform.targetIOS iosPlatform;
projectNodePackage = callPackage ./node-package.nix { inherit pkgs nodejs yarn; };
projectNodePackage = callPackage ./node-package.nix { inherit pkgs nodejs yarn; inherit (stdenv.lib) importJSON; };
# TARGETS
jsbundle = pkgs.callPackage ../targets/jsbundle.nix { inherit stdenv pkgs target-os nodejs localMavenRepoBuilder mkFilter projectNodePackage; };

View File

@ -7,7 +7,7 @@ let
createMobileFilesSymlinks = root: ''
# Set up symlinks to mobile enviroment in project root
ln -sf ${root}/mobile_files/package.json.orig ${root}/package.json
ln -sf ${root}/mobile_files/package.json ${root}/package.json
ln -sf ${root}/mobile_files/metro.config.js ${root}/metro.config.js
ln -sf ${root}/mobile_files/yarn.lock ${root}/yarn.lock
'';

View File

@ -1,4 +1,4 @@
{ fetchFromGitHub, pkgs, nodejs, yarn }:
{ importJSON, fetchFromGitHub, pkgs, nodejs, yarn }:
let
yarn2nix = import (fetchFromGitHub {
@ -8,15 +8,17 @@ let
rev = "3cc020e384ce2a439813adb7a0cc772a034d90bb";
sha256 = "0h2kzdfiw43rbiiffpqq9lkhvdv8mgzz2w29pzrxgv8d39x67vr9";
}) { inherit pkgs nodejs yarn; };
yarnLock = ../../mobile_files/yarn.lock;
packageJSON = ../../mobile_files/package.json;
packageJSONContent = importJSON packageJSON;
# Create a yarn package for our project that contains all the dependecies, so that we have a
# known good node_modules folder that we can use later on
projectNodePackage = yarn2nix.mkYarnModules rec {
name = "${pname}-${version}";
pname = "StatusIm";
version = "0.0.1";
packageJSON = ../../mobile_files/package.json.orig;
yarnLock = ../../mobile_files/yarn.lock;
pname = packageJSONContent.name;
version = packageJSONContent.version;
inherit packageJSON yarnLock;
# Replace symlink to deps with copy of real dependencies
postBuild = ''
# Fixup symlinks in folder we'll be moving.

View File

@ -114,7 +114,7 @@ function buildJSBundle() {
function compile() {
# Temporarily add path to javascript bundle to package.json
local jsBundleLine="\"desktopJSBundlePath\": \"$JS_BUNDLE_PATH\""
local jsPackagePath=$(joinExistingPath "$STATUS_REACT_HOME" 'desktop_files/package.json.orig')
local jsPackagePath=$(joinExistingPath "$STATUS_REACT_HOME" 'desktop_files/package.json')
local tmp=$(mktemp)
jq ".=(. + {$jsBundleLine})" "$jsPackagePath" > "$tmp" && mv "$tmp" "$jsPackagePath"
echo -e "${YELLOW}Added 'desktopJSBundlePath' line to $jsPackagePath:${NC}"

View File

@ -18,11 +18,11 @@ PLATFORM_FOLDER="desktop_files"
$GIT_ROOT/scripts/run-environment-check.sh desktop
if [ ! -f package.json ] || [ $(readlink package.json) != "${PLATFORM_FOLDER}/package.json.orig" ]; then
if [ ! -f package.json ] || [ $(readlink package.json) != "${PLATFORM_FOLDER}/package.json" ]; then
rm -rf node_modules
echo "Creating link: package.json -> ${PLATFORM_FOLDER}/package.json.orig"
ln -sf ${PLATFORM_FOLDER}/package.json.orig package.json
echo "Creating link: package.json -> ${PLATFORM_FOLDER}/package.json"
ln -sf ${PLATFORM_FOLDER}/package.json package.json
echo "Creating link: yarn.lock -> ${PLATFORM_FOLDER}/yarn.lock"
ln -sf ${PLATFORM_FOLDER}/yarn.lock yarn.lock