Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

refactor: get app directory from CLI #459

Merged
merged 10 commits into from
Mar 21, 2018
Merged

refactor: get app directory from CLI #459

merged 10 commits into from
Mar 21, 2018

Conversation

sis0k0
Copy link
Contributor

@sis0k0 sis0k0 commented Mar 12, 2018

  • Pass sourceDir and appResourcesDir when starting webpack from the projectData service.
  • Read sourceDir and appResourcesDir in webpack configs from env object.
  • Bootstrap CLI on postinstall to get the appPath value from the project data. Defaults to app.
  • Pass appPath from webpack config to getEntryModule.

resolves #436

index.js Outdated
throw new Error("app/package.json must contain a `main` attribute.");
exports.getAotEntryModule = function (appDirectory = APP_DIR) {
const entry = getPackageJsonEntry(appDirectory);
const aotEntry = `${entry}.aot.ts`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the entry point need to be .ts 💭

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, the Angular compiler needs a ts file.

lib/compiler.js Outdated
}

function getProjectDir($projectData) {
const projectDir = safeGet($projectData, "projectDir");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this is necessary - CLI's $projectData always has projectDir property - if it doesn't the initial creation of the $projectData class would have failed long before we get here

@@ -3,6 +3,10 @@ const fs = require("fs");
const semver = require("semver");
const { EOL } = require("os");

const { getProjectData, PROJECT_DATA_GETTERS } = require("./nsCliHelpers");

const APP_DIR = "app";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can reuse this constant here

@SvetoslavTsenov
Copy link
Contributor

👍

Copy link
Contributor

@Mitko-Kerezov Mitko-Kerezov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks okay to me, but instead of setting INIT_CWD you can try using the latest version of nativescript-hook (0.2.3). This can be handled in a separate PR, as discussed offline

@SvetoslavTsenov
Copy link
Contributor

test

1 similar comment
@SvetoslavTsenov
Copy link
Contributor

test

@SvetoslavTsenov
Copy link
Contributor

test

@sis0k0 sis0k0 merged commit 999232e into master Mar 21, 2018
@sis0k0 sis0k0 deleted the sis0k0/app-path-env branch March 21, 2018 14:36
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get app directory location from CLI
3 participants