From 3f607fcf7c578b3197f067a7a817e81031bdbf92 Mon Sep 17 00:00:00 2001 From: Landon Abney Date: Wed, 3 Jan 2018 11:45:35 -0800 Subject: [PATCH 1/7] perf: decaffeinate the provider and defer dependencies Move from CoffeeScript to JavaScript so the code is actually readable, and allowing things like `async`/`await`. Also moves the configuration to a `configSchema` in the `package.json` file. Dependencies are deferred till they are actually needed, with an opportunistic load during an "idle" time. --- lib/init.coffee | 122 ---------------------- lib/init.js | 180 ++++++++++++++++++++++++++++++++ package.json | 48 +++++++-- spec/.eslintrc.js | 14 +++ spec/linter-stylint-spec.coffee | 2 +- 5 files changed, 237 insertions(+), 129 deletions(-) delete mode 100644 lib/init.coffee create mode 100644 lib/init.js create mode 100644 spec/.eslintrc.js diff --git a/lib/init.coffee b/lib/init.coffee deleted file mode 100644 index 166e3c7..0000000 --- a/lib/init.coffee +++ /dev/null @@ -1,122 +0,0 @@ -{CompositeDisposable} = require('atom') -bundledPugLint = require('pug-lint') -path = require('path') -objectAssign = require('object-assign') -configFile = require('pug-lint/lib/config-file') -reqResolve = require('resolve') - -pugLints = new Map() - -resolvePath = (name, baseDir) -> - return new Promise (resolve, reject) -> - reqResolve name, { basedir: baseDir }, (err, res) -> - reject(err) if err? - resolve(res) - -getPugLint = (baseDir) -> - if pugLints.has(baseDir) - return Promise.resolve pugLints.get(baseDir) - - resolvePath('pug-lint', baseDir) - .then (pugLintPath) -> - pugLints.set(baseDir, require(pugLintPath)) - return Promise.resolve pugLints.get(baseDir) - .catch () -> - pugLints.set(baseDir, bundledPugLint) - return Promise.resolve pugLints.get(baseDir) - -module.exports = - config: - projectConfigFile: - type: 'string' - default: '' - description: 'Relative path from project to config file' - - onlyRunWhenConfig: - default: false - title: 'Run Pug-lint only if config is found' - description: 'Disable linter if there is no config file found for the linter.', - type: 'boolean' - - activate: -> - require('atom-package-deps').install('linter-pug') - - if atom.config.get('linter-pug.executablePath')? - atom.notifications.addWarning('Removing custom pug-lint path', { - detail: "linter-pug has moved to the Node.js API for pug-lint and " + - "will now use a project's local instance where possible, falling " + - "back to a bundled version of pug-lint where none is found." - }) - atom.config.unset('linter-pug.executablePath') - - @subscriptions = new CompositeDisposable - @subscriptions.add atom.config.observe 'linter-pug.executablePath', - (executablePath) => - @executablePath = executablePath - @subscriptions.add atom.config.observe 'linter-pug.projectConfigFile', - (projectConfigFile) => - @projectConfigFile = projectConfigFile - @subscriptions.add atom.config.observe 'linter-pug.onlyRunWhenConfig', - (onlyRunWhenConfig) => - @onlyRunWhenConfig = onlyRunWhenConfig - - getConfig: (filePath) -> - config = undefined - if path.isAbsolute(@projectConfigFile) - config = configFile.load(false, @projectConfigFile) - else - config = configFile.load(false, path.join(path.dirname(filePath), @projectConfigFile)) - if !config and @onlyRunWhenConfig - return undefined - - options = {} - newConfig = objectAssign(options, config) - - if !newConfig.configPath and config and config.configPath - newConfig.configPath = config.configPath - return newConfig - - provideLinter: -> - helpers = require('atom-linter') - provider = - name: 'pug-lint' - grammarScopes: ['source.jade', 'source.pug'] - scope: 'file' - lintOnFly: true - - lint: (textEditor) => - rules = [] - filePath = textEditor.getPath() - fileText = textEditor.getText() - projectConfig = @getConfig(filePath) - - # Use Atom's project root folder - projectDir = atom.project.relativizePath(filePath)[0] - if !projectDir? - # Fall back to the file directory - projectDir = path.dirname(filePath) - - if !fileText - return Promise.resolve([]) - - if !projectConfig || !projectConfig.configPath - if @onlyRunWhenConfig - atom.notifications.addError 'Pug-lint config not found' - return Promise.resolve([]) - - if(@onlyRunWhenConfig || projectConfig) - rules = projectConfig - - return new Promise (resolve) -> - getPugLint(projectDir).then (pugLint) -> - linter = new pugLint() - linter.configure rules - - results = linter.checkString fileText - - resolve results.map (res) -> { - type: res.name - filePath: filePath - range: helpers.generateRange textEditor, res.line - 1, res.column - 1 - text: res.msg - } diff --git a/lib/init.js b/lib/init.js new file mode 100644 index 0000000..ba9fba8 --- /dev/null +++ b/lib/init.js @@ -0,0 +1,180 @@ +'use babel'; + +// eslint-disable-next-line import/no-extraneous-dependencies, import/extensions +import { CompositeDisposable } from 'atom'; +import path from 'path'; + +// Dependencies +let bundledPugLint; +let objectAssign; +let configFile; +let helpers; +let resolve; + +const pugLints = new Map(); + +const resolvePath = (name, basedir) => + new Promise(((res, reject) => + resolve(name, { basedir }, (err, modulePath) => { + if (err != null) { + reject(err); + } + return res(modulePath); + }) + )); + +const getPugLint = async (baseDir) => { + if (pugLints.has(baseDir)) { + return pugLints.get(baseDir); + } + + try { + const pugLintPath = await resolvePath('pug-lint', baseDir); + // eslint-disable-next-line import/no-dynamic-require + pugLints.set(baseDir, require(pugLintPath)); + } catch (e) { + pugLints.set(baseDir, bundledPugLint); + } + + return pugLints.get(baseDir); +}; + +const loadDeps = () => { + if (!bundledPugLint) { + bundledPugLint = require('pug-lint'); + } + if (!objectAssign) { + objectAssign = require('object-assign'); + } + if (!configFile) { + configFile = require('pug-lint/lib/config-file'); + } + if (!helpers) { + helpers = require('atom-linter'); + } + if (!resolve) { + resolve = require('resolve'); + } +}; + +module.exports = { + activate() { + this.idleCallbacks = new Set(); + let depsCallbackID; + const installLinterJSHintDeps = () => { + this.idleCallbacks.delete(depsCallbackID); + loadDeps(); + }; + depsCallbackID = window.requestIdleCallback(installLinterJSHintDeps); + this.idleCallbacks.add(depsCallbackID); + + if (atom.config.get('linter-pug.executablePath')) { + atom.notifications.addWarning( + 'Removing custom pug-lint path', + { + detail: 'linter-pug has moved to the Node.js API for pug-lint and ' + + "will now use a project's local instance where possible, falling " + + 'back to a bundled version of pug-lint where none is found.', + }, + ); + atom.config.unset('linter-pug.executablePath'); + } + + this.subscriptions = new CompositeDisposable(); + this.subscriptions.add(atom.config.observe( + 'linter-pug.projectConfigFile', + (value) => { this.projectConfigFile = value; }, + )); + this.subscriptions.add(atom.config.observe( + 'linter-pug.onlyRunWhenConfig', + (value) => { this.onlyRunWhenConfig = value; }, + )); + }, + + deactivate() { + this.idleCallbacks.forEach(callbackID => window.cancelIdleCallback(callbackID)); + this.idleCallbacks.clear(); + this.subscriptions.dispose(); + }, + + getConfig(filePath) { + let config; + if (path.isAbsolute(this.projectConfigFile)) { + config = configFile.load(false, this.projectConfigFile); + } else { + config = configFile.load(false, path.join(path.dirname(filePath), this.projectConfigFile)); + } + if (!config && this.onlyRunWhenConfig) { + return undefined; + } + + const options = {}; + const newConfig = objectAssign(options, config); + + if (!newConfig.configPath && config && config.configPath) { + newConfig.configPath = config.configPath; + } + return newConfig; + }, + + provideLinter() { + return { + name: 'pug-lint', + grammarScopes: ['source.jade', 'source.pug'], + scope: 'file', + lintOnFly: true, + + lint: async (textEditor) => { + if (!atom.workspace.isTextEditor(textEditor)) { + // Somehow, called with an invalid TextEditor instance + return null; + } + + const filePath = textEditor.getPath(); + if (!filePath) { + // File somehow has no path + return null; + } + + const fileText = textEditor.getText(); + if (!fileText) { + // Nothing in the file + return null; + } + + // Load the dependencies if they aren't already + loadDeps(); + + const projectConfig = this.getConfig(filePath); + if (!projectConfig || !projectConfig.configPath) { + if (this.onlyRunWhenConfig) { + atom.notifications.addError('Pug-lint config not found'); + return null; + } + } + + let rules = []; + if (this.onlyRunWhenConfig || projectConfig) { + rules = projectConfig; + } + + // Use Atom's project root folder + let projectDir = atom.project.relativizePath(filePath)[0]; + if ((projectDir == null)) { + // Fall back to the file directory + projectDir = path.dirname(filePath); + } + + const linter = new (await getPugLint(projectDir))(); + linter.configure(rules); + const results = linter.checkString(fileText); + return results.map(res => ({ + type: res.name, + filePath, + range: helpers.generateRange(textEditor, res.line - 1, res.column - 1), + text: res.msg, + })); + }, + }; + }, +}; diff --git a/package.json b/package.json index 0720510..9f50524 100644 --- a/package.json +++ b/package.json @@ -9,28 +9,64 @@ }, "license": "MIT", "engines": { - "atom": ">=1.0.0 <2.0.0" + "atom": ">=1.7.0 <2.0.0" }, "readmeFilename": "README.md", "bugs": { "url": "https://github.com/AtomLinter/atom-linter-pug/issues" }, "homepage": "https://github.com/AtomLinter/atom-linter-pug", + "configSchema": { + "projectConfigFile": { + "type": "string", + "default": "", + "description": "Relative path from project to config file" + }, + "onlyRunWhenConfig": { + "default": false, + "title": "Run Pug-lint only if config is found", + "description": "Disable linter if there is no config file found for the linter.", + "type": "boolean" + } + }, "providedServices": { "linter": { "versions": { - "1.0.0": "provideLinter" + "2.0.0": "provideLinter" } } }, "dependencies": { "atom-linter": "^10.0.0", - "atom-package-deps": "^4.0.1", "object-assign": "^4.1.0", "pug-lint": "^2.1.9", "resolve": "^1.5.0" }, - "package-deps": [ - "linter" - ] + "devDependencies": { + "eslint": "^4.14.0", + "eslint-config-airbnb-base": "^12.1.0", + "eslint-plugin-import": "^2.8.0", + "jasmine-fix": "^1.3.1" + }, + "eslintConfig": { + "rules": { + "global-require": "off", + "import/no-unresolved": [ + "error", + { + "ignore": [ + "atom" + ] + } + ] + }, + "extends": "airbnb-base", + "globals": { + "atom": true + }, + "env": { + "node": true, + "browser": true + } + } } diff --git a/spec/.eslintrc.js b/spec/.eslintrc.js new file mode 100644 index 0000000..3dc3525 --- /dev/null +++ b/spec/.eslintrc.js @@ -0,0 +1,14 @@ +module.exports = { + env: { + atomtest: true, + jasmine: true, + }, + rules: { + "import/no-extraneous-dependencies": [ + "error", + { + "devDependencies": true + } + ] + } +}; diff --git a/spec/linter-stylint-spec.coffee b/spec/linter-stylint-spec.coffee index d5344ac..1afaaef 100644 --- a/spec/linter-stylint-spec.coffee +++ b/spec/linter-stylint-spec.coffee @@ -6,7 +6,7 @@ noConfigRule = path.join(__dirname, 'fixtures', 'noConfig', 'badRule.pug') noConfigSyntax = path.join(__dirname, 'fixtures', 'noConfig', 'badSyntax.pug') describe 'The pug-lint provider for Linter', -> - lint = require('../lib/init.coffee').provideLinter().lint + lint = require('../lib/init').provideLinter().lint beforeEach -> atom.workspace.destroyActivePaneItem() From 211bb6513d2bdcfe8503db0de6e719ca12f676ae Mon Sep 17 00:00:00 2001 From: Landon Abney Date: Wed, 3 Jan 2018 11:52:58 -0800 Subject: [PATCH 2/7] style: decaffeinate and asyncify the specs Convert the specs to JavaScript and utilize `async`/`await` to clean them up. --- spec/linter-stylint-spec.coffee | 57 ----------------------------- spec/linter-stylint-spec.js | 65 +++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 57 deletions(-) delete mode 100644 spec/linter-stylint-spec.coffee create mode 100644 spec/linter-stylint-spec.js diff --git a/spec/linter-stylint-spec.coffee b/spec/linter-stylint-spec.coffee deleted file mode 100644 index 1afaaef..0000000 --- a/spec/linter-stylint-spec.coffee +++ /dev/null @@ -1,57 +0,0 @@ -path = require 'path' - -goodPug = path.join(__dirname, 'fixtures', 'config', 'good.pug') -badPug = path.join(__dirname, 'fixtures', 'config', 'bad.pug') -noConfigRule = path.join(__dirname, 'fixtures', 'noConfig', 'badRule.pug') -noConfigSyntax = path.join(__dirname, 'fixtures', 'noConfig', 'badSyntax.pug') - -describe 'The pug-lint provider for Linter', -> - lint = require('../lib/init').provideLinter().lint - - beforeEach -> - atom.workspace.destroyActivePaneItem() - waitsForPromise -> - atom.packages.activatePackage 'linter-pug' - - - it 'should be in the packages list', -> - expect(atom.packages.isPackageLoaded('linter-pug')).toBe true - - it 'should be an active package', -> - expect(atom.packages.isPackageActive('linter-pug')).toBe true - - describe 'works with a configuration', -> - it 'finds nothing wrong with valid file', -> - waitsForPromise -> - atom.workspace.open(goodPug).then (editor) -> - lint(editor).then (messages) -> - expect(messages.length).toBe 0 - - it 'finds something wrong with invalid file', -> - errMsg = 'Attribute interpolation operators must not be used' - waitsForPromise -> - atom.workspace.open(badPug).then (editor) -> - lint(editor).then (messages) -> - expect(messages.length).toEqual 1 - expect(messages[0].html).not.toBeDefined() - expect(messages[0].text).toBe errMsg - expect(messages[0].filePath).toBe badPug - expect(messages[0].range).toEqual [[0, 13], [0, 20]] - - describe 'works without a configuration', -> - it 'finds nothing wrong with a "bad" file', -> - waitsForPromise -> - atom.workspace.open(noConfigRule).then (editor) -> - lint(editor).then (messages) -> - expect(messages.length).toBe 0 - - it 'finds syntax errors without a configuration', -> - errMsg = 'The end of the string reached with no closing bracket ) found.' - waitsForPromise -> - atom.workspace.open(noConfigSyntax).then (editor) -> - lint(editor).then (messages) -> - expect(messages.length).toEqual 1 - expect(messages[0].html).not.toBeDefined() - expect(messages[0].text).toBe errMsg - expect(messages[0].filePath).toBe noConfigSyntax - expect(messages[0].range).toEqual [[1, 0], [1, 0]] diff --git a/spec/linter-stylint-spec.js b/spec/linter-stylint-spec.js new file mode 100644 index 0000000..51e57e0 --- /dev/null +++ b/spec/linter-stylint-spec.js @@ -0,0 +1,65 @@ +'use babel'; + +// eslint-disable-next-line no-unused-vars +import { it, fit, wait, beforeEach, afterEach } from 'jasmine-fix'; +import path from 'path'; + +const { lint } = require('../lib/init').provideLinter(); + +const goodPug = path.join(__dirname, 'fixtures', 'config', 'good.pug'); +const badPug = path.join(__dirname, 'fixtures', 'config', 'bad.pug'); +const noConfigRule = path.join(__dirname, 'fixtures', 'noConfig', 'badRule.pug'); +const noConfigSyntax = path.join(__dirname, 'fixtures', 'noConfig', 'badSyntax.pug'); + +describe('The pug-lint provider for Linter', () => { + beforeEach(async () => { + atom.workspace.destroyActivePaneItem(); + await atom.packages.activatePackage('linter-pug'); + }); + + it('should be in the packages list', () => + expect(atom.packages.isPackageLoaded('linter-pug')).toBe(true)); + + it('should be an active package', () => + expect(atom.packages.isPackageActive('linter-pug')).toBe(true)); + + describe('works with a configuration', () => { + it('finds nothing wrong with valid file', async () => { + const editor = await atom.workspace.open(goodPug); + const messages = await lint(editor); + expect(messages.length).toBe(0); + }); + + it('finds something wrong with invalid file', async () => { + const errMsg = 'Attribute interpolation operators must not be used'; + const editor = await atom.workspace.open(badPug); + const messages = await lint(editor); + + expect(messages.length).toEqual(1); + expect(messages[0].html).not.toBeDefined(); + expect(messages[0].text).toBe(errMsg); + expect(messages[0].filePath).toBe(badPug); + expect(messages[0].range).toEqual([[0, 13], [0, 20]]); + }); + }); + + describe('works without a configuration', () => { + it('finds nothing wrong with a "bad" file', async () => { + const editor = await atom.workspace.open(noConfigRule); + const messages = await lint(editor); + expect(messages.length).toBe(0); + }); + + it('finds syntax errors without a configuration', async () => { + const errMsg = 'The end of the string reached with no closing bracket ) found.'; + const editor = await atom.workspace.open(noConfigSyntax); + const messages = await lint(editor); + + expect(messages.length).toEqual(1); + expect(messages[0].html).not.toBeDefined(); + expect(messages[0].text).toBe(errMsg); + expect(messages[0].filePath).toBe(noConfigSyntax); + expect(messages[0].range).toEqual([[1, 0], [1, 0]]); + }); + }); +}); From 2d9798a4e7d15328884dc899bbe99d3fd3ef850c Mon Sep 17 00:00:00 2001 From: Landon Abney Date: Wed, 3 Jan 2018 12:13:50 -0800 Subject: [PATCH 3/7] feat: update to Linter v2 API Update the Linter API to v2 so this provider isn't stuck in the past. --- lib/init.js | 12 +++++++----- spec/linter-stylint-spec.js | 16 ++++++++-------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/init.js b/lib/init.js index ba9fba8..01c3fd0 100644 --- a/lib/init.js +++ b/lib/init.js @@ -167,12 +167,14 @@ module.exports = { const linter = new (await getPugLint(projectDir))(); linter.configure(rules); - const results = linter.checkString(fileText); + const results = linter.checkString(fileText, filePath); return results.map(res => ({ - type: res.name, - filePath, - range: helpers.generateRange(textEditor, res.line - 1, res.column - 1), - text: res.msg, + severity: 'error', + location: { + file: res.filename, + position: helpers.generateRange(textEditor, res.line - 1, res.column - 1), + }, + excerpt: res.msg, })); }, }; diff --git a/spec/linter-stylint-spec.js b/spec/linter-stylint-spec.js index 51e57e0..0b07eb0 100644 --- a/spec/linter-stylint-spec.js +++ b/spec/linter-stylint-spec.js @@ -36,10 +36,10 @@ describe('The pug-lint provider for Linter', () => { const messages = await lint(editor); expect(messages.length).toEqual(1); - expect(messages[0].html).not.toBeDefined(); - expect(messages[0].text).toBe(errMsg); - expect(messages[0].filePath).toBe(badPug); - expect(messages[0].range).toEqual([[0, 13], [0, 20]]); + expect(messages[0].description).not.toBeDefined(); + expect(messages[0].excerpt).toBe(errMsg); + expect(messages[0].location.file).toBe(badPug); + expect(messages[0].location.position).toEqual([[0, 13], [0, 20]]); }); }); @@ -56,10 +56,10 @@ describe('The pug-lint provider for Linter', () => { const messages = await lint(editor); expect(messages.length).toEqual(1); - expect(messages[0].html).not.toBeDefined(); - expect(messages[0].text).toBe(errMsg); - expect(messages[0].filePath).toBe(noConfigSyntax); - expect(messages[0].range).toEqual([[1, 0], [1, 0]]); + expect(messages[0].description).not.toBeDefined(); + expect(messages[0].excerpt).toBe(errMsg); + expect(messages[0].location.file).toBe(noConfigSyntax); + expect(messages[0].location.position).toEqual([[1, 0], [1, 0]]); }); }); }); From 9122172f95512ade7835372995704390879312d9 Mon Sep 17 00:00:00 2001 From: Landon Abney Date: Wed, 3 Jan 2018 14:24:10 -0800 Subject: [PATCH 4/7] build(git): enable commitlint Add a configuration for `commitlint` that enforces Angular-like commit messages in preparation for adding of `semantic-release`. --- .travis.yml | 7 ++++++- commitlint.config.js | 5 +++++ package.json | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 commitlint.config.js diff --git a/.travis.yml b/.travis.yml index 4301e00..0da31d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ ### Project specific config ### -language: generic +language: node_js +node_js: + - "8" env: matrix: @@ -9,6 +11,9 @@ env: os: - linux +before_script: + - commitlint-travis + ### Generic setup follows ### dist: trusty diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..f37b7d2 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,5 @@ +module.exports = { + extends: [ + '@commitlint/config-conventional', + ], +}; diff --git a/package.json b/package.json index 9f50524..49b1a85 100644 --- a/package.json +++ b/package.json @@ -43,11 +43,18 @@ "resolve": "^1.5.0" }, "devDependencies": { + "@commitlint/config-conventional": "^5.2.3", + "@commitlint/travis-cli": "^5.2.8", + "commitlint": "^5.2.8", "eslint": "^4.14.0", "eslint-config-airbnb-base": "^12.1.0", "eslint-plugin-import": "^2.8.0", + "husky": "^0.14.3", "jasmine-fix": "^1.3.1" }, + "scripts": { + "commitmsg": "commitlint -e $GIT_PARAMS" + }, "eslintConfig": { "rules": { "global-require": "off", From 89cea7f30ac6bffd41fa4582d704c398a77ff22d Mon Sep 17 00:00:00 2001 From: Landon Abney Date: Wed, 3 Jan 2018 14:28:39 -0800 Subject: [PATCH 5/7] build(apm): add semantic-release configuration Utilize the new shared config for APM for `semantic-release` in order to automate deployment from CI. Notes: Uses `travis-deploy-once` instead of Build Stages since we would need to reconfigure Atom in the deploy job if using Build Stages. --- .travis.yml | 12 ++++++++++-- package.json | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0da31d2..33b455b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,9 @@ node_js: - "8" env: + global: + - secure: "ixSEYjGpVSOPGu0t58ZWOZ/FudTrOa1vkV5MxHdkRMyDi2S25naE7cQukxaFwQk/Mn1bk+LJl6cyDT6wrd8BeNdWVOTy/+ZZB2mMa5oYGN1eGFG+p9JAshCLjfNmPj6gz6Ubo5iuKXkBjckvCFj2DQgvgBHRn2mP3+coGLn/9rfChSU0VbyTSx0gHp7+G4VOvs9sgG5tkxLuc1ItHJuDoeZlGW4R660LqY+HDRZRFBcJft2+zPMWOGbOMEMHnNBSOfyfaeAeHulJRd8TJ05/IAyGsoU8biXFxCAjveSSMT6IWAOkBdpaDVacDg0P7ClYvxup0eAImHlOXaoSaMUWLu4pvSk+6FTG2qauRT+t0igeWNuNdu5X4kmdL50vDvykLW88ln1pJ8hflEeH7sV8aTvStklXgSoi5PaCtpKLlDp3HXw9tTgV7iC+afVm2gpJUL7RB7yAInptUci+Bnq7FqVpGXUFlLbIP4VbB8sApI0ZaarbpQVMsP6N3N8pHtOEPMu0PepRIbqnf/cnRKxe1GdI0VU2JTMYgHq+OqFou4EuQKtNW+6552TiXY8Johl3vdJQWCbby88YfPkx1hRETAoVA/fUpkeO3lo4A0PIFzdQeG+8ZyOG4Seg3kvA9Lc8d3L5yEQtdVJR0vWWds7Va++NP1O3bx3eTGBQcBqN+K4=" + - secure: "VWt+R8fkwoezX+5WdB5Bmb09fIGvOCcwxdYhxdkMQlpWbPwlZoqw3OYY/9/aLGIAEzpYxSpKWvA+McMRmvmzQWRknWmhwwt2+MbQkfpy9k8rpoJmGQsBEWmcC7aQ/38fyDUgx5vxWuADyCVa0dzm6MqgL3E9VlhJaNCnJfsA+oadN6EG5S5sYRTQdBiarZ+GEqzcS50Nii/HuHUT881EXKPcMkSuefyzpzmEbVzwwECG2Huq1po0KErY1Ud4QgQyyI8JG/JaXIoAKloACfkL+oMbInfi0/4/hL4kOUWOOglNc1hwn+C1bTwsndyTaqgAdbIzLbid7acww/Mb0dufCnf4ddF1fQTCYNuaGLe/WuqszQHUMn1/2uxE9hjJY/Q0pAPXmsjV/ju3nEvRNZ6t2ABYSiXkN09Ro6R7DohR18Pdcj5b1Vb0kh8jDg/ljd368FQMN9pvw3Gj7qi3AEAyyDqLgdvm6ikyuQKiOgqwDwsbSCqgBAYZJgRQnCf7h2Wah1zY7djIBG+01mtLbPpcOh3D2mxSg0wmg4E9wMpJwYxsmHy5YvP+wTKinQWk1oPRgUtgEK4Z0m1mHsilcS0dZDDyLf6UxzCqvma/r7eJUV1XrsfSypen1yCyWYdT2SrB7m6tyXp4PjN2htKpemjiY57yHQxSOWWglDDeK6i7xy0=" matrix: - ATOM_CHANNEL=stable - ATOM_CHANNEL=beta @@ -14,13 +17,18 @@ os: before_script: - commitlint-travis +after_success: + # Add apm to the PATH + - export PATH=${PATH}:${HOME}/atom/usr/bin/ + - npm run travis-deploy-once "npm run semantic-release" + ### Generic setup follows ### dist: trusty script: - curl -s -O https://raw.githubusercontent.com/atom/ci/master/build-package.sh - chmod u+x build-package.sh - - ./build-package.sh + - "./build-package.sh" notifications: email: @@ -30,7 +38,7 @@ notifications: branches: only: - master - - /^greenkeeper/.*$/ + - "/^greenkeeper/.*$/" git: depth: 10 diff --git a/package.json b/package.json index 49b1a85..8ecdd89 100644 --- a/package.json +++ b/package.json @@ -45,15 +45,23 @@ "devDependencies": { "@commitlint/config-conventional": "^5.2.3", "@commitlint/travis-cli": "^5.2.8", + "@semantic-release/apm-config": "^1.0.2", "commitlint": "^5.2.8", "eslint": "^4.14.0", "eslint-config-airbnb-base": "^12.1.0", "eslint-plugin-import": "^2.8.0", "husky": "^0.14.3", - "jasmine-fix": "^1.3.1" + "jasmine-fix": "^1.3.1", + "semantic-release": "^12.1.0", + "travis-deploy-once": "^4.3.0" }, "scripts": { - "commitmsg": "commitlint -e $GIT_PARAMS" + "commitmsg": "commitlint -e $GIT_PARAMS", + "semantic-release": "semantic-release", + "travis-deploy-once": "travis-deploy-once" + }, + "release": { + "extends": "@semantic-release/apm-config" }, "eslintConfig": { "rules": { From 91d763e38575dd21a3038108189c3974f39c51d8 Mon Sep 17 00:00:00 2001 From: Landon Abney Date: Wed, 3 Jan 2018 16:30:45 -0800 Subject: [PATCH 6/7] chore(ci): update TravisCI configuration Update the TravisCI configuration to match the current `atom/ci` recommendation. --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 33b455b..33c4e28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,8 +23,6 @@ after_success: - npm run travis-deploy-once "npm run semantic-release" ### Generic setup follows ### -dist: trusty - script: - curl -s -O https://raw.githubusercontent.com/atom/ci/master/build-package.sh - chmod u+x build-package.sh @@ -45,10 +43,12 @@ git: sudo: false +dist: trusty + addons: apt: packages: - build-essential - - git - - libgnome-keyring-dev - fakeroot + - git + - libsecret-1-dev From 5702ee340b1e427582106d3f8d9b4ab80f278c6d Mon Sep 17 00:00:00 2001 From: Landon Abney Date: Thu, 4 Jan 2018 08:50:27 -0800 Subject: [PATCH 7/7] fix: slight grammar fix in warning message Note: The following breaking change was implemented and documented in 3e6355b, before `semantic-release` was brought in. BREAKING CHANGE: The `executablePath` setting has been removed and is no longer available. `linter-pug` will now use your project's local `pug-lint` when one can be found using the standard `require.resolve` implementation. If one can't be found local to your project then the bundled one will be used as a fallback. --- lib/init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/init.js b/lib/init.js index 01c3fd0..ae21794 100644 --- a/lib/init.js +++ b/lib/init.js @@ -74,7 +74,7 @@ module.exports = { { detail: 'linter-pug has moved to the Node.js API for pug-lint and ' + "will now use a project's local instance where possible, falling " + - 'back to a bundled version of pug-lint where none is found.', + 'back to a bundled version of pug-lint if none is found.', }, ); atom.config.unset('linter-pug.executablePath');