2015-12-03 06:45:32 +08:00
|
|
|
fs = require 'fs-plus'
|
|
|
|
path = require 'path'
|
|
|
|
|
|
|
|
module.exports = (grunt) ->
|
|
|
|
{cp, mkdir, rm} = require('./task-helpers')(grunt)
|
2016-04-26 06:27:21 +08:00
|
|
|
rootDir = path.resolve(path.join('../', 'src', 'pro'))
|
2015-12-03 06:45:32 +08:00
|
|
|
|
|
|
|
copyArcFiles = ->
|
|
|
|
cp path.join(rootDir, 'arc-N1', '.arcconfig'), '.arcconfig'
|
|
|
|
cp path.join(rootDir, 'arc-N1', '.arclint'), '.arclint'
|
|
|
|
cp path.join(rootDir, 'arc-N1', 'arclib'), 'arclib'
|
|
|
|
|
|
|
|
copySourceExtensions = ->
|
|
|
|
cp path.join(rootDir, 'src'), 'src'
|
|
|
|
|
2016-04-26 06:27:21 +08:00
|
|
|
linkPlugins = ->
|
|
|
|
for plugin in fs.readdirSync(path.join(rootDir, 'packages'))
|
|
|
|
from = path.join(rootDir, 'packages', plugin)
|
|
|
|
to = path.join(path.resolve('internal_packages'), plugin)
|
|
|
|
|
2016-04-26 07:18:23 +08:00
|
|
|
try
|
|
|
|
if fs.lstatSync(to)
|
|
|
|
grunt.log.writeln "Removing old symlink at #{to}"
|
|
|
|
fs.unlinkSync(to)
|
2016-04-26 06:27:21 +08:00
|
|
|
|
|
|
|
grunt.log.writeln "Adding '#{plugin}' to internal_packages"
|
|
|
|
fs.symlinkSync(from, to, 'dir')
|
|
|
|
|
2015-12-03 06:45:32 +08:00
|
|
|
desc = 'Adds in proprietary Nylas packages, fonts, and sounds to N1'
|
|
|
|
grunt.registerTask 'add-nylas-build-resources', desc, ->
|
|
|
|
canaryFileExists = fs.existsSync(path.join(rootDir, "README.md"))
|
|
|
|
if not canaryFileExists
|
|
|
|
grunt.log.writeln "No extra Nylas resources added"
|
|
|
|
return
|
|
|
|
else
|
|
|
|
grunt.log.writeln "Found proprietary Nylas plugins"
|
|
|
|
copyArcFiles()
|
|
|
|
copySourceExtensions()
|
2016-04-26 06:27:21 +08:00
|
|
|
linkPlugins()
|