Skip to content
This repository was archived by the owner on Jan 20, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
1c2081f
Merge remote-tracking branch 'origin/beta'
pvdlg Jan 9, 2020
7d4241a
chore(package): update semantic-release to version 16.0.0
pvdlg Jan 9, 2020
f472b2e
ci: use shared Travis config from semantic-release master branch
pvdlg Jan 9, 2020
a3de7b8
chore: require Node.js >=10.18
pvdlg Jan 28, 2020
bc31603
chore(package): update semantic-release to version 17.0.0
pvdlg Jan 28, 2020
b85c7a4
chore(package): update ava to version 3.1.0
greenkeeper[bot] Jan 19, 2020
75a7c2f
chore: add Mockserver generated files to .gitignore
pvdlg Jan 28, 2020
b871766
chore(package): update got to version 10.5.2
greenkeeper[bot] Feb 7, 2020
7e2fbe8
chore(package): update tempy to version 0.4.0
greenkeeper[bot] Feb 12, 2020
489a7e5
chore(package): update xo to version 0.26.0
greenkeeper[bot] Feb 12, 2020
c13b61b
chore(package): update sinon to version 9.0.0
greenkeeper[bot] Feb 19, 2020
2c7987b
chore(package): update xo to version 0.27.0
greenkeeper[bot] Feb 24, 2020
c8aba73
chore(package): update tempy to version 0.5.0
greenkeeper[bot] Mar 9, 2020
f22bef4
chore(package): update fs-extra to version 9.0.0
greenkeeper[bot] Mar 19, 2020
821ec69
chore(package): update xo to version 0.28.0
greenkeeper[bot] Mar 11, 2020
d3cf73e
ci: replace travis with actions, setup renovate (#72)
gr2m Nov 20, 2020
b39399c
ci: remove CODEOWNERS
gr2m Nov 20, 2020
b4a15d2
chore(deps): pin dependencies (#74)
renovate[bot] Nov 23, 2020
00acaf8
chore(deps): update dependency get-stream to v6 (#77)
renovate[bot] Nov 29, 2020
5daf941
chore(deps): update dependency semantic-release to v17.3.0 (#75)
renovate[bot] Nov 30, 2020
f57a6e7
chore(deps): update dependency ava to v3.14.0 (#82)
renovate[bot] Dec 7, 2020
f913821
chore(deps): update dependency semantic-release to v17.3.1 (#85)
renovate[bot] Dec 29, 2020
435d6e5
chore(deps): update dependency sinon to v9.2.2 (#83)
renovate[bot] Dec 30, 2020
8d1825c
chore(deps): update dependency tempy to v1 (#80)
renovate[bot] Dec 30, 2020
8d4f5ad
chore(deps): lock file maintenance (#79)
renovate[bot] Dec 30, 2020
8543ca5
chore(deps): update dependency got to v11 (#78)
renovate[bot] Dec 30, 2020
09b3a28
chore(deps): update dependency ava to v3.15.0 (#86)
renovate[bot] Jan 1, 2021
b8fccf2
chore(deps): lock file maintenance (#87)
renovate[bot] Jan 4, 2021
6b24d95
chore(deps): update actions/setup-node action to v2 (#84)
renovate[bot] Jan 4, 2021
f831874
chore(deps): lock file maintenance (#88)
renovate[bot] Jan 4, 2021
9462ff2
chore(deps): lock file maintenance (#90)
renovate[bot] Jan 11, 2021
717aa20
chore(deps): update dependency semantic-release to v17.3.2 (#91)
renovate[bot] Jan 13, 2021
01cf174
chore(deps): update dependency sinon to v9.2.3 (#89)
renovate[bot] Jan 13, 2021
a7e06c2
chore(deps): update dependency semantic-release to v17.3.3 (#92)
renovate[bot] Jan 16, 2021
37b6a68
chore(deps): update dependency fs-extra to v9.1.0 (#93)
renovate[bot] Jan 19, 2021
a2358dd
chore(deps): update dependency semantic-release to v17.3.4 (#94)
renovate[bot] Jan 19, 2021
6ba08f3
chore(deps): update dependency semantic-release to v17.3.5 (#95)
renovate[bot] Jan 21, 2021
aea3a2b
chore(deps): update dependency sinon to v9.2.4 (#99)
renovate[bot] Jan 23, 2021
e6891f7
chore(deps): update dependency semantic-release to v17.3.7 (#96)
renovate[bot] Jan 23, 2021
69b6cfe
chore(deps): update dependency p-retry to v4.3.0 (#98)
renovate[bot] Jan 23, 2021
f7835c1
chore(deps): lock file maintenance (#100)
renovate[bot] Jan 25, 2021
9f957da
chore(deps): lock file maintenance (#101)
renovate[bot] Feb 1, 2021
dc0607d
chore(deps): lock file maintenance (#102)
renovate[bot] Feb 1, 2021
58461a6
chore(deps): lock file maintenance (#104)
renovate[bot] Feb 8, 2021
f854a54
chore(deps): update dependency p-retry to v4.4.0 (#107)
renovate[bot] Feb 15, 2021
bfc930e
chore(deps): update dependency semantic-release to v17.3.9 (#105)
renovate[bot] Feb 15, 2021
ea09da1
chore(deps): update dependency semantic-release to v17.4.3 (#108)
renovate[bot] May 12, 2021
839f810
chore(deps): update dependency tempy to v1.0.1 (#109)
renovate[bot] May 12, 2021
c2dbba8
chore(deps): update dependency trim-newlines to 3.0.1 [security] (#117)
renovate[bot] Jun 10, 2021
e765aa7
chore(deps): update dependency fs-extra to v10 (#116)
renovate[bot] Jun 10, 2021
e718f6e
chore(deps): bump normalize-url from 4.5.0 to 4.5.1 (#118)
dependabot[bot] Jun 12, 2021
14beac6
chore(deps): bump lodash from 4.17.20 to 4.17.21 (#115)
dependabot[bot] Jun 12, 2021
318da18
chore(deps): update dependency glob-parent to 5.1.2 [security] (#120)
renovate[bot] Jun 12, 2021
75f2f64
chore(deps): lock file maintenance (#106)
renovate[bot] Jun 12, 2021
ac3f0a7
chore(deps): update dependency sinon to v11 (#122)
renovate[bot] Jun 23, 2021
3faf3a9
chore(deps): update dependency semantic-release to v17.4.4 (#123)
renovate[bot] Jun 23, 2021
db825b6
chore(deps): lock file maintenance (#121)
renovate[bot] Jun 23, 2021
4dba9f3
chore(deps): update dependency get-stream to v6.0.1 (#124)
renovate[bot] Jun 23, 2021
b4f524c
ci(workflow): add cache to workflows using actions/setup-node (#126)
oscard0m Jul 21, 2021
b8310ce
chore(deps): lock file maintenance (#125)
renovate[bot] Jul 21, 2021
54e60f1
chore(deps): update dependency codecov to v3.8.3 (#128)
renovate[bot] Jul 31, 2021
5d90940
chore(deps): lock file maintenance (#127)
renovate[bot] Aug 1, 2021
46a016a
chore(deps): update dependency path-parse to 1.0.7 [security] (#130)
renovate[bot] Aug 12, 2021
b43b015
chore(deps): lock file maintenance (#129)
renovate[bot] Aug 12, 2021
e369f31
chore(deps): update dependency got to v11.8.2 (#134)
renovate[bot] Aug 27, 2021
f7199db
chore(deps): lock file maintenance (#132)
renovate[bot] Aug 28, 2021
a6acf93
chore(deps): update dependency semantic-release to v17.4.7 (#136)
renovate[bot] Sep 4, 2021
b89a67a
chore(deps): update dependency sinon to v11.1.2 (#137)
renovate[bot] Sep 4, 2021
a4d5a1b
chore(deps): update dependency dockerode to v3.3.0 (#138)
renovate[bot] Sep 4, 2021
0d9da6e
chore(deps): update dependency p-retry to v4.6.1 (#139)
renovate[bot] Sep 4, 2021
0459d8e
chore(deps): lock file maintenance (#135)
renovate[bot] Sep 4, 2021
e95fd1e
chore(deps): lock file maintenance (#140)
renovate[bot] Sep 6, 2021
23ef444
chore(deps): lock file maintenance (#141)
renovate[bot] Sep 6, 2021
8a568ce
chore(deps): update dependency dockerode to v3.3.1 (#142)
renovate[bot] Sep 7, 2021
10b25ed
chore(deps): lock file maintenance (#143)
renovate[bot] Sep 13, 2021
cd50121
build(release.yml): set node-version to 16
gr2m Sep 17, 2021
a02ef61
build(test.yml): set node-version to 16
gr2m Sep 17, 2021
e5059df
chore(deps): lock file maintenance (#145)
renovate[bot] Sep 20, 2021
3ffb799
feat(node-version): raised the minimum required version to v14.17 (#146)
UziTech Sep 21, 2021
f5544fb
fix(deps): update dependency execa to v5 (#81)
renovate[bot] Sep 21, 2021
39cec52
chore(deps): update dependency ssh2 to 1.4.0 [security] (#147)
renovate[bot] Sep 22, 2021
1f00512
chore(deps): lock file maintenance (#148)
renovate[bot] Sep 27, 2021
79904ea
chore(deps): update dependency xo to v0.45.0 (#76)
renovate[bot] Oct 2, 2021
9c7181c
fix: Convert package to ESM
UziTech Oct 3, 2021
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
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Release
"on":
push:
branches:
- master
- next
- beta
- "*.x"
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
cache: npm
node-version: 16
- run: npm ci
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_BOT_NPM_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test
"on":
push:
branches:
- master
- renovate/**
pull_request:
types:
- opened
- synchronize
jobs:
test_matrix:
strategy:
matrix:
node-version:
- '14.17'
- 16
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: UziTech/action-setup-atom@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
# waiting on https://github.com/ljharb/ls-engines/pull/23 to be fixed
# - name: Ensure dependencies are compatible with the version of node
# run: npx ls-engines
- run: npm run test:ci
test:
runs-on: ubuntu-latest
needs: test_matrix
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
cache: npm
node-version: 16
- run: npm ci
- run: npm run lint
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,5 @@ $RECYCLE.BIN/

# End of https://www.gitignore.io/api/macos,windows,linux,node

package-lock.json
yarn.lock
# Mockserver
CertificateAuthorityCertificate.pem
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@

[**semantic-release**](https://github.com/semantic-release/semantic-release) plugin to publish [Atom](https://www.atom.io) packages with [apm](https://github.com/atom/apm).

[![Travis](https://img.shields.io/travis/com/semantic-release/apm.svg)](https://travis-ci.com/semantic-release/apm)
[![Codecov](https://img.shields.io/codecov/c/github/semantic-release/apm.svg)](https://codecov.io/gh/semantic-release/apm)
[![Greenkeeper badge](https://badges.greenkeeper.io/semantic-release/apm.svg)](https://greenkeeper.io/)

[![npm latest version](https://img.shields.io/npm/v/@semantic-release/apm/latest.svg)](https://www.npmjs.com/package/@semantic-release/apm)
[![Build Status](https://github.com/semantic-release/apm/workflows/Test/badge.svg)](https://github.com/semantic-release/apm/actions?query=workflow%3ATest+branch%3Amaster)[![npm latest version](https://img.shields.io/npm/v/@semantic-release/apm/latest.svg)](https://www.npmjs.com/package/@semantic-release/apm)
[![npm next version](https://img.shields.io/npm/v/@semantic-release/apm/next.svg)](https://www.npmjs.com/package/@semantic-release/apm)
[![npm beta version](https://img.shields.io/npm/v/@semantic-release/apm/beta.svg)](https://www.npmjs.com/package/@semantic-release/apm)

| Step | Description |
|--------------------|----------------------------------------------------------------------------------------------|
| ------------------ | -------------------------------------------------------------------------------------------- |
| `verifyConditions` | Verify the presence of the `ATOM_ACCESS_TOKEN` environment variable and the `apm` CLI. |
| `prepare` | Update the `package.json` version with [`npm version`](https://docs.npmjs.com/cli/version). |
| `publish` | [Publish the Atom package](https://flight-manual.atom.io/hacking-atom/sections/publishing/). |
Expand Down Expand Up @@ -59,5 +55,5 @@ Visit your account page on [Atom.io](https://atom.io/account) to obtain your aut
### Environment variables

| Variable | Description |
|---------------------|----------------------------------------------------|
| ------------------- | -------------------------------------------------- |
| `ATOM_ACCESS_TOKEN` | The token used to authenticate with Atom registry. |
18 changes: 8 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* eslint require-atomic-updates: off */

const AggregateError = require('aggregate-error');
const getPkg = require('./lib/get-pkg');
const verifyApm = require('./lib/verify');
const prepareApm = require('./lib/prepare');
const publishApm = require('./lib/publish');
import AggregateError from 'aggregate-error';
import getPkg from './lib/get-pkg.js';
import verifyApm from './lib/verify.js';
import prepareApm from './lib/prepare.js';
import publishApm from './lib/publish.js';

let verified;
let prepared;

async function verifyConditions(pluginConfig, context) {
export async function verifyConditions(pluginConfig, context) {
const errors = await verifyApm(pluginConfig, context);

try {
Expand All @@ -25,7 +25,7 @@ async function verifyConditions(pluginConfig, context) {
verified = true;
}

async function prepare(pluginConfig, context) {
export async function prepare(pluginConfig, context) {
const errors = verified ? [] : await verifyApm(pluginConfig, context);

try {
Expand All @@ -43,7 +43,7 @@ async function prepare(pluginConfig, context) {
prepared = true;
}

async function publish(pluginConfig, context) {
export async function publish(pluginConfig, context) {
let pkg;
const errors = verified ? [] : await verifyApm(pluginConfig, context);

Expand All @@ -64,5 +64,3 @@ async function publish(pluginConfig, context) {

return publishApm(pluginConfig, pkg, context);
}

module.exports = {verifyConditions, prepare, publish};
77 changes: 47 additions & 30 deletions lib/definitions/errors.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,50 @@
const pkg = require('../../package.json');
import {dirname, resolve} from 'node:path';
import {fileURLToPath} from 'node:url';
import {readPackageSync} from 'read-pkg';

const __dirname = dirname(fileURLToPath(import.meta.url));
const pkg = readPackageSync({cwd: resolve(__dirname, '../../')});
const [homepage] = pkg.homepage.split('#');
const linkify = file => `${homepage}/blob/master/${file}`;

module.exports = {
ENOAPMTOKEN: () => ({
message: 'No apm token specified.',
details: `An [apm token](${linkify(
'README.md#atom-authentication'
)}) must be created and set in the \`ATOM_ACCESS_TOKEN\` environment variable on your CI environment.

Please visit your account page on [atom.io](https://atom.io/account) and to set it in the \`ATOM_ACCESS_TOKEN\` environment variable on your CI environment.`,
}),
ENOAPMCLI: () => ({
message: 'The apm CLI must be installed.',
details: `The \`apm\` command line has to be installed in your CI environment and available in the \`PATH\` environment varialbe.

See [Atom installation](${linkify('README.md#atom-installation')}) for more details.`,
}),
ENOPKGNAME: () => ({
message: 'Missing `name` property in `package.json`.',
details: `The \`package.json\`'s [name](https://docs.npmjs.com/files/package.json#name) property is required in order to publish an Atom package.

Please make sure to add a valid \`name\` for your package in your \`package.json\`.`,
}),
ENOPKG: () => ({
message: 'Missing `package.json` file.',
details: `A [package.json file](https://docs.npmjs.com/files/package.json) at the root of your project is required to publish an Atom package.

Please follow the [npm guideline](https://docs.npmjs.com/getting-started/creating-node-modules) to create a valid \`package.json\` file.`,
}),
const linkify = (file) => `${homepage}/blob/master/${file}`;

const errors = {
ENOAPMTOKEN() {
return {
message: 'No apm token specified.',
details: `An [apm token](${linkify(
'README.md#atom-authentication'
)}) must be created and set in the \`ATOM_ACCESS_TOKEN\` environment variable on your CI environment.

Please visit your account page on [atom.io](https://atom.io/account) and to set it in the \`ATOM_ACCESS_TOKEN\` environment variable on your CI environment.`,
};
},

ENOAPMCL() {
return {
message: 'The apm CLI must be installed.',
details: `The \`apm\` command line has to be installed in your CI environment and available in the \`PATH\` environment varialbe.

See [Atom installation](${linkify('README.md#atom-installation')}) for more details.`,
};
},

ENOPKGNAM() {
return {
message: 'Missing `name` property in `package.json`.',
details: `The \`package.json\`'s [name](https://docs.npmjs.com/files/package.json#name) property is required in order to publish an Atom package.

Please make sure to add a valid \`name\` for your package in your \`package.json\`.`,
};
},

ENOPK() {
return {
message: 'Missing `package.json` file.',
details: `A [package.json file](https://docs.npmjs.com/files/package.json) at the root of your project is required to publish an Atom package.

Please follow the [npm guideline](https://docs.npmjs.com/getting-started/creating-node-modules) to create a valid \`package.json\` file.`,
};
},
};

export default errors;
8 changes: 4 additions & 4 deletions lib/get-error.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const SemanticReleaseError = require('@semantic-release/error');
const ERROR_DEFINITIONS = require('./definitions/errors');
import SemanticReleaseError from '@semantic-release/error';
import ERROR_DEFINITIONS from './definitions/errors.js';

module.exports = (code, ctx = {}) => {
export default function getError(code, ctx = {}) {
const {message, details} = ERROR_DEFINITIONS[code](ctx);
return new SemanticReleaseError(message, code, details);
};
}
19 changes: 8 additions & 11 deletions lib/get-pkg.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
const readPkg = require('read-pkg');
const AggregateError = require('aggregate-error');
const getError = require('./get-error');
import {readPackage} from 'read-pkg';
import AggregateError from 'aggregate-error';
import getError from './get-error.js';

module.exports = async (pluginConfig, {cwd}) => {
export default async function getPkg(pluginConfig, {cwd}) {
try {
const pkg = await readPkg({cwd});
const pkg = await readPackage({cwd});

if (!pkg.name) {
throw getError('ENOPKGNAME');
}

return pkg;
} catch (error) {
if (error.code === 'ENOENT') {
throw new AggregateError([getError('ENOPKG')]);
} else {
throw new AggregateError([error]);
}
const error_ = error.code === 'ENOENT' ? new AggregateError([getError('ENOPKG')]) : new AggregateError([error]);
throw error_;
}
};
}
6 changes: 3 additions & 3 deletions lib/prepare.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const execa = require('execa');
import execa from 'execa';

module.exports = async (pluginConfig, {cwd, env, stdout, stderr, nextRelease: {version}, logger}) => {
export default async function prepareApm(pluginConfig, {cwd, env, stdout, stderr, nextRelease: {version}, logger}) {
logger.log(`Write version ${version} to package.json`);

const versionResult = execa('npm', ['version', version, '--no-git-tag-version'], {cwd, env});
versionResult.stdout.pipe(stdout, {end: false});
versionResult.stderr.pipe(stderr, {end: false});

await versionResult;
};
}
6 changes: 3 additions & 3 deletions lib/publish.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const execa = require('execa');
import execa from 'execa';

module.exports = async (pluginConfig, {name}, context) => {
export default async function publishApm(pluginConfig, {name}, context) {
const {
cwd,
env,
Expand All @@ -22,4 +22,4 @@ module.exports = async (pluginConfig, {name}, context) => {

logger.log(`Published ${name}@${version}`);
return {name: 'Atom package', url: `https://atom.io/packages/${name}`};
};
}
8 changes: 5 additions & 3 deletions lib/resolve-config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module.exports = (pluginConfig, {env}) => ({
apmToken: env.ATOM_ACCESS_TOKEN,
});
export default function resolveConfig(pluginConfig, {env}) {
return {
apmToken: env.ATOM_ACCESS_TOKEN,
};
}
10 changes: 5 additions & 5 deletions lib/verify.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const execa = require('execa');
const resolveConfig = require('./resolve-config');
const getError = require('./get-error');
import execa from 'execa';
import resolveConfig from './resolve-config.js';
import getError from './get-error.js';

module.exports = async (pluginConfig, context) => {
export default async function verifyApm(pluginConfig, context) {
const {cwd, env} = context;
const errors = [];
const {apmToken} = resolveConfig(pluginConfig, context);
Expand All @@ -16,4 +16,4 @@ module.exports = async (pluginConfig, context) => {
}

return errors;
};
}
Loading