Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[iceworks] fixed node environment variable #2488

Merged
merged 1 commit into from
Jul 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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