Skip to content

Commit

Permalink
fix: fixed node environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
思忠 committed Jul 18, 2019
1 parent 3c86860 commit f944317
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/iceworks-server/src/lib/plugin/project-manager/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Project implements IProject {
env[PATH],
];

// for electron
// for electron
const resourcesPath = process['resourcesPath']; // eslint-disable-line
if (resourcesPath) {
pathEnv.push(path.join(resourcesPath, 'bin'));
Expand All @@ -92,6 +92,12 @@ class Project implements IProject {

env[PATH] = pathEnv.join(path.delimiter);

// reset NODE_ENV
// in egg.js: Generally, before deploying the application, dependencies will be installed with NODE_ENV=production or --production
// which will exclude devDependencies because those used in development may increase the size of package released or even create pitfalls that you never expect.
// Refs: https://github.com/eggjs/egg-scripts/blob/master/lib/cmd/start.js#L109
env.NODE_ENV = 'development'

return env;
}

Expand Down Expand Up @@ -313,7 +319,7 @@ class ProjectManager extends EventEmitter {

// check read and write
try {
await accessAsync(targetPath, fs.constants.R_OK | fs.constants.W_OK); // eslint-disable-line
await accessAsync(targetPath, fs.constants.R_OK | fs.constants.W_OK); // eslint-disable-line
} catch (error) {
error.message = '当前路径没有读写权限,请更换项目路径';
throw error;
Expand Down Expand Up @@ -343,7 +349,7 @@ class ProjectManager extends EventEmitter {
private async generateAbcFile(projectDir: string, iceScriptsVersion: string) {
// '^2.0.0' -> true
const latestVersion = /^\^2\./.test(iceScriptsVersion);

const abcData = {
type: latestVersion ? 'ice-scripts' : 'iceworks',
builder: latestVersion ? '@ali/builder-ice-scripts' : '@ali/builder-iceworks',
Expand Down

0 comments on commit f944317

Please # to comment.