Skip to content

Update dependencies and drop support for Node v10 #13

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
node-version: [12.x, 14.x, 16.x]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Integrate your deploy pipeline with Sentry. Upload sourcemaps, assign related co
# Compatibility

* ember-cli-deploy v1.0 or above
* Node.js v8 or above
* Node.js v12 or above


## Installation
Expand Down
90 changes: 52 additions & 38 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
const path = require('path');
const { execSync } = require('child_process');
const BasePlugin = require('ember-cli-deploy-plugin');
const packageJson = require("./package.json");

module.exports = {
name: require('./package').name,
name: packageJson.name,

createDeployPlugin(options) {
const DeployPlugin = BasePlugin.extend({
name: options.name,

defaultConfig: {
assetsDir(context) {
return path.join(context.distDir, 'assets');
return path.join(context.distDir, "assets");
},

revisionKey(context) {
Expand All @@ -27,70 +28,83 @@ module.exports = {
return context.deployTarget;
},

url: '',
url: "",
},

requiredConfig: ['appName', 'orgName', 'authToken'],
requiredConfig: ["appName", "orgName", "authToken"],

didPrepare() {
const releaseName = `${this.readConfig('appName')}@${this.readConfig('revisionKey')}`;
const assetsDir = this.readConfig('assetsDir');
const urlPrefix = this.readConfig('urlPrefix') ? `--url-prefix ${this.readConfig('urlPrefix')}` : '';

this.log('SENTRY: Creating release...');
this.sentryCliExec('releases', `new ${releaseName}`);

this.log('SENTRY: Assigning commits...');
this.sentryCliExec('releases', `set-commits ${releaseName} --auto --ignore-missing`);
const releaseName = `${this.readConfig("appName")}@${this.readConfig(
"revisionKey"
)}`;
const assetsDir = this.readConfig("assetsDir");
const urlPrefix = this.readConfig("urlPrefix")
? `--url-prefix ${this.readConfig("urlPrefix")}`
: "";

this.log("SENTRY: Creating release...");
this.sentryCliExec("releases", `new ${releaseName}`);

this.log("SENTRY: Assigning commits...");
this.sentryCliExec(
"releases",
`set-commits ${releaseName} --auto --ignore-missing`
);

this.log('SENTRY: Uploading source maps...');
this.sentryCliExec('releases', `files ${releaseName} upload-sourcemaps --rewrite ${assetsDir} ${urlPrefix}`);
this.log("SENTRY: Uploading source maps...");
this.sentryCliExec(
"releases",
`files ${releaseName} upload-sourcemaps --rewrite ${assetsDir} ${urlPrefix}`
);

this.log('SENTRY: Finalizing release...');
this.sentryCliExec('releases', `finalize ${releaseName}`);
this.log("SENTRY: Finalizing release...");
this.sentryCliExec("releases", `finalize ${releaseName}`);

this.log('SENTRY: Release published!...');
this.log("SENTRY: Release published!...");
},

didDeploy() {
const appName = this.readConfig('appName');
const releaseName = `${appName}@${this.readConfig('revisionKey')}`;
const environment = this.readConfig('environment');

this.log('SENTRY: Deploying release...');
this.sentryCliExec('releases', `deploys ${releaseName} new -e ${environment}`);
this.log('SENTRY: Deployed!');
const appName = this.readConfig("appName");
const releaseName = `${appName}@${this.readConfig("revisionKey")}`;
const environment = this.readConfig("environment");

this.log("SENTRY: Deploying release...");
this.sentryCliExec(
"releases",
`deploys ${releaseName} new -e ${environment}`
);
this.log("SENTRY: Deployed!");
},

didFail() {
const appName = this.readConfig('appName');
const releaseName = `${appName}@${this.readConfig('revisionKey')}`;
const appName = this.readConfig("appName");
const releaseName = `${appName}@${this.readConfig("revisionKey")}`;

this.log('SENTRY: Deleting release...');
this.sentryCliExec('releases', `delete ${releaseName}`);
this.log('SENTRY: Release deleted!');
this.log("SENTRY: Deleting release...");
this.sentryCliExec("releases", `delete ${releaseName}`);
this.log("SENTRY: Release deleted!");
},

sentryCliExec(command, subCommand) {
const authToken = this.readConfig('authToken');
const orgName = this.readConfig('orgName');
const appName = this.readConfig('appName');
const url = this.readConfig('url');
const authToken = this.readConfig("authToken");
const orgName = this.readConfig("orgName");
const appName = this.readConfig("appName");
const url = this.readConfig("url");

return this._exec(
[
path.join('node_modules', '.bin', 'sentry-cli'),
url ? `--url ${url}` : '',
path.join("node_modules", ".bin", "sentry-cli"),
url ? `--url ${url}` : "",
`--auth-token ${authToken}`,
command,
`--org ${orgName}`,
`--project ${appName}`,
subCommand,
].join(' ')
].join(" ")
);
},

_exec(command = '') {
_exec(command = "") {
return execSync(command, { cwd: this.project.root });
},
});
Expand Down
Loading