Skip to content

Commit

Permalink
Point to formspree api
Browse files Browse the repository at this point in the history
  • Loading branch information
derrickreimer committed Aug 18, 2020
1 parent 6528a5b commit dda7912
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 62 deletions.
57 changes: 8 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
]
},
"dependencies": {
"@statickit/deploy": "^0.3.0",
"@statickit/functions": "github:unstacked/statickit-functions#37679bcf-8da7-4b23-842b-2eac5026a269",
"@formspree/deploy": "github:formspree/formspree-deploy#master",
"axios": "^0.19.0",
"chalk": "^2.4.2",
"common-tags": "^1.8.0",
Expand All @@ -70,4 +69,4 @@
"np": {
"yarn": false
}
}
}
10 changes: 5 additions & 5 deletions src/cmds/deploy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const chalk = require('chalk');
const deploy = require('@statickit/deploy');
const deploy = require('@formspree/deploy');
const ora = require('ora');
const version = require('../../package.json').version;
const log = require('../log');
Expand Down Expand Up @@ -44,15 +44,15 @@ exports.builder = yargs => {
});

yargs.option('file', {
describe: 'Path to the local `statickit.json` file',
default: 'statickit.json'
describe: 'Path to the local `formspree.json` file',
default: 'formspree.json'
});
};

exports.handler = async args => {
const rawConfig = args.config || deploy.getRawConfig(args);
const endpoint = args.endpoint || 'https://api.statickit.com';
const userAgent = `@statickit/cli@${version}`;
const endpoint = args.endpoint || 'https://formspree-cli.herokuapp.com';
const userAgent = `@formspree/cli@${version}`;
const spinner = ora(chalk.gray('Deploying...'));

if (!rawConfig) {
Expand Down
4 changes: 2 additions & 2 deletions src/version_check.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = async () => {
spinner.start();

try {
const manifest = await pacote.manifest('@statickit/cli@latest');
const manifest = await pacote.manifest('@formspree/cli@latest');
const newVersion = manifest.version;
spinner.stop();

Expand All @@ -21,7 +21,7 @@ module.exports = async () => {
`${chalk.yellow.bold('Update Available!')} ${chalk.gray(
`v${installedVersion} ➜ v${newVersion}`
)}\n Run ${log.variable(
'npm i -g @statickit/cli@latest'
'npm i -g @formspree/cli@latest'
)} to update.\n`
);
}
Expand Down
6 changes: 3 additions & 3 deletions test/cmds/deploy.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const deploy = require('@statickit/deploy');
const deploy = require('@formspree/deploy');
const version = require('../../package.json').version;

jest.mock('process', () => ({
env: { MY_SECRET: 'pa$$w0rd', API_KEY: '12345' }
}));
jest.mock('@statickit/deploy');
jest.mock('@formspree/deploy');

jest.mock('ora', () => {
return () => ({
Expand All @@ -30,7 +30,7 @@ it('sends a deploy request with the right params', async () => {
deploy.request.mockImplementation(params => {
expect(params.config).toStrictEqual({});
expect(params.key).toBe('xxx');
expect(params.userAgent).toBe(`@statickit/cli@${version}`);
expect(params.userAgent).toBe(`@formspree/cli@${version}`);

return Promise.resolve({ status: 200, data: { id: 'xxxx-xxxx-xxxx' } });
});
Expand Down

0 comments on commit dda7912

Please sign in to comment.