mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-17 14:07:34 +03:00
Merge pull request #128 from Sertonix/remove-unused-snippets-deprecated-api
Removed unused code fragments from the old build scripts
This commit is contained in:
commit
c4e07fbf10
10
.gitattributes
vendored
10
.gitattributes
vendored
@ -15,13 +15,3 @@ spec/fixtures/sample.txt text eol=lf
|
||||
|
||||
# Windows bash scripts are also Unix LF endings
|
||||
*.sh eol=lf
|
||||
|
||||
# The script executables should be LF so they can be edited on Windows
|
||||
script/bootstrap text eol=lf
|
||||
script/build text eol=lf
|
||||
script/cibuild text eol=lf
|
||||
script/clean text eol=lf
|
||||
script/lint text eol=lf
|
||||
script/postprocess-junit-results text eol=lf
|
||||
script/test text eol=lf
|
||||
script/verify-snapshot-script text eol=lf
|
||||
|
@ -274,7 +274,6 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"preinstall": "node -e 'process.exit(0)'",
|
||||
"test": "node script/test",
|
||||
"build": "electron-rebuild",
|
||||
"build:apm": "cd ppm && yarn install",
|
||||
"start": "electron --enable-logging . -f",
|
||||
@ -289,8 +288,7 @@
|
||||
"node": true
|
||||
},
|
||||
"globals": [
|
||||
"atom",
|
||||
"snapshotResult"
|
||||
"atom"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
|
143
script/config.js
143
script/config.js
@ -1,143 +0,0 @@
|
||||
// This module exports paths, names, and other metadata that is referenced
|
||||
// throughout the build.
|
||||
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const spawnSync = require('./lib/spawn-sync');
|
||||
|
||||
const repositoryRootPath = path.resolve(__dirname, '..');
|
||||
const apmRootPath = path.join(repositoryRootPath, 'ppm');
|
||||
const scriptRootPath = path.join(repositoryRootPath, 'script');
|
||||
const scriptRunnerRootPath = path.join(scriptRootPath, 'script-runner');
|
||||
const scriptRunnerModulesPath = path.join(scriptRunnerRootPath, 'node_modules');
|
||||
const buildOutputPath = path.join(repositoryRootPath, 'out');
|
||||
const docsOutputPath = path.join(repositoryRootPath, 'docs', 'output');
|
||||
const intermediateAppPath = path.join(buildOutputPath, 'app');
|
||||
const symbolsPath = path.join(buildOutputPath, 'symbols');
|
||||
const electronDownloadPath = path.join(repositoryRootPath, 'electron');
|
||||
const homeDirPath = process.env.HOME || process.env.USERPROFILE;
|
||||
const atomHomeDirPath =
|
||||
process.env.ATOM_HOME || path.join(homeDirPath, '.pulsar');
|
||||
|
||||
const appMetadata = require(path.join(repositoryRootPath, 'package.json'));
|
||||
const apmMetadata = require(path.join(apmRootPath, 'package.json'));
|
||||
const computedAppVersion = computeAppVersion(
|
||||
process.env.ATOM_RELEASE_VERSION || appMetadata.version
|
||||
);
|
||||
const channel = getChannel(computedAppVersion);
|
||||
const appName = getAppName(channel);
|
||||
const executableName = getExecutableName(channel, appName);
|
||||
const channelName = getChannelName(channel);
|
||||
|
||||
// Sets the installation jobs to run maximally in parallel if the user has
|
||||
// not already configured this. This is applied just by requiring this file.
|
||||
if (process.env.npm_config_jobs === undefined) {
|
||||
process.env.npm_config_jobs = 'max';
|
||||
}
|
||||
|
||||
const REPO_OWNER = process.env.REPO_OWNER || 'pulsar-edit';
|
||||
const MAIN_REPO = process.env.MAIN_REPO || 'pulsar';
|
||||
const NIGHTLY_RELEASE_REPO =
|
||||
process.env.NIGHTLY_RELEASE_REPO || 'pulsar-nightly-releases';
|
||||
|
||||
module.exports = {
|
||||
appMetadata,
|
||||
apmMetadata,
|
||||
channel,
|
||||
channelName,
|
||||
appName,
|
||||
executableName,
|
||||
computedAppVersion,
|
||||
repositoryRootPath,
|
||||
apmRootPath,
|
||||
scriptRootPath,
|
||||
scriptRunnerRootPath,
|
||||
scriptRunnerModulesPath,
|
||||
buildOutputPath,
|
||||
docsOutputPath,
|
||||
intermediateAppPath,
|
||||
symbolsPath,
|
||||
electronDownloadPath,
|
||||
atomHomeDirPath,
|
||||
homeDirPath,
|
||||
getApmBinPath,
|
||||
getNpmBinPath,
|
||||
getLocalNpmBinPath,
|
||||
snapshotAuxiliaryData: {},
|
||||
REPO_OWNER,
|
||||
MAIN_REPO,
|
||||
NIGHTLY_RELEASE_REPO
|
||||
};
|
||||
|
||||
function getChannelName(channel) {
|
||||
return channel === 'stable' ? 'pulsar' : `pulsar-${channel}`;
|
||||
}
|
||||
|
||||
function getChannel(version) {
|
||||
const match = version.match(/\d+\.\d+\.\d+(-([a-z]+)(\d+|-\w{4,})?)?$/);
|
||||
if (!match) {
|
||||
throw new Error(`Found incorrectly formatted Pulsar version ${version}`);
|
||||
} else if (match[2]) {
|
||||
return match[2];
|
||||
}
|
||||
|
||||
return 'stable';
|
||||
}
|
||||
|
||||
function getAppName(channel) {
|
||||
return channel === 'stable'
|
||||
? 'Pulsar'
|
||||
: `Pulsar ${process.env.ATOM_CHANNEL_DISPLAY_NAME ||
|
||||
channel.charAt(0).toUpperCase() + channel.slice(1)}`;
|
||||
}
|
||||
|
||||
function getExecutableName(channel, appName) {
|
||||
if (process.platform === 'darwin') {
|
||||
return appName;
|
||||
} else if (process.platform === 'win32') {
|
||||
return channel === 'stable' ? 'pulsar.exe' : `pulsar-${channel}.exe`;
|
||||
} else {
|
||||
return 'pulsar';
|
||||
}
|
||||
}
|
||||
|
||||
function computeAppVersion(version) {
|
||||
if (version.match(/-dev$/)) {
|
||||
const result = spawnSync('git', ['rev-parse', '--short', 'HEAD'], {
|
||||
cwd: repositoryRootPath
|
||||
});
|
||||
const commitHash = result.stdout.toString().trim();
|
||||
version += '-' + commitHash;
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
function getApmBinPath() {
|
||||
const apmBinName = process.platform === 'win32' ? 'apm.cmd' : 'apm';
|
||||
return path.join(
|
||||
apmRootPath,
|
||||
'node_modules',
|
||||
'pulsar-package-manager',
|
||||
'bin',
|
||||
apmBinName
|
||||
);
|
||||
}
|
||||
|
||||
function getNpmBinPath() {
|
||||
return process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||
}
|
||||
|
||||
function getLocalNpmBinPath() {
|
||||
// NOTE this assumes that npm is installed as a script-runner dependency
|
||||
const npmBinName = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||
const localNpmBinPath = path.resolve(
|
||||
repositoryRootPath,
|
||||
'script',
|
||||
'script-runner',
|
||||
'node_modules',
|
||||
'.bin',
|
||||
npmBinName
|
||||
);
|
||||
return localNpmBinPath;
|
||||
}
|
@ -9,61 +9,6 @@ require('./native-compile-cache');
|
||||
require('./compile-cache');
|
||||
require('./module-cache');
|
||||
|
||||
if (global.isGeneratingSnapshot) {
|
||||
require('about');
|
||||
require('archive-view');
|
||||
require('autocomplete-atom-api');
|
||||
require('autocomplete-css');
|
||||
require('autocomplete-html');
|
||||
require('autocomplete-plus');
|
||||
require('autocomplete-snippets');
|
||||
require('autoflow');
|
||||
require('autosave');
|
||||
require('background-tips');
|
||||
require('bookmarks');
|
||||
require('bracket-matcher');
|
||||
require('command-palette');
|
||||
require('deprecation-cop');
|
||||
require('dev-live-reload');
|
||||
require('encoding-selector');
|
||||
require('exception-reporting');
|
||||
require('dalek');
|
||||
require('find-and-replace');
|
||||
require('fuzzy-finder');
|
||||
require('github');
|
||||
require('git-diff');
|
||||
require('go-to-line');
|
||||
require('grammar-selector');
|
||||
require('image-view');
|
||||
require('incompatible-packages');
|
||||
require('keybinding-resolver');
|
||||
require('language-c');
|
||||
require('language-html');
|
||||
require('language-javascript');
|
||||
require('language-ruby');
|
||||
require('language-rust-bundled');
|
||||
require('language-typescript');
|
||||
require('line-ending-selector');
|
||||
require('link');
|
||||
require('markdown-preview');
|
||||
require('notifications');
|
||||
require('open-on-github');
|
||||
require('package-generator');
|
||||
require('settings-view');
|
||||
require('snippets');
|
||||
require('spell-check');
|
||||
require('status-bar');
|
||||
require('styleguide');
|
||||
require('symbols-view');
|
||||
require('tabs');
|
||||
require('timecop');
|
||||
require('tree-view');
|
||||
require('update-package-dependencies');
|
||||
require('welcome');
|
||||
require('whitespace');
|
||||
require('wrap-guide');
|
||||
}
|
||||
|
||||
const clipboard = new Clipboard();
|
||||
TextEditor.setClipboard(clipboard);
|
||||
TextEditor.viewForItem = item => atom.views.getView(item);
|
||||
|
@ -1,7 +1,3 @@
|
||||
if (typeof snapshotResult !== 'undefined') {
|
||||
snapshotResult.setGlobals(global, process, global, {}, console, require);
|
||||
}
|
||||
|
||||
const startTime = Date.now();
|
||||
const StartupTime = require('../startup-time');
|
||||
StartupTime.setStartTime();
|
||||
|
@ -333,13 +333,10 @@ module.exports = class PaneContainer {
|
||||
this.emitter.emit('did-change-active-pane-item', activeItem);
|
||||
|
||||
this.cancelStoppedChangingActivePaneItemTimeout();
|
||||
// `setTimeout()` isn't available during the snapshotting phase, but that's okay.
|
||||
if (!global.isGeneratingSnapshot) {
|
||||
this.stoppedChangingActivePaneItemTimeout = setTimeout(() => {
|
||||
this.stoppedChangingActivePaneItemTimeout = null;
|
||||
this.emitter.emit('did-stop-changing-active-pane-item', activeItem);
|
||||
}, STOPPED_CHANGING_ACTIVE_PANE_ITEM_DELAY);
|
||||
}
|
||||
this.stoppedChangingActivePaneItemTimeout = setTimeout(() => {
|
||||
this.stoppedChangingActivePaneItemTimeout = null;
|
||||
this.emitter.emit('did-stop-changing-active-pane-item', activeItem);
|
||||
}, STOPPED_CHANGING_ACTIVE_PANE_ITEM_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
const StartupTime = require('../src/startup-time');
|
||||
const entryPointDirPath = __dirname;
|
||||
let blobStore = null;
|
||||
let useSnapshot = false;
|
||||
|
||||
const startupMarkers = electron.remote.getCurrentWindow().startupMarkers;
|
||||
|
||||
@ -42,47 +41,13 @@
|
||||
!getWindowLoadSettings().resourcePath.startsWith(
|
||||
process.resourcesPath + path.sep
|
||||
);
|
||||
useSnapshot = !devMode && typeof snapshotResult !== 'undefined';
|
||||
|
||||
if (useSnapshot) {
|
||||
Module.prototype.require = function(module) {
|
||||
const absoluteFilePath = Module._resolveFilename(module, this, false);
|
||||
let relativeFilePath = path.relative(
|
||||
entryPointDirPath,
|
||||
absoluteFilePath
|
||||
);
|
||||
if (process.platform === 'win32') {
|
||||
relativeFilePath = relativeFilePath.replace(/\\/g, '/');
|
||||
}
|
||||
let cachedModule =
|
||||
snapshotResult.customRequire.cache[relativeFilePath];
|
||||
if (!cachedModule) {
|
||||
cachedModule = { exports: Module._load(module, this, false) };
|
||||
snapshotResult.customRequire.cache[relativeFilePath] = cachedModule;
|
||||
}
|
||||
return cachedModule.exports;
|
||||
};
|
||||
|
||||
snapshotResult.setGlobals(
|
||||
global,
|
||||
process,
|
||||
window,
|
||||
document,
|
||||
console,
|
||||
require
|
||||
);
|
||||
}
|
||||
|
||||
const FileSystemBlobStore = useSnapshot
|
||||
? snapshotResult.customRequire('../src/file-system-blob-store.js')
|
||||
: require('../src/file-system-blob-store');
|
||||
const FileSystemBlobStore = require('../src/file-system-blob-store');
|
||||
blobStore = FileSystemBlobStore.load(
|
||||
path.join(process.env.ATOM_HOME, 'blob-store')
|
||||
);
|
||||
|
||||
const NativeCompileCache = useSnapshot
|
||||
? snapshotResult.customRequire('../src/native-compile-cache.js')
|
||||
: require('../src/native-compile-cache');
|
||||
const NativeCompileCache = require('../src/native-compile-cache');
|
||||
NativeCompileCache.setCacheStore(blobStore);
|
||||
NativeCompileCache.setV8Version(process.versions.v8);
|
||||
NativeCompileCache.install();
|
||||
@ -118,26 +83,16 @@
|
||||
}
|
||||
|
||||
function setupWindow() {
|
||||
const CompileCache = useSnapshot
|
||||
? snapshotResult.customRequire('../src/compile-cache.js')
|
||||
: require('../src/compile-cache');
|
||||
const CompileCache = require('../src/compile-cache');
|
||||
CompileCache.setAtomHomeDirectory(process.env.ATOM_HOME);
|
||||
CompileCache.install(process.resourcesPath, require);
|
||||
|
||||
const ModuleCache = useSnapshot
|
||||
? snapshotResult.customRequire('../src/module-cache.js')
|
||||
: require('../src/module-cache');
|
||||
const ModuleCache = require('../src/module-cache');
|
||||
ModuleCache.register(getWindowLoadSettings());
|
||||
|
||||
useSnapshot
|
||||
? snapshotResult.customRequire(
|
||||
'../node_modules/document-register-element/build/document-register-element.node.js'
|
||||
)
|
||||
: require('document-register-element');
|
||||
require('document-register-element');
|
||||
|
||||
const Grim = useSnapshot
|
||||
? snapshotResult.customRequire('../node_modules/grim/lib/grim.js')
|
||||
: require('grim');
|
||||
const Grim = require('grim');
|
||||
const documentRegisterElement = document.registerElement;
|
||||
|
||||
document.registerElement = (type, options) => {
|
||||
@ -150,18 +105,14 @@
|
||||
|
||||
const { userSettings, appVersion } = getWindowLoadSettings();
|
||||
|
||||
const CSON = useSnapshot
|
||||
? snapshotResult.customRequire('../node_modules/season/lib/cson.js')
|
||||
: require('season');
|
||||
const CSON = require('season');
|
||||
CSON.setCacheDir(path.join(CompileCache.getCacheDirectory(), 'cson'));
|
||||
|
||||
const initScriptPath = path.relative(
|
||||
entryPointDirPath,
|
||||
getWindowLoadSettings().windowInitializationScript
|
||||
);
|
||||
const initialize = useSnapshot
|
||||
? snapshotResult.customRequire(initScriptPath)
|
||||
: require(initScriptPath);
|
||||
const initialize = require(initScriptPath);
|
||||
|
||||
StartupTime.addMarker('window:initialize:start');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user